summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/MenuItem.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-07-10 13:29:21 -0600
committerAndreas Kling <kling@serenityos.org>2020-07-11 11:45:49 +0200
commit1c1ab716921d8c6c200a1298364903388929fd0a (patch)
tree4688c003db7e5abaeec7fa91d5ef79e91c57d061 /Libraries/LibGUI/MenuItem.h
parentfc4e01a3c9719113e9ae2e17e36777507b8edd52 (diff)
downloadserenity-1c1ab716921d8c6c200a1298364903388929fd0a.zip
WindowServer/LibGUI: Add default menu items and allow default action for context menu
By specifying an optional Action for Menu::popup an application can specify what item should be displayed as a default item.
Diffstat (limited to 'Libraries/LibGUI/MenuItem.h')
-rw-r--r--Libraries/LibGUI/MenuItem.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Libraries/LibGUI/MenuItem.h b/Libraries/LibGUI/MenuItem.h
index 871690a805..1441061661 100644
--- a/Libraries/LibGUI/MenuItem.h
+++ b/Libraries/LibGUI/MenuItem.h
@@ -47,7 +47,7 @@ public:
~MenuItem();
Type type() const { return m_type; }
- String text() const;
+
const Action* action() const { return m_action.ptr(); }
Action* action() { return m_action.ptr(); }
unsigned identifier() const { return m_identifier; }
@@ -64,6 +64,9 @@ public:
bool is_enabled() const { return m_enabled; }
void set_enabled(bool);
+ bool is_default() const { return m_default; }
+ void set_default(bool);
+
void set_menu_id(Badge<Menu>, unsigned menu_id);
void set_identifier(Badge<Menu>, unsigned identifier);
@@ -76,6 +79,7 @@ private:
bool m_enabled { true };
bool m_checkable { false };
bool m_checked { false };
+ bool m_default { false };
RefPtr<Action> m_action;
RefPtr<Menu> m_submenu;
};