1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QICONENGINE_H |
5 | #define QICONENGINE_H |
6 | |
7 | #include <QtGui/qtguiglobal.h> |
8 | #include <QtCore/qlist.h> |
9 | #include <QtGui/qicon.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | |
14 | class Q_GUI_EXPORT QIconEngine |
15 | { |
16 | public: |
17 | QIconEngine(); |
18 | virtual ~QIconEngine(); |
19 | virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0; |
20 | virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); |
21 | virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); |
22 | |
23 | virtual void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state); |
24 | virtual void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state); |
25 | |
26 | virtual QString key() const; |
27 | virtual QIconEngine *clone() const = 0; |
28 | virtual bool read(QDataStream &in); |
29 | virtual bool write(QDataStream &out) const; |
30 | |
31 | virtual QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal, |
32 | QIcon::State state = QIcon::Off); |
33 | |
34 | virtual QString iconName(); |
35 | virtual bool isNull(); |
36 | virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale); |
37 | |
38 | enum IconEngineHook { IsNullHook = 3, ScaledPixmapHook }; |
39 | |
40 | struct ScaledPixmapArgument |
41 | { |
42 | QSize size; |
43 | QIcon::Mode mode; |
44 | QIcon::State state; |
45 | qreal scale; |
46 | QPixmap pixmap; |
47 | }; |
48 | |
49 | virtual void virtual_hook(int id, void *data); |
50 | |
51 | protected: |
52 | QIconEngine(const QIconEngine &other); |
53 | |
54 | private: |
55 | QIconEngine &operator=(const QIconEngine &other) = delete; |
56 | }; |
57 | |
58 | QT_END_NAMESPACE |
59 | |
60 | #endif // QICONENGINE_H |
61 | |