00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __EDELIB_ICONLOADER_H__
00022 #define __EDELIB_ICONLOADER_H__
00023
00024 #include "IconTheme.h"
00025
00026 class Fl_Shared_Image;
00027 class Fl_Widget;
00028
00029 EDELIB_NS_BEGIN
00030
00031 class IconLoaderItem;
00032
00039 enum IconLoaderOptions {
00040 ICON_LOADER_OPTION_NO_ABSOLUTE_PATH = (1 << 1),
00041 ICON_LOADER_OPTION_NO_WIDGET_REDRAW = (1 << 2),
00042 ICON_LOADER_OPTION_NO_ICON_SCALE = (1 << 3)
00043 };
00044
00084 class IconLoader {
00085 private:
00086 static IconLoader* pinstance;
00087
00088 list<IconLoaderItem*> items;
00089 IconTheme* curr_theme;
00090
00091 IconLoader();
00092 ~IconLoader();
00093 IconLoader(const IconLoader&);
00094 IconLoader& operator=(const IconLoader&);
00095
00096 void clear_items(void);
00097 public:
00098 #ifndef SKIP_DOCS
00099 const char* get_icon_path(const char* name, IconSizes sz, IconContext ctx);
00100 Fl_Shared_Image* get_icon(const char* name, IconSizes sz, IconContext ctx, unsigned long options);
00101 bool set_icon(const char* name, Fl_Widget* widget, IconSizes sz, IconContext ctx, unsigned long options);
00102 void load_theme(const char* name);
00103 void reload_icons(void);
00104 void repoll_icons(void);
00105 const IconTheme* current_theme(void) const { return curr_theme; }
00106
00107 static IconLoader* instance();
00108 #endif
00109
00114 static void init(const char* theme);
00115
00119 static void init(void) { IconLoader::init(IconTheme::default_theme_name()); }
00120
00124 static void shutdown(void);
00125
00129 static bool inited(void);
00130
00140 static void reload(const char* theme);
00141
00151 static void repoll(void);
00152
00166 static Fl_Shared_Image* get(const char* name, IconSizes sz, IconContext ctx = ICON_CONTEXT_ANY,
00167 unsigned long options = 0);
00168
00172 static String get_path(const char* name, IconSizes sz, IconContext ctx = ICON_CONTEXT_ANY);
00173
00186 static bool set(Fl_Widget* widget, const char* name, IconSizes sz, IconContext ctx = ICON_CONTEXT_ANY,
00187 unsigned long options = 0);
00188
00192 static const IconTheme* theme(void);
00193
00200 static void set_fallback_icon(const char* name);
00201
00205 static const char* get_fallback_icon(void);
00206
00211 static const char** get_builtin_xpm_icon(IconSizes sz);
00212 };
00213
00214 EDELIB_NS_END
00215 #endif