MenuField: enable/disable the menu field when...

the child menu bar or the child menu bar's menu is enabled/disabled.

This means that there is just one status we have to check, the menu
fields, and the child menus agree. This change takes practical form
in the Backgrounds preflet which disables the placement menu when
the image is set to "None", but, only the menu got disabled and not the
parent menu field so the label was erroneously still drawn as enabled.
This commit is contained in:
John Scipione
2013-08-20 18:15:13 -04:00
parent ac359925f5
commit 408c0ee4cd
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -52,6 +52,7 @@ public:
virtual void MessageReceived(BMessage* msg);
virtual void MakeFocus(bool focused = true);
virtual void SetMaxContentWidth(float width);
virtual void SetEnabled(bool enabled);
void TogglePopUpMarker(bool show)
{ fShowPopUpMarker = show; }
+9
View File
@@ -276,6 +276,15 @@ _BMCMenuBar_::SetMaxContentWidth(float width)
}
void
_BMCMenuBar_::SetEnabled(bool enabled)
{
fMenuField->SetEnabled(enabled);
BMenuBar::SetEnabled(enabled);
}
BSize
_BMCMenuBar_::MinSize()
{
+3
View File
@@ -1021,6 +1021,9 @@ BMenu::SetEnabled(bool enabled)
fEnabled = enabled;
if (dynamic_cast<_BMCMenuBar_*>(Supermenu()) != NULL)
Supermenu()->SetEnabled(enabled);
if (fSuperitem)
fSuperitem->SetEnabled(enabled);
}