1 // Commit: 2c7cab4172f1acc86fd49345a2847417e162f2c3
2 /****************************************************************************
4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** No Commercial Usage
12 ** This file contains pre-release code and may not be distributed.
13 ** You may use this file in accordance with the terms and conditions
14 ** contained in the Technology Preview License Agreement accompanying
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
41 ****************************************************************************/
43 #ifndef QSGANCHORS_P_H
44 #define QSGANCHORS_P_H
46 #include <qdeclarative.h>
48 #include <QtCore/QObject>
50 #include <private/qdeclarativeglobal_p.h>
56 QT_MODULE(Declarative)
59 class QSGAnchorsPrivate;
61 class Q_DECLARATIVE_PRIVATE_EXPORT QSGAnchors : public QObject
65 Q_PROPERTY(QSGAnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged)
66 Q_PROPERTY(QSGAnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged)
67 Q_PROPERTY(QSGAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged)
68 Q_PROPERTY(QSGAnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged)
69 Q_PROPERTY(QSGAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged)
70 Q_PROPERTY(QSGAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged)
71 Q_PROPERTY(QSGAnchorLine 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(QSGItem *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged)
81 Q_PROPERTY(QSGItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
82 Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged)
85 QSGAnchors(QSGItem *item, QObject *parent=0);
86 virtual ~QSGAnchors();
95 BaselineAnchor = 0x40,
96 Horizontal_Mask = LeftAnchor | RightAnchor | HCenterAnchor,
97 Vertical_Mask = TopAnchor | BottomAnchor | VCenterAnchor | BaselineAnchor
99 Q_DECLARE_FLAGS(Anchors, Anchor)
101 QSGAnchorLine left() const;
102 void setLeft(const QSGAnchorLine &edge);
105 QSGAnchorLine right() const;
106 void setRight(const QSGAnchorLine &edge);
109 QSGAnchorLine horizontalCenter() const;
110 void setHorizontalCenter(const QSGAnchorLine &edge);
111 void resetHorizontalCenter();
113 QSGAnchorLine top() const;
114 void setTop(const QSGAnchorLine &edge);
117 QSGAnchorLine bottom() const;
118 void setBottom(const QSGAnchorLine &edge);
121 QSGAnchorLine verticalCenter() const;
122 void setVerticalCenter(const QSGAnchorLine &edge);
123 void resetVerticalCenter();
125 QSGAnchorLine baseline() const;
126 void setBaseline(const QSGAnchorLine &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 QSGItem *fill() const;
154 void setFill(QSGItem *);
157 QSGItem *centerIn() const;
158 void setCenterIn(QSGItem *);
159 void resetCenterIn();
161 Anchors usedAnchors() const;
166 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 void mirroredChanged();
189 friend class QSGItemPrivate;
190 Q_DISABLE_COPY(QSGAnchors)
191 Q_DECLARE_PRIVATE(QSGAnchors)
193 Q_DECLARE_OPERATORS_FOR_FLAGS(QSGAnchors::Anchors)
197 QML_DECLARE_TYPE(QSGAnchors)
201 #endif // QSGANCHORS_P_H