mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibGUI: Add GAction class and make GMenu deal in actions rather than strings.
This commit is contained in:
parent
a5a7ea3d1e
commit
3085e400bc
Notes:
sideshowbarker
2024-07-19 15:46:14 +09:00
Author: https://github.com/awesomekling
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