Rename Qt Quick-specific classes to QQuick*
[profile/ivi/qtdeclarative.git] / src / declarative / items / qquickimage_p.h
1 // Commit: ac5c099cc3c5b8c7eec7a49fdeb8a21037230350
2 /****************************************************************************
3 **
4 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 **
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 **
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this
15 ** file. Please review the following information to ensure the GNU Lesser
16 ** General Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** GNU General Public License Usage
24 ** Alternatively, this file may be used under the terms of the GNU General
25 ** Public License version 3.0 as published by the Free Software Foundation
26 ** and appearing in the file LICENSE.GPL included in the packaging of this
27 ** file. Please review the following information to ensure the GNU General
28 ** Public License version 3.0 requirements will be met:
29 ** http://www.gnu.org/copyleft/gpl.html.
30 **
31 ** Other Usage
32 ** Alternatively, this file may be used in accordance with the terms and
33 ** conditions contained in a signed written agreement between you and Nokia.
34 **
35 **
36 **
37 **
38 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QQUICKIMAGE_P_H
44 #define QQUICKIMAGE_P_H
45
46 #include "qquickimagebase_p.h"
47 #include <private/qsgtextureprovider_p.h>
48
49 QT_BEGIN_HEADER
50
51 QT_BEGIN_NAMESPACE
52
53 QT_MODULE(Declarative)
54
55 class QQuickImagePrivate;
56 class Q_AUTOTEST_EXPORT QQuickImage : public QQuickImageBase
57 {
58     Q_OBJECT
59     Q_ENUMS(FillMode)
60     Q_ENUMS(HAlignment)
61     Q_ENUMS(VAlignment)
62
63     Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
64     Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedGeometryChanged)
65     Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedGeometryChanged)
66     Q_PROPERTY(HAlignment horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged)
67     Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged)
68
69 public:
70     QQuickImage(QQuickItem *parent=0);
71     ~QQuickImage();
72
73     enum HAlignment { AlignLeft = Qt::AlignLeft,
74                        AlignRight = Qt::AlignRight,
75                        AlignHCenter = Qt::AlignHCenter };
76     enum VAlignment { AlignTop = Qt::AlignTop,
77                        AlignBottom = Qt::AlignBottom,
78                        AlignVCenter = Qt::AlignVCenter };
79
80     enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally, Pad };
81
82     FillMode fillMode() const;
83     void setFillMode(FillMode);
84
85     qreal paintedWidth() const;
86     qreal paintedHeight() const;
87
88     QRectF boundingRect() const;
89
90     HAlignment horizontalAlignment() const;
91     void setHorizontalAlignment(HAlignment align);
92
93     VAlignment verticalAlignment() const;
94     void setVerticalAlignment(VAlignment align);
95
96     bool isTextureProvider() const { return true; }
97     QSGTextureProvider *textureProvider() const;
98
99 Q_SIGNALS:
100     void fillModeChanged();
101     void paintedGeometryChanged();
102     void horizontalAlignmentChanged(HAlignment alignment);
103     void verticalAlignmentChanged(VAlignment alignment);
104
105 protected:
106     QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent);
107     void pixmapChange();
108     void updatePaintedGeometry();
109
110     virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
111     virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
112
113 private:
114     Q_DISABLE_COPY(QQuickImage)
115     Q_DECLARE_PRIVATE(QQuickImage)
116 };
117
118 QT_END_NAMESPACE
119 QML_DECLARE_TYPE(QQuickImage)
120 QT_END_HEADER
121
122 #endif // QQUICKIMAGE_P_H