wt_draw
[windtk] / src / windtk.c
index 1e4de86..ea916c3 100644 (file)
@@ -41,6 +41,7 @@ void wt_allocator(void *(*allocfunc)(size_t), void (*freefunc)(void *p))
 
 int wt_init(int w, int h, struct wt_graphics *gfx)
 {
+       wt->root = 0;
        if(!(wt->root = wt_alloc_widget(0))) {
                return -1;
        }
@@ -90,6 +91,24 @@ void wt_inp_motion(int x, int y)
 {
 }
 
+void wt_draw_tree(wt_widget *tree)
+{
+       int i;
+
+       if(tree->draw) {
+               tree->draw(tree);
+       }
+
+       for(i=0; i<tree->num_child; i++) {
+               wt_draw_tree(tree->child[i]);
+       }
+}
+
+void wt_draw(void)
+{
+       wt_draw_tree(wt->root);
+}
+
 void wt_gfx_color(int cidx)
 {
        wt->gfx.color(wt->colors[cidx]);