My Project
Loading...
Searching...
No Matches
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 LOMIRI_SHELL_APPLICATION_MIRSURFACE_H
18#define LOMIRI_SHELL_APPLICATION_MIRSURFACE_H
19
20#include <QObject>
21#include <QRect>
22#include <QSize>
23
24#include "Mir.h"
25
26#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
27Q_MOC_INCLUDE("MirSurfaceListInterface.h")
28#endif
29
30namespace lomiri
31{
32namespace shell
33{
34namespace application
35{
36
37class MirSurfaceListInterface;
38
45class MirSurfaceInterface : public QObject
46{
47 Q_OBJECT
48
52 Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
53
54
57 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
58
62 Q_PROPERTY(QString persistentId READ persistentId CONSTANT)
63
67 Q_PROPERTY(QString appId READ appId CONSTANT)
68
72 Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
73
77 Q_PROPERTY(QPoint requestedPosition READ requestedPosition WRITE setRequestedPosition NOTIFY requestedPositionChanged)
78
82 Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
83
87 Q_PROPERTY(Mir::State state READ state NOTIFY stateChanged)
88
93 Q_PROPERTY(bool live READ live NOTIFY liveChanged)
94
99 Q_PROPERTY(bool isReady READ isReady NOTIFY ready)
100
104 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
105
111 Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
112 NOTIFY orientationAngleChanged DESIGNABLE false)
113
118 Q_PROPERTY(int minimumWidth READ minimumWidth NOTIFY minimumWidthChanged)
119
124 Q_PROPERTY(int minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
125
130 Q_PROPERTY(int maximumWidth READ maximumWidth NOTIFY maximumWidthChanged)
131
136 Q_PROPERTY(int maximumHeight READ maximumHeight NOTIFY maximumHeightChanged)
137
142 Q_PROPERTY(int widthIncrement READ widthIncrement NOTIFY widthIncrementChanged)
143
148 Q_PROPERTY(int heightIncrement READ heightIncrement NOTIFY heightIncrementChanged)
149
153 Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged)
154
159 Q_PROPERTY(QString keymap READ keymap WRITE setKeymap NOTIFY keymapChanged)
160
166 Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
167
173 Q_PROPERTY(QRect inputBounds READ inputBounds NOTIFY inputBoundsChanged)
174
180 Q_PROPERTY(bool confinesMousePointer READ confinesMousePointer NOTIFY confinesMousePointerChanged)
181
187 Q_PROPERTY(bool allowClientResize READ allowClientResize WRITE setAllowClientResize NOTIFY allowClientResizeChanged)
188
193
200 Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* childSurfaceList READ childSurfaceList CONSTANT)
201
202public:
204 MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
205 virtual ~MirSurfaceInterface() {}
206
207 virtual Mir::Type type() const = 0;
208
209 virtual QString name() const = 0;
210
211 virtual QString persistentId() const = 0;
212
213 virtual QString appId() const = 0;
214
215 virtual QPoint position() const = 0;
216
217 virtual QSize size() const = 0;
218 virtual void resize(int width, int height) = 0;
219 virtual void resize(const QSize &size) = 0;
220
221 virtual Mir::State state() const = 0;
222
223 virtual bool live() const = 0;
224 virtual bool isReady() const = 0;
225 virtual bool visible() const = 0;
226
227 virtual Mir::OrientationAngle orientationAngle() const = 0;
228 virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
229
230 virtual int minimumWidth() const = 0;
231 virtual int minimumHeight() const = 0;
232 virtual int maximumWidth() const = 0;
233 virtual int maximumHeight() const = 0;
234 virtual int widthIncrement() const = 0;
235 virtual int heightIncrement() const = 0;
236
237 virtual void setKeymap(const QString &) = 0;
238 virtual QString keymap() const = 0;
239
240 virtual Mir::ShellChrome shellChrome() const = 0;
241
242 virtual bool focused() const = 0;
243
244 virtual QRect inputBounds() const = 0;
245
246 virtual bool confinesMousePointer() const = 0;
247
248 virtual bool allowClientResize() const = 0;
249 virtual void setAllowClientResize(bool) = 0;
250
251 virtual QPoint requestedPosition() const = 0;
252 virtual void setRequestedPosition(const QPoint &) = 0;
253
254 virtual MirSurfaceInterface* parentSurface() const = 0;
255
258
263 Q_INVOKABLE virtual void close() = 0;
264
269 Q_INVOKABLE virtual void forceClose() = 0;
270
276 Q_INVOKABLE virtual void activate() = 0;
277
278public Q_SLOTS:
282 virtual void requestState(Mir::State state) = 0;
283
284Q_SIGNALS:
286 void ready();
287 void typeChanged(Mir::Type value);
288 void liveChanged(bool value);
289 void visibleChanged(bool visible);
290 void stateChanged(Mir::State value);
291 void orientationAngleChanged(Mir::OrientationAngle value);
292 void positionChanged(QPoint position);
293 void requestedPositionChanged(QPoint position);
294 void sizeChanged(const QSize &value);
295 void nameChanged(const QString &name);
296 void minimumWidthChanged(int value);
297 void minimumHeightChanged(int value);
298 void maximumWidthChanged(int value);
299 void maximumHeightChanged(int value);
300 void widthIncrementChanged(int value);
301 void heightIncrementChanged(int value);
302 void shellChromeChanged(Mir::ShellChrome value);
303 void keymapChanged(const QString &value);
304 void focusedChanged(bool value);
305 void inputBoundsChanged(QRect value);
306 void confinesMousePointerChanged(bool value);
307 void allowClientResizeChanged(bool value);
309
316
321};
322
323} // namespace application
324} // namespace shell
325} // namespace lomiri
326
328
329#endif // LOMIRI_SHELL_APPLICATION_MIRSURFACE_H
Acting mostly as a namespace to hold enums and such for use in QML.
Definition Mir.h:26
State
Surface state.
Definition Mir.h:64
ShellChrome
Shell chrome.
Definition Mir.h:97
Type
Surface type.
Definition Mir.h:47
OrientationAngle
Surface orientation angle.
Definition Mir.h:86
Holds a Mir surface. Pretty much an opaque class.
Definition MirSurfaceInterface.h:46
int minimumHeight
The requested minimum height for the surface Zero if not set.
Definition MirSurfaceInterface.h:124
lomiri::shell::application::MirSurfaceListInterface * childSurfaceList
The list of child surfaces.
Definition MirSurfaceInterface.h:200
virtual Q_INVOKABLE void activate()=0
Activates this surface.
bool isReady
True if surface is ready MirAL decides surface ready when it swaps its first frame.
Definition MirSurfaceInterface.h:99
QString appId
App Id of the app this surface belongs to.
Definition MirSurfaceInterface.h:67
MirSurfaceInterface * parentSurface
The parent MirSurface or null if this is a top-level surface.
Definition MirSurfaceInterface.h:192
QSize size
Size of the current surface buffer, in pixels.
Definition MirSurfaceInterface.h:82
void focusRequested()
Emitted in response to a requestFocus() call.
int widthIncrement
The requested width increment for the surface Zero if not set.
Definition MirSurfaceInterface.h:142
bool visible
Visibility of the surface.
Definition MirSurfaceInterface.h:104
Mir::State state
State of the surface.
Definition MirSurfaceInterface.h:87
int maximumHeight
The requested maximum height for the surface Zero if not set.
Definition MirSurfaceInterface.h:136
virtual Q_INVOKABLE void close()=0
Sends a close request.
bool live
True if it has a mir client bound to it. A "zombie" (live == false) surface never becomes alive again...
Definition MirSurfaceInterface.h:93
int minimumWidth
The requested minimum width for the surface Zero if not set.
Definition MirSurfaceInterface.h:118
QRect inputBounds
Input bounds.
Definition MirSurfaceInterface.h:173
QPoint requestedPosition
Requested position of the current surface buffer, in pixels.
Definition MirSurfaceInterface.h:77
bool focused
Whether the surface is focused.
Definition MirSurfaceInterface.h:166
Mir::ShellChrome shellChrome
The Shell chrome mode.
Definition MirSurfaceInterface.h:153
bool allowClientResize
Whether to comply to resize requests coming from the client side.
Definition MirSurfaceInterface.h:187
Mir::Type type
The surface type.
Definition MirSurfaceInterface.h:52
virtual Q_INVOKABLE void forceClose()=0
Sends a force close request.
QString name
Name of the surface, given by the client application.
Definition MirSurfaceInterface.h:57
int maximumWidth
The requested maximum width for the surface Zero if not set.
Definition MirSurfaceInterface.h:130
QString keymap
The requested keymap for this surface Its format is "layout+variant".
Definition MirSurfaceInterface.h:159
QPoint position
Position of the current surface buffer, in pixels.
Definition MirSurfaceInterface.h:72
int heightIncrement
The requested height increment for the surface Zero if not set.
Definition MirSurfaceInterface.h:148
virtual void requestState(Mir::State state)=0
Requests a change to the specified state.
bool confinesMousePointer
Whether the surface wants to confine the mouse pointer within its boundaries.
Definition MirSurfaceInterface.h:180
Mir::OrientationAngle orientationAngle
Orientation angle of the surface.
Definition MirSurfaceInterface.h:112
QString persistentId
Persistent Id of the surface.
Definition MirSurfaceInterface.h:62
void closeRequested()
Emitted when close() is called.
Interface for a list model of MirSurfaces.
Definition MirSurfaceListInterface.h:36
Top-level namespace for all things Lomiri-related.
Definition Version.h:38