Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / quick / items / qquickrectangle_p.h
1 // Commit: ac5c099cc3c5b8c7eec7a49fdeb8a21037230350
2 /****************************************************************************
3 **
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
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 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QQUICKRECTANGLE_P_H
44 #define QQUICKRECTANGLE_P_H
45
46 #include "qquickitem.h"
47
48 #include <QtGui/qbrush.h>
49
50 #include <private/qtquickglobal_p.h>
51
52 QT_BEGIN_HEADER
53
54 QT_BEGIN_NAMESPACE
55
56 class Q_QUICK_PRIVATE_EXPORT QQuickPen : public QObject
57 {
58     Q_OBJECT
59
60     Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY penChanged)
61     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged)
62     Q_PROPERTY(bool aligned READ aligned WRITE setAligned NOTIFY penChanged)
63 public:
64     QQuickPen(QObject *parent=0);
65
66     qreal width() const;
67     void setWidth(qreal w);
68
69     QColor color() const;
70     void setColor(const QColor &c);
71
72     bool aligned() const;
73     void setAligned(bool aligned);
74
75     bool isValid() const;
76
77 Q_SIGNALS:
78     void penChanged();
79
80 private:
81     qreal m_width;
82     QColor m_color;
83     bool m_aligned : 1;
84     bool m_valid : 1;
85 };
86
87 class Q_AUTOTEST_EXPORT QQuickGradientStop : public QObject
88 {
89     Q_OBJECT
90
91     Q_PROPERTY(qreal position READ position WRITE setPosition)
92     Q_PROPERTY(QColor color READ color WRITE setColor)
93
94 public:
95     QQuickGradientStop(QObject *parent=0);
96
97     qreal position() const;
98     void setPosition(qreal position);
99
100     QColor color() const;
101     void setColor(const QColor &color);
102
103 private:
104     void updateGradient();
105
106 private:
107     qreal m_position;
108     QColor m_color;
109 };
110
111 class Q_AUTOTEST_EXPORT QQuickGradient : public QObject
112 {
113     Q_OBJECT
114
115     Q_PROPERTY(QDeclarativeListProperty<QQuickGradientStop> stops READ stops)
116     Q_CLASSINFO("DefaultProperty", "stops")
117
118 public:
119     QQuickGradient(QObject *parent=0);
120     ~QQuickGradient();
121
122     QDeclarativeListProperty<QQuickGradientStop> stops();
123
124     const QGradient *gradient() const;
125
126 Q_SIGNALS:
127     void updated();
128
129 private:
130     void doUpdate();
131
132 private:
133     QList<QQuickGradientStop *> m_stops;
134     mutable QGradient *m_gradient;
135     friend class QQuickRectangle;
136     friend class QQuickGradientStop;
137 };
138
139 class QQuickRectanglePrivate;
140 class Q_QUICK_PRIVATE_EXPORT QQuickRectangle : public QQuickItem
141 {
142     Q_OBJECT
143
144     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
145     Q_PROPERTY(QQuickGradient *gradient READ gradient WRITE setGradient)
146     Q_PROPERTY(QQuickPen * border READ border CONSTANT)
147     Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
148 public:
149     QQuickRectangle(QQuickItem *parent=0);
150
151     QColor color() const;
152     void setColor(const QColor &);
153
154     QQuickPen *border();
155
156     QQuickGradient *gradient() const;
157     void setGradient(QQuickGradient *gradient);
158
159     qreal radius() const;
160     void setRadius(qreal radius);
161
162     virtual QRectF boundingRect() const;
163
164 Q_SIGNALS:
165     void colorChanged();
166     void radiusChanged();
167
168 protected:
169     virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
170
171 private Q_SLOTS:
172     void doUpdate();
173
174 private:
175     Q_DISABLE_COPY(QQuickRectangle)
176     Q_DECLARE_PRIVATE(QQuickRectangle)
177 };
178
179 QT_END_NAMESPACE
180
181 QML_DECLARE_TYPE(QQuickPen)
182 QML_DECLARE_TYPE(QQuickGradientStop)
183 QML_DECLARE_TYPE(QQuickGradient)
184 QML_DECLARE_TYPE(QQuickRectangle)
185
186 QT_END_HEADER
187
188 #endif // QQUICKRECTANGLE_P_H