kdecore Library API Documentation

kicontheme.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: kicontheme.h,v 1.29 2003/11/02 14:50:34 carewolf 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         SizeMedium=32,
00093         SizeLarge=48,
00095         SizeHuge=64
00096          };
00097 
00101     enum States { DefaultState, 
00102           ActiveState,  
00103           DisabledState, 
00104           LastState      
00105     };
00106 
00112     enum Overlays {
00113       LockOverlay=0x100, 
00114       ZipOverlay=0x200,  
00115       LinkOverlay=0x400, 
00116       HiddenOverlay=0x800, 
00117       ShareOverlay=0x1000, 
00118       OverlayMask = ~0xff
00119     };
00120 
00124     int size;
00125 
00129     Context context;
00130 
00134     Type type;
00135 
00139     int threshold;
00140 
00144     QString path;
00145 
00146 private:
00147     KIconPrivate *d;
00148 };
00149 
00150 inline KIcon::Group& operator++(KIcon::Group& group) { group = static_cast<KIcon::Group>(group+1); return group; }
00151 inline KIcon::Group operator++(KIcon::Group& group,int) { KIcon::Group ret = group; ++group; return ret; }
00152 
00158 class KIconTheme
00159 {
00160 public:
00167     KIconTheme(const QString& name, const QString& appName=QString::null);
00168     ~KIconTheme();
00169 
00174     QString name() const { return mName; }
00175 
00181     QString description() const { return mDesc; }
00182 
00188     QString example() const;
00189 
00194     QString screenshot() const;
00195 
00200     QString linkOverlay() const;
00201 
00206     QString zipOverlay() const;
00207 
00212     QString lockOverlay() const;
00213 
00219     QString shareOverlay () const;
00220 
00225     QString dir() const { return mDir; }
00226 
00231     QStringList inherits() const { return mInherits; }
00232 
00237     bool isValid() const;
00238 
00244     bool isHidden() const;
00245 
00251     int depth() const { return mDepth; }
00252 
00258     int defaultSize(KIcon::Group group) const;
00259 
00265     QValueList<int> querySizes(KIcon::Group group) const;
00266 
00273     QStringList queryIcons(int size, KIcon::Context context = KIcon::Any) const;
00274 
00281     QStringList queryIconsByContext(int size, KIcon::Context context = KIcon::Any) const;
00282 
00283 
00294     KIcon iconPath(const QString& name, int size, KIcon::MatchType match) const;
00295 
00300     static QStringList list();
00301 
00306     static QString current();
00307 
00311     static void reconfigure();
00312 
00318     static QString defaultThemeName();
00319 
00320 private:
00321     int mDefSize[8];
00322     QValueList<int> mSizes[8];
00323 
00324     int mDepth;
00325     QString mDir, mName, mDesc;
00326     QStringList mInherits;
00327     QPtrList<KIconThemeDir> mDirs;
00328     KIconThemePrivate *d;
00329 
00330     static QString *_theme;
00331     static QStringList *_theme_list;
00332 };
00333 
00334 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:19:39 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003