mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +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
23
LibGUI/GAction.h
Normal file
23
LibGUI/GAction.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Function.h>
|
||||
|
||||
class GAction {
|
||||
public:
|
||||
GAction(const String& text, Function<void(const GAction&)> = nullptr);
|
||||
GAction(const String& text, const String& custom_data = String(), Function<void(const GAction&)> = nullptr);
|
||||
~GAction();
|
||||
|
||||
String text() const { return m_text; }
|
||||
String custom_data() const { return m_custom_data; }
|
||||
|
||||
Function<void(GAction&)> on_activation;
|
||||
|
||||
void activate();
|
||||
|
||||
private:
|
||||
String m_text;
|
||||
String m_custom_data;
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue