kdecore Library API Documentation

kicontheme.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: kicontheme.h,v 1.31 2004/05/31 17:18:02 montanaro 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 
00022 class KConfig;
00023 class KIconThemeDir;
00024 
00025 class KIconThemePrivate;
00026 
00027 class KIconPrivate;
00028 
00036 class KIcon
00037 {
00038 public:
00039     KIcon() { size = 0; }
00040 
00044     bool isValid() const { return size != 0; }
00045 
00049     enum Context {
00050       Any, 
00051       Action, 
00052       Application, 
00053       Device, 
00054       FileSystem, 
00055       MimeType 
00056     };
00057 
00061     enum Type {
00062       Fixed, 
00063       Scalable, 
00064       Threshold 
00065     };
00066 
00070     enum MatchType {
00071       MatchExact, 
00072       MatchBest   
00073 
00074     };
00075 
00076     // if you add a group here, make sure to change the config reading in
00077     // KIconLoader too
00081     enum Group { NoGroup=-1, Desktop=0, FirstGroup=0, Toolbar,
00082         MainToolbar, Small, Panel, LastGroup, User };
00083 
00087     enum StdSizes {
00089         SizeSmall=16,
00091         SizeSmallMedium=22,
00093         SizeMedium=32,
00095         SizeLarge=48,
00097         SizeHuge=64,
00099         SizeEnormous=128
00100          };
00101 
00105     enum States { DefaultState, 
00106           ActiveState,  
00107           DisabledState, 
00108           LastState      
00109     };
00110 
00116     enum Overlays {
00117       LockOverlay=0x100, 
00118       ZipOverlay=0x200,  
00119       LinkOverlay=0x400, 
00120       HiddenOverlay=0x800, 
00121       ShareOverlay=0x1000, 
00122       OverlayMask = ~0xff
00123     };
00124 
00128     int size;
00129 
00133     Context context;
00134 
00138     Type type;
00139 
00143     int threshold;
00144 
00148     QString path;
00149 
00150 private:
00151     KIconPrivate *d;
00152 };
00153 
00154 inline KIcon::Group& operator++(KIcon::Group& group) { group = static_cast<KIcon::Group>(group+1); return group; }
00155 inline KIcon::Group operator++(KIcon::Group& group,int) { KIcon::Group ret = group; ++group; return ret; }
00156 
00162 class KIconTheme
00163 {
00164 public:
00171     KIconTheme(const QString& name, const QString& appName=QString::null);
00172     ~KIconTheme();
00173 
00178     QString name() const { return mName; }
00179 
00185     QString description() const { return mDesc; }
00186 
00192     QString example() const;
00193 
00198     QString screenshot() const;
00199 
00204     QString linkOverlay() const;
00205 
00210     QString zipOverlay() const;
00211 
00216     QString lockOverlay() const;
00217 
00223     QString shareOverlay () const;
00224 
00229     QString dir() const { return mDir; }
00230 
00235     QStringList inherits() const { return mInherits; }
00236 
00241     bool isValid() const;
00242 
00248     bool isHidden() const;
00249 
00255     int depth() const { return mDepth; }
00256 
00262     int defaultSize(KIcon::Group group) const;
00263 
00269     QValueList<int> querySizes(KIcon::Group group) const;
00270 
00277     QStringList queryIcons(int size, KIcon::Context context = KIcon::Any) const;
00278 
00285     QStringList queryIconsByContext(int size, KIcon::Context context = KIcon::Any) const;
00286 
00287 
00298     KIcon iconPath(const QString& name, int size, KIcon::MatchType match) const;
00299 
00304     static QStringList list();
00305 
00310     static QString current();
00311 
00315     static void reconfigure();
00316 
00322     static QString defaultThemeName();
00323 
00324 private:
00325     int mDefSize[8];
00326     QValueList<int> mSizes[8];
00327 
00328     int mDepth;
00329     QString mDir, mName, mDesc;
00330     QStringList mInherits;
00331     QPtrList<KIconThemeDir> mDirs;
00332     KIconThemePrivate *d;
00333 
00334     static QString *_theme;
00335     static QStringList *_theme_list;
00336 };
00337 
00338 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Jan 15 13:32:28 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003