Implement the ability to remove top level menus on MacOS, essentially just reflecting removal of a content node. r=pink

This commit is contained in:
saari%netscape.com 2000-03-30 01:25:03 +00:00
Родитель 91257a1d13
Коммит c61930d421
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -1523,7 +1523,28 @@ nsMenu::ContentRemoved(
nsIContent * aContainer,
nsIContent * aChild,
PRInt32 aIndexInContainer)
{
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
if(!element) {
NS_ERROR("Unable to QI dom element.");
return NS_OK;
}
nsCOMPtr<nsIContent> contentNode;
contentNode = do_QueryInterface(element);
if (!contentNode) {
NS_ERROR("DOM Node doesn't support the nsIContent interface required to handle DOM events.");
return NS_OK;
}
if(aChild == contentNode.get()) {
if(mMenuParent) {
mMenuParent->RemoveItem(aIndexInContainer);
} else if(mMenuBarParent) {
mMenuBarParent->RemoveMenu(aIndexInContainer);
}
}
return NS_OK;
}
//-------------------------------------------------------------------------

Просмотреть файл

@ -493,6 +493,12 @@ NS_METHOD nsMenuBar::InsertMenuAt(const PRUint32 aCount, nsIMenu *& aMenu)
//-------------------------------------------------------------------------
NS_METHOD nsMenuBar::RemoveMenu(const PRUint32 aCount)
{
nsISupports* menu = (nsISupports*)mMenuVoidArray[aCount];
NS_IF_RELEASE( menu );
mMenuVoidArray.RemoveElementAt(aCount);
::DrawMenuBar();
return NS_OK;
}