mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:18:11 +00:00
GAction: Added GCommonActions as a template to create standard actions
Instead of creating actions from the ground up, GCommonActions contains all related information to that common action. Such as the icon, keybind, ect.
This commit is contained in:
parent
6126edcd75
commit
deb31645aa
2 changed files with 45 additions and 3 deletions
|
@ -4,18 +4,27 @@
|
|||
#include <AK/Badge.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
#include <LibDraw/GraphicsBitmap.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
|
||||
class GAction;
|
||||
class GActionGroup;
|
||||
class GButton;
|
||||
class GMenuItem;
|
||||
class GWidget;
|
||||
|
||||
namespace GCommonActions {
|
||||
NonnullRefPtr<GAction> make_cut_action(Function<void()>, GWidget* widget);
|
||||
NonnullRefPtr<GAction> make_copy_action(Function<void()>, GWidget* widget);
|
||||
NonnullRefPtr<GAction> make_paste_action(Function<void()>, GWidget* widget);
|
||||
NonnullRefPtr<GAction> make_quit_action(Function<void()>);
|
||||
};
|
||||
|
||||
class GAction : public RefCounted<GAction>
|
||||
, public Weakable<GAction> {
|
||||
public:
|
||||
|
@ -41,7 +50,6 @@ public:
|
|||
return adopt(*new GAction(text, shortcut, move(icon), move(callback), widget));
|
||||
}
|
||||
~GAction();
|
||||
|
||||
GWidget* widget() { return m_widget.ptr(); }
|
||||
const GWidget* widget() const { return m_widget.ptr(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue