From 189fa68c0b3deacd5e3655922328ef4743afb937 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 17 Feb 2020 20:04:05 +0100 Subject: 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. --- Libraries/LibGUI/Menu.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Libraries/LibGUI/Menu.h') 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(); -- cgit v1.2.3