source: trunk/src/declarative/graphicsitems/qdeclarativeanchors_p.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 7.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation (qt-info@nokia.com)
6**
7** This file is part of the QtDeclarative module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at qt-info@nokia.com.
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QDECLARATIVEANCHORS_H
43#define QDECLARATIVEANCHORS_H
44
45#include "qdeclarativeitem.h"
46
47#include <qdeclarative.h>
48
49#include <QtCore/QObject>
50
51#include <private/qdeclarativeglobal_p.h>
52
53QT_BEGIN_HEADER
54
55QT_BEGIN_NAMESPACE
56
57QT_MODULE(Declarative)
58
59class QDeclarativeAnchorsPrivate;
60class QDeclarativeAnchorLine;
61class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject
62{
63 Q_OBJECT
64
65 Q_PROPERTY(QDeclarativeAnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged)
66 Q_PROPERTY(QDeclarativeAnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged)
67 Q_PROPERTY(QDeclarativeAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged)
68 Q_PROPERTY(QDeclarativeAnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged)
69 Q_PROPERTY(QDeclarativeAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged)
70 Q_PROPERTY(QDeclarativeAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged)
71 Q_PROPERTY(QDeclarativeAnchorLine 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
83public:
84 QDeclarativeAnchors(QObject *parent=0);
85 QDeclarativeAnchors(QGraphicsObject *item, QObject *parent=0);
86 virtual ~QDeclarativeAnchors();
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 QDeclarativeAnchorLine left() const;
102 void setLeft(const QDeclarativeAnchorLine &edge);
103 void resetLeft();
104
105 QDeclarativeAnchorLine right() const;
106 void setRight(const QDeclarativeAnchorLine &edge);
107 void resetRight();
108
109 QDeclarativeAnchorLine horizontalCenter() const;
110 void setHorizontalCenter(const QDeclarativeAnchorLine &edge);
111 void resetHorizontalCenter();
112
113 QDeclarativeAnchorLine top() const;
114 void setTop(const QDeclarativeAnchorLine &edge);
115 void resetTop();
116
117 QDeclarativeAnchorLine bottom() const;
118 void setBottom(const QDeclarativeAnchorLine &edge);
119 void resetBottom();
120
121 QDeclarativeAnchorLine verticalCenter() const;
122 void setVerticalCenter(const QDeclarativeAnchorLine &edge);
123 void resetVerticalCenter();
124
125 QDeclarativeAnchorLine baseline() const;
126 void setBaseline(const QDeclarativeAnchorLine &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
166Q_SIGNALS:
167 void leftChanged();
168 void rightChanged();
169 void topChanged();
170 void bottomChanged();
171 void verticalCenterChanged();
172 void horizontalCenterChanged();
173 void baselineChanged();
174 void fillChanged();
175 void centerInChanged();
176 void leftMarginChanged();
177 void rightMarginChanged();
178 void topMarginChanged();
179 void bottomMarginChanged();
180 void marginsChanged();
181 void verticalCenterOffsetChanged();
182 void horizontalCenterOffsetChanged();
183 void baselineOffsetChanged();
184
185private:
186 friend class QDeclarativeItem;
187 friend class QDeclarativeGraphicsWidget;
188 Q_DISABLE_COPY(QDeclarativeAnchors)
189 Q_DECLARE_PRIVATE(QDeclarativeAnchors)
190 Q_PRIVATE_SLOT(d_func(), void _q_widgetGeometryChanged())
191 Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject *obj))
192};
193Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeAnchors::Anchors)
194
195QT_END_NAMESPACE
196
197QML_DECLARE_TYPE(QDeclarativeAnchors)
198
199QT_END_HEADER
200
201#endif
Note: See TracBrowser for help on using the repository browser.