istereo2

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