add more spacing
[personal-kdebase.git] / workspace / kwin / effects / boxswitch.h
blob667a482c1a69e6a40e7719d22cb90d8671e1d78f
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.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_BOXSWITCH_H
22 #define KWIN_BOXSWITCH_H
24 #include <kwineffects.h>
26 #include <QHash>
27 #include <QPixmap>
28 #include <QRect>
29 #include <QRegion>
30 #include <QSize>
31 #include <QFont>
32 #include <QQueue>
34 #include <kwinglutils.h>
35 #include <kwinxrenderutils.h>
37 namespace KWin
40 class BoxSwitchEffect
41 : public Effect
43 public:
44 BoxSwitchEffect();
45 ~BoxSwitchEffect();
46 virtual void reconfigure( ReconfigureFlags );
47 virtual void prePaintScreen( ScreenPrePaintData &data, int time );
48 virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
49 virtual void postPaintScreen();
50 virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
51 virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
53 virtual void windowInputMouseEvent( Window w, QEvent* e );
54 virtual void windowDamaged( EffectWindow* w, const QRect& damage );
55 virtual void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
56 virtual void tabBoxAdded( int mode );
57 virtual void tabBoxClosed();
58 virtual void tabBoxUpdated();
59 virtual void windowClosed( EffectWindow* w );
60 private:
61 class ItemInfo;
62 void setActive();
63 void setInactive();
64 void moveResizeInputWindow( int x, int y, int width, int height );
65 void calculateFrameSize();
66 void calculateItemSizes();
67 void setSelectedWindow( EffectWindow* w );
69 void paintFrame();
70 void paintHighlight( QRect area );
71 void paintWindowThumbnail( EffectWindow* w );
72 void paintDesktopThumbnail( int iDesktop );
73 void paintWindowIcon( EffectWindow* w );
74 void paintText( const QString& text );
76 bool mActivated;
77 Window mInput;
78 int mMode;
80 QRect frame_area;
81 int frame_margin; // TODO graphical background
82 int highlight_margin; // TODO graphical background
83 QSize item_max_size; // maximum item display size (including highlight)
84 QRect text_area;
85 QFont text_font;
86 QColor color_frame;
87 QColor color_highlight;
88 QColor color_text;
90 float bg_opacity;
91 bool elevate_window;
93 QHash< EffectWindow*, ItemInfo* > windows;
94 EffectWindowList original_windows;
95 EffectWindow* selected_window;
96 QHash< int, ItemInfo* > desktops;
97 QList< int > original_desktops;
98 int selected_desktop;
100 int painting_desktop;
102 bool mAnimateSwitch;
103 TimeLine activeTimeLine;
104 TimeLine timeLine;
105 bool animation;
106 QRect highlight_area;
107 bool highlight_is_set;
108 enum Direction
110 Left,
111 Right
113 Direction direction;
114 QQueue<Direction> scheduled_directions;
115 EffectWindow* edge_window;
116 EffectWindow* right_window;
119 class BoxSwitchEffect::ItemInfo
121 public:
122 QRect area; // maximal painting area, including any frames/highlights/etc.
123 QRegion clickable;
124 QRect thumbnail;
125 QPixmap icon;
126 #ifdef KWIN_HAVE_OPENGL_COMPOSITING
127 GLTexture iconTexture;
128 #endif
129 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
130 XRenderPicture iconPicture;
131 #endif
134 } // namespace
136 #endif