mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibGUI, WindowServer: Greatly simplify menubar logic
Currently, any number of menubars can be plugged in and out of a window. This is unnecessary complexity, since we only need one menubar on a window. This commit removes most of the logic for dynamically attaching and detaching menubars and makes one menubar always available. The menubar is only considered existent if it has at least a single menu in it (in other words, an empty menubar will not be shown). This commit additionally fixes a bug wherein menus added after a menubar has been attached would not have their rects properly setup, and would therefore appear glitched out on the top left corner of the menubar.
This commit is contained in:
parent
95ab61e3db
commit
611370e7dc
19 changed files with 150 additions and 255 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
|
||||
|
@ -53,11 +54,13 @@ private:
|
|||
void unrealize_menu();
|
||||
void realize_if_needed(const RefPtr<Action>& default_action);
|
||||
|
||||
void realize_menu_item(MenuItem&, int item_id);
|
||||
|
||||
int m_menu_id { -1 };
|
||||
String m_name;
|
||||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
NonnullOwnPtrVector<MenuItem> m_items;
|
||||
WeakPtr<Action> m_last_default_action;
|
||||
WeakPtr<Action> m_current_default_action;
|
||||
bool m_visible { false };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue