~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to kwin/placement.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
 KWin - the KDE window manager
 
3
 This file is part of the KDE project.
 
4
 
 
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>
 
8
 
 
9
You can Freely distribute this program under the GNU General Public
 
10
License. See the file "COPYING" for the exact licensing terms.
 
11
******************************************************************/
 
12
 
 
13
#ifndef KWIN_PLACEMENT_H
 
14
#define KWIN_PLACEMENT_H
 
15
 
 
16
#include <QPoint>
 
17
#include <QRect>
 
18
#include <QList>
 
19
 
 
20
namespace KWin
 
21
{
 
22
 
 
23
class Workspace;
 
24
class Client;
 
25
 
 
26
class Placement
 
27
    {
 
28
    public:
 
29
 
 
30
        Placement(Workspace* w);
 
31
 
 
32
        /**
 
33
         * Placement policies. How workspace decides the way windows get positioned
 
34
         * on the screen. The better the policy, the heavier the resource use.
 
35
         * Normally you don't have to worry. What the WM adds to the startup time
 
36
         * is nil compared to the creation of the window itself in the memory
 
37
         */
 
38
        enum Policy
 
39
            {
 
40
            NoPlacement, // not really a placement
 
41
            Default, // special, means to use the global default
 
42
            Unknown, // special, means the function should use its default
 
43
            Random,
 
44
            Smart,
 
45
            Cascade,
 
46
            Centered,
 
47
            ZeroCornered,
 
48
            UnderMouse, // special
 
49
            OnMainWindow, // special
 
50
            Maximizing
 
51
            };
 
52
 
 
53
        void place(Client* c, QRect& area );
 
54
        
 
55
        void placeAtRandom            (Client* c, const QRect& area, Policy next = Unknown );
 
56
        void placeCascaded            (Client* c, QRect& area, Policy next = Unknown );
 
57
        void placeSmart               (Client* c, const QRect& area, Policy next = Unknown );
 
58
        void placeMaximizing          (Client* c, QRect& area, Policy next = Unknown );
 
59
        void placeCentered    (Client* c, const QRect& area, Policy next = Unknown );
 
60
        void placeZeroCornered(Client* c, const QRect& area, Policy next = Unknown );
 
61
        void placeDialog      (Client* c, QRect& area, Policy next = Unknown );
 
62
        void placeUtility     (Client* c, QRect& area, Policy next = Unknown );
 
63
 
 
64
        void reinitCascading( int desktop );
 
65
 
 
66
        static Policy policyFromString( const QString& policy, bool no_special );
 
67
        static const char* policyToString( Policy policy );
 
68
 
 
69
    private:
 
70
 
 
71
        void place(Client* c, QRect& area, Policy policy, Policy nextPlacement = Unknown );
 
72
        void placeUnderMouse(Client* c, QRect& area, Policy next = Unknown );
 
73
        void placeOnMainWindow(Client* c, QRect& area, Policy next = Unknown );
 
74
        QRect checkArea( const Client*c, const QRect& area );
 
75
 
 
76
        Placement();
 
77
 
 
78
    //CT needed for cascading+
 
79
        struct DesktopCascadingInfo 
 
80
            {
 
81
            QPoint pos;
 
82
            int col;
 
83
            int row;
 
84
            };
 
85
 
 
86
        QList<DesktopCascadingInfo> cci;
 
87
 
 
88
        Workspace* m_WorkspacePtr;
 
89
    };
 
90
 
 
91
} // namespace
 
92
 
 
93
#endif