add more spacing
[personal-kdebase.git] / workspace / kwin / effects / desktopgrid.h
blob0e68115491f441ec16752ad57838e0f9c6445188
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
6 Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *********************************************************************/
22 #ifndef KWIN_DESKTOPGRID_H
23 #define KWIN_DESKTOPGRID_H
25 #include <kwineffects.h>
26 #include <QObject>
28 namespace KWin
31 class DesktopGridEffect
32 : public QObject, public Effect
34 Q_OBJECT
35 public:
36 DesktopGridEffect();
37 ~DesktopGridEffect();
38 virtual void reconfigure( ReconfigureFlags );
39 virtual void prePaintScreen( ScreenPrePaintData& data, int time );
40 virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
41 virtual void postPaintScreen();
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 windowClosed( EffectWindow* w );
45 virtual void windowInputMouseEvent( Window w, QEvent* e );
46 virtual void grabbedKeyboardEvent( QKeyEvent* e );
47 virtual bool borderActivated( ElectricBorder border );
49 enum { LayoutPager, LayoutAutomatic, LayoutCustom }; // Layout modes
51 private slots:
52 void toggle();
54 private:
55 QPointF scalePos( const QPoint& pos, int desktop, int screen = -1 ) const;
56 QPoint unscalePos( const QPoint& pos, int* desktop = NULL ) const;
57 int posToDesktop( const QPoint& pos ) const;
58 EffectWindow* windowAt( QPoint pos ) const;
59 void setCurrentDesktop( int desktop );
60 void setHighlightedDesktop( int desktop );
61 int desktopToRight( int desktop, bool wrap = true ) const;
62 int desktopToLeft( int desktop, bool wrap = true ) const;
63 int desktopUp( int desktop, bool wrap = true ) const;
64 int desktopDown( int desktop, bool wrap = true ) const;
65 void setActive( bool active );
66 void setup();
67 void finish();
69 ElectricBorder borderActivate;
70 int zoomDuration;
71 int border;
72 Qt::Alignment desktopNameAlignment;
73 int layoutMode;
74 int customLayoutRows;
76 bool activated;
77 TimeLine timeline;
78 int paintingDesktop;
79 int highlightedDesktop;
80 Window input;
81 bool keyboardGrab;
82 bool wasWindowMove;
83 EffectWindow* windowMove;
84 QPoint windowMoveDiff;
86 // Soft highlighting
87 QList<TimeLine> hoverTimeline;
89 QSize gridSize;
90 Qt::Orientation orientation;
91 QPoint activeCell;
92 // Per screen variables
93 QList<double> scale; // Because the border isn't a ratio each screen is different
94 QList<double> unscaledBorder;
95 QList<QSizeF> scaledSize;
96 QList<QPointF> scaledOffset;
100 } // namespace
102 #endif