Deskbar: Persist ExpandoMenuBar

Add private BMenu::_SetMenuLayout() method. Set TExpandoMenuBar
as a friend class in BMenu to call this method. A little hacky,
but, this keeps SetMenuLayout() from being exposed as part of
the public API.

Don't destroy and rebuild the ExpandoMenuBar when switching from
horizontal to vertical mode. Instead build the TExpandoMenuBar
when the application starts and then switch it from B_ITEMS_IN_ROW
to B_ITEMS_IN_COLUMNS by using the newly added _SetMenuLayout()
method.

When we resize from vertical to horizontal, recalc the max
menu item widths, this resizes the application menu items so
that they take up the right amount of space.

Since we no longer destroy the menu bar we no longer have to
save whether menu items are expanded or not in a separate list.
Instead we can store that information in directly in
TExpandoMenuBar. This removes a lot of code.

Fixes #9350
This commit is contained in:
John Scipione
2015-02-19 19:02:39 -05:00
parent c9d2a320a3
commit deaae5fc20
10 changed files with 173 additions and 213 deletions
+2
View File
@@ -173,6 +173,7 @@ public:
private:
friend class BMenuBar;
friend class BPrivate::MenuPrivate;
friend class TExpandoMenuBar;
friend status_t _init_interface_kit_();
friend status_t set_menu_info(menu_info* info);
friend status_t get_menu_info(menu_info* info);
@@ -269,6 +270,7 @@ private:
int _State(BMenuItem** _item = NULL) const;
void _InvokeItem(BMenuItem* item, bool now = false);
void _QuitTracking(bool onlyThis = true);
void _SetMenuLayout(menu_layout layout) { fLayout = layout; };
static menu_info sMenuInfo;