kicontheme.h
00001 /* vi: ts=8 sts=4 sw=4 00002 * 00003 * This file is part of the KDE project, module tdecore. 00004 * Copyright (C) 2000 Geert Jansen <jansen@kde.org> 00005 * Antonio Larrosa <larrosa@kde.org> 00006 * 00007 * This is free software; it comes under the GNU Library General 00008 * Public License, version 2. See the file "COPYING.LIB" for the 00009 * exact licensing terms. 00010 * 00011 */ 00012 00013 #ifndef __TDEIconTheme_h_Included__ 00014 #define __TDEIconTheme_h_Included__ 00015 00016 #include <tqstring.h> 00017 #include <tqstringlist.h> 00018 #include <tqptrlist.h> 00019 #include <tqvaluelist.h> 00020 #include "tdelibs_export.h" 00021 00022 class TDEConfig; 00023 class TDEIconThemeDir; 00024 00025 class TDEIconThemePrivate; 00026 00027 class TDEIconPrivate; 00028 00036 class TDECORE_EXPORT TDEIcon 00037 { 00038 public: 00039 TDEIcon() { 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 Animation, 00057 Category, 00058 Emblem, 00059 Emote, 00060 International, 00061 Place, 00062 StatusIcon 00063 }; 00064 00068 enum Type { 00069 Fixed, 00070 Scalable, 00071 Threshold 00072 }; 00073 00077 enum MatchType { 00078 MatchExact, 00079 MatchBest 00080 00081 }; 00082 00083 // if you add a group here, make sure to change the config reading in 00084 // TDEIconLoader too 00088 enum Group { 00090 NoGroup=-1, 00092 Desktop=0, 00094 FirstGroup=0, 00096 Toolbar, 00098 MainToolbar, 00100 Small, 00102 Panel, 00104 LastGroup, 00106 User 00107 }; 00108 00112 enum StdSizes { 00114 SizeSmall=16, 00116 SizeSmallMedium=22, 00118 SizeMedium=32, 00120 SizeLarge=48, 00122 SizeHuge=64, 00124 SizeEnormous=128 00125 }; 00126 00130 enum States { DefaultState, 00131 ActiveState, 00132 DisabledState, 00133 LastState 00134 }; 00135 00141 enum Overlays { 00142 LockOverlay=0x100, 00143 ZipOverlay=0x200, 00144 LinkOverlay=0x400, 00145 HiddenOverlay=0x800, 00146 ShareOverlay=0x1000, 00147 OverlayMask = ~0xff 00148 }; 00149 00153 int size; 00154 00158 Context context; 00159 00163 Type type; 00164 00168 int threshold; 00169 00173 TQString path; 00174 00175 private: 00176 TDEIconPrivate *d; 00177 }; 00178 00179 inline TDEIcon::Group& operator++(TDEIcon::Group& group) { group = static_cast<TDEIcon::Group>(group+1); return group; } 00180 inline TDEIcon::Group operator++(TDEIcon::Group& group,int) { TDEIcon::Group ret = group; ++group; return ret; } 00181 00187 class TDECORE_EXPORT TDEIconTheme 00188 { 00189 public: 00196 TDEIconTheme(const TQString& name, const TQString& appName=TQString::null); 00197 ~TDEIconTheme(); 00198 00203 TQString name() const { return mName; } 00204 00210 TQString description() const { return mDesc; } 00211 00217 TQString example() const; 00218 00223 TQString screenshot() const; 00224 00229 TQString linkOverlay() const; 00230 00235 TQString zipOverlay() const; 00236 00241 TQString lockOverlay() const; 00242 00248 TQString shareOverlay () const; 00249 00254 TQString dir() const { return mDir; } 00255 00260 TQStringList inherits() const { return mInherits; } 00261 00266 bool isValid() const; 00267 00273 bool isHidden() const; 00274 00280 int depth() const { return mDepth; } 00281 00287 int defaultSize(TDEIcon::Group group) const; 00288 00294 TQValueList<int> querySizes(TDEIcon::Group group) const; 00295 00302 TQStringList queryIcons(int size, TDEIcon::Context context = TDEIcon::Any) const; 00303 00310 TQStringList queryIconsByContext(int size, TDEIcon::Context context = TDEIcon::Any) const; 00311 00312 00323 TDEIcon iconPath(const TQString& name, int size, TDEIcon::MatchType match) const; 00324 00329 bool hasContext( TDEIcon::Context context ) const; 00330 00335 static TQStringList list(); 00336 00341 static TQString current(); 00342 00346 static void reconfigure(); 00347 00353 static TQString defaultThemeName(); 00354 00355 private: 00356 int mDefSize[8]; 00357 TQValueList<int> mSizes[8]; 00358 00359 int mDepth; 00360 TQString mDir, mName, mDesc; 00361 TQStringList mInherits; 00362 TQPtrList<TDEIconThemeDir> mDirs; 00363 TDEIconThemePrivate *d; 00364 00365 static TQString *_theme; 00366 static TQStringList *_theme_list; 00367 }; 00368 00369 #endif