summaryrefslogtreecommitdiffstats
path: root/ganv/Node.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ganv/Node.hpp')
-rw-r--r--ganv/Node.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/ganv/Node.hpp b/ganv/Node.hpp
index fb1c1be..c9aaa63 100644
--- a/ganv/Node.hpp
+++ b/ganv/Node.hpp
@@ -38,6 +38,8 @@ public:
: Item(GANV_ITEM(g_object_ref(gobj)))
{
g_signal_connect(gobj, "moved", G_CALLBACK(on_moved), this);
+ CONNECT_PROP_SIGNAL(gobj, selected,
+ on_notify<gboolean>, &Node::on_selected)
}
~Node() {
@@ -83,6 +85,13 @@ private:
static void on_moved(GanvNode* node, double x, double y) {
Glib::wrap(node)->_signal_moved.emit(x, y);
}
+
+ template<typename T>
+ static void on_notify(GObject* gobj, GParamSpec* pspec, gpointer signal) {
+ T value;
+ g_object_get(gobj, g_param_spec_get_name(pspec), &value, NULL);
+ ((sigc::signal<bool, T>*)signal)->emit(value);
+ }
};
} // namespace Ganv