fix for bug 38619, make MacOS menus respect the "hidden" attribute.

This commit is contained in:
saari%netscape.com 2000-05-09 06:15:33 +00:00
parent 04ad1ba807
commit ada77060c4

View File

@ -1521,6 +1521,8 @@ nsMenu::AttributeChanged(
if(aContent == contentNode.get()){
nsCOMPtr<nsIAtom> disabledAtom = NS_NewAtom("disabled");
nsCOMPtr<nsIAtom> valueAtom = NS_NewAtom("value");
nsCOMPtr<nsIAtom> hiddenAtom = NS_NewAtom("hidden");
if(aAttribute == disabledAtom.get()) {
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aContent));
nsString valueString;
@ -1553,8 +1555,22 @@ nsMenu::AttributeChanged(
::DrawMenuBar();
}
#endif
} else if(aAttribute == hiddenAtom.get()) {
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aContent));
nsString valueString;
element->GetAttribute(NS_ConvertASCIItoUCS2("hidden"), valueString);
if(valueString.EqualsWithConversion("true")) {
// hide this menu
::DeleteMenu(mMacMenuID);
} else {
// show this menu
::InsertMenu(mMacMenuHandle, mMacMenuID+1);
}
if(mMenuBarParent) {
mMenuBarParent->SetNativeData(::GetMenuBar());
::DrawMenuBar();
}
}
}
}
return NS_OK;