theme
[windtk] / src / windtk.c
index ea916c3..d6b4d64 100644 (file)
@@ -57,6 +57,34 @@ void wt_destroy(void)
        wt->root = 0;
 }
 
+struct wt_theme *wt_load_theme(const char *path)
+{
+       return 0;       /* TODO */
+}
+
+void wt_unload_theme(struct wt_theme *theme)
+{
+}
+
+static void use_theme(wt_widget *w, struct wt_theme *theme)
+{
+       int i;
+
+       if(w->use_theme) {
+               w->use_theme(w, theme);
+       }
+
+       for(i=0; i<w->num_child; i++) {
+               use_theme(w->child[i], theme);
+       }
+}
+
+void wt_use_theme(struct wt_theme *theme)
+{
+       wt->theme = theme;
+       use_theme(wt->root, theme);
+}
+
 void wt_viewport(int x, int y, int w, int h)
 {
        wt_setrect(&wt->vp, x, y, w, h);
@@ -96,7 +124,7 @@ void wt_draw_tree(wt_widget *tree)
        int i;
 
        if(tree->draw) {
-               tree->draw(tree);
+               tree->draw(tree, &wt->gfx);
        }
 
        for(i=0; i<tree->num_child; i++) {