summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ganv/Node.hpp9
-rw-r--r--ganv/node.h3
-rw-r--r--src/Canvas.cpp2
-rw-r--r--src/node.c43
-rw-r--r--src/port.c9
5 files changed, 31 insertions, 35 deletions
diff --git a/ganv/Node.hpp b/ganv/Node.hpp
index 6bdb96c..3359ac3 100644
--- a/ganv/Node.hpp
+++ b/ganv/Node.hpp
@@ -73,10 +73,15 @@ public:
METHOD0(ganv_node, disconnect);
- sigc::signal<void, double, double> signal_moved;
+ sigc::signal<void, double, double>& signal_moved() {
+ return _signal_moved;
+ }
+
+private:
+ sigc::signal<void, double, double> _signal_moved;
static void on_moved(GanvNode* node, double x, double y) {
- Glib::wrap(node)->signal_moved.emit(x, y);
+ Glib::wrap(node)->_signal_moved.emit(x, y);
}
};
diff --git a/ganv/node.h b/ganv/node.h
index e1f39ac..7c14b53 100644
--- a/ganv/node.h
+++ b/ganv/node.h
@@ -75,9 +75,6 @@ struct _GanvNodeClass {
double* y,
double* dx,
double* dy);
-
- gboolean (*on_event)(GanvNode* node,
- GdkEvent* event);
};
GType ganv_node_get_type(void);
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 9de1a43..ca7a9ad 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1366,7 +1366,7 @@ Canvas::Canvas(double width, double height)
{
g_object_set_qdata(G_OBJECT(impl()->_gcanvas), wrapper_key(), this);
- g_signal_connect_after(gobj(), "event",
+ g_signal_connect_after(impl()->root(), "event",
G_CALLBACK(on_event_after), this);
g_signal_connect(gobj(), "connect",
G_CALLBACK(on_connect), this);
diff --git a/src/node.c b/src/node.c
index 843fb27..6092924 100644
--- a/src/node.c
+++ b/src/node.c
@@ -45,12 +45,6 @@ enum {
PROP_DRAGGABLE
};
-static gboolean
-on_event(GanvNode* node, GdkEvent* event)
-{
- return GANV_NODE_GET_CLASS(node)->on_event(node, event);
-}
-
static void
ganv_node_init(GanvNode* node)
{
@@ -71,9 +65,6 @@ ganv_node_init(GanvNode* node)
impl->selected = FALSE;
impl->highlighted = FALSE;
impl->draggable = FALSE;
-
- g_signal_connect(G_OBJECT(node),
- "event", G_CALLBACK(on_event), node);
}
static void
@@ -120,9 +111,9 @@ ganv_node_set_property(GObject* object,
g_return_if_fail(object != NULL);
g_return_if_fail(GANV_IS_NODE(object));
- GanvNode* node = GANV_NODE(object);
- GanvNodeImpl* impl = node->impl;
- GanvItem* item = GANV_ITEM(object);
+ GanvNode* node = GANV_NODE(object);
+ GanvNodeImpl* impl = node->impl;
+ GanvItem* item = GANV_ITEM(object);
switch (prop_id) {
SET_CASE(PARTNER, object, impl->partner);
@@ -164,9 +155,9 @@ ganv_node_get_property(GObject* object,
g_return_if_fail(object != NULL);
g_return_if_fail(GANV_IS_NODE(object));
- GanvNode* node = GANV_NODE(object);
- GanvNodeImpl* impl = node->impl;
- GanvItem* item = GANV_ITEM(object);
+ GanvNode* node = GANV_NODE(object);
+ GanvNodeImpl* impl = node->impl;
+ GanvItem* item = GANV_ITEM(object);
typedef char* gstring;
@@ -329,9 +320,10 @@ ganv_node_default_move_to(GanvNode* node,
}
static gboolean
-ganv_node_default_on_event(GanvNode* node,
- GdkEvent* event)
+ganv_node_default_event(GanvItem* item,
+ GdkEvent* event)
{
+ GanvNode* node = GANV_NODE(item);
GanvCanvas* canvas = GANV_CANVAS(GANV_ITEM(node)->canvas);
// FIXME: put these somewhere better
@@ -580,15 +572,16 @@ ganv_node_class_init(GanvNodeClass* class)
object_class->destroy = ganv_node_destroy;
item_class->realize = ganv_node_realize;
-
- class->disconnect = ganv_node_default_disconnect;
- class->move = ganv_node_default_move;
- class->move_to = ganv_node_default_move_to;
- class->tick = ganv_node_default_tick;
- class->tail_vector = ganv_node_default_tail_vector;
- class->head_vector = ganv_node_default_head_vector;
- class->on_event = ganv_node_default_on_event;
+ item_class->event = ganv_node_default_event;
+
+ class->disconnect = ganv_node_default_disconnect;
+ class->move = ganv_node_default_move;
+ class->move_to = ganv_node_default_move_to;
+ class->tick = ganv_node_default_tick;
+ class->tail_vector = ganv_node_default_tail_vector;
+ class->head_vector = ganv_node_default_head_vector;
}
+
gboolean
ganv_node_can_tail(const GanvNode* self)
{
diff --git a/src/port.c b/src/port.c
index f7d41ac..b804617 100644
--- a/src/port.c
+++ b/src/port.c
@@ -203,12 +203,11 @@ ganv_port_set_height(GanvBox* box,
}
static gboolean
-on_event(GanvNode* node, GdkEvent* event)
+event(GanvItem* item, GdkEvent* event)
{
- GanvItem* item = GANV_ITEM(node);
GanvCanvas* canvas = GANV_CANVAS(item->canvas);
- return ganv_canvas_port_event(canvas, GANV_PORT(node), event);
+ return ganv_canvas_port_event(canvas, GANV_PORT(item), event);
}
static void
@@ -216,6 +215,7 @@ ganv_port_class_init(GanvPortClass* class)
{
GObjectClass* gobject_class = (GObjectClass*)class;
GtkObjectClass* object_class = (GtkObjectClass*)class;
+ GanvItemClass* item_class = (GanvItemClass*)class;
GanvNodeClass* node_class = (GanvNodeClass*)class;
GanvBoxClass* box_class = (GanvBoxClass*)class;
@@ -236,7 +236,8 @@ ganv_port_class_init(GanvPortClass* class)
object_class->destroy = ganv_port_destroy;
- node_class->on_event = on_event;
+ item_class->event = event;
+
node_class->tail_vector = ganv_port_tail_vector;
node_class->head_vector = ganv_port_head_vector;
node_class->resize = ganv_port_resize;