edelib  2.1.0
Theme.h
1 /*
2  * $Id: Theme.h 3441 2012-11-01 20:40:30Z karijes $
3  *
4  * Theming stuff
5  * Copyright (c) 2009 edelib authors
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __EDELIB_THEME_H__
22 #define __EDELIB_THEME_H__
23 
24 #include "edelib-global.h"
25 
26 /* make it visible outside namespace */
27 struct scheme;
28 
29 EDELIB_NS_BEGIN
30 struct Theme_P;
31 
32 #ifndef SKIP_DOCS
33 typedef void (*ThemeErrorHandler)(const char *str, void *data);
34 #endif
35 
48 class EDELIB_API Theme {
49 private:
50  Theme_P *priv;
52 
53  /* safe to be called multiple times */
54  void init_interpreter(void);
55 public:
60  Theme(const char *msg_domain = "edelib");
61 
63  ~Theme();
64 
68  bool load(const char *f);
69 
73  void clear(void);
74 
78  bool loaded(void) const;
79 
85  void set_error_handler(ThemeErrorHandler func, void *data = 0);
86 
88  void *error_handler_data(void) const;
89 
91  ThemeErrorHandler error_handler(void) const;
92 
99  void prompt(void);
100 
105  bool get_item(const char *style_name, const char *item_name, char *ret, unsigned int sz);
106 
112  bool get_item(const char *style_name, const char *item_name, long &ret, long fallback = 0);
113 
115  const char *author(void) const;
116 
118  const char *name(void) const;
119 
121  const char *sample_image(void) const;
122 
127  scheme* get_interpreter(void);
128 };
129 
130 EDELIB_NS_END
131 #endif
#define E_DISABLE_CLASS_COPY(klass)
Definition: edelib-global.h:161
Theming engine for widgets.
Definition: Theme.h:48