source: trunk/include/qiconset.h@ 138

Last change on this file since 138 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1/****************************************************************************
2** $Id: qiconset.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Definition of QIconSet class
5**
6** Created : 980318
7**
8** Copyright (C) 1992-2001 Trolltech AS. All rights reserved.
9**
10** This file is part of the kernel module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QICONSET_H
39#define QICONSET_H
40
41#ifndef QT_H
42#include "qobject.h"
43#include "qpixmap.h"
44#endif // QT_H
45
46#ifndef QT_NO_ICONSET
47
48class QIconFactory;
49class QIconSetPrivate;
50
51// ### Remove all 'virtual' functions in QIconSet (but not QIconFactory) in Qt 4.0
52class Q_EXPORT QIconSet
53{
54public:
55 // the implementation makes assumptions about the value of these
56 enum Size { Automatic, Small, Large };
57 enum Mode { Normal, Disabled, Active };
58 enum State { On, Off };
59
60 QIconSet();
61 QIconSet( const QPixmap& pixmap, Size size = Automatic );
62 QIconSet( const QPixmap& smallPix, const QPixmap& largePix );
63 QIconSet( const QIconSet& other );
64 virtual ~QIconSet();
65
66 void reset( const QPixmap& pixmap, Size size );
67
68 virtual void setPixmap( const QPixmap& pixmap, Size size,
69 Mode mode = Normal, State state = Off );
70 virtual void setPixmap( const QString& fileName, Size size,
71 Mode mode = Normal, State state = Off );
72 QPixmap pixmap( Size size, Mode mode, State state = Off ) const;
73 QPixmap pixmap( Size size, bool enabled, State state = Off ) const;
74 QPixmap pixmap() const;
75 bool isGenerated( Size size, Mode mode, State state = Off ) const;
76 void clearGenerated();
77 void installIconFactory( QIconFactory *factory );
78
79 bool isNull() const;
80
81 void detach();
82
83 QIconSet& operator=( const QIconSet& other );
84
85 // static functions
86 static void setIconSize( Size which, const QSize& size );
87 static const QSize& iconSize( Size which );
88
89#ifndef Q_QDOC
90 Q_DUMMY_COMPARISON_OPERATOR(QIconSet)
91#endif
92
93private:
94 void normalize( Size& which, const QSize& pixSize );
95 QPixmap *createScaled( Size size, const QPixmap *suppliedPix ) const;
96 QPixmap *createDisabled( Size size, State state ) const;
97
98 QIconSetPrivate *d;
99};
100
101class Q_EXPORT QIconFactory : private QShared
102{
103public:
104 QIconFactory();
105 virtual ~QIconFactory();
106
107 virtual QPixmap *createPixmap( const QIconSet& iconSet, QIconSet::Size size,
108 QIconSet::Mode mode, QIconSet::State state );
109 void setAutoDelete( bool autoDelete ) { autoDel = autoDelete; }
110 bool autoDelete() const { return autoDel; }
111
112 static QIconFactory *defaultFactory();
113 static void installDefaultFactory( QIconFactory *factory );
114
115private:
116#if defined(Q_DISABLE_COPY)
117 QIconFactory( const QIconFactory & );
118 QIconFactory &operator=( const QIconFactory & );
119#endif
120
121 friend class QIconSet;
122 friend class QIconSetPrivate;
123
124 uint autoDel : 1;
125 uint unused : 31;
126};
127
128#endif // QT_NO_ICONSET
129#endif
Note: See TracBrowser for help on using the repository browser.