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:
parent
a5a7ea3d1e
commit
3085e400bc
9 changed files with 103 additions and 43 deletions
23
LibGUI/GAction.cpp
Normal file
23
LibGUI/GAction.cpp
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue