2
* Copyright (C) 2015 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef UNITY_SHELL_APPLICATION_MIRSURFACE_H
18
#define UNITY_SHELL_APPLICATION_MIRSURFACE_H
33
@brief Holds a Mir surface. Pretty much an opaque class.
35
All surface manipulation is done by giving it to a MirSurfaceItem and then
36
using MirSurfaceItem's properties.
38
class MirSurfaceInterface : public QObject
43
* @brief The surface type
45
Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
48
* @brief Name of the surface, given by the client application
50
Q_PROPERTY(QString name READ name CONSTANT)
53
* @brief Size of the current surface buffer, in pixels.
55
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
58
* @brief State of the surface
60
Q_PROPERTY(Mir::State state READ state WRITE setState NOTIFY stateChanged)
63
* @brief True if it has a mir client bound to it.
64
* A "zombie" (live == false) surface never becomes alive again.
66
Q_PROPERTY(bool live READ live NOTIFY liveChanged)
69
* @brief Orientation angle of the surface
71
* How many degrees, clockwise, the UI in the surface has to rotate to match shell's UI orientation
73
Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
74
NOTIFY orientationAngleChanged DESIGNABLE false)
78
MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
79
virtual ~MirSurfaceInterface() {}
81
virtual Mir::Type type() const = 0;
83
virtual QString name() const = 0;
85
virtual QSize size() const = 0;
86
virtual void resize(int width, int height) = 0;
87
virtual void resize(const QSize &size) = 0;
89
virtual Mir::State state() const = 0;
90
virtual void setState(Mir::State qmlState) = 0;
92
virtual bool live() const = 0;
94
virtual Mir::OrientationAngle orientationAngle() const = 0;
95
virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
100
void typeChanged(Mir::Type value);
101
void liveChanged(bool value);
102
void stateChanged(Mir::State value);
103
void orientationAngleChanged(Mir::OrientationAngle value);
104
void sizeChanged(const QSize &value);
108
} // namespace application
112
Q_DECLARE_METATYPE(unity::shell::application::MirSurfaceInterface*)
114
#endif // UNITY_SHELL_APPLICATION_MIRSURFACE_H