X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fwindow.c;fp=src%2Fwindow.c;h=d0d8d74e8faf724bf5b4ae7e6825812b51d381e5;hb=b012c112e391964e63247dcbb55988855b0fc95e;hp=a103ed4e31224eedfa8cfe3c5c3d1f2260d0e10e;hpb=487b4f073cfbec280ed91e001c51cb32814ee4b5;p=windtk diff --git a/src/window.c b/src/window.c index a103ed4..d0d8d74 100644 --- a/src/window.c +++ b/src/window.c @@ -1,6 +1,7 @@ #include "wtimpl.h" -static void draw_win(wt_widget *w); +static void draw_win(wt_widget *w, struct wt_graphics *gfx); +static void use_theme(wt_widget *w, struct wt_theme *theme); wt_widget *wt_window(wt_widget *par, const char *title, int style, int x, int y, int xsz, int ysz) { @@ -15,12 +16,17 @@ wt_widget *wt_window(wt_widget *par, const char *title, int style, int x, int y, wt_resize(w, xsz, ysz); /* TODO: style */ - w->draw = draw_win; + use_theme(w, wt->theme); return w; } -static void draw_win(wt_widget *w) +static void draw_win(wt_widget *w, struct wt_graphics *gfx) { wt_gfx_color(COL_BG); wt_gfx_fillrect(&w->rect); } + +static void use_theme(wt_widget *w, struct wt_theme *theme) +{ + w->draw = theme && theme->draw_window ? theme->draw_window : draw_win; +}