1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEANCHORS_H
43 #define QDECLARATIVEANCHORS_H
45 #include "qdeclarativeitem.h"
47 #include <QtDeclarative/qdeclarative.h>
49 #include <QtCore/QObject>
51 #include <QtDeclarative/private/qdeclarativeglobal_p.h>
57 QT_MODULE(Declarative)
59 class QDeclarative1AnchorsPrivate;
60 class QDeclarative1AnchorLine;
61 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarative1Anchors : public QObject
65 Q_PROPERTY(QDeclarative1AnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged)
66 Q_PROPERTY(QDeclarative1AnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged)
67 Q_PROPERTY(QDeclarative1AnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged)
68 Q_PROPERTY(QDeclarative1AnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged)
69 Q_PROPERTY(QDeclarative1AnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged)
70 Q_PROPERTY(QDeclarative1AnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged)
71 Q_PROPERTY(QDeclarative1AnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline NOTIFY baselineChanged)
72 Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
73 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
74 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
75 Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged)
76 Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
77 Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
78 Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged)
79 Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
80 Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged)
81 Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
82 Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1)
85 QDeclarative1Anchors(QObject *parent=0);
86 QDeclarative1Anchors(QGraphicsObject *item, QObject *parent=0);
87 virtual ~QDeclarative1Anchors();
96 BaselineAnchor = 0x40,
97 Horizontal_Mask = LeftAnchor | RightAnchor | HCenterAnchor,
98 Vertical_Mask = TopAnchor | BottomAnchor | VCenterAnchor | BaselineAnchor
100 Q_DECLARE_FLAGS(Anchors, Anchor)
102 QDeclarative1AnchorLine left() const;
103 void setLeft(const QDeclarative1AnchorLine &edge);
106 QDeclarative1AnchorLine right() const;
107 void setRight(const QDeclarative1AnchorLine &edge);
110 QDeclarative1AnchorLine horizontalCenter() const;
111 void setHorizontalCenter(const QDeclarative1AnchorLine &edge);
112 void resetHorizontalCenter();
114 QDeclarative1AnchorLine top() const;
115 void setTop(const QDeclarative1AnchorLine &edge);
118 QDeclarative1AnchorLine bottom() const;
119 void setBottom(const QDeclarative1AnchorLine &edge);
122 QDeclarative1AnchorLine verticalCenter() const;
123 void setVerticalCenter(const QDeclarative1AnchorLine &edge);
124 void resetVerticalCenter();
126 QDeclarative1AnchorLine baseline() const;
127 void setBaseline(const QDeclarative1AnchorLine &edge);
128 void resetBaseline();
130 qreal leftMargin() const;
131 void setLeftMargin(qreal);
133 qreal rightMargin() const;
134 void setRightMargin(qreal);
136 qreal horizontalCenterOffset() const;
137 void setHorizontalCenterOffset(qreal);
139 qreal topMargin() const;
140 void setTopMargin(qreal);
142 qreal bottomMargin() const;
143 void setBottomMargin(qreal);
145 qreal margins() const;
146 void setMargins(qreal);
148 qreal verticalCenterOffset() const;
149 void setVerticalCenterOffset(qreal);
151 qreal baselineOffset() const;
152 void setBaselineOffset(qreal);
154 QGraphicsObject *fill() const;
155 void setFill(QGraphicsObject *);
158 QGraphicsObject *centerIn() const;
159 void setCenterIn(QGraphicsObject *);
160 void resetCenterIn();
162 Anchors usedAnchors() const;
165 void componentComplete();
173 void bottomChanged();
174 void verticalCenterChanged();
175 void horizontalCenterChanged();
176 void baselineChanged();
178 void centerInChanged();
179 void leftMarginChanged();
180 void rightMarginChanged();
181 void topMarginChanged();
182 void bottomMarginChanged();
183 void marginsChanged();
184 void verticalCenterOffsetChanged();
185 void horizontalCenterOffsetChanged();
186 void baselineOffsetChanged();
187 Q_REVISION(1) void mirroredChanged();
190 friend class QDeclarativeItem;
191 friend class QDeclarativeItemPrivate;
192 friend class QDeclarative1GraphicsWidget;
193 Q_DISABLE_COPY(QDeclarative1Anchors)
194 Q_DECLARE_PRIVATE(QDeclarative1Anchors)
195 Q_PRIVATE_SLOT(d_func(), void _q_widgetGeometryChanged())
196 Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject *obj))
198 Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarative1Anchors::Anchors)
202 QML_DECLARE_TYPE(QDeclarative1Anchors)