| 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 | #ifndef QTICOHANDLER_H |
| 4 | #define QTICOHANDLER_H |
| 5 | |
| 6 | #include <QtGui/QImageIOHandler> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | class ICOReader; |
| 11 | class QtIcoHandler: public QImageIOHandler |
| 12 | { |
| 13 | public: |
| 14 | QtIcoHandler(QIODevice *device); |
| 15 | virtual ~QtIcoHandler(); |
| 16 | |
| 17 | bool canRead() const override; |
| 18 | bool read(QImage *image) override; |
| 19 | bool write(const QImage &image) override; |
| 20 | |
| 21 | int imageCount() const override; |
| 22 | bool jumpToImage(int imageNumber) override; |
| 23 | bool jumpToNextImage() override; |
| 24 | |
| 25 | static bool canRead(QIODevice *device); |
| 26 | |
| 27 | bool supportsOption(ImageOption option) const override; |
| 28 | QVariant option(ImageOption option) const override; |
| 29 | |
| 30 | private: |
| 31 | int m_currentIconIndex; |
| 32 | ICOReader *m_pICOReader; |
| 33 | mutable bool knownCanRead = false; |
| 34 | }; |
| 35 | |
| 36 | QT_END_NAMESPACE |
| 37 | |
| 38 | #endif /* QTICOHANDLER_H */ |
| 39 | |
| 40 | |