diff options
Diffstat (limited to 'gio/src/actionmap.hg')
-rw-r--r-- | gio/src/actionmap.hg | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg index e42d592e..5222a0da 100644 --- a/gio/src/actionmap.hg +++ b/gio/src/actionmap.hg @@ -50,19 +50,16 @@ class ActionMap : public Glib::Interface _CLASS_INTERFACE(ActionMap, GActionMap, G_ACTION_MAP, GActionMapInterface) public: + _WRAP_METHOD(void add_action(const Glib::RefPtr<Action>& action), g_action_map_add_action) + _WRAP_METHOD(void remove_action(const Glib::ustring& action_name), g_action_map_remove_action) + _WRAP_METHOD(Glib::RefPtr<Action> lookup_action(const Glib::ustring& action_name), g_action_map_lookup_action, refreturn) _WRAP_METHOD(Glib::RefPtr<const Action> lookup_action(const Glib::ustring& action_name) const, g_action_map_lookup_action, constversion, refreturn) - /** A Slot to be called when an action has been activated, - * passing a parameter of a specified type. - * See add_action_with_parameter(). - * - * For instance, - * void on_slot_activated(const Glib::VariantBase& parameter); - */ - using ActivateWithParameterSlot = sigc::slot<void, const Glib::VariantBase&>; + // The various add_action() methods are our equivalent for g_action_map_add_action_entries(). + _IGNORE(g_action_map_add_action_entries) + - //This is an equivalent for g_action_map_add_action_entries(). /** A convenience method for creating a SimpleAction instance * and adding it to the ActionMap. * @@ -71,7 +68,15 @@ public: */ Glib::RefPtr<SimpleAction> add_action(const Glib::ustring& name); - //This is an equivalent for g_action_map_add_action_entries(). + /** A Slot to be called when an action has been activated, + * without passing a parameter to the slot. + * See add_action() and add_action_bool(). + * + * For instance, + * void on_slot_activated(); + */ + using ActivateSlot = sigc::slot<void()>; + /** A convenience method for creating a SimpleAction instance * and adding it to the ActionMap. * @@ -79,17 +84,17 @@ public: * @param slot The callback method to be called when the action is activated. * @return The Action. */ - Glib::RefPtr<SimpleAction> add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot, const Glib::VariantType& parameter_type); - _IGNORE(g_action_map_add_action_entries) + Glib::RefPtr<SimpleAction> add_action(const Glib::ustring& name, const ActivateSlot& slot); + /** A Slot to be called when an action has been activated, - * without passing a parameter to the slot. - * See add_action() and add_action_bool(). + * passing a parameter of a specified type. + * See add_action_with_parameter(). * * For instance, - * void on_slot_activated(); + * void on_slot_activated(const Glib::VariantBase& parameter); */ - using ActivateSlot = sigc::slot<void>; + using ActivateWithParameterSlot = sigc::slot<void(const Glib::VariantBase&)>; /** A convenience method for creating a SimpleAction instance * and adding it to the ActionMap. @@ -99,7 +104,7 @@ public: * @parameter_type The type of parameter to be passed to the slot. * @return The Action. */ - Glib::RefPtr<SimpleAction> add_action(const Glib::ustring& name, const ActivateSlot& slot); + Glib::RefPtr<SimpleAction> add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot, const Glib::VariantType& parameter_type); /** A convenience method for creating a boolean-stateful SimpleAction instance @@ -151,6 +156,7 @@ public: */ Glib::RefPtr<SimpleAction> add_action_radio_string(const Glib::ustring& name, const ActivateWithStringParameterSlot& slot, const Glib::ustring& state); + //TODO: Docs: Add hints about how to specify the various possible states in the GtkBuilder XML. /** A convenience method for creating an integer-based radio SimpleAction instance * and adding it to the ActionMap. @@ -181,9 +187,6 @@ public: Glib::RefPtr<SimpleAction> add_action_radio_integer(const Glib::ustring& name, const ActivateWithIntParameterSlot& slot, gint32 state); - _WRAP_METHOD(void add_action(const Glib::RefPtr<Action>& action), g_action_map_add_action) - _WRAP_METHOD(void remove_action(const Glib::ustring& action_name), g_action_map_remove_action) - #m4 _CONVERSION(`Glib::RefPtr<Action>', `GAction*', `Glib::unwrap($3)') _WRAP_VFUNC(Glib::RefPtr<Action> lookup_action(const Glib::ustring& name) const, "lookup_action", refreturn) |