summaryrefslogtreecommitdiff
path: root/LibGUI/GMenuItem.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-12 14:09:48 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-12 14:09:48 +0100
commit3085e400bcda710ac6977016768581bc789bb937 (patch)
tree6f40a1fa142afa9e163779c63ff5cb8157f107b8 /LibGUI/GMenuItem.h
parenta5a7ea3d1e6cbf595aa5d1809217abe6580fb63a (diff)
downloadserenity-3085e400bcda710ac6977016768581bc789bb937.zip
LibGUI: Add GAction class and make GMenu deal in actions rather than strings.
Diffstat (limited to 'LibGUI/GMenuItem.h')
-rw-r--r--LibGUI/GMenuItem.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/LibGUI/GMenuItem.h b/LibGUI/GMenuItem.h
index 48675e303f..383c1b00fe 100644
--- a/LibGUI/GMenuItem.h
+++ b/LibGUI/GMenuItem.h
@@ -2,21 +2,25 @@
#include <AK/AKString.h>
+class GAction;
+
class GMenuItem {
public:
- enum Type { Invalid, Text, Separator };
+ enum Type { Invalid, Action, Separator };
explicit GMenuItem(Type);
- GMenuItem(unsigned identifier, const String& text);
+ explicit GMenuItem(OwnPtr<GAction>&&);
~GMenuItem();
Type type() const { return m_type; }
- String text() const { return m_text; }
+ String text() const;
+ const GAction* action() const { return m_action.ptr(); }
+ GAction* action() { return m_action.ptr(); }
unsigned identifier() const { return m_identifier; }
private:
Type m_type { Invalid };
unsigned m_identifier { 0 };
- String m_text;
+ OwnPtr<GAction> m_action;
};