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.
This commit is contained in:
Andreas Kling 2020-02-17 20:04:05 +01:00
parent 7afd9039d1
commit 189fa68c0b
Notes: sideshowbarker 2024-07-19 09:15:33 +09:00

View File

@ -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();