1 // Commit: ac5c099cc3c5b8c7eec7a49fdeb8a21037230350
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 QSGRECTANGLE_P_H
44 #define QSGRECTANGLE_P_H
48 #include <QtGui/qbrush.h>
50 #include <private/qdeclarativeglobal_p.h>
56 QT_MODULE(Declarative)
57 class Q_DECLARATIVE_PRIVATE_EXPORT QSGPen : public QObject
61 Q_PROPERTY(int width READ width WRITE setWidth NOTIFY penChanged)
62 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged)
64 QSGPen(QObject *parent=0);
70 void setColor(const QColor &c);
83 class Q_AUTOTEST_EXPORT QSGGradientStop : public QObject
87 Q_PROPERTY(qreal position READ position WRITE setPosition)
88 Q_PROPERTY(QColor color READ color WRITE setColor)
91 QSGGradientStop(QObject *parent=0);
93 qreal position() const;
94 void setPosition(qreal position);
97 void setColor(const QColor &color);
100 void updateGradient();
107 class Q_AUTOTEST_EXPORT QSGGradient : public QObject
111 Q_PROPERTY(QDeclarativeListProperty<QSGGradientStop> stops READ stops)
112 Q_CLASSINFO("DefaultProperty", "stops")
115 QSGGradient(QObject *parent=0);
118 QDeclarativeListProperty<QSGGradientStop> stops();
120 const QGradient *gradient() const;
129 QList<QSGGradientStop *> m_stops;
130 mutable QGradient *m_gradient;
131 friend class QSGRectangle;
132 friend class QSGGradientStop;
135 class QSGRectanglePrivate;
136 class Q_DECLARATIVE_PRIVATE_EXPORT QSGRectangle : public QSGItem
140 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
141 Q_PROPERTY(QSGGradient *gradient READ gradient WRITE setGradient)
142 Q_PROPERTY(QSGPen * border READ border CONSTANT)
143 Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
145 QSGRectangle(QSGItem *parent=0);
147 QColor color() const;
148 void setColor(const QColor &);
152 QSGGradient *gradient() const;
153 void setGradient(QSGGradient *gradient);
155 qreal radius() const;
156 void setRadius(qreal radius);
158 QRectF boundingRect() const;
162 void radiusChanged();
165 virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
171 Q_DISABLE_COPY(QSGRectangle)
172 Q_DECLARE_PRIVATE(QSGRectangle)
177 QML_DECLARE_TYPE(QSGPen)
178 QML_DECLARE_TYPE(QSGGradientStop)
179 QML_DECLARE_TYPE(QSGGradient)
180 QML_DECLARE_TYPE(QSGRectangle)
184 #endif // QSGRECTANGLE_P_H