~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/tile.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

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) 2009 Nikhil Marathe <nsm.nikhil@gmail.com>
 
6
 
 
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.
 
11
 
 
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.
 
16
 
 
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
*********************************************************************/
 
20
 
 
21
#ifndef KWIN_TILE_H
 
22
#define KWIN_TILE_H
 
23
 
 
24
#include <QRect>
 
25
#include <QString>
 
26
 
 
27
namespace KWin
 
28
{
 
29
 
 
30
class Client;
 
31
class Workspace;
 
32
 
 
33
class Tile
 
34
{
 
35
public:
 
36
    enum Direction {
 
37
        Top,
 
38
        Right,
 
39
        Bottom,
 
40
        Left
 
41
    };
 
42
 
 
43
    enum LayoutMode {
 
44
        UseRatio, // uses m_ratio
 
45
        UseGeometry, // uses current geometry of children
 
46
        Equal // distribute equally
 
47
    };
 
48
 
 
49
    Tile(Client *c, const QRect& area);
 
50
    Tile(const Tile& orig);
 
51
    virtual ~Tile();
 
52
    void setGeometry(const QRect& area);
 
53
    void setGeometry(int x, int y, int w, int h);
 
54
 
 
55
    void resize(const QRect area);
 
56
 
 
57
    void restorePreviousGeometry();
 
58
 
 
59
    void commit();
 
60
 
 
61
    void focus();
 
62
 
 
63
    // :| the float datatype interferes with naming
 
64
    void floatTile();
 
65
    void unfloatTile();
 
66
 
 
67
    bool minimized() const;
 
68
    bool floating() const;
 
69
    bool ignoreGeometry() const;
 
70
    QRect geometry() const;
 
71
    Client* client() const;
 
72
 
 
73
    void dumpTile(const QString& indent = "") const;
 
74
 
 
75
private:
 
76
 
 
77
    // -------------
 
78
    // PROPERTIES
 
79
    // -------------
 
80
 
 
81
    // our client
 
82
    Client *m_client;
 
83
 
 
84
    // tiled geometry
 
85
    QRect m_geom;
 
86
    // before tiling was enabled, if any
 
87
    QRect m_prevGeom;
 
88
 
 
89
    bool m_floating;
 
90
 
 
91
};
 
92
 
 
93
inline QRect Tile::geometry() const
 
94
{
 
95
    return m_geom;
 
96
}
 
97
 
 
98
inline Client* Tile::client() const
 
99
{
 
100
    return m_client;
 
101
}
 
102
 
 
103
inline bool Tile::floating() const
 
104
{
 
105
    return m_floating;
 
106
}
 
107
 
 
108
/*
 
109
 * should be respected by all geometry modifying methods.
 
110
 * It returns true if the Tile is 'out' of the layout,
 
111
 * due to being minimized, floating or for some other reason.
 
112
 */
 
113
inline bool Tile::ignoreGeometry() const
 
114
{
 
115
    return minimized() || floating();
 
116
}
 
117
 
 
118
inline void Tile::setGeometry(const QRect& area)
 
119
{
 
120
    setGeometry(area.x(), area.y(), area.width(), area.height());
 
121
}
 
122
 
 
123
} // namespace
 
124
#endif
 
125