Loading...
Searching...
No Matches
MirSurfaceInterface.h
/*
* Copyright (C) 2015-2016 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOMIRI_SHELL_APPLICATION_MIRSURFACE_H
#define LOMIRI_SHELL_APPLICATION_MIRSURFACE_H
#include <QObject>
#include <QRect>
#include <QSize>
#include "Mir.h"
namespace lomiri
{
namespace shell
{
namespace application
{
class MirSurfaceListInterface;
class MirSurfaceInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QString persistentId READ persistentId CONSTANT)
Q_PROPERTY(QString appId READ appId CONSTANT)
Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
Q_PROPERTY(QPoint requestedPosition READ requestedPosition WRITE setRequestedPosition NOTIFY requestedPositionChanged)
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
Q_PROPERTY(Mir::State state READ state NOTIFY stateChanged)
Q_PROPERTY(bool live READ live NOTIFY liveChanged)
Q_PROPERTY(bool isReady READ isReady NOTIFY ready)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
NOTIFY orientationAngleChanged DESIGNABLE false)
Q_PROPERTY(int minimumWidth READ minimumWidth NOTIFY minimumWidthChanged)
Q_PROPERTY(int minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
Q_PROPERTY(int maximumWidth READ maximumWidth NOTIFY maximumWidthChanged)
Q_PROPERTY(int maximumHeight READ maximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(int widthIncrement READ widthIncrement NOTIFY widthIncrementChanged)
Q_PROPERTY(int heightIncrement READ heightIncrement NOTIFY heightIncrementChanged)
Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged)
Q_PROPERTY(QString keymap READ keymap WRITE setKeymap NOTIFY keymapChanged)
Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
Q_PROPERTY(QRect inputBounds READ inputBounds NOTIFY inputBoundsChanged)
Q_PROPERTY(bool confinesMousePointer READ confinesMousePointer NOTIFY confinesMousePointerChanged)
Q_PROPERTY(bool allowClientResize READ allowClientResize WRITE setAllowClientResize NOTIFY allowClientResizeChanged)
Q_PROPERTY(MirSurfaceInterface* parentSurface READ parentSurface CONSTANT)
Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* childSurfaceList READ childSurfaceList CONSTANT)
public:
MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
virtual ~MirSurfaceInterface() {}
virtual Mir::Type type() const = 0;
virtual QString name() const = 0;
virtual QString persistentId() const = 0;
virtual QString appId() const = 0;
virtual QPoint position() const = 0;
virtual QSize size() const = 0;
virtual void resize(int width, int height) = 0;
virtual void resize(const QSize &size) = 0;
virtual Mir::State state() const = 0;
virtual bool live() const = 0;
virtual bool isReady() const = 0;
virtual bool visible() const = 0;
virtual Mir::OrientationAngle orientationAngle() const = 0;
virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
virtual int minimumWidth() const = 0;
virtual int minimumHeight() const = 0;
virtual int maximumWidth() const = 0;
virtual int maximumHeight() const = 0;
virtual int widthIncrement() const = 0;
virtual int heightIncrement() const = 0;
virtual void setKeymap(const QString &) = 0;
virtual QString keymap() const = 0;
virtual Mir::ShellChrome shellChrome() const = 0;
virtual bool focused() const = 0;
virtual QRect inputBounds() const = 0;
virtual bool confinesMousePointer() const = 0;
virtual bool allowClientResize() const = 0;
virtual void setAllowClientResize(bool) = 0;
virtual QPoint requestedPosition() const = 0;
virtual void setRequestedPosition(const QPoint &) = 0;
virtual MirSurfaceInterface* parentSurface() const = 0;
virtual lomiri::shell::application::MirSurfaceListInterface* childSurfaceList() const = 0;
Q_INVOKABLE virtual void close() = 0;
Q_INVOKABLE virtual void forceClose() = 0;
Q_INVOKABLE virtual void activate() = 0;
public Q_SLOTS:
virtual void requestState(Mir::State state) = 0;
Q_SIGNALS:
void ready();
void typeChanged(Mir::Type value);
void liveChanged(bool value);
void visibleChanged(bool visible);
void stateChanged(Mir::State value);
void orientationAngleChanged(Mir::OrientationAngle value);
void positionChanged(QPoint position);
void requestedPositionChanged(QPoint position);
void sizeChanged(const QSize &value);
void nameChanged(const QString &name);
void minimumWidthChanged(int value);
void minimumHeightChanged(int value);
void maximumWidthChanged(int value);
void maximumHeightChanged(int value);
void widthIncrementChanged(int value);
void heightIncrementChanged(int value);
void shellChromeChanged(Mir::ShellChrome value);
void keymapChanged(const QString &value);
void focusedChanged(bool value);
void inputBoundsChanged(QRect value);
void confinesMousePointerChanged(bool value);
void allowClientResizeChanged(bool value);
void focusRequested();
void closeRequested();
};
} // namespace application
} // namespace shell
} // namespace lomiri
Q_DECLARE_METATYPE(lomiri::shell::application::MirSurfaceInterface*)
#endif // LOMIRI_SHELL_APPLICATION_MIRSURFACE_H
Mir
Acting mostly as a namespace to hold enums and such for use in QML.
Definition Mir.h:26
Mir::State
State
Surface state.
Definition Mir.h:64
Mir::ShellChrome
ShellChrome
Shell chrome.
Definition Mir.h:97
Mir::Type
Type
Surface type.
Definition Mir.h:47
Mir::OrientationAngle
OrientationAngle
Surface orientation angle.
Definition Mir.h:86
lomiri::shell::application::MirSurfaceInterface
Holds a Mir surface. Pretty much an opaque class.
Definition MirSurfaceInterface.h:42
lomiri::shell::application::MirSurfaceInterface::minimumHeight
int minimumHeight
The requested minimum height for the surface Zero if not set.
Definition MirSurfaceInterface.h:120
lomiri::shell::application::MirSurfaceInterface::childSurfaceList
lomiri::shell::application::MirSurfaceListInterface * childSurfaceList
The list of child surfaces.
Definition MirSurfaceInterface.h:196
lomiri::shell::application::MirSurfaceInterface::activate
virtual Q_INVOKABLE void activate()=0
Activates this surface.
lomiri::shell::application::MirSurfaceInterface::isReady
bool isReady
True if surface is ready MirAL decides surface ready when it swaps its first frame.
Definition MirSurfaceInterface.h:95
lomiri::shell::application::MirSurfaceInterface::appId
QString appId
App Id of the app this surface belongs to.
Definition MirSurfaceInterface.h:63
lomiri::shell::application::MirSurfaceInterface::parentSurface
MirSurfaceInterface * parentSurface
The parent MirSurface or null if this is a top-level surface.
Definition MirSurfaceInterface.h:188
lomiri::shell::application::MirSurfaceInterface::size
QSize size
Size of the current surface buffer, in pixels.
Definition MirSurfaceInterface.h:78
lomiri::shell::application::MirSurfaceInterface::focusRequested
void focusRequested()
Emitted in response to a requestFocus() call.
lomiri::shell::application::MirSurfaceInterface::widthIncrement
int widthIncrement
The requested width increment for the surface Zero if not set.
Definition MirSurfaceInterface.h:138
lomiri::shell::application::MirSurfaceInterface::visible
bool visible
Visibility of the surface.
Definition MirSurfaceInterface.h:100
lomiri::shell::application::MirSurfaceInterface::state
Mir::State state
State of the surface.
Definition MirSurfaceInterface.h:83
lomiri::shell::application::MirSurfaceInterface::maximumHeight
int maximumHeight
The requested maximum height for the surface Zero if not set.
Definition MirSurfaceInterface.h:132
lomiri::shell::application::MirSurfaceInterface::close
virtual Q_INVOKABLE void close()=0
Sends a close request.
lomiri::shell::application::MirSurfaceInterface::live
bool live
True if it has a mir client bound to it. A "zombie" (live == false) surface never becomes alive again...
Definition MirSurfaceInterface.h:89
lomiri::shell::application::MirSurfaceInterface::minimumWidth
int minimumWidth
The requested minimum width for the surface Zero if not set.
Definition MirSurfaceInterface.h:114
lomiri::shell::application::MirSurfaceInterface::inputBounds
QRect inputBounds
Input bounds.
Definition MirSurfaceInterface.h:169
lomiri::shell::application::MirSurfaceInterface::requestedPosition
QPoint requestedPosition
Requested position of the current surface buffer, in pixels.
Definition MirSurfaceInterface.h:73
lomiri::shell::application::MirSurfaceInterface::focused
bool focused
Whether the surface is focused.
Definition MirSurfaceInterface.h:162
lomiri::shell::application::MirSurfaceInterface::shellChrome
Mir::ShellChrome shellChrome
The Shell chrome mode.
Definition MirSurfaceInterface.h:149
lomiri::shell::application::MirSurfaceInterface::allowClientResize
bool allowClientResize
Whether to comply to resize requests coming from the client side.
Definition MirSurfaceInterface.h:183
lomiri::shell::application::MirSurfaceInterface::type
Mir::Type type
The surface type.
Definition MirSurfaceInterface.h:48
lomiri::shell::application::MirSurfaceInterface::forceClose
virtual Q_INVOKABLE void forceClose()=0
Sends a force close request.
lomiri::shell::application::MirSurfaceInterface::name
QString name
Name of the surface, given by the client application.
Definition MirSurfaceInterface.h:53
lomiri::shell::application::MirSurfaceInterface::maximumWidth
int maximumWidth
The requested maximum width for the surface Zero if not set.
Definition MirSurfaceInterface.h:126
lomiri::shell::application::MirSurfaceInterface::keymap
QString keymap
The requested keymap for this surface Its format is "layout+variant".
Definition MirSurfaceInterface.h:155
lomiri::shell::application::MirSurfaceInterface::position
QPoint position
Position of the current surface buffer, in pixels.
Definition MirSurfaceInterface.h:68
lomiri::shell::application::MirSurfaceInterface::heightIncrement
int heightIncrement
The requested height increment for the surface Zero if not set.
Definition MirSurfaceInterface.h:144
lomiri::shell::application::MirSurfaceInterface::requestState
virtual void requestState(Mir::State state)=0
Requests a change to the specified state.
lomiri::shell::application::MirSurfaceInterface::confinesMousePointer
bool confinesMousePointer
Whether the surface wants to confine the mouse pointer within its boundaries.
Definition MirSurfaceInterface.h:176
lomiri::shell::application::MirSurfaceInterface::orientationAngle
Mir::OrientationAngle orientationAngle
Orientation angle of the surface.
Definition MirSurfaceInterface.h:108
lomiri::shell::application::MirSurfaceInterface::persistentId
QString persistentId
Persistent Id of the surface.
Definition MirSurfaceInterface.h:58
lomiri::shell::application::MirSurfaceInterface::closeRequested
void closeRequested()
Emitted when close() is called.
lomiri::shell::application::MirSurfaceListInterface
Interface for a list model of MirSurfaces.
Definition MirSurfaceListInterface.h:32
lomiri
Top-level namespace for all things Lomiri-related.
Definition Version.h:38