Add the static items at Bookmark menu construction, so the shortcuts work even

when the menu has never been opened yet.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@526 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-06-15 21:24:07 +00:00 committed by Alexandre Deckner
parent 054e7e4344
commit fdd4f3bbb8

View File

@ -127,6 +127,10 @@ public:
: :
BNavMenu(title, B_REFS_RECEIVED, target) BNavMenu(title, B_REFS_RECEIVED, target)
{ {
// Add these items here already, so the shortcuts work even when
// the menu has never been opened yet.
_AddStaticItems();
SetNavDir(navDir); SetNavDir(navDir);
} }
@ -137,11 +141,17 @@ public:
BNavMenu::AttachedToWindow(); BNavMenu::AttachedToWindow();
if (CountItems() > 0) if (CountItems() > 0)
AddItem(new BSeparatorItem(), 0); AddItem(new BSeparatorItem(), 0);
_AddStaticItems();
DoLayout();
}
private:
void _AddStaticItems()
{
AddItem(new BMenuItem("Manage bookmarks", AddItem(new BMenuItem("Manage bookmarks",
new BMessage(SHOW_BOOKMARKS), 'M'), 0); new BMessage(SHOW_BOOKMARKS), 'M'), 0);
AddItem(new BMenuItem("Bookmark this page", AddItem(new BMenuItem("Bookmark this page",
new BMessage(CREATE_BOOKMARK), 'B'), 0); new BMessage(CREATE_BOOKMARK), 'B'), 0);
DoLayout();
} }
}; };