initial commit
[ld42_outofspace] / src / goatkit / theme.h
1 /*
2 GoatKit - a themable/animated widget toolkit for games
3 Copyright (C) 2014-2018 John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef GOATKIT_THEME_H_
19 #define GOATKIT_THEME_H_
20
21 #define GOATKIT_BUILTIN_THEME(n, f)     \
22         static goatkit::Theme goatkit_theme##__LINE__(n, f)
23
24 namespace goatkit {
25
26 class Widget;
27 class Theme;
28 struct ThemeImpl;
29
30 typedef void (*WidgetDrawFunc)(const Widget*);
31 typedef WidgetDrawFunc (*WidgetLookupFunc)(const char*);
32
33 void add_theme_path(const char *path);
34 void default_draw_func(const Widget *w);
35
36 void register_theme(const char *name, Theme *theme);
37 Theme *get_theme(const char *name);
38
39 class Theme {
40 private:
41         ThemeImpl *impl;
42
43 public:
44         Theme();
45         Theme(const char *name, WidgetLookupFunc func);
46         ~Theme();
47
48         bool load(const char *name);
49         void unload();
50
51         WidgetDrawFunc get_draw_func(const char *type) const;
52 };
53
54 extern Theme *theme;    // the current theme
55
56 }       // namespace goatkit
57
58 #endif  // GOATKIT_THEME_H_