File indexing completed on 2024-04-28 15:32:11

0001 /*
0002     SPDX-FileCopyrightText: 2009 Sebastian Trueg <trueg@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef _K_PIXMAPSEQUENCE_WIDGET_H_
0008 #define _K_PIXMAPSEQUENCE_WIDGET_H_
0009 
0010 #include <QWidget>
0011 #include <memory>
0012 
0013 #include <kwidgetsaddons_export.h>
0014 
0015 class KPixmapSequence;
0016 
0017 /**
0018  * \class KPixmapSequenceWidget kpixmapsequencewidget.h KPixmapSequenceWidget
0019  *
0020  * \brief A simple widget showing a fixed size pixmap sequence.
0021  *
0022  * The KPixmapSequenceWidget uses the KPixmapSequenceOverlayPainter to show a
0023  * sequence of pixmaps. It is intended as a simple wrapper around the
0024  * KPixmapSequenceOverlayPainter in case a widget is more appropriate than
0025  * an event filter.
0026  *
0027  * \author Sebastian Trueg <trueg@kde.org>
0028  *
0029  * \since 4.4
0030  */
0031 class KWIDGETSADDONS_EXPORT KPixmapSequenceWidget : public QWidget
0032 {
0033     Q_OBJECT
0034     Q_PROPERTY(int interval READ interval WRITE setInterval)
0035 
0036 public:
0037     /**
0038      * Constructor
0039      */
0040     explicit KPixmapSequenceWidget(QWidget *parent = nullptr);
0041     KPixmapSequenceWidget(const KPixmapSequence &seq, QWidget *parent = nullptr);
0042 
0043     /**
0044      * Destructor
0045      */
0046     ~KPixmapSequenceWidget() override;
0047 
0048     /**
0049      * The sequence used to draw the overlay.
0050      *
0051      * \sa setSequence
0052      */
0053     KPixmapSequence sequence() const;
0054 
0055     /**
0056      * The interval between frames.
0057      *
0058      * \sa setInterval, KPixmapSequenceOverlayPainter::interval
0059      */
0060     int interval() const;
0061 
0062     /**
0063      * \reimpl
0064      */
0065     QSize sizeHint() const override;
0066 
0067 public Q_SLOTS:
0068     /**
0069      * Set the sequence to be used. By default the KDE busy sequence is used.
0070      */
0071     void setSequence(const KPixmapSequence &seq);
0072 
0073     /**
0074      * Set the interval between frames. The default is 200.
0075      * \sa interval, KPixmapSequenceOverlayPainter::setInterval
0076      */
0077     void setInterval(int msecs);
0078 
0079 private:
0080     std::unique_ptr<class KPixmapSequenceWidgetPrivate> const d;
0081 };
0082 
0083 #endif