Instead of creating the Modifiers bitmaps on demand, for every DrawItem invocation,

for every BMenuItem, have them created in _init_interface_kit(), and keep
them cached. This required some reorganisation of the code in Menu and MenuItem.
Also has the side effect that BMenuItem doesn't have to know about the
alt/ctrl/command keys stuff.
Added a comment in BMenu::AttachedToWindow().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31962 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-07-30 10:33:46 +00:00
parent e9ff085cfe
commit c3d7cee2d9
4 changed files with 180 additions and 88 deletions
+13
View File
@@ -16,6 +16,7 @@ enum menu_states {
MENU_STATE_CLOSED = 5
};
class BBitmap;
class BMenu;
class BWindow;
@@ -45,10 +46,22 @@ public:
void InvokeItem(BMenuItem *item, bool now = false);
void QuitTracking(bool thisMenuOnly = true);
static status_t CreateBitmaps();
static void DeleteBitmaps();
static const BBitmap *MenuItemCommand();
static const BBitmap *MenuItemControl();
static const BBitmap *MenuItemOption();
static const BBitmap *MenuItemShift();
private:
BMenu *fMenu;
};
extern BBitmap *gMenuItemAlt;
extern BBitmap *gMenuItemControl;
extern BBitmap *gMenuItemOption;
extern BBitmap *gMenuItemShift;
};
extern const char *kEmptyMenuLabel;