kdecore Library API Documentation

kicontheme.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: kicontheme.h,v 1.35 2004/10/28 12:54:40 howells Exp $
00004  *
00005  * This file is part of the KDE project, module kdecore.
00006  * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
00007  *                    Antonio Larrosa <larrosa@kde.org>
00008  *
00009  * This is free software; it comes under the GNU Library General
00010  * Public License, version 2. See the file "COPYING.LIB" for the
00011  * exact licensing terms.
00012  *
00013  */
00014 
00015 #ifndef __KIconTheme_h_Included__
00016 #define __KIconTheme_h_Included__
00017 
00018 #include <qstring.h>
00019 #include <qstringlist.h>
00020 #include <qptrlist.h>
00021 #include "kdelibs_export.h"
00022 
00023 class KConfig;
00024 class KIconThemeDir;
00025 
00026 class KIconThemePrivate;
00027 
00028 class KIconPrivate;
00029 
00037 class KDECORE_EXPORT KIcon
00038 {
00039 public:
00040     KIcon() { size = 0; }
00041 
00045     bool isValid() const { return size != 0; }
00046 
00050     enum Context {
00051       Any, 
00052       Action, 
00053       Application, 
00054       Device, 
00055       FileSystem, 
00056       MimeType 
00057     };
00058 
00062     enum Type {
00063       Fixed, 
00064       Scalable, 
00065       Threshold 
00066     };
00067 
00071     enum MatchType {
00072       MatchExact, 
00073       MatchBest   
00074 
00075     };
00076 
00077     // if you add a group here, make sure to change the config reading in
00078     // KIconLoader too
00082     enum Group {
00084     NoGroup=-1,
00086     Desktop=0,
00088     FirstGroup=0,
00090     Toolbar,
00092         MainToolbar,
00094     Small,
00096     Panel,
00098     LastGroup,
00100     User
00101          };
00102 
00106     enum StdSizes {
00108         SizeSmall=16,
00110         SizeSmallMedium=22,
00112         SizeMedium=32,
00114         SizeLarge=48,
00116         SizeHuge=64,
00118         SizeEnormous=128
00119          };
00120 
00124     enum States { DefaultState, 
00125           ActiveState,  
00126           DisabledState, 
00127           LastState      
00128     };
00129 
00135     enum Overlays {
00136       LockOverlay=0x100, 
00137       ZipOverlay=0x200,  
00138       LinkOverlay=0x400, 
00139       HiddenOverlay=0x800, 
00140       ShareOverlay=0x1000, 
00141       OverlayMask = ~0xff
00142     };
00143 
00147     int size;
00148 
00152     Context context;
00153 
00157     Type type;
00158 
00162     int threshold;
00163 
00167     QString path;
00168 
00169 private:
00170     KIconPrivate *d;
00171 };
00172 
00173 inline KIcon::Group& operator++(KIcon::Group& group) { group = static_cast<KIcon::Group>(group+1); return group; }
00174 inline KIcon::Group operator++(KIcon::Group& group,int) { KIcon::Group ret = group; ++group; return ret; }
00175 
00181 class KDECORE_EXPORT KIconTheme
00182 {
00183 public:
00190     KIconTheme(const QString& name, const QString& appName=QString::null);
00191     ~KIconTheme();
00192 
00197     QString name() const { return mName; }
00198 
00204     QString description() const { return mDesc; }
00205 
00211     QString example() const;
00212 
00217     QString screenshot() const;
00218 
00223     QString linkOverlay() const;
00224 
00229     QString zipOverlay() const;
00230 
00235     QString lockOverlay() const;
00236 
00242     QString shareOverlay () const;
00243 
00248     QString dir() const { return mDir; }
00249 
00254     QStringList inherits() const { return mInherits; }
00255 
00260     bool isValid() const;
00261 
00267     bool isHidden() const;
00268 
00274     int depth() const { return mDepth; }
00275 
00281     int defaultSize(KIcon::Group group) const;
00282 
00288     QValueList<int> querySizes(KIcon::Group group) const;
00289 
00296     QStringList queryIcons(int size, KIcon::Context context = KIcon::Any) const;
00297 
00304     QStringList queryIconsByContext(int size, KIcon::Context context = KIcon::Any) const;
00305 
00306 
00317     KIcon iconPath(const QString& name, int size, KIcon::MatchType match) const;
00318 
00323     static QStringList list();
00324 
00329     static QString current();
00330 
00334     static void reconfigure();
00335 
00341     static QString defaultThemeName();
00342 
00343 private:
00344     int mDefSize[8];
00345     QValueList<int> mSizes[8];
00346 
00347     int mDepth;
00348     QString mDir, mName, mDesc;
00349     QStringList mInherits;
00350     QPtrList<KIconThemeDir> mDirs;
00351     KIconThemePrivate *d;
00352 
00353     static QString *_theme;
00354     static QStringList *_theme_list;
00355 };
00356 
00357 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:09:39 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003