MirSurfaceItemInterface.h
/*
* Copyright (C) 2015 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_MIRSURFACEITEM_H
#define LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H
#include "Mir.h"
#include <QQuickItem>
namespace lomiri
{
namespace shell
{
namespace application
{
class MirSurfaceInterface;
class MirSurfaceItemInterface : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(lomiri::shell::application::MirSurfaceInterface* surface READ surface WRITE setSurface NOTIFY surfaceChanged)
Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
Q_PROPERTY(Mir::State surfaceState READ surfaceState NOTIFY surfaceStateChanged)
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(bool live READ live NOTIFY liveChanged)
Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
NOTIFY orientationAngleChanged DESIGNABLE false)
Q_PROPERTY(bool consumesInput READ consumesInput
WRITE setConsumesInput
NOTIFY consumesInputChanged)
Q_PROPERTY(int surfaceWidth READ surfaceWidth
WRITE setSurfaceWidth
NOTIFY surfaceWidthChanged)
Q_PROPERTY(int surfaceHeight READ surfaceHeight
WRITE setSurfaceHeight
NOTIFY surfaceHeightChanged)
Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged)
public:
enum FillMode {
Stretch,
PadOrCrop
};
Q_ENUM(FillMode)
MirSurfaceItemInterface(QQuickItem *parent = 0) : QQuickItem(parent) {}
virtual ~MirSurfaceItemInterface() {}
virtual Mir::Type type() const = 0;
virtual QString name() const = 0;
virtual bool live() const = 0;
virtual Mir::State surfaceState() const = 0;
virtual Mir::OrientationAngle orientationAngle() const = 0;
virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
virtual MirSurfaceInterface* surface() const = 0;
virtual void setSurface(MirSurfaceInterface*) = 0;
virtual bool consumesInput() const = 0;
virtual void setConsumesInput(bool value) = 0;
virtual int surfaceWidth() const = 0;
virtual void setSurfaceWidth(int value) = 0;
virtual int surfaceHeight() const = 0;
virtual void setSurfaceHeight(int value) = 0;
virtual FillMode fillMode() const = 0;
virtual void setFillMode(FillMode value) = 0;
virtual Mir::ShellChrome shellChrome() const = 0;
Q_SIGNALS:
void typeChanged(Mir::Type);
void surfaceStateChanged(Mir::State);
void liveChanged(bool live);
void orientationAngleChanged(Mir::OrientationAngle angle);
void surfaceChanged(lomiri::shell::application::MirSurfaceInterface* surface);
void consumesInputChanged(bool value);
void surfaceWidthChanged(int value);
void surfaceHeightChanged(int value);
void nameChanged(const QString &name);
void fillModeChanged(FillMode value);
void shellChromeChanged(Mir::ShellChrome value);
};
} // namespace application
} // namespace shell
} // namespace lomiri
#endif // LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H
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::MirSurfaceItemInterface
Renders a MirSurface in a QML scene and forwards the input events it receives to it.
Definition: MirSurfaceItemInterface.h:41
lomiri::shell::application::MirSurfaceItemInterface::name
QString name
Name of the given surface or an empty string if no surface is set.
Definition: MirSurfaceItemInterface.h:62
lomiri::shell::application::MirSurfaceItemInterface::live
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:68
lomiri::shell::application::MirSurfaceItemInterface::surface
lomiri::shell::application::MirSurfaceInterface * surface
The surface to be displayed.
Definition: MirSurfaceItemInterface.h:47
lomiri::shell::application::MirSurfaceItemInterface::type
Mir::Type type
Type of the given surface or Mir.UnknownType if no surface is set.
Definition: MirSurfaceItemInterface.h:52
lomiri::shell::application::MirSurfaceItemInterface::orientationAngle
Mir::OrientationAngle orientationAngle
Orientation angle of the given surface.
Definition: MirSurfaceItemInterface.h:76
lomiri::shell::application::MirSurfaceItemInterface::surfaceWidth
int surfaceWidth
The desired width for the contained MirSurface. It's ignored if set to zero or a negative number The ...
Definition: MirSurfaceItemInterface.h:95
lomiri::shell::application::MirSurfaceItemInterface::surfaceHeight
int surfaceHeight
The desired height for the contained MirSurface. It's ignored if set to zero or a negative number The...
Definition: MirSurfaceItemInterface.h:104
lomiri::shell::application::MirSurfaceItemInterface::consumesInput
bool consumesInput
Whether the item will forward activeFocus, touch events, mouse events and key events to its surface....
Definition: MirSurfaceItemInterface.h:86
lomiri::shell::application::MirSurfaceItemInterface::shellChrome
Mir::ShellChrome shellChrome
The Shell chrome mode.
Definition: MirSurfaceItemInterface.h:111
lomiri::shell::application::MirSurfaceItemInterface::surfaceState
Mir::State surfaceState
State of the given surface or Mir.UnknownState if no surface is set.
Definition: MirSurfaceItemInterface.h:57
lomiri
Top-level namespace for all things Lomiri-related.
Definition: Version.h:38