2008-11-04 00:08:39 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 by André Duffeck <duffeck@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMA_FLASHINGLABEL_H
|
|
|
|
#define PLASMA_FLASHINGLABEL_H
|
|
|
|
|
2012-02-02 10:35:53 +01:00
|
|
|
#include <QGraphicsWidget>
|
|
|
|
#include <QTextOption>
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class FlashingLabelPrivate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @class FlashingLabel plasma/widgets/flashinglabel.h <Plasma/Widgets/FlashingLabel>
|
|
|
|
*
|
|
|
|
* @short Provides flashing text or icons inside Plasma
|
|
|
|
*/
|
|
|
|
class PLASMA_EXPORT FlashingLabel : public QGraphicsWidget
|
|
|
|
{
|
2009-11-14 04:38:56 +01:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool autohide READ autohide WRITE setAutohide)
|
|
|
|
Q_PROPERTY(QFont font READ font WRITE setFont)
|
|
|
|
Q_PROPERTY(QColor color READ color WRITE setColor)
|
|
|
|
Q_PROPERTY(int duration READ duration WRITE setDuration)
|
|
|
|
|
2009-11-07 17:44:56 +01:00
|
|
|
public:
|
|
|
|
explicit FlashingLabel(QGraphicsItem *parent = 0);
|
|
|
|
virtual ~FlashingLabel();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-07 17:44:56 +01:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-14 04:38:56 +01:00
|
|
|
QFont font() const;
|
2009-11-07 17:44:56 +01:00
|
|
|
void setFont(const QFont &);
|
2009-11-14 04:38:56 +01:00
|
|
|
|
|
|
|
QColor color() const;
|
2009-11-07 17:44:56 +01:00
|
|
|
void setColor(const QColor &);
|
2009-11-14 04:38:56 +01:00
|
|
|
|
|
|
|
int duration() const;
|
2009-11-07 17:44:56 +01:00
|
|
|
void setDuration(int duration);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-14 04:38:56 +01:00
|
|
|
Q_INVOKABLE void flash(const QString &text, int duration = 0,
|
|
|
|
const QTextOption &option = QTextOption(Qt::AlignCenter));
|
|
|
|
Q_INVOKABLE void flash(const QPixmap &pixmap, int duration = 0,
|
|
|
|
Qt::Alignment align = Qt::AlignCenter);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-07 17:44:56 +01:00
|
|
|
void setAutohide(bool autohide);
|
|
|
|
bool autohide() const;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-07 17:44:56 +01:00
|
|
|
protected:
|
|
|
|
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-07 17:44:56 +01:00
|
|
|
public Q_SLOTS:
|
|
|
|
void kill();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-11-07 17:44:56 +01:00
|
|
|
protected Q_SLOTS:
|
|
|
|
void fadeIn();
|
|
|
|
void fadeOut();
|
|
|
|
|
|
|
|
private:
|
2010-02-11 14:04:12 +01:00
|
|
|
Q_PRIVATE_SLOT(d, void elementAnimationFinished())
|
2009-11-23 19:49:25 +01:00
|
|
|
Q_PRIVATE_SLOT(d, void setPalette())
|
2009-11-07 17:44:56 +01:00
|
|
|
FlashingLabelPrivate *const d;
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|