My Project
MirSurfaceInterface.h
1 /*
2  * Copyright (C) 2015 Canonical, Ltd.
3  *
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.
7  *
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.
12  *
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/>.
15  */
16 
17 #ifndef UNITY_SHELL_APPLICATION_MIRSURFACE_H
18 #define UNITY_SHELL_APPLICATION_MIRSURFACE_H
19 
20 #include <QObject>
21 #include <QSize>
22 
23 #include "Mir.h"
24 
25 namespace unity
26 {
27 namespace shell
28 {
29 namespace application
30 {
31 
38 class MirSurfaceInterface : public QObject
39 {
40  Q_OBJECT
41 
45  Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
46 
47 
50  Q_PROPERTY(QString name READ name CONSTANT)
51 
55  Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
56 
60  Q_PROPERTY(Mir::State state READ state WRITE setState NOTIFY stateChanged)
61 
66  Q_PROPERTY(bool live READ live NOTIFY liveChanged)
67 
73  Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
74  NOTIFY orientationAngleChanged DESIGNABLE false)
75 
76 public:
78  MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
79  virtual ~MirSurfaceInterface() {}
80 
81  virtual Mir::Type type() const = 0;
82 
83  virtual QString name() const = 0;
84 
85  virtual QSize size() const = 0;
86  virtual void resize(int width, int height) = 0;
87  virtual void resize(const QSize &size) = 0;
88 
89  virtual Mir::State state() const = 0;
90  virtual void setState(Mir::State qmlState) = 0;
91 
92  virtual bool live() const = 0;
93 
94  virtual Mir::OrientationAngle orientationAngle() const = 0;
95  virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
97 
98 Q_SIGNALS:
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);
106 };
107 
108 } // namespace application
109 } // namespace shell
110 } // namespace unity
111 
113 
114 #endif // UNITY_SHELL_APPLICATION_MIRSURFACE_H
Type
Surface type.
Definition: Mir.h:36
Mir::Type type
The surface type.
Definition: MirSurfaceInterface.h:45
State
Surface state.
Definition: Mir.h:52
QString name
Name of the surface, given by the client application.
Definition: MirSurfaceInterface.h:50
Mir::OrientationAngle orientationAngle
Orientation angle of the surface.
Definition: MirSurfaceInterface.h:74
Top-level namespace for all things Unity-related.
Definition: Version.h:37
QSize size
Size of the current surface buffer, in pixels.
Definition: MirSurfaceInterface.h:55
Mir::State state
State of the surface.
Definition: MirSurfaceInterface.h:60
OrientationAngle
Surface orientation angle.
Definition: Mir.h:66
Acting as a namespace to hold enums and such for use in QML.
Definition: Mir.h:25
bool live
True if it has a mir client bound to it. A "zombie" (live == false) surface never becomes alive again...
Definition: MirSurfaceInterface.h:66
Holds a Mir surface. Pretty much an opaque class.
Definition: MirSurfaceInterface.h:38