| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2009 Sebastian Trueg <trueg@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef _K_PIXMAPSEQUENCE_WIDGET_H_ |
| 8 | #define _K_PIXMAPSEQUENCE_WIDGET_H_ |
| 9 | |
| 10 | #include <QWidget> |
| 11 | #include <memory> |
| 12 | |
| 13 | #include <kwidgetsaddons_export.h> |
| 14 | |
| 15 | class KPixmapSequence; |
| 16 | |
| 17 | /*! |
| 18 | * \class KPixmapSequenceWidget |
| 19 | * \inmodule KWidgetsAddons |
| 20 | * |
| 21 | * \brief A simple widget showing a fixed size pixmap sequence. |
| 22 | * |
| 23 | * The KPixmapSequenceWidget uses the KPixmapSequenceOverlayPainter to show a |
| 24 | * sequence of pixmaps. It is intended as a simple wrapper around the |
| 25 | * KPixmapSequenceOverlayPainter in case a widget is more appropriate than |
| 26 | * an event filter. |
| 27 | * |
| 28 | * \since 4.4 |
| 29 | */ |
| 30 | class KWIDGETSADDONS_EXPORT KPixmapSequenceWidget : public QWidget |
| 31 | { |
| 32 | Q_OBJECT |
| 33 | Q_PROPERTY(int interval READ interval WRITE setInterval) |
| 34 | |
| 35 | public: |
| 36 | /*! |
| 37 | * Constructor |
| 38 | */ |
| 39 | explicit KPixmapSequenceWidget(QWidget *parent = nullptr); |
| 40 | |
| 41 | /*! |
| 42 | * |
| 43 | */ |
| 44 | KPixmapSequenceWidget(const KPixmapSequence &seq, QWidget *parent = nullptr); |
| 45 | |
| 46 | ~KPixmapSequenceWidget() override; |
| 47 | |
| 48 | /*! |
| 49 | * The sequence used to draw the overlay. |
| 50 | * |
| 51 | * \sa setSequence |
| 52 | */ |
| 53 | KPixmapSequence sequence() const; |
| 54 | |
| 55 | /*! |
| 56 | * The interval between frames. |
| 57 | * |
| 58 | * \sa setInterval, KPixmapSequenceOverlayPainter::interval |
| 59 | */ |
| 60 | int interval() const; |
| 61 | |
| 62 | QSize sizeHint() const override; |
| 63 | |
| 64 | public Q_SLOTS: |
| 65 | /*! |
| 66 | * Set the sequence to be used. By default the KDE busy sequence is used. |
| 67 | */ |
| 68 | void setSequence(const KPixmapSequence &seq); |
| 69 | |
| 70 | /*! |
| 71 | * Set the interval between frames. The default is 200. |
| 72 | * \sa interval, KPixmapSequenceOverlayPainter::setInterval |
| 73 | */ |
| 74 | void setInterval(int msecs); |
| 75 | |
| 76 | private: |
| 77 | std::unique_ptr<class KPixmapSequenceWidgetPrivate> const d; |
| 78 | }; |
| 79 | |
| 80 | #endif |
| 81 | |