My Project
Loading...
Searching...
No Matches
MirSurfaceItemInterface.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 LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H
18#define LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H
19
20#include "Mir.h"
21
22#include <QQuickItem>
23
24#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
25Q_MOC_INCLUDE("MirSurfaceInterface.h")
26#endif
27
28namespace lomiri
29{
30namespace shell
31{
32namespace application
33{
34
35class MirSurfaceInterface;
36
44class MirSurfaceItemInterface : public QQuickItem
45{
46 Q_OBJECT
47
51 Q_PROPERTY(lomiri::shell::application::MirSurfaceInterface* surface READ surface WRITE setSurface NOTIFY surfaceChanged)
52
53
56 Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
57
61 Q_PROPERTY(Mir::State surfaceState READ surfaceState NOTIFY surfaceStateChanged)
62
66 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
67
72 Q_PROPERTY(bool live READ live NOTIFY liveChanged)
73
79 Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
80 NOTIFY orientationAngleChanged DESIGNABLE false)
81
82
88 Q_PROPERTY(bool consumesInput READ consumesInput
89 WRITE setConsumesInput
90 NOTIFY consumesInputChanged)
91
97 Q_PROPERTY(int surfaceWidth READ surfaceWidth
98 WRITE setSurfaceWidth
99 NOTIFY surfaceWidthChanged)
100
106 Q_PROPERTY(int surfaceHeight READ surfaceHeight
107 WRITE setSurfaceHeight
108 NOTIFY surfaceHeightChanged)
109
110 Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
111
115 Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged)
116
117public:
118
119 enum FillMode {
120 Stretch,
121 PadOrCrop
122 };
123 Q_ENUM(FillMode)
124
125
126 MirSurfaceItemInterface(QQuickItem *parent = 0) : QQuickItem(parent) {}
127 virtual ~MirSurfaceItemInterface() {}
128
129 virtual Mir::Type type() const = 0;
130 virtual QString name() const = 0;
131 virtual bool live() const = 0;
132
133 virtual Mir::State surfaceState() const = 0;
134
135 virtual Mir::OrientationAngle orientationAngle() const = 0;
136 virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
137
138 virtual MirSurfaceInterface* surface() const = 0;
139 virtual void setSurface(MirSurfaceInterface*) = 0;
140
141 virtual bool consumesInput() const = 0;
142 virtual void setConsumesInput(bool value) = 0;
143
144 virtual int surfaceWidth() const = 0;
145 virtual void setSurfaceWidth(int value) = 0;
146
147 virtual int surfaceHeight() const = 0;
148 virtual void setSurfaceHeight(int value) = 0;
149
150 virtual FillMode fillMode() const = 0;
151 virtual void setFillMode(FillMode value) = 0;
152
153 virtual Mir::ShellChrome shellChrome() const = 0;
155
156Q_SIGNALS:
158 void typeChanged(Mir::Type);
159 void surfaceStateChanged(Mir::State);
160 void liveChanged(bool live);
161 void orientationAngleChanged(Mir::OrientationAngle angle);
163 void consumesInputChanged(bool value);
164 void surfaceWidthChanged(int value);
165 void surfaceHeightChanged(int value);
166 void nameChanged(const QString &name);
167 void fillModeChanged(FillMode value);
168 void shellChromeChanged(Mir::ShellChrome value);
170};
171
172} // namespace application
173} // namespace shell
174} // namespace lomiri
175
176#endif // LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_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
Renders a MirSurface in a QML scene and forwards the input events it receives to it.
Definition MirSurfaceItemInterface.h:45
QString name
Name of the given surface or an empty string if no surface is set.
Definition MirSurfaceItemInterface.h:66
bool live
True if the item has a surface and that surface has a mir client bound to it. A "zombie" (live == fal...
Definition MirSurfaceItemInterface.h:72
lomiri::shell::application::MirSurfaceInterface * surface
The surface to be displayed.
Definition MirSurfaceItemInterface.h:51
Mir::Type type
Type of the given surface or Mir.UnknownType if no surface is set.
Definition MirSurfaceItemInterface.h:56
Mir::OrientationAngle orientationAngle
Orientation angle of the given surface.
Definition MirSurfaceItemInterface.h:80
int surfaceWidth
The desired width for the contained MirSurface. It's ignored if set to zero or a negative number The ...
Definition MirSurfaceItemInterface.h:99
int surfaceHeight
The desired height for the contained MirSurface. It's ignored if set to zero or a negative number The...
Definition MirSurfaceItemInterface.h:108
bool consumesInput
Whether the item will forward activeFocus, touch events, mouse events and key events to its surface....
Definition MirSurfaceItemInterface.h:90
Mir::ShellChrome shellChrome
The Shell chrome mode.
Definition MirSurfaceItemInterface.h:115
Mir::State surfaceState
State of the given surface or Mir.UnknownState if no surface is set.
Definition MirSurfaceItemInterface.h:61
Top-level namespace for all things Lomiri-related.
Definition Version.h:38