summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Menu.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-17 20:04:05 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-17 20:04:05 +0100
commit189fa68c0b3deacd5e3655922328ef4743afb937 (patch)
tree833287de9dc421ab79e407a94374e803ab579347 /Libraries/LibGUI/Menu.h
parent7afd9039d1c8e20a25eb3c320fa58b7ff617ca4f (diff)
downloadserenity-189fa68c0b3deacd5e3655922328ef4743afb937.zip
LibGUI: Expose GUI::Menu::menu_id() and also allow forced realization
Menu realization is when we instruct WindowServer to create the server-side menu objects on our behalf.
Diffstat (limited to 'Libraries/LibGUI/Menu.h')
-rw-r--r--Libraries/LibGUI/Menu.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/Libraries/LibGUI/Menu.h b/Libraries/LibGUI/Menu.h
index aa9956c886..d8ebb1dd93 100644
--- a/Libraries/LibGUI/Menu.h
+++ b/Libraries/LibGUI/Menu.h
@@ -39,7 +39,14 @@ public:
explicit Menu(const StringView& name = "");
virtual ~Menu() override;
+ void realize_menu_if_needed()
+ {
+ if (menu_id() == -1)
+ realize_menu();
+ }
+
static Menu* from_menu_id(int);
+ int menu_id() const { return m_menu_id; }
const String& name() const { return m_name; }
@@ -55,7 +62,6 @@ public:
private:
friend class MenuBar;
- int menu_id() const { return m_menu_id; }
int realize_menu();
void unrealize_menu();
void realize_if_needed();