KDEUI
kiconloader.h
Go to the documentation of this file.
00001 /* vi: ts=8 sts=4 sw=4 00002 * 00003 * This file is part of the KDE project, module kdecore. 00004 * Copyright (C) 2000 Geert Jansen <jansen@kde.org> 00005 * Antonio Larrosa <larrosa@kde.org> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License version 2 as published by the Free Software Foundation. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KICONLOADER_H 00023 #define KICONLOADER_H 00024 00025 #include <QtCore/QString> 00026 #include <QtCore/QStringList> 00027 #include <QtCore/QObject> 00028 00029 #include <kglobal.h> 00030 #include <kdeui_export.h> 00031 00032 class QIcon; 00033 class QMovie; 00034 class QPixmap; 00035 00036 class KComponentData; 00037 class KIconLoaderPrivate; 00038 class KStandardDirs; 00039 class KIconEffect; 00040 class KIconTheme; 00041 00077 class KDEUI_EXPORT KIconLoader : public QObject 00078 { 00079 Q_OBJECT 00080 Q_ENUMS(Context) 00081 Q_ENUMS(Type) 00082 Q_ENUMS(MatchType) 00083 Q_ENUMS(Group) 00084 Q_ENUMS(StdSizes) 00085 Q_ENUMS(States) 00086 00087 public: 00091 enum Context { 00092 Any, 00093 Action, 00094 Application, 00095 Device, 00096 FileSystem, 00097 MimeType, 00098 Animation, 00099 Category, 00100 Emblem, 00101 Emote, 00102 International, 00103 Place, 00104 StatusIcon 00105 }; 00106 00110 enum Type { 00111 Fixed, 00112 Scalable, 00113 Threshold 00114 }; 00115 00119 enum MatchType { 00120 MatchExact, 00121 MatchBest 00122 }; 00123 00127 enum Group { 00129 NoGroup=-1, 00131 Desktop=0, 00133 FirstGroup=0, 00135 Toolbar, 00137 MainToolbar, 00139 Small, 00141 Panel, 00143 Dialog, 00145 LastGroup, 00147 User 00148 }; 00149 00153 enum StdSizes { 00155 SizeSmall=16, 00157 SizeSmallMedium=22, 00159 SizeMedium=32, 00161 SizeLarge=48, 00163 SizeHuge=64, 00165 SizeEnormous=128 00166 }; 00167 00171 enum States { 00172 DefaultState, 00173 ActiveState, 00174 DisabledState, 00175 LastState 00176 }; 00177 00190 explicit KIconLoader(const QString& appname=QString(), KStandardDirs *dirs = 0, QObject* parent = 0); 00191 00201 explicit KIconLoader(const KComponentData &componentData, QObject* parent = 0); 00202 00206 ~KIconLoader(); 00207 00212 static KIconLoader* global(); 00213 00218 void addAppDir(const QString& appname); 00219 00249 QPixmap loadIcon(const QString& name, KIconLoader::Group group, int size=0, 00250 int state=KIconLoader::DefaultState, const QStringList &overlays = QStringList(), 00251 QString *path_store=0L, 00252 bool canReturnNull=false) const; 00253 00273 QPixmap loadMimeTypeIcon( const QString& iconName, KIconLoader::Group group, int size=0, 00274 int state=KIconLoader::DefaultState, const QStringList &overlays = QStringList(), 00275 QString *path_store=0 ) const; 00276 00294 #ifndef KDE_NO_DEPRECATED 00295 KDE_DEPRECATED QIcon loadIconSet(const QString& name, KIconLoader::Group group, int size = 0, 00296 bool canReturnNull = false); 00297 #endif 00298 00313 QString iconPath(const QString& name, int group_or_size, 00314 bool canReturnNull=false) const; 00315 00326 QMovie *loadMovie(const QString& name, KIconLoader::Group group, int size=0, QObject *parent=0) const; 00327 00337 QString moviePath(const QString& name, KIconLoader::Group group, int size=0) const; 00338 00349 QStringList loadAnimated(const QString& name, KIconLoader::Group group, int size=0) const; 00350 00361 QStringList queryIcons(int group_or_size, KIconLoader::Context context=KIconLoader::Any) const; 00362 00374 QStringList queryIconsByContext(int group_or_size, 00375 KIconLoader::Context context=KIconLoader::Any) const; 00376 00380 bool hasContext( KIconLoader::Context context ) const; 00381 00388 QStringList queryIconsByDir( const QString& iconsDir ) const; 00389 00395 int currentSize(KIconLoader::Group group) const; 00396 00404 KIconTheme *theme() const; 00405 00410 KIconEffect *iconEffect() const; 00411 00418 void reconfigure( const QString& _appname, KStandardDirs *_dirs ); 00419 00425 static QPixmap unknown(); 00426 00434 bool alphaBlending( KIconLoader::Group group ) const; 00435 00440 void addExtraDesktopThemes(); 00441 00446 bool extraDesktopThemesAdded() const; 00447 00448 public Q_SLOTS: 00452 void newIconLoader(); 00453 00454 Q_SIGNALS: 00458 void iconLoaderSettingsChanged(); 00459 00460 private: 00461 // @internal the data object 00462 KIconLoaderPrivate *d; 00463 }; 00464 00469 KDEUI_EXPORT QPixmap DesktopIcon(const QString& name, int size=0, 00470 int state=KIconLoader::DefaultState, const QStringList& overlays = QStringList()); 00471 00477 #ifndef KDE_NO_DEPRECATED 00478 KDEUI_EXPORT_DEPRECATED QIcon DesktopIconSet(const QString& name, int size=0); 00479 #endif 00480 00485 KDEUI_EXPORT QPixmap BarIcon(const QString& name, int size=0, int state=KIconLoader::DefaultState, 00486 const QStringList& overlays = QStringList()); 00487 00493 #ifndef KDE_NO_DEPRECATED 00494 KDEUI_EXPORT_DEPRECATED QIcon BarIconSet(const QString& name, int size=0); 00495 #endif 00496 00501 KDEUI_EXPORT QPixmap SmallIcon(const QString& name, int size=0, 00502 int state=KIconLoader::DefaultState, const QStringList &overlays = QStringList()); 00503 00509 #ifndef KDE_NO_DEPRECATED 00510 KDEUI_EXPORT_DEPRECATED QIcon SmallIconSet(const QString& name, int size=0); 00511 #endif 00512 00517 KDEUI_EXPORT QPixmap MainBarIcon(const QString& name, int size=0, 00518 int state=KIconLoader::DefaultState, const QStringList &overlays = QStringList()); 00519 00525 #ifndef KDE_NO_DEPRECATED 00526 KDEUI_EXPORT_DEPRECATED QIcon MainBarIconSet(const QString& name, int size=0); 00527 #endif 00528 00533 KDEUI_EXPORT QPixmap UserIcon(const QString& name, int state=KIconLoader::DefaultState, const QStringList &overlays = QStringList()); 00534 00540 #ifndef KDE_NO_DEPRECATED 00541 KDEUI_EXPORT_DEPRECATED QIcon UserIconSet(const QString& name); 00542 #endif 00543 00548 KDEUI_EXPORT int IconSize(KIconLoader::Group group); 00549 00550 inline KIconLoader::Group& operator++(KIconLoader::Group& group) { group = static_cast<KIconLoader::Group>(group+1); return group; } 00551 inline KIconLoader::Group operator++(KIconLoader::Group& group,int) { KIconLoader::Group ret = group; ++group; return ret; } 00552 00553 #endif // KICONLOADER_H
KDE 4.6 API Reference