summaryrefslogtreecommitdiff
path: root/gio/src/actionmap.hg
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2013-07-22 12:22:01 +0200
committerMurray Cumming <murrayc@murrayc.com>2013-07-22 12:22:01 +0200
commitadbf749ac8342832c56c149c622270e09c712d83 (patch)
tree2c6a39b4ee0aaa2ecbd001d872549828a747f381 /gio/src/actionmap.hg
parent73afd45347b14a7776b6b79f247a353fe8348dd8 (diff)
downloadglibmm-adbf749ac8342832c56c149c622270e09c712d83.tar.gz
ActionMap: Add add_action(name, slot).
This is a convenience method similar to g_action_map_add_action_entries() in C.
Diffstat (limited to 'gio/src/actionmap.hg')
-rw-r--r--gio/src/actionmap.hg20
1 files changed, 19 insertions, 1 deletions
diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg
index 3a518935..05fa5721 100644
--- a/gio/src/actionmap.hg
+++ b/gio/src/actionmap.hg
@@ -18,6 +18,7 @@
*/
#include <glibmm/interface.h>
+#include <giomm/simpleaction.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
@@ -54,7 +55,24 @@ public:
_WRAP_METHOD(Glib::RefPtr<Action> lookup_action(const Glib::ustring& action_name), g_action_map_lookup_action)
_WRAP_METHOD(Glib::RefPtr<const Action> lookup_action(const Glib::ustring& action_name) const, g_action_map_lookup_action, constversion)
- //TODO: _WRAP_METHOD(void add_action_entries(const GActionEntry* entries, int n_entries, gpointer user_data), g_action_map_add_action_entries)
+ /** A Slot to be called when an action has been activated.
+ * See add_action().
+ *
+ * For instance,
+ * void on_slot_activated(const Glib::VariantBase& parameter);
+ */
+ typedef sigc::slot< void,const Glib::VariantBase& > ActivateSlot;
+
+ //This is our equivalent for g_action_map_add_action_entries().
+ /** A convenience method for creating a SimpleAction instance
+ * and adding it to the ActionMap.
+ *
+ * @param name The name of the Action.
+ * @param slot The callback method to be called when the action is activated.
+ * @return The Action.
+ */
+ Glib::RefPtr<SimpleAction> add_action(const Glib::ustring& name, const ActivateSlot& slot);
+ _IGNORE(g_action_map_add_action_entries)
_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)