1
/********************************************************************
2
KWin - the KDE window manager
3
This file is part of the KDE project.
5
Copyright (C) 2009 Martin Gräßlin <kde@martin-graesslin.com>
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*********************************************************************/
21
#ifndef DESKTOPCHANGEOSD_H
22
#define DESKTOPCHANGEOSD_H
24
#include <QGraphicsView>
25
#include <QGraphicsItem>
27
#include <KDE/Plasma/FrameSvg>
28
#include <KDE/Plasma/Theme>
29
#include <KDE/Plasma/WindowEffects>
30
#include <QWeakPointer>
33
class QPropertyAnimation;
39
class DesktopChangeText : public QGraphicsItem
42
DesktopChangeText(Workspace* ws);
45
enum { Type = UserType + 2 };
47
inline void setWidth(float width) {
50
inline void setHeight(float height) {
54
virtual QRectF boundingRect() const;
55
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
56
inline virtual int type() const {
66
class DesktopChangeOSD : public QGraphicsView
69
DesktopChangeOSD(Workspace* ws);
73
void desktopChanged(int old);
74
void numberDesktopsChanged();
76
inline Plasma::FrameSvg* itemFrame() {
79
inline int& getDelayTime() {
84
virtual void hideEvent(QHideEvent*);
85
virtual void drawBackground(QPainter* painter, const QRectF& rect);
90
Plasma::FrameSvg m_frame;
91
Plasma::FrameSvg m_item_frame;
92
QGraphicsScene* m_scene;
94
QTimer m_delayedHideTimer;
100
class DesktopChangeItem : public QObject, public QGraphicsItem
103
Q_PROPERTY(qreal arrowValue READ arrowValue WRITE setArrowValue)
104
Q_PROPERTY(qreal highLightValue READ highLightValue WRITE setHighLightValue)
106
Q_INTERFACES(QGraphicsItem)
108
DesktopChangeItem(Workspace* ws, DesktopChangeOSD* parent, int desktop);
109
~DesktopChangeItem();
110
enum { Type = UserType + 1 };
111
void startDesktopHighLightAnimation(int time);
112
void stopDesktopHighLightAnimation();
114
inline void setWidth(float width) {
117
inline void setHeight(float height) {
120
inline int desktop() const {
124
virtual QRectF boundingRect() const;
125
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
126
inline virtual int type() const {
137
void setArrow(Arrow arrow, int start_delay, int hide_delay);
139
qreal arrowValue() const;
140
qreal highLightValue() const;
143
void setArrowValue(qreal value);
144
void setHighLightValue(qreal value);
149
void arrowAnimationFinished();
153
DesktopChangeOSD* m_parent;
157
QTimer m_delayed_show_arrow_timer;
158
QTimer m_delayed_hide_arrow_timer;
163
bool m_fadeInHighLight;
166
qreal m_highLightValue;
168
QWeakPointer<QPropertyAnimation> m_arrowAnimation;
169
QWeakPointer<QPropertyAnimation> m_highLightAnimation;
174
#endif // DESKTOPCHANGEOSD_H