theme
[windtk] / src / window.c
index a103ed4..d0d8d74 100644 (file)
@@ -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;
+}