SetEnabled() enables or disables the parent menu too, SetRadioMode() and SetLabelFromMarked() call each other if needed, BMenuBar::Draw() doesn't make a difference if the menubar is disabled or not, should even fix bug #87 as it was calling LayoutItems() every cycle. Work done by John Drinkwater and me

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15988 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-01-16 21:42:57 +00:00
parent 487f65913b
commit dd180e6378
2 changed files with 30 additions and 24 deletions
+13 -1
View File
@@ -530,6 +530,14 @@ BMenu::SetEnabled(bool enabled)
{
fEnabled = enabled;
if (fSuper) {
// Can't use fSuper->SetEnabled() here, as
// it would call SetEnabled() on us again, thus
// entering an infinite loop
fSuper->fEnabled = enabled;
}
for (int32 i = 0; i < CountItems(); i++)
ItemAt(i)->SetEnabled(enabled);
}
@@ -539,6 +547,8 @@ void
BMenu::SetRadioMode(bool flag)
{
fRadioMode = flag;
if (!flag)
SetLabelFromMarked(false);
}
@@ -560,6 +570,8 @@ void
BMenu::SetLabelFromMarked(bool flag)
{
fDynamicName = flag;
if (flag)
SetRadioMode(true);
}
@@ -935,7 +947,7 @@ BMenu::Hide()
BMenuItem *
BMenu::Track(bool openAnyway, BRect *clickToOpenRect)
{
if (IsStickyPrefOn())
if (!IsStickyPrefOn())
openAnyway = false;
SetStickyMode(openAnyway);