add more spacing
[personal-kdebase.git] / workspace / kwin / effects / coverswitch.h
blob1ee04e6dfbe266a218e81f9a9aa6a65873957d78
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2008 Martin Gräßlin <ubuntu@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 KWIN_COVERSWITCH_H
22 #define KWIN_COVERSWITCH_H
24 #include <QHash>
25 #include <QPixmap>
26 #include <QRect>
27 #include <QRegion>
28 #include <QSize>
29 #include <QQueue>
31 #include <kwineffects.h>
32 #include <kwinglutils.h>
34 namespace KWin
37 class CoverSwitchEffect
38 : public Effect
40 public:
41 CoverSwitchEffect();
42 ~CoverSwitchEffect();
44 virtual void reconfigure( ReconfigureFlags );
45 virtual void prePaintScreen( ScreenPrePaintData& data, int time );
46 virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
47 virtual void postPaintScreen();
48 virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
49 virtual void tabBoxAdded( int mode );
50 virtual void tabBoxClosed();
51 virtual void tabBoxUpdated();
52 virtual void windowInputMouseEvent( Window w, QEvent* e );
54 static bool supported();
55 private:
56 void paintScene( EffectWindow* frontWindow, QList< EffectWindow* >* leftWindows, QList< EffectWindow* >* rightWindows,
57 bool reflectedWindows = false );
58 void paintWindowCover( EffectWindow* w, bool reflectedWindow, WindowPaintData& data );
59 void paintFrontWindow( EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow );
60 void paintWindows( QList< EffectWindow* >* windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL );
61 // thumbnail bar
62 class ItemInfo;
63 void calculateFrameSize();
64 void calculateItemSizes();
65 void paintFrame();
66 void paintHighlight( QRect area );
67 void paintWindowThumbnail( EffectWindow* w );
68 void paintWindowIcon( EffectWindow* w );
70 bool mActivated;
71 float angle;
72 bool animateSwitch;
73 bool animateStart;
74 bool animateStop;
75 bool animation;
76 bool start;
77 bool stop;
78 bool reflection;
79 int animationDuration;
80 bool stopRequested;
81 bool startRequested;
82 TimeLine timeLine;
83 QRect area;
84 Window input;
85 float zPosition;
86 float scaleFactor;
87 enum Direction
89 Left,
90 Right
92 Direction direction;
93 QQueue<Direction> scheduled_directions;
94 EffectWindow* selected_window;
95 int activeScreen;
96 QList< EffectWindow* > leftWindows;
97 QList< EffectWindow* > rightWindows;
99 // thumbnail bar
100 bool thumbnails;
101 bool dynamicThumbnails;
102 int thumbnailWindows;
103 QHash< EffectWindow*, ItemInfo* > windows;
104 QRect frame_area;
105 int frame_margin;
106 int highlight_margin;
107 QSize item_max_size; // maximum item display size (including highlight)
108 QColor color_frame;
109 QColor color_highlight;
110 QColor color_text;
111 EffectWindow* edge_window;
112 EffectWindow* right_window;
113 QRect highlight_area;
114 bool highlight_is_set;
118 class CoverSwitchEffect::ItemInfo
120 public:
121 QRect area; // maximal painting area, including any frames/highlights/etc.
122 QRegion clickable;
123 QRect thumbnail;
124 QPixmap icon;
125 GLTexture iconTexture;
128 } // namespace
130 #endif