[glibmm] ActionMap: add_action(): Add more overloads
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] ActionMap: add_action(): Add more overloads
- Date: Sat, 27 Jul 2013 21:13:30 +0000 (UTC)
commit 081749f9ddfb151413264711cf2cd2d7badf1f34
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Jul 27 23:11:35 2013 +0200
ActionMap: add_action(): Add more overloads
gio/src/actionmap.ccg | 22 +++++++++++++++++++++-
gio/src/actionmap.hg | 16 +++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/gio/src/actionmap.ccg b/gio/src/actionmap.ccg
index 8c651fb..3c87802 100644
--- a/gio/src/actionmap.ccg
+++ b/gio/src/actionmap.ccg
@@ -23,12 +23,32 @@
namespace Gio
{
-Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name, const ActivateSlot& slot)
+Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name)
{
Glib::RefPtr<SimpleAction> action = SimpleAction::create(name);
+ add_action(action);
+ return action;
+}
+
+Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name, const ActivateSlot& slot)
+{
+ Glib::RefPtr<SimpleAction> action = add_action(name);
action->signal_activate().connect(slot);
+ return action;
+}
+
+Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, bool state)
+{
+ Glib::RefPtr<SimpleAction> action = SimpleAction::create_bool(name, state);
add_action(action);
return action;
}
+Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, bool state, const
ActivateSlot& slot)
+{
+ Glib::RefPtr<SimpleAction> action = add_action_bool(name, state);
+ action->signal_activate().connect(slot);
+ return action;
+}
+
} // namespace Gio
diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg
index 05fa572..3e6d71a 100644
--- a/gio/src/actionmap.hg
+++ b/gio/src/actionmap.hg
@@ -63,7 +63,17 @@ public:
*/
typedef sigc::slot< void,const Glib::VariantBase& > ActivateSlot;
- //This is our equivalent for 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.
+ *
+ * @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);
+
+ //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.
*
@@ -74,6 +84,10 @@ public:
Glib::RefPtr<SimpleAction> add_action(const Glib::ustring& name, const ActivateSlot& slot);
_IGNORE(g_action_map_add_action_entries)
+ Glib::RefPtr<SimpleAction> add_action_bool(const Glib::ustring& name, bool state);
+
+ Glib::RefPtr<SimpleAction> add_action_bool(const Glib::ustring& name, bool state, const ActivateSlot&
slot);
+
_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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]