IconLoader.h
/*
* $Id: IconLoader.h 3441 2012-11-01 20:40:30Z karijes $
*
* Icon loader via IconTheme
* Copyright (c) 2009 edelib authors
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __EDELIB_ICONLOADER_H__
#define __EDELIB_ICONLOADER_H__
#include "IconTheme.h"
class Fl_Shared_Image;
class Fl_Widget;
EDELIB_NS_BEGIN
struct IconLoaderItem;
enum IconLoaderOptions {
ICON_LOADER_OPTION_NO_ABSOLUTE_PATH = (1 << 1),
ICON_LOADER_OPTION_NO_WIDGET_REDRAW = (1 << 2),
ICON_LOADER_OPTION_NO_ICON_SCALE = (1 << 3)
};
class EDELIB_API IconLoader {
private:
static IconLoader* pinstance;
list<IconLoaderItem*> items;
IconTheme* curr_theme;
IconLoader();
~IconLoader();
IconLoader(const IconLoader&);
IconLoader& operator=(const IconLoader&);
void clear_items(void);
public:
#ifndef SKIP_DOCS
const char* get_icon_path(const char* name, IconSizes sz, IconContext ctx);
Fl_Shared_Image* get_icon(const char* name, IconSizes sz, IconContext ctx, unsigned long options);
bool set_icon(const char* name, Fl_Widget* widget, IconSizes sz, IconContext ctx, unsigned long options);
void load_theme(const char* name);
void reload_icons(void);
void repoll_icons(void);
const IconTheme* current_theme(void) const { return curr_theme; }
static IconLoader* instance();
#endif
static void init(const char* theme);
static void init(void) { IconLoader::init(IconTheme::default_theme_name()); }
static void shutdown(void);
static bool inited(void);
static void reload(const char* theme);
static void repoll(void);
static Fl_Shared_Image* get(const char* name, IconSizes sz, IconContext ctx = ICON_CONTEXT_ANY,
unsigned long options = 0);
static String get_path(const char* name, IconSizes sz, IconContext ctx = ICON_CONTEXT_ANY);
static bool set(Fl_Widget* widget, const char* name, IconSizes sz, IconContext ctx = ICON_CONTEXT_ANY,
unsigned long options = 0);
static const IconTheme* theme(void);
static void set_fallback_icon(const char* name);
static const char* get_fallback_icon(void);
static const char** get_builtin_xpm_icon(IconSizes sz);
};
EDELIB_NS_END
#endif
edelib::list< IconLoaderItem * >
edelib::IconLoader
Loads icons with IconTheme.
Definition: IconLoader.h:84
edelib::IconLoader::init
static void init(void)
Definition: IconLoader.h:119
edelib::IconSizes
IconSizes
Icon sizes to look for.
Definition: IconTheme.h:33
edelib::ICON_LOADER_OPTION_NO_ICON_SCALE
do not scale icon
Definition: IconLoader.h:42
edelib::ICON_CONTEXT_ANY
Can be any icon context.
Definition: IconTheme.h:47
edelib::IconLoaderOptions
IconLoaderOptions
Settable options for IconLoader functions.
Definition: IconLoader.h:39
edelib::String
A (relatively simple) string implementation.
Definition: String.h:82
edelib::IconContext
IconContext
Icon types to look for.
Definition: IconTheme.h:46
edelib::IconTheme
Finds named icon according to the given theme.
Definition: IconTheme.h:80
edelib::ICON_LOADER_OPTION_NO_ABSOLUTE_PATH
do not see given the path as absolute icon path
Definition: IconLoader.h:40