1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
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>
58 class QDeclarative1AnchorsPrivate;
59 class QDeclarative1AnchorLine;
60 class Q_QTQUICK1_EXPORT QDeclarative1Anchors : public QObject
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)
84 QDeclarative1Anchors(QObject *parent=0);
85 QDeclarative1Anchors(QGraphicsObject *item, QObject *parent=0);
86 virtual ~QDeclarative1Anchors();
95 BaselineAnchor = 0x40,
96 Horizontal_Mask = LeftAnchor | RightAnchor | HCenterAnchor,
97 Vertical_Mask = TopAnchor | BottomAnchor | VCenterAnchor | BaselineAnchor
99 Q_DECLARE_FLAGS(Anchors, Anchor)
101 QDeclarative1AnchorLine left() const;
102 void setLeft(const QDeclarative1AnchorLine &edge);
105 QDeclarative1AnchorLine right() const;
106 void setRight(const QDeclarative1AnchorLine &edge);
109 QDeclarative1AnchorLine horizontalCenter() const;
110 void setHorizontalCenter(const QDeclarative1AnchorLine &edge);
111 void resetHorizontalCenter();
113 QDeclarative1AnchorLine top() const;
114 void setTop(const QDeclarative1AnchorLine &edge);
117 QDeclarative1AnchorLine bottom() const;
118 void setBottom(const QDeclarative1AnchorLine &edge);
121 QDeclarative1AnchorLine verticalCenter() const;
122 void setVerticalCenter(const QDeclarative1AnchorLine &edge);
123 void resetVerticalCenter();
125 QDeclarative1AnchorLine baseline() const;
126 void setBaseline(const QDeclarative1AnchorLine &edge);
127 void resetBaseline();
129 qreal leftMargin() const;
130 void setLeftMargin(qreal);
132 qreal rightMargin() const;
133 void setRightMargin(qreal);
135 qreal horizontalCenterOffset() const;
136 void setHorizontalCenterOffset(qreal);
138 qreal topMargin() const;
139 void setTopMargin(qreal);
141 qreal bottomMargin() const;
142 void setBottomMargin(qreal);
144 qreal margins() const;
145 void setMargins(qreal);
147 qreal verticalCenterOffset() const;
148 void setVerticalCenterOffset(qreal);
150 qreal baselineOffset() const;
151 void setBaselineOffset(qreal);
153 QGraphicsObject *fill() const;
154 void setFill(QGraphicsObject *);
157 QGraphicsObject *centerIn() const;
158 void setCenterIn(QGraphicsObject *);
159 void resetCenterIn();
161 Anchors usedAnchors() const;
164 void componentComplete();
172 void bottomChanged();
173 void verticalCenterChanged();
174 void horizontalCenterChanged();
175 void baselineChanged();
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();
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))
197 Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarative1Anchors::Anchors)
201 QML_DECLARE_TYPE(QDeclarative1Anchors)