1
Fork 0
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:
Andreas Kling 2019-02-12 14:09:48 +01:00
parent a5a7ea3d1e
commit 3085e400bc
9 changed files with 103 additions and 43 deletions

23
LibGUI/GAction.h Normal file
View 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;
};