gameui
diff src/theme.h @ 5:5a84873185ff
rudimentary theme plugin system and other minor fixes
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 22 Mar 2014 01:50:01 +0200 |
parents | e0916bb20b7f |
children |
line diff
1.1 --- a/src/theme.h Fri Mar 21 21:45:37 2014 +0200 1.2 +++ b/src/theme.h Sat Mar 22 01:50:01 2014 +0200 1.3 @@ -3,27 +3,29 @@ 1.4 1.5 #include <string> 1.6 #include <map> 1.7 +#include "goatkit.h" 1.8 1.9 namespace goatkit { 1.10 1.11 class Widget; 1.12 1.13 -typedef void (*widget_draw_func)(const Widget*); 1.14 - 1.15 +void add_theme_path(const char *path); 1.16 void default_draw_func(const Widget *w); 1.17 1.18 class Theme { 1.19 private: 1.20 void *so; 1.21 - std::map<std::string, widget_draw_func> draw_func; 1.22 + WidgetDrawFunc (*lookup_theme_draw_func)(const char*); 1.23 + mutable std::map<std::string, WidgetDrawFunc> func_cache; 1.24 1.25 public: 1.26 Theme(); 1.27 ~Theme(); 1.28 1.29 bool load(const char *name); 1.30 + void unload(); 1.31 1.32 - widget_draw_func get_draw_func(const char *type) const; 1.33 + WidgetDrawFunc get_draw_func(const char *type) const; 1.34 }; 1.35 1.36 extern Theme *theme; // the current theme