kdecore Library API Documentation

kicontheme.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: kicontheme.h,v 1.26.2.1 2003/09/21 20:10:28 mcamen 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 };
00094 
00098     enum States { DefaultState, 
00099                   ActiveState,  
00100                   DisabledState, 
00101                   LastState      
00102     };
00103 
00109     enum Overlays { 
00110       LockOverlay=0x100, 
00111       ZipOverlay=0x200,  
00112       LinkOverlay=0x400, 
00113       HiddenOverlay=0x800, 
00114       ShareOverlay=0x1000, 
00115       OverlayMask = ~0xff 
00116     };
00117 
00121     int size;
00122 
00126     Context context;
00127 
00131     Type type;
00132 
00136     int threshold;
00137 
00141     QString path;
00142 
00143 private:
00144     KIconPrivate *d;
00145 };
00146 
00147 inline KIcon::Group& operator++(KIcon::Group& group) { group = static_cast<KIcon::Group>(group+1); return group; }
00148 inline KIcon::Group operator++(KIcon::Group& group,int) { KIcon::Group ret = group; ++group; return ret; }
00149 
00155 class KIconTheme
00156 {
00157 public:
00164     KIconTheme(const QString& name, const QString& appName=QString::null);
00165     ~KIconTheme();
00166 
00171     QString name() const { return mName; }
00172 
00178     QString description() const { return mDesc; }
00179 
00185     QString example() const;
00186 
00191     QString screenshot() const;
00192 
00197     QString linkOverlay() const;
00198 
00203     QString zipOverlay() const;
00204 
00209     QString lockOverlay() const;
00210 
00216     QString shareOverlay () const;
00217 
00222     QString dir() const { return mDir; }
00223 
00228     QStringList inherits() const { return mInherits; }
00229 
00234     bool isValid() const;
00235 
00241     bool isHidden() const;
00242 
00248     int depth() const { return mDepth; }
00249 
00255     int defaultSize(KIcon::Group group) const;
00256 
00262     QValueList<int> querySizes(KIcon::Group group) const;
00263 
00270     QStringList queryIcons(int size, KIcon::Context context = KIcon::Any) const;
00271 
00278     QStringList queryIconsByContext(int size, KIcon::Context context = KIcon::Any) const;
00279 
00280 
00291     KIcon iconPath(const QString& name, int size, KIcon::MatchType match) const;
00292 
00297     static QStringList list();
00298 
00303     static QString current();
00304 
00308     static void reconfigure();
00309 
00315     static QString defaultThemeName();
00316 
00317 private:
00318     int mDefSize[8];
00319     QValueList<int> mSizes[8];
00320 
00321     int mDepth;
00322     QString mDir, mName, mDesc;
00323     QStringList mInherits;
00324     QPtrList<KIconThemeDir> mDirs;
00325     KIconThemePrivate *d;
00326 
00327     static QString *_theme;
00328     static QStringList *_theme_list;
00329 };
00330 
00331 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:34 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001