summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ganv/Node.hpp1
-rw-r--r--src/Canvas.cpp3
-rw-r--r--src/node.c13
3 files changed, 16 insertions, 1 deletions
diff --git a/ganv/Node.hpp b/ganv/Node.hpp
index 4de2d35..af5e691 100644
--- a/ganv/Node.hpp
+++ b/ganv/Node.hpp
@@ -57,6 +57,7 @@ public:
RW_PROPERTY(gboolean, selected)
RW_PROPERTY(gboolean, highlighted)
RW_PROPERTY(gboolean, draggable)
+ RW_PROPERTY(gboolean, grabbed)
RW_OBJECT_PROPERTY(Node*, partner);
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 4f3ca33..9629cab 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1418,6 +1418,8 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
ganv_item_grab(GANV_ITEM(port),
GDK_POINTER_MOTION_MASK|GDK_BUTTON_RELEASE_MASK,
NULL, event->button.time);
+ GANV_NODE(port)->impl->grabbed = TRUE;
+
}
} else if (!port->impl->is_input) {
port_dragging = port_pressed = true;
@@ -1499,6 +1501,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
port_dragging = false;
} else if (control_dragging) {
control_dragging = false;
+ GANV_NODE(port)->impl->grabbed = FALSE;
} else if (event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) {
select_port_toggle(port, event->button.state);
} else {
diff --git a/src/node.c b/src/node.c
index 72af575..a728cb0 100644
--- a/src/node.c
+++ b/src/node.c
@@ -45,7 +45,8 @@ enum {
PROP_IS_SOURCE,
PROP_SELECTED,
PROP_HIGHLIGHTED,
- PROP_DRAGGABLE
+ PROP_DRAGGABLE,
+ PROP_GRABBED
};
static void
@@ -151,6 +152,7 @@ ganv_node_set_property(GObject* object,
SET_CASE(IS_SOURCE, boolean, impl->is_source);
SET_CASE(HIGHLIGHTED, boolean, impl->highlighted);
SET_CASE(DRAGGABLE, boolean, impl->draggable);
+ SET_CASE(GRABBED, boolean, impl->grabbed);
case PROP_SELECTED:
if (impl->selected != g_value_get_boolean(value)) {
GanvItem* item = GANV_ITEM(object);
@@ -212,6 +214,7 @@ ganv_node_get_property(GObject* object,
GET_CASE(SELECTED, boolean, impl->selected);
GET_CASE(HIGHLIGHTED, boolean, impl->highlighted);
GET_CASE(DRAGGABLE, boolean, impl->draggable);
+ GET_CASE(GRABBED, boolean, impl->grabbed);
case PROP_CANVAS:
g_value_set_object(value, GANV_ITEM(object)->canvas);
break;
@@ -662,6 +665,14 @@ ganv_node_class_init(GanvNodeClass* klass)
0,
G_PARAM_READWRITE));
+ g_object_class_install_property(
+ gobject_class, PROP_GRABBED, g_param_spec_boolean(
+ "grabbed",
+ _("Grabbed"),
+ _("Whether this object is grabbed by the user."),
+ 0,
+ G_PARAM_READWRITE));
+
signal_moved = g_signal_new("moved",
ganv_node_get_type(),
G_SIGNAL_RUN_FIRST,