X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fwidget.c;fp=src%2Fwidget.c;h=02c3ff049166eba31643393fe07fb35ce6287350;hb=492a32903dd07d3736bb878e81eb95f351556bac;hp=96be75588c0f59201a0836fcfb1e93f18335cc20;hpb=526fc352816f21f1cbfa8110262a58224c14d208;p=windtk diff --git a/src/widget.c b/src/widget.c index 96be755..02c3ff0 100644 --- a/src/widget.c +++ b/src/widget.c @@ -9,6 +9,7 @@ wt_widget *wt_alloc_widget(wt_widget *par) return 0; } w->type = WT_TYPE_WIDGET; + w->dirty = 1; if(!par) par = wt->root; wt_add_child(par, w); @@ -36,6 +37,17 @@ void wt_free_tree(wt_widget *tree) wt_free_widget(tree); } +void wt_dirty_widget(wt_widget *w) +{ + int i; + + w->dirty = 1; + + for(i=0; inum_child; i++) { + wt_dirty_widget(w->child[i]); + } +} + int wt_type(wt_widget *w) { return w->type; @@ -156,8 +168,8 @@ void wt_move(wt_widget *w, int x, int y) void wt_resize(wt_widget *w, int x, int y) { - w->rect.width = x; - w->rect.height = y; + w->rect.w = x; + w->rect.h = y; /* TODO: invalidate something */ } @@ -170,15 +182,15 @@ int *wt_position(wt_widget *w, int *xret, int *yret) int *wt_size(wt_widget *w, int *xret, int *yret) { - if(xret) *xret = w->rect.width; - if(yret) *yret = w->rect.height; - return &w->rect.width; + if(xret) *xret = w->rect.w; + if(yret) *yret = w->rect.h; + return &w->rect.w; } int wt_hittest(wt_widget *w, int x, int y) { - return x >= w->rect.x && y >= w->rect.y && x < w->rect.x + w->rect.width && - y < w->rect.y + w->rect.height; + return x >= w->rect.x && y >= w->rect.y && x < w->rect.x + w->rect.w && + y < w->rect.y + w->rect.h; } wt_widget *wt_widget_at(int x, int y)