1/********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5Copyright (C) 2009 Marco Martin notmart@gmail.com
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*********************************************************************/
20
21#ifndef KWIN_SLIDINGPOPUPS_H
22#define KWIN_SLIDINGPOPUPS_H
23
24// Include with base class for effects.
25#include <kwineffects.h>
26
27class QTimeLine;
28
29namespace KWin
30{
31
32class SlidingPopupsEffect
33 : public Effect
34{
35 Q_OBJECT
36 Q_PROPERTY(int fadeInTime READ fadeInTime)
37 Q_PROPERTY(int fadeOutTime READ fadeOutTime)
38public:
39 SlidingPopupsEffect();
40 ~SlidingPopupsEffect();
41 virtual void prePaintScreen(ScreenPrePaintData& data, int time);
42 virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
43 virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
44 virtual void postPaintWindow(EffectWindow* w);
45 virtual void reconfigure(ReconfigureFlags flags);
46 virtual bool isActive() const;
47 // TODO react also on virtual desktop changes
48
49 // for properties
50 int fadeInTime() const {
51 return mFadeInTime;
52 }
53 int fadeOutTime() const {
54 return mFadeOutTime;
55 }
56public Q_SLOTS:
57 void slotWindowAdded(KWin::EffectWindow *c);
58 void slotWindowClosed(KWin::EffectWindow *c);
59 void slotWindowDeleted(KWin::EffectWindow *w);
60 void slotPropertyNotify(KWin::EffectWindow *w, long a);
61private:
62 enum Position {
63 West = 0,
64 North = 1,
65 East = 2,
66 South = 3
67 };
68 struct Data {
69 int start; //point in screen coordinates where the window starts
70 //to animate, from decides if this point is an x or an y
71 Position from;
72 int fadeInDuration;
73 int fadeOutDuration;
74 };
75 long mAtom;
76 QHash< const EffectWindow*, QTimeLine* > mAppearingWindows;
77 QHash< const EffectWindow*, QTimeLine* > mDisappearingWindows;
78 QHash< const EffectWindow*, Data > mWindowsData;
79 int mFadeInTime;
80 int mFadeOutTime;
81};
82
83} // namespace
84
85#endif
86