summaryrefslogtreecommitdiffstats
path: root/src/module.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-13 21:35:54 +0000
committerDavid Robillard <d@drobilla.net>2011-12-13 21:35:54 +0000
commit4cdd7331a69e2f714b440644bd36334031cfbccc (patch)
tree112d6ce1dce981f9352cf2aa7b8647f76d9df88b /src/module.c
parent646675f0d21abec2848ae8e25f906aa693139fbd (diff)
downloadganv-4cdd7331a69e2f714b440644bd36334031cfbccc.tar.gz
ganv-4cdd7331a69e2f714b440644bd36334031cfbccc.tar.bz2
ganv-4cdd7331a69e2f714b440644bd36334031cfbccc.zip
Make items responsible for drawing their own children.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3868 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/module.c')
-rw-r--r--src/module.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c
index a6fe461..d3ae675 100644
--- a/src/module.c
+++ b/src/module.c
@@ -526,6 +526,26 @@ ganv_module_update(GanvItem* item, int flags)
}
static void
+ganv_module_draw(GanvItem* item,
+ cairo_t* cr,
+ int cx, int cy,
+ int width, int height)
+{
+ GanvModule* module = GANV_MODULE(item);
+
+ // Draw box and label
+ if (GANV_ITEM_CLASS(parent_class)->draw) {
+ (*GANV_ITEM_CLASS(parent_class)->draw)(item, cr, cx, cy, width, height);
+ }
+
+ // Draw ports
+ FOREACH_PORT(module->impl->ports, p) {
+ GANV_ITEM_GET_CLASS(GANV_ITEM(*p))->draw(
+ GANV_ITEM(*p), cr, cx, cy, width, height);
+ }
+}
+
+static void
ganv_module_move_to(GanvNode* node,
double x,
double y)
@@ -567,6 +587,7 @@ ganv_module_class_init(GanvModuleClass* class)
object_class->destroy = ganv_module_destroy;
item_class->update = ganv_module_update;
+ item_class->draw = ganv_module_draw;
node_class->move = ganv_module_move;
node_class->move_to = ganv_module_move_to;