return 0;
}
w->type = WT_TYPE_WIDGET;
+ w->dirty = 1;
if(!par) par = wt->root;
wt_add_child(par, w);
wt_free_widget(tree);
}
+void wt_dirty_widget(wt_widget *w)
+{
+ int i;
+
+ w->dirty = 1;
+
+ for(i=0; i<w->num_child; i++) {
+ wt_dirty_widget(w->child[i]);
+ }
+}
+
int wt_type(wt_widget *w)
{
return w->type;
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 */
}
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)