edelib 2.0.0

edelib/Theme.h

00001 /*
00002  * $Id: Theme.h 3271 2012-05-07 08:25:54Z karijes $
00003  *
00004  * Theming stuff
00005  * Copyright (c) 2009 edelib authors
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef __EDELIB_THEME_H__
00022 #define __EDELIB_THEME_H__
00023 
00024 #include "edelib-global.h"
00025 
00026 /* make it visible outside namespace */
00027 struct scheme;
00028 
00029 EDELIB_NS_BEGIN
00030 class Theme_P;
00031 
00032 #ifndef SKIP_DOCS
00033 typedef void (*ThemeErrorHandler)(const char *str, void *data);
00034 #endif
00035 
00048 class Theme {
00049 private:
00050         Theme_P           *priv;
00051         E_DISABLE_CLASS_COPY(Theme)
00052 
00053         /* safe to be called multiple times */
00054         void init_interpreter(void);
00055 public:
00060         Theme(const char *msg_domain = "edelib");
00061 
00063         ~Theme();
00064 
00068         bool load(const char *f);
00069 
00073         void clear(void);
00074 
00078         bool loaded(void) const;
00079 
00085         void set_error_handler(ThemeErrorHandler func, void *data = 0);
00086 
00088         void *error_handler_data(void) const;
00089 
00091         ThemeErrorHandler error_handler(void) const;
00092 
00099         void prompt(void);
00100 
00105         bool get_item(const char *style_name, const char *item_name, char *ret, unsigned int sz);
00106 
00112         bool get_item(const char *style_name, const char *item_name, long &ret, long fallback = 0);
00113 
00115         const char *author(void) const;
00116 
00118         const char *name(void) const;
00119 
00121         const char *sample_image(void) const;
00122 
00127         scheme* get_interpreter(void);
00128 };
00129 
00130 EDELIB_NS_END
00131 #endif