#pragma once #include #include #include #include #include #include class GAction : public Retainable { public: static Retained create(const String& text, Function callback) { return adopt(*new GAction(text, move(callback))); } static Retained create(const String& text, const String& custom_data, Function callback) { return adopt(*new GAction(text, custom_data, move(callback))); } static Retained create(const String& text, RetainPtr&& icon, Function callback) { return adopt(*new GAction(text, move(icon), move(callback))); } static Retained create(const String& text, const GShortcut& shortcut, Function callback) { return adopt(*new GAction(text, shortcut, move(callback))); } static Retained create(const String& text, const GShortcut& shortcut, RetainPtr&& icon, Function callback) { return adopt(*new GAction(text, shortcut, move(icon), move(callback))); } ~GAction(); String text() const { return m_text; } GShortcut shortcut() const { return m_shortcut; } String custom_data() const { return m_custom_data; } const GraphicsBitmap* icon() const { return m_icon.ptr(); } Function on_activation; void activate(); private: GAction(const String& text, Function = nullptr); GAction(const String& text, const GShortcut&, Function = nullptr); GAction(const String& text, const GShortcut&, RetainPtr&& icon, Function = nullptr); GAction(const String& text, RetainPtr&& icon, Function = nullptr); GAction(const String& text, const String& custom_data = String(), Function = nullptr); String m_text; String m_custom_data; RetainPtr m_icon; GShortcut m_shortcut; };