X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fwindtk.c;fp=src%2Fwindtk.c;h=ea916c36399cc55438224c09823372dcccb95926;hb=487b4f073cfbec280ed91e001c51cb32814ee4b5;hp=1e4de8694cd5d860955c84af48a0dda5e02a7904;hpb=932050b6d47ae674793437d798ccd16894c01e13;p=windtk diff --git a/src/windtk.c b/src/windtk.c index 1e4de86..ea916c3 100644 --- a/src/windtk.c +++ b/src/windtk.c @@ -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; inum_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]);