QQuickCanvas renames
[profile/ivi/qtdeclarative.git] / src / quick / items / qquickitem.h
index 0f68910..61bb325 100644 (file)
@@ -1,11 +1,9 @@
-// Commit: 6f78a6080b84cc3ef96b73a4ff58d1b5a72f08f4
 /****************************************************************************
 **
 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
 **
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** GNU Lesser General Public License Usage
@@ -36,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -44,8 +43,8 @@
 #define QQUICKITEM_H
 
 #include <QtQuick/qtquickglobal.h>
-#include <QtDeclarative/qdeclarative.h>
-#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlcomponent.h>
 
 #include <QtCore/QObject>
 #include <QtCore/QList>
@@ -82,29 +81,28 @@ private:
 };
 
 class QQuickItemLayer;
-class QDeclarativeV8Function;
-class QDeclarativeState;
+class QQmlV8Function;
+class QQuickState;
 class QQuickAnchorLine;
-class QDeclarativeTransition;
+class QQuickTransition;
 class QQuickKeyEvent;
 class QQuickAnchors;
 class QQuickItemPrivate;
-class QQuickCanvas;
-class QSGEngine;
+class QQuickWindow;
 class QTouchEvent;
 class QSGNode;
 class QSGTransformNode;
 class QSGTextureProvider;
 
-class Q_QUICK_EXPORT QQuickItem : public QObject, public QDeclarativeParserStatus
+class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus
 {
     Q_OBJECT
-    Q_INTERFACES(QDeclarativeParserStatus)
+    Q_INTERFACES(QQmlParserStatus)
 
     Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
-    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
-    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QDeclarativeListProperty<QObject> resources READ resources DESIGNABLE false)
-    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QDeclarativeListProperty<QQuickItem> children READ children NOTIFY childrenChanged DESIGNABLE false)
+    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false)
+    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QObject> resources READ resources DESIGNABLE false)
+    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickItem> children READ children NOTIFY childrenChanged DESIGNABLE false)
 
     Q_PROPERTY(QPointF pos READ pos FINAL)
     Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
@@ -116,9 +114,10 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QDeclarativeParserStatu
     Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
     Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickItem> visibleChildren READ visibleChildren NOTIFY visibleChildrenChanged DESIGNABLE false)
 
-    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QDeclarativeListProperty<QDeclarativeState> states READ states DESIGNABLE false)
-    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QDeclarativeListProperty<QDeclarativeTransition> transitions READ transitions DESIGNABLE false)
+    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickState> states READ states DESIGNABLE false)
+    Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty<QQuickTransition> transitions READ transitions DESIGNABLE false)
     Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
     Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL)
     Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQuickAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
@@ -140,9 +139,10 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QDeclarativeParserStatu
     Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
     Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged)
     Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint)  // XXX todo - notify?
-    Q_PROPERTY(QDeclarativeListProperty<QQuickTransform> transform READ transform DESIGNABLE false FINAL)
+    Q_PROPERTY(QQmlListProperty<QQuickTransform> transform READ transform DESIGNABLE false FINAL)
 
     Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
+    Q_PROPERTY(bool antialiasing READ antialiasing WRITE setAntialiasing NOTIFY antialiasingChanged)
     Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged)
     Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged)
 
@@ -166,8 +166,8 @@ public:
     enum ItemChange {
         ItemChildAddedChange,      // value.item
         ItemChildRemovedChange,    // value.item
-        ItemSceneChange,           // value.canvas
-        ItemVisibleHasChanged,     // value.realValue
+        ItemSceneChange,           // value.window
+        ItemVisibleHasChanged,     // value.boolValue
         ItemParentHasChanged,      // value.item
         ItemOpacityHasChanged,     // value.realValue
         ItemActiveFocusHasChanged, // value.boolValue
@@ -176,12 +176,12 @@ public:
 
     union ItemChangeData {
         ItemChangeData(QQuickItem *v) : item(v) {}
-        ItemChangeData(QQuickCanvas *v) : canvas(v) {}
+        ItemChangeData(QQuickWindow *v) : window(v) {}
         ItemChangeData(qreal v) : realValue(v) {}
         ItemChangeData(bool v) : boolValue(v) {}
 
         QQuickItem *item;
-        QQuickCanvas *canvas;
+        QQuickWindow *window;
         qreal realValue;
         bool boolValue;
     };
@@ -195,9 +195,9 @@ public:
     QQuickItem(QQuickItem *parent = 0);
     virtual ~QQuickItem();
 
-    QSGEngine *sceneGraphEngine() const;
-
-    QQuickCanvas *canvas() const;
+    //canvas() is being removed in favor of window() really soon now
+    QQuickWindow *canvas() const { return window(); }
+    QQuickWindow *window() const;
     QQuickItem *parentItem() const;
     void setParentItem(QQuickItem *parent);
     void stackBefore(const QQuickItem *);
@@ -215,7 +215,7 @@ public:
     qreal baselineOffset() const;
     void setBaselineOffset(qreal);
 
-    QDeclarativeListProperty<QQuickTransform> transform();
+    QQmlListProperty<QQuickTransform> transform();
 
     qreal x() const;
     qreal y() const;
@@ -261,11 +261,15 @@ public:
     bool smooth() const;
     void setSmooth(bool);
 
+    bool antialiasing() const;
+    void setAntialiasing(bool);
+
     Flags flags() const;
     void setFlag(Flag flag, bool enabled = true);
     void setFlags(Flags flags);
 
     virtual QRectF boundingRect() const;
+    virtual QRectF clipRect() const;
 
     bool hasActiveFocus() const;
     bool hasFocus() const;
@@ -286,11 +290,13 @@ public:
     bool filtersChildMouseEvents() const;
     void setFiltersChildMouseEvents(bool filter);
 
-    void grabTouchPoints(const QList<int> &ids);
+    void grabTouchPoints(const QVector<int> &ids);
     void ungrabTouchPoints();
     bool keepTouchGrab() const;
     void setKeepTouchGrab(bool);
 
+    Q_INVOKABLE virtual bool contains(const QPointF &point) const;
+
     QTransform itemTransform(QQuickItem *, bool *) const;
     QPointF mapToItem(const QQuickItem *item, const QPointF &point) const;
     QPointF mapToScene(const QPointF &point) const;
@@ -303,19 +309,17 @@ public:
 
     void polish();
 
-    Q_INVOKABLE void mapFromItem(QDeclarativeV8Function*) const;
-    Q_INVOKABLE void mapToItem(QDeclarativeV8Function*) const;
+    Q_INVOKABLE void mapFromItem(QQmlV8Function*) const;
+    Q_INVOKABLE void mapToItem(QQmlV8Function*) const;
     Q_INVOKABLE void forceActiveFocus();
     Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const;
 
-    Qt::InputMethodHints inputMethodHints() const;
-    void setInputMethodHints(Qt::InputMethodHints hints);
     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
 
     struct UpdatePaintNodeData {
        QSGTransformNode *transformNode;
     private:
-       friend class QQuickCanvasPrivate;
+       friend class QQuickWindowPrivate;
        UpdatePaintNodeData();
     };
 
@@ -324,7 +328,6 @@ public:
 
 public Q_SLOTS:
     void update();
-    void updateMicroFocus();
 
 Q_SIGNALS:
     void childrenRectChanged(const QRectF &);
@@ -335,6 +338,7 @@ Q_SIGNALS:
     void parentChanged(QQuickItem *);
     void transformOriginChanged(TransformOrigin);
     void smoothChanged(bool);
+    void antialiasingChanged(bool);
     void clipChanged(bool);
 
     // XXX todo
@@ -342,6 +346,7 @@ Q_SIGNALS:
     void opacityChanged();
     void enabledChanged();
     void visibleChanged();
+    void visibleChildrenChanged();
     void rotationChanged();
     void scaleChanged();
 
@@ -359,6 +364,8 @@ protected:
     bool isComponentComplete() const;
     virtual void itemChange(ItemChange, const ItemChangeData &);
 
+    void updateInputMethod(Qt::InputMethodQueries queries = Qt::ImQueryInput);
+
     void setImplicitWidth(qreal);
     bool widthValid() const; // ### better name?
     void setImplicitHeight(qreal);
@@ -384,10 +391,12 @@ protected:
     virtual void hoverEnterEvent(QHoverEvent *event);
     virtual void hoverMoveEvent(QHoverEvent *event);
     virtual void hoverLeaveEvent(QHoverEvent *event);
+#ifndef QT_NO_DRAGANDDROP
     virtual void dragEnterEvent(QDragEnterEvent *);
     virtual void dragMoveEvent(QDragMoveEvent *);
     virtual void dragLeaveEvent(QDragLeaveEvent *);
     virtual void dropEvent(QDropEvent *);
+#endif
     virtual bool childMouseEventFilter(QQuickItem *, QEvent *);
     virtual void windowDeactivateEvent();
 
@@ -395,17 +404,15 @@ protected:
                                  const QRectF &oldGeometry);
 
     virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+    virtual void releaseResources();
     virtual void updatePolish();
 
-protected Q_SLOTS:
-    void sendAccessibilityUpdate();
-
 protected:
     QQuickItem(QQuickItemPrivate &dd, QQuickItem *parent = 0);
 
 private:
-    friend class QQuickCanvas;
-    friend class QQuickCanvasPrivate;
+    friend class QQuickWindow;
+    friend class QQuickWindowPrivate;
     friend class QSGRenderer;
     friend class QAccessibleQuickItem;
     friend class QQuickAccessibleAttached;