1
/********************************************************************
2
KWin - the KDE window manager
3
This file is part of the KDE project.
5
Copyright (C) 2009 Martin Gräßlin <kde@martin-graesslin.com>
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.
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.
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
*********************************************************************/
21
#ifndef DESKTOPMODEL_H
22
#define DESKTOPMODEL_H
24
#include <QModelIndex>
27
* This file defines the class DesktopModel, the model for desktops.
29
* @author Martin Gräßlin <kde@martin-graesslin.com>
40
* The model for desktops used in TabBox.
42
* @author Martin Gräßlin <kde@martin-graesslin.com>
46
: public QAbstractItemModel
50
DesktopRole = Qt::UserRole, ///< Desktop number
51
DesktopNameRole = Qt::UserRole + 1, ///< Desktop name
52
ClientModelRole = Qt::UserRole + 2 ///< Clients on this desktop
54
DesktopModel(QObject* parent = 0);
57
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
58
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
59
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
60
virtual QModelIndex parent(const QModelIndex& child) const;
61
virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
64
* Generates a new list of desktops based on the current config.
65
* Calling this method will reset the model.
67
void createDesktopList();
69
* @return The current list of desktops.
71
QList< int > desktopList() const {
75
* @param desktop The desktop whose ModelIndex should be retrieved
76
* @return The ModelIndex of given desktop or an invalid ModelIndex if
77
* the desktop is not in the model.
79
QModelIndex desktopIndex(int desktop) const;
82
QList< int > m_desktopList;
83
QMap< int, ClientModel* > m_clientModels;
88
#endif // DESKTOPMODEL_H