edelib 2.0.0

edelib/IconTheme.h

00001 /*
00002  * $Id: IconTheme.h 2839 2009-09-28 11:36:20Z karijes $
00003  *
00004  * Icon theme
00005  * Copyright (c) 2005-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_ICONTHEME_H__
00022 #define __EDELIB_ICONTHEME_H__
00023 
00024 #include "String.h"
00025 #include "List.h"
00026 
00027 EDELIB_NS_BEGIN
00028 
00033 enum IconSizes {
00034         ICON_SIZE_TINY         = 16,   
00035         ICON_SIZE_SMALL        = 22,   
00036         ICON_SIZE_MEDIUM       = 32,   
00037         ICON_SIZE_LARGE        = 48,   
00038         ICON_SIZE_HUGE         = 64,   
00039         ICON_SIZE_ENORMOUS     = 128   
00040 };
00041 
00046 enum IconContext {
00047         ICON_CONTEXT_ANY = 0,          
00048         ICON_CONTEXT_ACTION,           
00049         ICON_CONTEXT_APPLICATION,      
00050         ICON_CONTEXT_DEVICE,           
00051         ICON_CONTEXT_FILESYSTEM,       
00052         ICON_CONTEXT_MIMETYPE,         
00053         ICON_CONTEXT_STOCK,            
00054         ICON_CONTEXT_EMBLEM,           
00055         ICON_CONTEXT_MISC              
00056 };
00057 
00058 class IconThemePrivate;
00059 
00080 class EDELIB_API IconTheme {
00081 private:
00082         IconThemePrivate* priv;
00083 
00084         void load_theme(const char* name);
00085         void read_inherits(const char* buf);
00086 
00087         E_DISABLE_CLASS_COPY(IconTheme)
00088 public:
00092         IconTheme() : priv(NULL) { }
00093 
00097         ~IconTheme() { clear(); }
00098 
00103         void load(const char* name);
00104 
00108         void clear(void);
00109 
00113         String find_icon(const char* icon, IconSizes size, IconContext context = ICON_CONTEXT_ANY);
00114 
00118         const char* theme_name(void) const;
00119 
00127         const char* stylized_theme_name(void) const;
00128 
00132         const char* description(void) const;
00133 
00138         const char* example_icon(void) const;
00139 
00143         void query_icons(list<String>& lst, IconSizes size, IconContext context = ICON_CONTEXT_ANY) const;
00144 
00148         static const char* default_theme_name(void) { return "edeneu"; }
00149 };
00150 
00151 EDELIB_NS_END
00152 #endif