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 NOTIFY nameChanged)
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 
71  Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
72 
78  Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
79  NOTIFY orientationAngleChanged DESIGNABLE false)
80 
85  Q_PROPERTY(int minimumWidth READ minimumWidth NOTIFY minimumWidthChanged)
86 
91  Q_PROPERTY(int minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
92 
97  Q_PROPERTY(int maximumWidth READ maximumWidth NOTIFY maximumWidthChanged)
98 
103  Q_PROPERTY(int maximumHeight READ maximumHeight NOTIFY maximumHeightChanged)
104 
109  Q_PROPERTY(int widthIncrement READ widthIncrement NOTIFY widthIncrementChanged)
110 
115  Q_PROPERTY(int heightIncrement READ heightIncrement NOTIFY heightIncrementChanged)
116 
120  Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged)
121 
128  Q_PROPERTY(QString keymapLayout READ keymapLayout NOTIFY keymapChanged)
129 
136  Q_PROPERTY(QString keymapVariant READ keymapVariant NOTIFY keymapChanged)
137 
138 public:
140  MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
141  virtual ~MirSurfaceInterface() {}
142 
143  virtual Mir::Type type() const = 0;
144 
145  virtual QString name() const = 0;
146 
147  virtual QSize size() const = 0;
148  virtual void resize(int width, int height) = 0;
149  virtual void resize(const QSize &size) = 0;
150 
151  virtual Mir::State state() const = 0;
152  virtual void setState(Mir::State qmlState) = 0;
153 
154  virtual bool live() const = 0;
155 
156  virtual bool visible() const = 0;
157 
158  virtual Mir::OrientationAngle orientationAngle() const = 0;
159  virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
160 
161  virtual int minimumWidth() const = 0;
162  virtual int minimumHeight() const = 0;
163  virtual int maximumWidth() const = 0;
164  virtual int maximumHeight() const = 0;
165  virtual int widthIncrement() const = 0;
166  virtual int heightIncrement() const = 0;
167 
168  virtual Mir::ShellChrome shellChrome() const = 0;
169  virtual QString keymapLayout() const = 0;
170  virtual QString keymapVariant() const = 0;
171  virtual void setKeymap(const QString &layout, const QString &variant) = 0;
173 
174 Q_SIGNALS:
176  void typeChanged(Mir::Type value);
177  void liveChanged(bool value);
178  void visibleChanged(bool visible);
179  void stateChanged(Mir::State value);
180  void orientationAngleChanged(Mir::OrientationAngle value);
181  void sizeChanged(const QSize &value);
182  void nameChanged(const QString &name);
183  void minimumWidthChanged(int value);
184  void minimumHeightChanged(int value);
185  void maximumWidthChanged(int value);
186  void maximumHeightChanged(int value);
187  void widthIncrementChanged(int value);
188  void heightIncrementChanged(int value);
189  void shellChromeChanged(Mir::ShellChrome value);
190  void keymapChanged(const QString &layout, const QString &variant);
192 };
193 
194 } // namespace application
195 } // namespace shell
196 } // namespace unity
197 
199 
200 #endif // UNITY_SHELL_APPLICATION_MIRSURFACE_H
int heightIncrement
The requested height increment for the surface Zero if not set.
Definition: MirSurfaceInterface.h:115
int minimumHeight
The requested minimum height for the surface Zero if not set.
Definition: MirSurfaceInterface.h:91
Type
Surface type.
Definition: Mir.h:45
Mir::Type type
The surface type.
Definition: MirSurfaceInterface.h:45
int minimumWidth
The requested minimum width for the surface Zero if not set.
Definition: MirSurfaceInterface.h:85
State
Surface state.
Definition: Mir.h:61
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:79
ShellChrome
Shell chrome.
Definition: Mir.h:85
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
QString keymapLayout
Keymap layout.
Definition: MirSurfaceInterface.h:128
int maximumWidth
The requested maximum width for the surface Zero if not set.
Definition: MirSurfaceInterface.h:97
Mir::State state
State of the surface.
Definition: MirSurfaceInterface.h:60
int maximumHeight
The requested maximum height for the surface Zero if not set.
Definition: MirSurfaceInterface.h:103
OrientationAngle
Surface orientation angle.
Definition: Mir.h:75
Acting mostly as a namespace to hold enums and such for use in QML.
Definition: Mir.h:25
QString keymapVariant
Keymap variant.
Definition: MirSurfaceInterface.h:136
int widthIncrement
The requested width increment for the surface Zero if not set.
Definition: MirSurfaceInterface.h:109
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
bool visible
Visibility of the surface.
Definition: MirSurfaceInterface.h:71
Mir::ShellChrome shellChrome
The Shell chrome mode.
Definition: MirSurfaceInterface.h:120
Holds a Mir surface. Pretty much an opaque class.
Definition: MirSurfaceInterface.h:38