~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/plasmagenericshell/toolbutton.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2008 Marco Martin <notmart@gmail.com>
 
3
 *   Copyright 2008 Aaron Seigo <aseigo@kde.org>
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU Library General Public License as
 
7
 *   published by the Free Software Foundation; either version 2, or
 
8
 *   (at your option) any later version.
 
9
 *
 
10
 *   This program is distributed in the hope that it will be useful,
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *   GNU General Public License for more details
 
14
 *
 
15
 *   You should have received a copy of the GNU Library General Public
 
16
 *   License along with this program; if not, write to the
 
17
 *   Free Software Foundation, Inc.,
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef TOOLBUTTON_H
 
22
#define TOOLBUTTON_H
 
23
 
 
24
#include <QToolButton>
 
25
#include <QWeakPointer>
 
26
 
 
27
#include "plasmagenericshell_export.h"
 
28
 
 
29
class QPropertyAnimation;
 
30
 
 
31
namespace Plasma
 
32
{
 
33
    class FrameSvg;
 
34
}
 
35
 
 
36
class PLASMAGENERICSHELL_EXPORT ToolButton: public QToolButton
 
37
{
 
38
    Q_OBJECT
 
39
    Q_PROPERTY(qreal alphaValue READ alphaValue WRITE setAlphaValue)
 
40
 
 
41
public:
 
42
    ToolButton(QWidget *parent);
 
43
    void setAction(QAction *action);
 
44
    qreal alphaValue() const;
 
45
 
 
46
protected:
 
47
    void paintEvent(QPaintEvent *event);
 
48
    void enterEvent(QEvent *event);
 
49
    void leaveEvent(QEvent *event);
 
50
 
 
51
protected slots:
 
52
    void actionDestroyed(QObject *);
 
53
    void syncToAction();
 
54
    void setAlphaValue(qreal progress);
 
55
    void animationFinished();
 
56
 
 
57
private:
 
58
    QAction *m_action;
 
59
    Plasma::FrameSvg *m_background;
 
60
    QWeakPointer<QPropertyAnimation> m_animation;
 
61
    bool m_isAnimating;
 
62
    qreal m_alpha;
 
63
    bool m_fadeIn;
 
64
};
 
65
 
 
66
#endif
 
67