2010-09-21 14:31:40 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2010 Rohan Prabhu <rohan@rohanprabhu.com>
|
2012-01-21 16:48:07 +00:00
|
|
|
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
2010-09-21 14:31:40 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
2012-01-22 11:38:03 +00:00
|
|
|
#ifndef KWIN_SCRIPTING_WORKSPACE_WRAPPER_H
|
|
|
|
#define KWIN_SCRIPTING_WORKSPACE_WRAPPER_H
|
2010-09-21 14:31:40 +00:00
|
|
|
|
2012-01-22 11:38:03 +00:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
#include <QtCore/QSize>
|
2010-09-21 14:31:40 +00:00
|
|
|
|
2012-01-22 11:38:03 +00:00
|
|
|
namespace KWin
|
2010-09-21 14:31:40 +00:00
|
|
|
{
|
2012-01-22 11:38:03 +00:00
|
|
|
// forward declarations
|
|
|
|
class Client;
|
2010-09-21 14:31:40 +00:00
|
|
|
|
2012-01-22 11:38:03 +00:00
|
|
|
class WorkspaceWrapper : public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2012-01-21 16:48:07 +00:00
|
|
|
Q_PROPERTY(int currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY currentDesktopChanged)
|
|
|
|
Q_PROPERTY(KWin::Client *activeClient READ activeClient WRITE setActiveClient NOTIFY clientActivated)
|
|
|
|
// TODO: write and notify?
|
|
|
|
Q_PROPERTY(QSize desktopGridSize READ desktopGridSize)
|
|
|
|
Q_PROPERTY(int desktopGridWidth READ desktopGridWidth)
|
|
|
|
Q_PROPERTY(int desktopGridHeight READ desktopGridHeight)
|
|
|
|
Q_PROPERTY(int workspaceWidth READ workspaceWidth)
|
|
|
|
Q_PROPERTY(int workspaceHeight READ workspaceHeight)
|
|
|
|
Q_PROPERTY(QSize workspaceSize READ workspaceSize)
|
2012-01-26 07:22:54 +00:00
|
|
|
/**
|
|
|
|
* The number of desktops currently used. Minimum number of desktops is 1, maximum 20.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(int desktops READ numberOfDesktops WRITE setNumberOfDesktops NOTIFY numberDesktopsChanged)
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
private:
|
2012-01-22 11:38:03 +00:00
|
|
|
Q_DISABLE_COPY(WorkspaceWrapper)
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
signals:
|
2012-01-21 09:04:47 +00:00
|
|
|
void desktopPresenceChanged(KWin::Client*, int);
|
|
|
|
void currentDesktopChanged(int);
|
|
|
|
void clientAdded(KWin::Client*);
|
|
|
|
void clientRemoved(KWin::Client*);
|
|
|
|
void clientManaging(KWin::Client*);
|
|
|
|
void clientMinimized(KWin::Client*);
|
|
|
|
void clientUnminimized(KWin::Client*);
|
|
|
|
void clientRestored(KWin::Client*);
|
|
|
|
void clientMaximizeSet(KWin::Client*, bool, bool);
|
|
|
|
void killWindowCalled(KWin::Client*);
|
|
|
|
void clientActivated(KWin::Client*);
|
|
|
|
void clientFullScreenSet(KWin::Client*, bool, bool);
|
|
|
|
void clientSetKeepAbove(KWin::Client*, bool);
|
2012-01-26 07:22:54 +00:00
|
|
|
/**
|
|
|
|
* Signal emitted whenever the number of desktops changed.
|
|
|
|
* To get the current number of desktops use the property desktops.
|
|
|
|
* @param oldNumberOfDesktops The previous number of desktops.
|
|
|
|
**/
|
|
|
|
void numberDesktopsChanged(int oldNumberOfDesktops);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
public:
|
2012-01-22 11:38:03 +00:00
|
|
|
WorkspaceWrapper(QObject* parent = 0);
|
2012-01-26 07:22:54 +00:00
|
|
|
#define GETTERSETTERDEF( rettype, getter, setter ) \
|
|
|
|
rettype getter() const; \
|
|
|
|
void setter( rettype val );
|
|
|
|
GETTERSETTERDEF(int, numberOfDesktops, setNumberOfDesktops)
|
|
|
|
#undef GETTERSETTERDEF
|
2011-01-30 14:34:42 +00:00
|
|
|
int currentDesktop() const;
|
2012-01-21 16:48:07 +00:00
|
|
|
void setCurrentDesktop(int desktop);
|
|
|
|
KWin::Client *activeClient();
|
|
|
|
void setActiveClient(KWin::Client *client);
|
|
|
|
QSize desktopGridSize() const;
|
|
|
|
int desktopGridWidth() const;
|
|
|
|
int desktopGridHeight() const;
|
|
|
|
int workspaceWidth() const;
|
|
|
|
int workspaceHeight() const;
|
|
|
|
QSize workspaceSize() const;
|
|
|
|
|
|
|
|
Q_INVOKABLE QList< KWin::Client* > clientList() const;
|
2012-01-21 09:51:22 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void setupClientConnections(KWin::Client* client);
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2010-09-21 14:31:40 +00:00
|
|
|
|
2010-12-12 18:22:09 +00:00
|
|
|
}
|
2010-09-21 14:31:40 +00:00
|
|
|
|
|
|
|
#endif
|