My Project
MirSurfaceInterface.h
1 /*
2  * Copyright (C) 2015-2016 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 
32 class MirSurfaceListInterface;
33 
40 class MirSurfaceInterface : public QObject
41 {
42  Q_OBJECT
43 
47  Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
48 
49 
52  Q_PROPERTY(QString name READ name NOTIFY nameChanged)
53 
57  Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
58 
62  Q_PROPERTY(Mir::State state READ state WRITE setState NOTIFY stateChanged)
63 
68  Q_PROPERTY(bool live READ live NOTIFY liveChanged)
69 
73  Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
74 
80  Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
81  NOTIFY orientationAngleChanged DESIGNABLE false)
82 
87  Q_PROPERTY(int minimumWidth READ minimumWidth NOTIFY minimumWidthChanged)
88 
93  Q_PROPERTY(int minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
94 
99  Q_PROPERTY(int maximumWidth READ maximumWidth NOTIFY maximumWidthChanged)
100 
105  Q_PROPERTY(int maximumHeight READ maximumHeight NOTIFY maximumHeightChanged)
106 
111  Q_PROPERTY(int widthIncrement READ widthIncrement NOTIFY widthIncrementChanged)
112 
117  Q_PROPERTY(int heightIncrement READ heightIncrement NOTIFY heightIncrementChanged)
118 
122  Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged)
123 
128  Q_PROPERTY(QString keymap READ keymap WRITE setKeymap NOTIFY keymapChanged)
129 
135  Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
136 
137 public:
139  MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
140  virtual ~MirSurfaceInterface() {}
141 
142  virtual Mir::Type type() const = 0;
143 
144  virtual QString name() const = 0;
145 
146  virtual QSize size() const = 0;
147  virtual void resize(int width, int height) = 0;
148  virtual void resize(const QSize &size) = 0;
149 
150  virtual Mir::State state() const = 0;
151  virtual void setState(Mir::State qmlState) = 0;
152 
153  virtual bool live() const = 0;
154 
155  virtual bool visible() const = 0;
156 
157  virtual Mir::OrientationAngle orientationAngle() const = 0;
158  virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
159 
160  virtual int minimumWidth() const = 0;
161  virtual int minimumHeight() const = 0;
162  virtual int maximumWidth() const = 0;
163  virtual int maximumHeight() const = 0;
164  virtual int widthIncrement() const = 0;
165  virtual int heightIncrement() const = 0;
166 
167  virtual void setKeymap(const QString &) = 0;
168  virtual QString keymap() const = 0;
169 
170  virtual Mir::ShellChrome shellChrome() const = 0;
171 
172  virtual bool focused() const = 0;
174 
180  Q_INVOKABLE virtual void requestFocus() = 0;
181 
186  Q_INVOKABLE virtual void close() = 0;
187 
191  Q_INVOKABLE virtual void raise() = 0;
192 
193 Q_SIGNALS:
195  void typeChanged(Mir::Type value);
196  void liveChanged(bool value);
197  void visibleChanged(bool visible);
198  void stateChanged(Mir::State value);
199  void orientationAngleChanged(Mir::OrientationAngle value);
200  void sizeChanged(const QSize &value);
201  void nameChanged(const QString &name);
202  void minimumWidthChanged(int value);
203  void minimumHeightChanged(int value);
204  void maximumWidthChanged(int value);
205  void maximumHeightChanged(int value);
206  void widthIncrementChanged(int value);
207  void heightIncrementChanged(int value);
208  void shellChromeChanged(Mir::ShellChrome value);
209  void keymapChanged(const QString &value);
210  void focusedChanged(bool value);
212 
216  void focusRequested();
217 };
218 
219 } // namespace application
220 } // namespace shell
221 } // namespace unity
222 
224 
225 #endif // UNITY_SHELL_APPLICATION_MIRSURFACE_H
int heightIncrement
The requested height increment for the surface Zero if not set.
Definition: MirSurfaceInterface.h:117
int minimumHeight
The requested minimum height for the surface Zero if not set.
Definition: MirSurfaceInterface.h:93
Type
Surface type.
Definition: Mir.h:45
virtual Q_INVOKABLE void requestFocus()=0
Requests focus for this surface.
Mir::Type type
The surface type.
Definition: MirSurfaceInterface.h:47
int minimumWidth
The requested minimum width for the surface Zero if not set.
Definition: MirSurfaceInterface.h:87
State
Surface state.
Definition: Mir.h:61
QString name
Name of the surface, given by the client application.
Definition: MirSurfaceInterface.h:52
virtual Q_INVOKABLE void close()=0
Sends a close request.
Mir::OrientationAngle orientationAngle
Orientation angle of the surface.
Definition: MirSurfaceInterface.h:81
ShellChrome
Shell chrome.
Definition: Mir.h:85
Top-level namespace for all things Unity-related.
Definition: Version.h:37
QString keymap
The requested keymap for this surface Its format is "layout+variant".
Definition: MirSurfaceInterface.h:128
bool focused
Whether the surface is focused.
Definition: MirSurfaceInterface.h:135
QSize size
Size of the current surface buffer, in pixels.
Definition: MirSurfaceInterface.h:57
int maximumWidth
The requested maximum width for the surface Zero if not set.
Definition: MirSurfaceInterface.h:99
Mir::State state
State of the surface.
Definition: MirSurfaceInterface.h:62
void focusRequested()
Emitted in response to a requestFocus() call.
int maximumHeight
The requested maximum height for the surface Zero if not set.
Definition: MirSurfaceInterface.h:105
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
int widthIncrement
The requested width increment for the surface Zero if not set.
Definition: MirSurfaceInterface.h:111
bool live
True if it has a mir client bound to it. A "zombie" (live == false) surface never becomes alive again...
Definition: MirSurfaceInterface.h:68
bool visible
Visibility of the surface.
Definition: MirSurfaceInterface.h:73
Mir::ShellChrome shellChrome
The Shell chrome mode.
Definition: MirSurfaceInterface.h:122
Holds a Mir surface. Pretty much an opaque class.
Definition: MirSurfaceInterface.h:40