istereo2

diff libs/goatkit/theme.h @ 11:03cc3b1884d1

implemented builtin themes registration and lookup in goatkit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Sep 2015 06:53:06 +0300
parents a3c4fcc9f8f3
children
line diff
     1.1 --- a/libs/goatkit/theme.h	Sat Sep 26 02:56:07 2015 +0300
     1.2 +++ b/libs/goatkit/theme.h	Mon Sep 28 06:53:06 2015 +0300
     1.3 @@ -18,18 +18,23 @@
     1.4  #ifndef THEME_H_
     1.5  #define THEME_H_
     1.6  
     1.7 -#define GOATKIT_THEME_BUILTIN	"GOATKIT_THEME_BUILTIN"
     1.8 +#define GOATKIT_BUILTIN_THEME(n, f)	\
     1.9 +	static goatkit::Theme goatkit_theme##__LINE__(n, f)
    1.10  
    1.11  namespace goatkit {
    1.12  
    1.13  class Widget;
    1.14 +class Theme;
    1.15 +struct ThemeImpl;
    1.16  
    1.17  typedef void (*WidgetDrawFunc)(const Widget*);
    1.18 +typedef WidgetDrawFunc (*WidgetLookupFunc)(const char*);
    1.19  
    1.20  void add_theme_path(const char *path);
    1.21  void default_draw_func(const Widget *w);
    1.22  
    1.23 -struct ThemeImpl;
    1.24 +void register_theme(const char *name, Theme *theme);
    1.25 +Theme *get_theme(const char *name);
    1.26  
    1.27  class Theme {
    1.28  private:
    1.29 @@ -37,6 +42,7 @@
    1.30  
    1.31  public:
    1.32  	Theme();
    1.33 +	Theme(const char *name, WidgetLookupFunc func);
    1.34  	~Theme();
    1.35  
    1.36  	bool load(const char *name);