summaryrefslogtreecommitdiffstats
path: root/ganv/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'ganv/node.h')
-rw-r--r--ganv/node.h170
1 files changed, 59 insertions, 111 deletions
diff --git a/ganv/node.h b/ganv/node.h
index bd6863f..fb7dd4c 100644
--- a/ganv/node.h
+++ b/ganv/node.h
@@ -29,126 +29,93 @@ G_BEGIN_DECLS
#define GANV_IS_NODE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_NODE))
#define GANV_IS_NODE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_NODE))
#define GANV_NODE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_NODE, GanvNodeClass))
+#define GANV_NODE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_NODE, GanvNodeImpl))
typedef struct _GanvNodeClass GanvNodeClass;
+typedef struct _GanvNodeImpl GanvNodeImpl;
struct _GanvNode {
- GnomeCanvasGroup group;
- struct _GanvNode* partner;
- GanvText* label;
- double dash_length;
- double dash_offset;
- double border_width;
- guint fill_color;
- guint border_color;
- gboolean can_tail;
- gboolean can_head;
- gboolean selected;
- gboolean highlighted;
- gboolean draggable;
+ GnomeCanvasGroup group;
+ GanvNodeImpl* impl;
};
struct _GanvNodeClass {
GnomeCanvasGroupClass parent_class;
- void (* tick)(GanvNode* self,
- double seconds);
+ void (*tick)(GanvNode* self,
+ double seconds);
- void (* move)(GanvNode* node,
- double dx,
- double dy);
+ void (*move)(GanvNode* node,
+ double dx,
+ double dy);
- void (* move_to)(GanvNode* node,
- double x,
- double y);
+ void (*move_to)(GanvNode* node,
+ double x,
+ double y);
- void (* resize)(GanvNode* node);
+ void (*resize)(GanvNode* node);
- void (* disconnect)(GanvNode* node);
+ void (*disconnect)(GanvNode* node);
- gboolean (* is_within)(const GanvNode* self,
- double x1,
- double y1,
- double x2,
- double y2);
+ gboolean (*is_within)(const GanvNode* self,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
- void (* tail_vector)(const GanvNode* self,
- const GanvNode* head,
- double* x,
- double* y,
- double* dx,
- double* dy);
+ void (*tail_vector)(const GanvNode* self,
+ const GanvNode* head,
+ double* x,
+ double* y,
+ double* dx,
+ double* dy);
- void (* head_vector)(const GanvNode* self,
- const GanvNode* tail,
- double* x,
- double* y,
- double* dx,
- double* dy);
+ void (*head_vector)(const GanvNode* self,
+ const GanvNode* tail,
+ double* x,
+ double* y,
+ double* dx,
+ double* dy);
- gboolean (* on_event)(GanvNode* node,
- GdkEvent* event);
+ gboolean (*on_event)(GanvNode* node,
+ GdkEvent* event);
};
GType ganv_node_get_type(void);
-static inline gboolean
-ganv_node_can_tail(const GanvNode* self)
-{
- return self->can_tail;
-}
+gboolean
+ganv_node_can_tail(const GanvNode* self);
-static inline gboolean
-ganv_node_can_head(const GanvNode* self)
-{
- return self->can_head;
-}
+gboolean
+ganv_node_can_head(const GanvNode* self);
-static inline gboolean
+gboolean
ganv_node_is_within(const GanvNode* self,
double x1,
double y1,
double x2,
- double y2)
-{
- return GANV_NODE_GET_CLASS(self)->is_within(
- self, x1, y1, x2, y2);
-}
+ double y2);
-static inline void
+void
ganv_node_tick(GanvNode* self,
- double seconds)
-{
- GanvNodeClass* klass = GANV_NODE_GET_CLASS(self);
- if (klass->tick) {
- klass->tick(self, seconds);
- }
-}
-
-static inline void
+ double seconds);
+
+void
ganv_node_tail_vector(const GanvNode* self,
const GanvNode* head,
double* x1,
double* y1,
double* x2,
- double* y2)
-{
- GANV_NODE_GET_CLASS(self)->tail_vector(
- self, head, x1, y1, x2, y2);
-}
+ double* y2);
-static inline void
+void
ganv_node_head_vector(const GanvNode* self,
const GanvNode* tail,
double* x1,
double* y1,
double* x2,
- double* y2)
-{
- GANV_NODE_GET_CLASS(self)->head_vector(
- self, tail, x1, y1, x2, y2);
-}
+ double* y2);
/**
Get the colours that should currently be used for drawing this node.
@@ -162,45 +129,26 @@ void ganv_node_get_draw_properties(const GanvNode* node,
const char* ganv_node_get_label(const GanvNode* node);
-static inline GanvNode*
-ganv_node_get_partner(const GanvNode* node)
-{
- return node->partner;
-}
+GanvNode*
+ganv_node_get_partner(const GanvNode* node);
-void ganv_node_set_label(GanvNode* node,
- const char* str);
+void ganv_node_set_label(GanvNode* node, const char* str);
-static inline void
+void
ganv_node_move(GanvNode* node,
double dx,
- double dy)
-{
- GANV_NODE_GET_CLASS(node)->move(node, dx, dy);
-}
+ double dy);
-static inline void
+void
ganv_node_move_to(GanvNode* node,
double x,
- double y)
-{
- GANV_NODE_GET_CLASS(node)->move_to(node, x, y);
-}
-
-static inline void
-ganv_node_resize(GanvNode* node)
-{
- GanvNodeClass* klass = GANV_NODE_GET_CLASS(node);
- if (klass->resize) {
- klass->resize(node);
- }
-}
-
-static inline void
-ganv_node_disconnect(GanvNode* node)
-{
- GANV_NODE_GET_CLASS(node)->disconnect(node);
-}
+ double y);
+
+void
+ganv_node_resize(GanvNode* node);
+
+void
+ganv_node_disconnect(GanvNode* node);
G_END_DECLS