Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qiconset.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QIconSet class 00005 ** 00006 ** Created : 980318 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the kernel module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QICONSET_H 00039 #define QICONSET_H 00040 00041 #ifndef QT_H 00042 #include "qobject.h" 00043 #include "qpixmap.h" 00044 #endif // QT_H 00045 00046 #ifndef QT_NO_ICONSET 00047 00048 class QIconFactory; 00049 class QIconSetPrivate; 00050 00051 // ### Remove all 'virtual' functions in QIconSet (but not QIconFactory) in Qt 4.0 00052 class Q_EXPORT QIconSet 00053 { 00054 public: 00055 // the implementation makes assumptions about the value of these 00056 enum Size { Automatic, Small, Large }; 00057 enum Mode { Normal, Disabled, Active }; 00058 enum State { On, Off }; 00059 00060 QIconSet(); 00061 QIconSet( const QPixmap& pixmap, Size size = Automatic ); 00062 QIconSet( const QPixmap& smallPix, const QPixmap& largePix ); 00063 QIconSet( const QIconSet& other ); 00064 virtual ~QIconSet(); 00065 00066 void reset( const QPixmap& pixmap, Size size ); 00067 00068 virtual void setPixmap( const QPixmap& pixmap, Size size, 00069 Mode mode = Normal, State state = Off ); 00070 virtual void setPixmap( const QString& fileName, Size size, 00071 Mode mode = Normal, State state = Off ); 00072 QPixmap pixmap( Size size, Mode mode, State state = Off ) const; 00073 QPixmap pixmap( Size size, bool enabled, State state = Off ) const; 00074 QPixmap pixmap() const; 00075 bool isGenerated( Size size, Mode mode, State state = Off ) const; 00076 void clearGenerated(); 00077 void installIconFactory( QIconFactory *factory ); 00078 00079 bool isNull() const; 00080 00081 void detach(); 00082 00083 QIconSet& operator=( const QIconSet& other ); 00084 00085 // static functions 00086 static void setIconSize( Size which, const QSize& size ); 00087 static const QSize& iconSize( Size which ); 00088 00089 #ifndef Q_QDOC 00090 Q_DUMMY_COMPARISON_OPERATOR(QIconSet) 00091 #endif 00092 00093 private: 00094 void normalize( Size& which, const QSize& pixSize ); 00095 QPixmap *createScaled( Size size, const QPixmap *suppliedPix ) const; 00096 QPixmap *createDisabled( Size size, State state ) const; 00097 00098 QIconSetPrivate *d; 00099 }; 00100 00101 class Q_EXPORT QIconFactory : private QShared 00102 { 00103 public: 00104 QIconFactory(); 00105 virtual ~QIconFactory(); 00106 00107 virtual QPixmap *createPixmap( const QIconSet& iconSet, QIconSet::Size size, 00108 QIconSet::Mode mode, QIconSet::State state ); 00109 void setAutoDelete( bool autoDelete ) { autoDel = autoDelete; } 00110 bool autoDelete() const { return autoDel; } 00111 00112 static QIconFactory *defaultFactory(); 00113 static void installDefaultFactory( QIconFactory *factory ); 00114 00115 private: 00116 #if defined(Q_DISABLE_COPY) 00117 QIconFactory( const QIconFactory & ); 00118 QIconFactory &operator=( const QIconFactory & ); 00119 #endif 00120 00121 friend class QIconSet; 00122 friend class QIconSetPrivate; 00123 00124 uint autoDel : 1; 00125 uint unused : 31; 00126 }; 00127 00128 #endif // QT_NO_ICONSET 00129 #endif