1
/*******************************************************************************
2
KWin - the KDE window manager
3
This file is part of the KDE project.
5
Copyright (C) 2009 Jorge Mata <matamax123@gmail.com>
6
Copyright (C) 2009 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_CLIENTGROUP_H
23
#define KWIN_CLIENTGROUP_H
27
#include "kdecoration.h"
36
* This class represents a group of clients for use in window tabbing. All
37
* clients in the group share the same geometry and state information; I.e if
38
* one client changes then all others should also be changed.
40
* Workspace::clientGroups is a list of all currently-existing client groups.
42
* A group MUST contain at least one client and MUST NOT contain multiple
43
* copies of the same client. A client MUST NOT be in two groups at the same
44
* time. All decorated clients SHOULD be in a group, even if it's a group of
47
* rohanp: Had to convert this object to a QObject to make it easier for adding
48
* scripting interface to ClientGroup.
50
* If a group contains multiple clients then only one will ever be mapped at
53
class ClientGroup : public QObject
58
* Creates a new group containing \p c.
60
ClientGroup(Client* c);
64
* Adds \p c to the group before \p before in the list. If \p becomeVisible is \i true then
65
* the added client will become also the visible client.
67
void add(Client* c, int before = -1, bool becomeVisible = false);
69
* Remove the client at index \p index from the group. If \p newGeom is set then the client
70
* will move and resize to the specified geometry, otherwise it will stay where the group
71
* is located. If \p toNullGroup is not true then the client will be added to a new group
74
void remove(int index, const QRect& newGeom = QRect(), bool toNullGroup = false);
76
* Remove \p c from the group. If \p newGeom is set then the client will move and resize to
77
* the specified geometry, otherwise it will stay where the group is located. If
78
* \p toNullGroup is not true then the client will be added to a new group of its own.
80
void remove(Client* c, const QRect& newGeom = QRect(), bool toNullGroup = false);
82
* Remove all clients from this group. Results in all clients except the first being moved
83
to a group of their own.
87
* Close all clients in this group.
91
* Move the client at index \p index to the position before the client at index \p before
94
void move(int index, int before);
96
* Move \p c to the position before \p before in the list.
98
void move(Client* c, Client* before);
100
* Display the right-click client menu belonging to the client at index \p index at the
101
* global coordinates specified by \p pos.
103
void displayClientMenu(int index, const QPoint& pos);
105
* Display the right-click client menu belonging to \p c at the global coordinates
106
* specified by \p pos.
108
void displayClientMenu(Client* c, const QPoint& pos);
111
* Returns the list index of \p c.
113
int indexOfClient(Client* c);
115
* Returns the list index of the currently visible client in the group.
117
int indexOfVisibleClient();
119
* Returns whether or not this group contains \p c.
121
bool contains(Client* c);
123
* Returns whether or not this group contains the active client.
125
bool containsActiveClient();
128
* Returns the list of all the clients contained in this group in their current order.
130
ClientList clients() const;
132
* Returns a list of the captions and icons of all the clients contained in this group
133
* in their current order.
135
QList< ClientGroupItem > items() const;
138
* Returns the currently visible client.
142
* Makes the client at index \p index the visible one in the group.
144
void setVisible(int index);
146
* Makes \p c the visible client in the group.
148
void setVisible(Client* c);
151
* Returns combined minimum size of all clients in the group.
153
QSize minSize() const;
155
* Returns combined maximum size of all clients in the group.
157
QSize maxSize() const;
160
* Ensures that all the clients in the group have identical geometries and states using
161
* \p main as the primary client to copy the settings off. If \p only is set then only
162
* that client is updated to match \p main.
164
void updateStates(Client* main, Client* only = NULL);
168
* Regenerate the list of client captions and icons.
172
* Determine the combined minimum and maximum sizes of all clients in the group.
174
void updateMinMaxSize();
177
QList< ClientGroupItem > items_;
186
inline int ClientGroup::indexOfClient(Client* c)
188
return clients_.indexOf(c);
191
inline int ClientGroup::indexOfVisibleClient()
196
inline bool ClientGroup::contains(Client* c)
198
return clients_.contains(c);
201
inline ClientList ClientGroup::clients() const
206
inline QList< ClientGroupItem > ClientGroup::items() const
211
inline Client* ClientGroup::visible()
213
return clients_[visible_];
216
inline QSize ClientGroup::minSize() const
221
inline QSize ClientGroup::maxSize() const