6df910e4e8a65ba7e1eea042f75a986e82d9f25c
[profile/ivi/qtdeclarative.git] / src / qtquick1 / graphicsitems / qdeclarativeanchors_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
6 **
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QDECLARATIVEANCHORS_H
43 #define QDECLARATIVEANCHORS_H
44
45 #include "qdeclarativeitem.h"
46
47 #include <QtDeclarative/qdeclarative.h>
48
49 #include <QtCore/QObject>
50
51 #include <QtDeclarative/private/qdeclarativeglobal_p.h>
52
53 QT_BEGIN_HEADER
54
55 QT_BEGIN_NAMESPACE
56
57
58 class QDeclarative1AnchorsPrivate;
59 class QDeclarative1AnchorLine;
60 class Q_QTQUICK1_EXPORT QDeclarative1Anchors : public QObject
61 {
62     Q_OBJECT
63
64     Q_PROPERTY(QDeclarative1AnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged)
65     Q_PROPERTY(QDeclarative1AnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged)
66     Q_PROPERTY(QDeclarative1AnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged)
67     Q_PROPERTY(QDeclarative1AnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged)
68     Q_PROPERTY(QDeclarative1AnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged)
69     Q_PROPERTY(QDeclarative1AnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged)
70     Q_PROPERTY(QDeclarative1AnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline NOTIFY baselineChanged)
71     Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
72     Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
73     Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
74     Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged)
75     Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
76     Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
77     Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged)
78     Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
79     Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged)
80     Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
81     Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1)
82
83 public:
84     QDeclarative1Anchors(QObject *parent=0);
85     QDeclarative1Anchors(QGraphicsObject *item, QObject *parent=0);
86     virtual ~QDeclarative1Anchors();
87
88     enum Anchor {
89         LeftAnchor = 0x01,
90         RightAnchor = 0x02,
91         TopAnchor = 0x04,
92         BottomAnchor = 0x08,
93         HCenterAnchor = 0x10,
94         VCenterAnchor = 0x20,
95         BaselineAnchor = 0x40,
96         Horizontal_Mask = LeftAnchor | RightAnchor | HCenterAnchor,
97         Vertical_Mask = TopAnchor | BottomAnchor | VCenterAnchor | BaselineAnchor
98     };
99     Q_DECLARE_FLAGS(Anchors, Anchor)
100
101     QDeclarative1AnchorLine left() const;
102     void setLeft(const QDeclarative1AnchorLine &edge);
103     void resetLeft();
104
105     QDeclarative1AnchorLine right() const;
106     void setRight(const QDeclarative1AnchorLine &edge);
107     void resetRight();
108
109     QDeclarative1AnchorLine horizontalCenter() const;
110     void setHorizontalCenter(const QDeclarative1AnchorLine &edge);
111     void resetHorizontalCenter();
112
113     QDeclarative1AnchorLine top() const;
114     void setTop(const QDeclarative1AnchorLine &edge);
115     void resetTop();
116
117     QDeclarative1AnchorLine bottom() const;
118     void setBottom(const QDeclarative1AnchorLine &edge);
119     void resetBottom();
120
121     QDeclarative1AnchorLine verticalCenter() const;
122     void setVerticalCenter(const QDeclarative1AnchorLine &edge);
123     void resetVerticalCenter();
124
125     QDeclarative1AnchorLine baseline() const;
126     void setBaseline(const QDeclarative1AnchorLine &edge);
127     void resetBaseline();
128
129     qreal leftMargin() const;
130     void setLeftMargin(qreal);
131
132     qreal rightMargin() const;
133     void setRightMargin(qreal);
134
135     qreal horizontalCenterOffset() const;
136     void setHorizontalCenterOffset(qreal);
137
138     qreal topMargin() const;
139     void setTopMargin(qreal);
140
141     qreal bottomMargin() const;
142     void setBottomMargin(qreal);
143
144     qreal margins() const;
145     void setMargins(qreal);
146
147     qreal verticalCenterOffset() const;
148     void setVerticalCenterOffset(qreal);
149
150     qreal baselineOffset() const;
151     void setBaselineOffset(qreal);
152
153     QGraphicsObject *fill() const;
154     void setFill(QGraphicsObject *);
155     void resetFill();
156
157     QGraphicsObject *centerIn() const;
158     void setCenterIn(QGraphicsObject *);
159     void resetCenterIn();
160
161     Anchors usedAnchors() const;
162
163     void classBegin();
164     void componentComplete();
165
166     bool mirrored();
167
168 Q_SIGNALS:
169     void leftChanged();
170     void rightChanged();
171     void topChanged();
172     void bottomChanged();
173     void verticalCenterChanged();
174     void horizontalCenterChanged();
175     void baselineChanged();
176     void fillChanged();
177     void centerInChanged();
178     void leftMarginChanged();
179     void rightMarginChanged();
180     void topMarginChanged();
181     void bottomMarginChanged();
182     void marginsChanged();
183     void verticalCenterOffsetChanged();
184     void horizontalCenterOffsetChanged();
185     void baselineOffsetChanged();
186     Q_REVISION(1) void mirroredChanged();
187
188 private:
189     friend class QDeclarativeItem;
190     friend class QDeclarativeItemPrivate;
191     friend class QDeclarative1GraphicsWidget;
192     Q_DISABLE_COPY(QDeclarative1Anchors)
193     Q_DECLARE_PRIVATE(QDeclarative1Anchors)
194     Q_PRIVATE_SLOT(d_func(), void _q_widgetGeometryChanged())
195     Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject *obj))
196 };
197 Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarative1Anchors::Anchors)
198
199 QT_END_NAMESPACE
200
201 QML_DECLARE_TYPE(QDeclarative1Anchors)
202
203 QT_END_HEADER
204
205 #endif