mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
LibGUI: Add GAction class and make GMenu deal in actions rather than strings.
This commit is contained in:
parent
a5a7ea3d1e
commit
3085e400bc
9 changed files with 103 additions and 43 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue