00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __KIconLoader_h_Included__
00013 #define __KIconLoader_h_Included__
00014
00015 #include <qstring.h>
00016 #include <qpixmap.h>
00017 #include <qiconset.h>
00018
00019
00020 #ifdef Status
00021 #define KIconLoaderXStatus Status
00022 #undef Status
00023 #endif
00024 #include <qmovie.h>
00025 #ifdef KIconLoaderXStatus
00026 #define Status int
00027 #undef KIconLoaderXStatus
00028 #endif
00029
00030 #include <kglobal.h>
00031 #include <kinstance.h>
00032 #include <kicontheme.h>
00033
00034 struct KIconGroup;
00035 class KIconThemeNode;
00036 class KConfig;
00037 struct KIconLoaderPrivate;
00038 class KStandardDirs;
00039 class KIconEffect;
00040
00041
00077 class KDECORE_EXPORT KIconLoader
00078 {
00079 public:
00080
00095 KIconLoader(const QString& appname=QString::null, KStandardDirs *dirs = 0);
00096
00100 ~KIconLoader();
00101
00106 void addAppDir(const QString& appname);
00107
00129 QPixmap loadIcon(const QString& name, KIcon::Group group, int size=0,
00130 int state=KIcon::DefaultState, QString *path_store=0L,
00131 bool canReturnNull=false) const;
00132
00151 QIconSet loadIconSet(const QString& name, KIcon::Group group, int size,
00152 bool canReturnNull, bool immediateExistenceCheck);
00153
00154
00171 QIconSet loadIconSet(const QString& name, KIcon::Group group, int size,
00172 bool canReturnNull);
00173
00174
00186 QIconSet loadIconSet(const QString& name, KIcon::Group group, int size=0);
00187
00202 QString iconPath(const QString& name, int group_or_size,
00203 bool canReturnNull=false) const;
00204
00213 QMovie loadMovie(const QString& name, KIcon::Group group, int size=0) const;
00214
00224 QString moviePath(const QString& name, KIcon::Group group, int size=0) const;
00225
00236 QStringList loadAnimated(const QString& name, KIcon::Group group, int size=0) const;
00237
00248 QStringList queryIcons(int group_or_size, KIcon::Context context=KIcon::Any) const;
00249
00261 QStringList queryIconsByContext(int group_or_size,
00262 KIcon::Context context=KIcon::Any) const;
00263
00267 bool hasContext( KIcon::Context context ) const;
00268
00276 QStringList queryIconsByDir( const QString& iconsDir ) const;
00277
00283 int currentSize(KIcon::Group group) const;
00284
00290 KIconTheme *theme() const;
00291
00296 KIconEffect *iconEffect() const;
00297
00304 void reconfigure( const QString& _appname, KStandardDirs *_dirs );
00305
00311 static QPixmap unknown();
00312
00320 bool alphaBlending( KIcon::Group group ) const;
00321
00327 void addExtraDesktopThemes();
00328
00334 bool extraDesktopThemesAdded() const;
00335
00355 void enableDelayedIconSetLoading( bool enable );
00356
00364 bool isDelayedIconSetLoadingEnabled() const;
00365
00366
00367 private:
00371 void init( const QString& _appname, KStandardDirs *_dirs );
00372
00378 KIcon findMatchingIcon(const QString& name, int size) const;
00379
00384 QImage *loadOverlay(const QString& name, int size) const;
00385
00390 void addAppThemes(const QString& appname);
00391
00397 void addBaseThemes(KIconThemeNode *node, const QString &appname);
00398
00404 QString unknownIconPath( int size ) const;
00405
00421 QString removeIconExtension(const QString &name) const;
00422
00432 QString removeIconExtensionInternal(const QString &name) const;
00433
00437 QIconSet loadIconSetNonDelayed( const QString& name, KIcon::Group group,
00438 int size, bool canReturnNull );
00439
00440
00441 KIconLoaderPrivate *d;
00442 };
00443
00448 KDECORE_EXPORT QPixmap DesktopIcon(const QString& name, int size=0,
00449 int state=KIcon::DefaultState,
00450 KInstance *instance=KGlobal::instance());
00451
00456 KDECORE_EXPORT QPixmap DesktopIcon(const QString& name, KInstance *instance);
00457
00462 KDECORE_EXPORT QIconSet DesktopIconSet(const QString& name, int size=0,
00463 KInstance *instance=KGlobal::instance());
00464
00469 KDECORE_EXPORT QPixmap BarIcon(const QString& name, int size=0, int state=KIcon::DefaultState,
00470 KInstance *instance=KGlobal::instance());
00471
00476 KDECORE_EXPORT QPixmap BarIcon(const QString& name, KInstance *instance);
00477
00482 KDECORE_EXPORT QIconSet BarIconSet(const QString& name, int size=0,
00483 KInstance *instance=KGlobal::instance());
00484
00489 KDECORE_EXPORT QPixmap SmallIcon(const QString& name, int size=0,
00490 int state=KIcon::DefaultState,
00491 KInstance *instance=KGlobal::instance());
00492
00497 KDECORE_EXPORT QPixmap SmallIcon(const QString& name, KInstance *instance);
00498
00503 KDECORE_EXPORT QIconSet SmallIconSet(const QString& name, int size=0,
00504 KInstance *instance=KGlobal::instance());
00505
00510 KDECORE_EXPORT QPixmap MainBarIcon(const QString& name, int size=0,
00511 int state=KIcon::DefaultState,
00512 KInstance *instance=KGlobal::instance());
00513
00518 KDECORE_EXPORT QPixmap MainBarIcon(const QString& name, KInstance *instance);
00519
00524 KDECORE_EXPORT QIconSet MainBarIconSet(const QString& name, int size=0,
00525 KInstance *instance=KGlobal::instance());
00526
00531 KDECORE_EXPORT QPixmap UserIcon(const QString& name, int state=KIcon::DefaultState,
00532 KInstance *instance=KGlobal::instance());
00533
00538 KDECORE_EXPORT QPixmap UserIcon(const QString& name, KInstance *instance);
00539
00544 KDECORE_EXPORT QIconSet UserIconSet(const QString& name,
00545 KInstance *instance=KGlobal::instance());
00546
00551 KDECORE_EXPORT int IconSize(KIcon::Group group, KInstance *instance=KGlobal::instance());
00552
00553 #endif // __KIconLoader_h_Included__