1
/********************************************************************
2
KWin - the KDE window manager
3
This file is part of the KDE project.
5
Copyright (C) 2010 Rohan Prabhu <rohan@rohanprabhu.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 KWIN_SCRIPTING_WINDOWINFO_H
22
#define KWIN_SCRIPTING_WINDOWINFO_H
24
#include "./../client.h"
28
#include <kwindowsystem.h>
29
#include <kwindowinfo.h>
31
#include <QScriptEngine>
33
// The following two extremely helpful functions are taken
34
// from the KWin Scripting proof-of-concept submitted by
35
// Lubos Lunak <l.lunak@kde.org>. Copyrights belong with
36
// original author (Lubos Lunak).
41
#define MAP_GET2(name, type2) \
42
type2 SWrapper::WindowInfo::name() const { \
43
return type2(infoClass.name()); \
46
#define MAP_GET(name, type) \
47
type SWrapper::WindowInfo::name() const { \
48
return infoClass.name(); \
51
#define MAP_SET(name, type) \
52
void SWrapper::Toplevel::name(type value) { \
53
subObject->name(value); \
60
// No signals/slots here, but the usage of properties
61
// would make things a breeze, so a QObject it is.
62
class WindowInfo : public QObject
66
KWindowInfo infoClass;
67
QScriptEngine* centralEngine;
70
* The info about a lot of window properties enumerated from the
71
* client this windowinfo was generated from.
73
Q_PROPERTY(bool valid READ valid)
74
Q_PROPERTY(int state READ state)
75
Q_PROPERTY(bool isMinimized READ isMinimized)
76
Q_PROPERTY(QString visibleName READ visibleName)
77
Q_PROPERTY(QString windowClassClass READ windowClassClass)
78
Q_PROPERTY(QString windowClassName READ windowClassName)
79
Q_PROPERTY(QString windowRole READ windowRole)
83
bool isMinimized() const;
84
QString visibleName() const;
86
QString windowClassClass() const;
87
QString windowClassName() const;
88
QString windowRole() const;
91
WindowInfo(const KWindowInfo, QScriptEngine*, QObject* parent = 0);
92
static QScriptValue generate(const KWindowInfo, QScriptEngine*, KWin::Client* client = 0);