1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEBORDERIMAGE_H
43 #define QDECLARATIVEBORDERIMAGE_H
45 #include "private/qdeclarativeimagebase_p.h"
47 #include <QtNetwork/qnetworkreply.h>
52 QT_MODULE(Declarative)
54 class QDeclarativeScaleGrid;
55 class QDeclarativeGridScaledImage;
56 class QDeclarativeBorderImagePrivate;
57 class Q_AUTOTEST_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase
62 Q_PROPERTY(QDeclarativeScaleGrid *border READ border CONSTANT)
63 Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged)
64 Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged)
66 // read-only for BorderImage
67 Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged)
70 QDeclarativeBorderImage(QDeclarativeItem *parent=0);
71 ~QDeclarativeBorderImage();
73 QDeclarativeScaleGrid *border();
75 enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile };
77 TileMode horizontalTileMode() const;
78 void setHorizontalTileMode(TileMode);
80 TileMode verticalTileMode() const;
81 void setVerticalTileMode(TileMode);
83 void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
84 void setSource(const QUrl &url);
87 void horizontalTileModeChanged();
88 void verticalTileModeChanged();
89 void sourceSizeChanged();
95 void setGridScaledImage(const QDeclarativeGridScaledImage& sci);
99 void requestFinished();
100 void sciRequestFinished();
103 Q_DISABLE_COPY(QDeclarativeBorderImage)
104 Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeBorderImage)
108 QML_DECLARE_TYPE(QDeclarativeBorderImage)
111 #endif // QDECLARATIVEBORDERIMAGE_H