~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to src/maliit/plugins/abstractsurface.h

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-01-31 13:26:48 UTC
  • Revision ID: package-import@ubuntu.com-20130131132648-w1u9d2279tppxcft
Tags: upstream-0.94.1
ImportĀ upstreamĀ versionĀ 0.94.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* * This file is part of Maliit framework *
 
2
 *
 
3
 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
 
4
 * All rights reserved.
 
5
 *
 
6
 * Contact: maliit-discuss@lists.maliit.org
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License version 2.1 as published by the Free Software Foundation
 
11
 * and appearing in the file LICENSE.LGPL included in the packaging
 
12
 * of this file.
 
13
 */
 
14
 
 
15
#ifndef MALIIT_PLUGINS_ABSTRACTSURFACE_H
 
16
#define MALIIT_PLUGINS_ABSTRACTSURFACE_H
 
17
 
 
18
#include <QSharedPointer>
 
19
 
 
20
class QPoint;
 
21
class QSize;
 
22
 
 
23
namespace Maliit {
 
24
namespace Plugins {
 
25
 
 
26
/*! \ingroup pluginapi
 
27
 * \brief The AbstractSurface class provides a window abstraction for rendering the plugin.
 
28
 *
 
29
 */
 
30
class AbstractSurface
 
31
{
 
32
public:
 
33
    /*!
 
34
     * \brief The Option enum describes the postioning and type of a surface
 
35
     */
 
36
    enum Option {
 
37
        None = 0x0,
 
38
 
 
39
        PositionOverlay = 0x1,
 
40
        PositionCenterBottom = 0x2,
 
41
        PositionLeftBottom = 0x4,
 
42
        PositionRightBottom = 0x8,
 
43
 
 
44
        TypeWidget = 0x100,
 
45
        TypeGraphicsView = 0x200,
 
46
        TypeWindow = 0x400,
 
47
        TypeQuick1 = 0x800,
 
48
        TypeQuick2 = 0x1000
 
49
    };
 
50
    Q_DECLARE_FLAGS(Options, Option)
 
51
 
 
52
    /*!
 
53
     * \brief ~AbstractSurface
 
54
     */
 
55
    virtual ~AbstractSurface();
 
56
 
 
57
    /*!
 
58
     * \brief shows the surface.
 
59
     */
 
60
    virtual void show() = 0;
 
61
    /*!
 
62
     * \brief hides the surface and its children.
 
63
     */
 
64
    virtual void hide() = 0;
 
65
 
 
66
    /*!
 
67
     * \brief returns the real size of the surface
 
68
     * \return the surface's real size
 
69
     */
 
70
    virtual QSize size() const = 0;
 
71
    /*!
 
72
     * \brief sets the size of the surface
 
73
     * \param size the requested surface size
 
74
     */
 
75
    virtual void setSize(const QSize &size) = 0;
 
76
 
 
77
    /*!
 
78
     * \brief returns the position of the surface relative to its parent
 
79
     * \return the surface's position relative to its parent
 
80
     */
 
81
    virtual QPoint relativePosition() const = 0;
 
82
 
 
83
    /*!
 
84
     * \brief sets the surface's position relative to its parent (for a PositionOverlay surface)
 
85
     * \param position the requested relative position
 
86
     */
 
87
    virtual void setRelativePosition(const QPoint &position) = 0;
 
88
 
 
89
    /*!
 
90
     * \brief returns the parent of a surface
 
91
     * \return the surface's parent
 
92
     */
 
93
    virtual QSharedPointer<AbstractSurface> parent() const = 0;
 
94
 
 
95
    /*!
 
96
     * \brief translates the coordinates of an event into the surfaces coordinate system
 
97
     * \param eventPosition the coordinates of the event
 
98
     * \param eventSurface the surface where the event occured (by default this)
 
99
     * \return the event coordinates translated to the surface coordinate system
 
100
     */
 
101
    virtual QPoint translateEventPosition(const QPoint &eventPosition,
 
102
                                          const QSharedPointer<AbstractSurface> &eventSurface = QSharedPointer<AbstractSurface>()) const = 0;
 
103
};
 
104
 
 
105
Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractSurface::Options)
 
106
 
 
107
} // namespace Plugins
 
108
} // namespace Maliit
 
109
 
 
110
#endif // MALIIT_PLUGINS_ABSTRACTSURFACE_H
 
111