~dandrader/unity-api/initialSurfaceGeom

« back to all changes in this revision

Viewing changes to include/unity/shell/application/MirSurfaceInterface.h

  • Committer: CI Train Bot
  • Author(s): Daniel d'Andrada
  • Date: 2015-08-27 08:50:41 UTC
  • mfrom: (183.1.1 mirSurface-15.04)
  • Revision ID: ci-train-bot@canonical.com-20150827085041-6plt7erf4572ymoh
Added MirSurface and MirSurfaceItem interfaces
Approved by: Gerry Boland

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 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
/**
 
33
   @brief Holds a Mir surface. Pretty much an opaque class.
 
34
 
 
35
   All surface manipulation is done by giving it to a MirSurfaceItem and then
 
36
   using MirSurfaceItem's properties.
 
37
 */
 
38
class MirSurfaceInterface : public QObject
 
39
{
 
40
    Q_OBJECT
 
41
 
 
42
    /**
 
43
     * @brief The surface type
 
44
     */
 
45
    Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged)
 
46
 
 
47
    /**
 
48
     * @brief Name of the surface, given by the client application
 
49
     */
 
50
    Q_PROPERTY(QString name READ name CONSTANT)
 
51
 
 
52
    /**
 
53
     * @brief Size of the current surface buffer, in pixels.
 
54
     */
 
55
    Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
 
56
 
 
57
    /**
 
58
     * @brief State of the surface
 
59
     */
 
60
    Q_PROPERTY(Mir::State state READ state WRITE setState NOTIFY stateChanged)
 
61
 
 
62
    /**
 
63
     * @brief True if it has a mir client bound to it.
 
64
     * A "zombie" (live == false) surface never becomes alive again.
 
65
     */
 
66
    Q_PROPERTY(bool live READ live NOTIFY liveChanged)
 
67
 
 
68
    /**
 
69
     * @brief Orientation angle of the surface
 
70
     *
 
71
     * How many degrees, clockwise, the UI in the surface has to rotate to match shell's UI orientation
 
72
     */
 
73
    Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle
 
74
               NOTIFY orientationAngleChanged DESIGNABLE false)
 
75
 
 
76
public:
 
77
    /// @cond
 
78
    MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {}
 
79
    virtual ~MirSurfaceInterface() {}
 
80
 
 
81
    virtual Mir::Type type() const = 0;
 
82
 
 
83
    virtual QString name() const = 0;
 
84
 
 
85
    virtual QSize size() const = 0;
 
86
    virtual void resize(int width, int height) = 0;
 
87
    virtual void resize(const QSize &size) = 0;
 
88
 
 
89
    virtual Mir::State state() const = 0;
 
90
    virtual void setState(Mir::State qmlState) = 0;
 
91
 
 
92
    virtual bool live() const = 0;
 
93
 
 
94
    virtual Mir::OrientationAngle orientationAngle() const = 0;
 
95
    virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0;
 
96
    /// @endcond
 
97
 
 
98
Q_SIGNALS:
 
99
    /// @cond
 
100
    void typeChanged(Mir::Type value);
 
101
    void liveChanged(bool value);
 
102
    void stateChanged(Mir::State value);
 
103
    void orientationAngleChanged(Mir::OrientationAngle value);
 
104
    void sizeChanged(const QSize &value);
 
105
    /// @endcond
 
106
};
 
107
 
 
108
} // namespace application
 
109
} // namespace shell
 
110
} // namespace unity
 
111
 
 
112
Q_DECLARE_METATYPE(unity::shell::application::MirSurfaceInterface*)
 
113
 
 
114
#endif // UNITY_SHELL_APPLICATION_MIRSURFACE_H