1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +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.cpp Normal file
View file

@ -0,0 +1,23 @@
#include <LibGUI/GAction.h>
GAction::GAction(const String& text, const String& custom_data, Function<void(const GAction&)> on_activation_callback)
: m_text(text)
, on_activation(move(on_activation_callback))
, m_custom_data(custom_data)
{
}
GAction::GAction(const String& text, Function<void(const GAction&)> on_activation_callback)
: GAction(text, String(), move(on_activation_callback))
{
}
GAction::~GAction()
{
}
void GAction::activate()
{
if (on_activation)
on_activation(*this);
}