[dia] object: new utilities for setting up connectionpoints/handles
- From: Zander Brown <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] object: new utilities for setting up connectionpoints/handles
- Date: Tue, 21 Jul 2020 01:07:52 +0000 (UTC)
commit 4aab23fab3dc09b06d68276c9121575a1935f60e
Author: Zander Brown <zbrown gnome org>
Date: Tue Jul 21 02:02:05 2020 +0100
object: new utilities for setting up connectionpoints/handles
lib/object.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/object.h | 11 ++++++++++
2 files changed, 82 insertions(+)
---
diff --git a/lib/object.c b/lib/object.c
index 8bfa365b..8db4b3f6 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -1795,3 +1795,74 @@ dia_object_transform (DiaObject *self,
return self->ops->transform (self, m);
}
+
+
+/**
+ * dia_object_add_handle:
+ * @self: the #DiaObject
+ * @handle: the #Handle to register
+ * @index: the index of @handle
+ * @id: the #HandleId of @handle
+ * @type: the #HandleType of @handle
+ * @connect_type: the @HandleConnectType of @handle
+ *
+ * Register @handle with @self, for use in object creation
+ *
+ * This SHOULD NOT be called on arbitary objects
+ *
+ * Stability: Stable
+ *
+ * Since: 0.98
+ */
+void
+dia_object_add_handle (DiaObject *self,
+ Handle *handle,
+ int index,
+ HandleId id,
+ HandleType type,
+ HandleConnectType connect_type)
+{
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (handle != NULL);
+ g_return_if_fail (index >= 0 && index < self->num_handles);
+
+ self->handles[index] = handle;
+
+ handle->id = id;
+ handle->type = type;
+ handle->connect_type = connect_type;
+ handle->connected_to = NULL;
+}
+
+
+/**
+ * dia_object_add_connection_point:
+ * @self: the #DiaObject
+ * @cp: the #ConnectionPoint to register
+ * @index: the index of @cp
+ * @flags: the #ConnectionPointFlags for flags
+ *
+ * Register @cp with @self, for use in object creation
+ *
+ * This SHOULD NOT be called on arbitary objects
+ *
+ * Stability: Stable
+ *
+ * Since: 0.98
+ */
+void
+dia_object_add_connection_point (DiaObject *self,
+ ConnectionPoint *cp,
+ int index,
+ ConnectionPointFlags flags)
+{
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (cp != NULL);
+ g_return_if_fail (index >= 0 && index < self->num_connections);
+
+ self->connections[index] = cp;
+
+ cp->object = self;
+ cp->connected = NULL;
+ cp->flags = flags;
+}
diff --git a/lib/object.h b/lib/object.h
index 28ffbcf3..0ffff0ef 100644
--- a/lib/object.h
+++ b/lib/object.h
@@ -498,6 +498,17 @@ gboolean dia_object_edit_text (DiaObject *s
gchar *textchange);
gboolean dia_object_transform (DiaObject *self,
const DiaMatrix *m);
+void dia_object_add_handle (DiaObject *self,
+ Handle *handle,
+ int index,
+ HandleId id,
+ HandleType type,
+ HandleConnectType connect_type);
+void dia_object_add_connection_point (DiaObject *self,
+ ConnectionPoint *cp,
+ int index,
+ ConnectionPointFlags flags);
+
gboolean dia_object_defaults_load (const gchar *filename,
gboolean create_lazy,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]