add more spacing
[personal-kdebase.git] / workspace / kwin / placement.h
blob59cf28a78c047cceb31f47bb5c20bdc90fd9de5b
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6 Copyright (C) 1997 to 2002 Cristian Tibirna <tibirna@kde.org>
7 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************/
23 #ifndef KWIN_PLACEMENT_H
24 #define KWIN_PLACEMENT_H
26 #include <QPoint>
27 #include <QRect>
28 #include <QList>
30 namespace KWin
33 class Workspace;
34 class Client;
36 class Placement
38 public:
40 Placement(Workspace* w);
42 /**
43 * Placement policies. How workspace decides the way windows get positioned
44 * on the screen. The better the policy, the heavier the resource use.
45 * Normally you don't have to worry. What the WM adds to the startup time
46 * is nil compared to the creation of the window itself in the memory
48 enum Policy
50 NoPlacement, // not really a placement
51 Default, // special, means to use the global default
52 Unknown, // special, means the function should use its default
53 Random,
54 Smart,
55 Cascade,
56 Centered,
57 ZeroCornered,
58 UnderMouse, // special
59 OnMainWindow, // special
60 Maximizing
63 void place(Client* c, QRect& area );
65 void placeAtRandom (Client* c, const QRect& area, Policy next = Unknown );
66 void placeCascaded (Client* c, QRect& area, Policy next = Unknown );
67 void placeSmart (Client* c, const QRect& area, Policy next = Unknown );
68 void placeMaximizing (Client* c, QRect& area, Policy next = Unknown );
69 void placeCentered (Client* c, const QRect& area, Policy next = Unknown );
70 void placeZeroCornered(Client* c, const QRect& area, Policy next = Unknown );
71 void placeDialog (Client* c, QRect& area, Policy next = Unknown );
72 void placeUtility (Client* c, QRect& area, Policy next = Unknown );
74 void reinitCascading( int desktop );
76 static Policy policyFromString( const QString& policy, bool no_special );
77 static const char* policyToString( Policy policy );
79 private:
81 void place(Client* c, QRect& area, Policy policy, Policy nextPlacement = Unknown );
82 void placeUnderMouse(Client* c, QRect& area, Policy next = Unknown );
83 void placeOnMainWindow(Client* c, QRect& area, Policy next = Unknown );
84 QRect checkArea( const Client*c, const QRect& area );
86 Placement();
88 //CT needed for cascading+
89 struct DesktopCascadingInfo
91 QPoint pos;
92 int col;
93 int row;
96 QList<DesktopCascadingInfo> cci;
98 Workspace* m_WorkspacePtr;
101 } // namespace
103 #endif