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) 2003 Lubos Lunak <l.lunak@kde.org>
7
Copyright (C) 2009 Martin Gräßlin <kde@martin-graesslin.com>
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
*********************************************************************/
27
#include <QModelIndex>
29
#include "tabbox/tabboxhandler.h"
42
class TabBoxHandlerImpl : public TabBoxHandler
46
virtual ~TabBoxHandlerImpl();
48
virtual int activeScreen() const;
49
virtual TabBoxClient* activeClient() const;
50
virtual int currentDesktop() const;
51
virtual QString desktopName(TabBoxClient* client) const;
52
virtual QString desktopName(int desktop) const;
53
virtual TabBoxClient* nextClientFocusChain(TabBoxClient* client) const;
54
virtual int nextDesktopFocusChain(int desktop) const;
55
virtual int numberOfDesktops() const;
56
virtual TabBoxClientList stackingOrder() const;
57
virtual void raiseClient(TabBoxClient *client) const;
58
virtual void restack(TabBoxClient *c, TabBoxClient *under);
59
virtual TabBoxClient* clientToAddToList(TabBoxClient* client, int desktop, bool allDesktops) const;
60
virtual TabBoxClient* desktopClient() const;
61
virtual void hideOutline();
62
virtual void showOutline(const QRect &outline);
63
virtual QVector< Window > outlineWindowIds() const;
66
class TabBoxClientImpl : public TabBoxClient
70
virtual ~TabBoxClientImpl();
72
virtual QString caption() const;
73
virtual QPixmap icon(const QSize& size = QSize(32, 32)) const;
74
virtual WId window() const;
75
virtual bool isMinimized() const;
76
virtual int x() const;
77
virtual int y() const;
78
virtual int width() const;
79
virtual int height() const;
81
Client* client() const {
84
void setClient(Client* client) {
92
class TabBox : public QObject
96
TabBox(Workspace *ws);
99
Client* currentClient();
100
ClientList currentClientList();
101
int currentDesktop();
102
QList< int > currentDesktopList();
104
void setCurrentClient(Client* newClient);
105
void setCurrentDesktop(int newDesktop);
107
void setMode(TabBoxMode mode);
108
TabBoxMode mode() const {
112
void reset(bool partial_reset = false);
113
void nextPrev(bool next = true);
116
void hide(bool abort = false);
120
bool isDisplayed() const;
122
void handleMouseEvent(XEvent*);
123
void grabbedKeyEvent(QKeyEvent* event);
125
Workspace* workspace() const;
133
void tabBoxAdded(int);
135
void tabBoxUpdated();
136
void tabBoxKeyEvent(QKeyEvent*);
139
void setCurrentIndex(QModelIndex index, bool notifyEffects = true);
140
void loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig);
144
TabBoxMode m_tabBoxMode;
146
TabBoxHandlerImpl* m_tabBox;
150
QTimer delayedShowTimer;
151
int display_refcount;
153
TabBoxConfig m_defaultConfig;
154
TabBoxConfig m_alternativeConfig;
155
TabBoxConfig m_desktopConfig;
156
TabBoxConfig m_desktopListConfig;
157
// false if an effect has referenced the tabbox
158
// true if tabbox is active (independent on showTabbox setting)
163
Returns the tab box' workspace
165
inline Workspace* TabBox::workspace() const
171
Increase the reference count, preventing the default tabbox from showing.
173
\sa unrefDisplay(), isDisplayed()
175
inline void TabBox::refDisplay()
181
Returns whether the tab box is being displayed, either natively or by an
184
\sa refDisplay(), unrefDisplay()
186
inline bool TabBox::isDisplayed() const
188
return display_refcount > 0;
191
} // namespace TabBox