| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2017 The Qt Company Ltd. | 
| 4 | ** Contact: http://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:LGPL3$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | 
| 16 | ** | 
| 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 3 as published by the Free Software | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the | 
| 21 | ** packaging of this file. Please review the following information to | 
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | 
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. | 
| 24 | ** | 
| 25 | ** GNU General Public License Usage | 
| 26 | ** Alternatively, this file may be used under the terms of the GNU | 
| 27 | ** General Public License version 2.0 or later as published by the Free | 
| 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in | 
| 29 | ** the packaging of this file. Please review the following information to | 
| 30 | ** ensure the GNU General Public License version 2.0 requirements will be | 
| 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. | 
| 32 | ** | 
| 33 | ** $QT_END_LICENSE$ | 
| 34 | ** | 
| 35 | ****************************************************************************/ | 
| 36 |  | 
| 37 | #ifndef QQUICKTEXTAREA_P_H | 
| 38 | #define QQUICKTEXTAREA_P_H | 
| 39 |  | 
| 40 | // | 
| 41 | //  W A R N I N G | 
| 42 | //  ------------- | 
| 43 | // | 
| 44 | // This file is not part of the Qt API.  It exists purely as an | 
| 45 | // implementation detail.  This header file may change from version to | 
| 46 | // version without notice, or even be removed. | 
| 47 | // | 
| 48 | // We mean it. | 
| 49 | // | 
| 50 |  | 
| 51 | #include <QtGui/qpalette.h> | 
| 52 | #include <QtQuick/private/qquicktextedit_p.h> | 
| 53 | #include <QtQuickTemplates2/private/qtquicktemplates2global_p.h> | 
| 54 |  | 
| 55 | QT_BEGIN_NAMESPACE | 
| 56 |  | 
| 57 | class QQuickText; | 
| 58 | class QQuickTextAreaPrivate; | 
| 59 | class QQuickTextAreaAttached; | 
| 60 | class QQuickMouseEvent; | 
| 61 |  | 
| 62 | class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit | 
| 63 | { | 
| 64 |     Q_OBJECT | 
| 65 |     Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override | 
| 66 |     Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged3 FINAL) | 
| 67 |     Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged3 FINAL) | 
| 68 |     Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL) | 
| 69 |     Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL) | 
| 70 |     Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL) | 
| 71 |     // 2.1 (Qt 5.8) | 
| 72 |     Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION 1) | 
| 73 |     Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1) | 
| 74 |     // 2.3 (Qt 5.10) | 
| 75 |     Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3) | 
| 76 |     // 2.5 (Qt 5.12) | 
| 77 |     Q_PROPERTY(QColor placeholderTextColor READ placeholderTextColor WRITE setPlaceholderTextColor NOTIFY placeholderTextColorChanged FINAL REVISION 5) | 
| 78 |     Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5) | 
| 79 |     Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5) | 
| 80 |     Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5) | 
| 81 |     Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5) | 
| 82 |     Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5) | 
| 83 |     Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5) | 
| 84 |     Q_CLASSINFO("DeferredPropertyNames" , "background" ) | 
| 85 |  | 
| 86 | public: | 
| 87 |     explicit QQuickTextArea(QQuickItem *parent = nullptr); | 
| 88 |     ~QQuickTextArea(); | 
| 89 |  | 
| 90 |     static QQuickTextAreaAttached *qmlAttachedProperties(QObject *object); | 
| 91 |  | 
| 92 |     QFont font() const; | 
| 93 |     void setFont(const QFont &font); | 
| 94 |  | 
| 95 |     QQuickItem *background() const; | 
| 96 |     void setBackground(QQuickItem *background); | 
| 97 |  | 
| 98 |     QString placeholderText() const; | 
| 99 |     void setPlaceholderText(const QString &text); | 
| 100 |  | 
| 101 |     Qt::FocusReason focusReason() const; | 
| 102 |     void setFocusReason(Qt::FocusReason reason); | 
| 103 |  | 
| 104 |     bool contains(const QPointF &point) const override; | 
| 105 |  | 
| 106 |     // 2.1 (Qt 5.8) | 
| 107 |     bool isHovered() const; | 
| 108 |     void setHovered(bool hovered); | 
| 109 |  | 
| 110 |     bool isHoverEnabled() const; | 
| 111 |     void setHoverEnabled(bool enabled); | 
| 112 |     void resetHoverEnabled(); | 
| 113 |  | 
| 114 |     // 2.3 (Qt 5.10) | 
| 115 |     QPalette palette() const; | 
| 116 |     void setPalette(const QPalette &palette); | 
| 117 |     void resetPalette(); | 
| 118 |  | 
| 119 |     // 2.5 (Qt 5.12) | 
| 120 |     QColor placeholderTextColor() const; | 
| 121 |     void setPlaceholderTextColor(const QColor &color); | 
| 122 |  | 
| 123 |     qreal implicitBackgroundWidth() const; | 
| 124 |     qreal implicitBackgroundHeight() const; | 
| 125 |  | 
| 126 |     qreal topInset() const; | 
| 127 |     void setTopInset(qreal inset); | 
| 128 |     void resetTopInset(); | 
| 129 |  | 
| 130 |     qreal leftInset() const; | 
| 131 |     void setLeftInset(qreal inset); | 
| 132 |     void resetLeftInset(); | 
| 133 |  | 
| 134 |     qreal rightInset() const; | 
| 135 |     void setRightInset(qreal inset); | 
| 136 |     void resetRightInset(); | 
| 137 |  | 
| 138 |     qreal bottomInset() const; | 
| 139 |     void setBottomInset(qreal inset); | 
| 140 |     void resetBottomInset(); | 
| 141 |  | 
| 142 | Q_SIGNALS: | 
| 143 |     void fontChanged(); | 
| 144 |     void implicitWidthChanged3(); | 
| 145 |     void implicitHeightChanged3(); | 
| 146 |     void backgroundChanged(); | 
| 147 |     void placeholderTextChanged(); | 
| 148 |     void focusReasonChanged(); | 
| 149 |     void pressAndHold(QQuickMouseEvent *event); | 
| 150 |     // 2.1 (Qt 5.8) | 
| 151 |     Q_REVISION(1) void pressed(QQuickMouseEvent *event); | 
| 152 |     Q_REVISION(1) void released(QQuickMouseEvent *event); | 
| 153 |     Q_REVISION(1) void hoveredChanged(); | 
| 154 |     Q_REVISION(1) void hoverEnabledChanged(); | 
| 155 |     // 2.3 (Qt 5.10) | 
| 156 |     Q_REVISION(3) void paletteChanged(); | 
| 157 |     // 2.5 (Qt 5.12) | 
| 158 |     Q_REVISION(5) void placeholderTextColorChanged(); | 
| 159 |     Q_REVISION(5) void implicitBackgroundWidthChanged(); | 
| 160 |     Q_REVISION(5) void implicitBackgroundHeightChanged(); | 
| 161 |     Q_REVISION(5) void topInsetChanged(); | 
| 162 |     Q_REVISION(5) void leftInsetChanged(); | 
| 163 |     Q_REVISION(5) void rightInsetChanged(); | 
| 164 |     Q_REVISION(5) void bottomInsetChanged(); | 
| 165 |  | 
| 166 | protected: | 
| 167 |     friend struct QQuickPressHandler; | 
| 168 |  | 
| 169 |     void classBegin() override; | 
| 170 |     void componentComplete() override; | 
| 171 |  | 
| 172 |     void itemChange(ItemChange change, const ItemChangeData &value) override; | 
| 173 |     void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; | 
| 174 |     virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset); | 
| 175 |  | 
| 176 |     QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override; | 
| 177 |  | 
| 178 |     void focusInEvent(QFocusEvent *event) override; | 
| 179 |     void focusOutEvent(QFocusEvent *event) override; | 
| 180 | #if QT_CONFIG(quicktemplates2_hover) | 
| 181 |     void hoverEnterEvent(QHoverEvent *event) override; | 
| 182 |     void hoverLeaveEvent(QHoverEvent *event) override; | 
| 183 | #endif | 
| 184 |     void mousePressEvent(QMouseEvent *event) override; | 
| 185 |     void mouseMoveEvent(QMouseEvent *event) override; | 
| 186 |     void mouseReleaseEvent(QMouseEvent *event) override; | 
| 187 |     void mouseDoubleClickEvent(QMouseEvent *event) override; | 
| 188 |     void timerEvent(QTimerEvent *event) override; | 
| 189 |  | 
| 190 | private: | 
| 191 |     Q_DISABLE_COPY(QQuickTextArea) | 
| 192 |     Q_DECLARE_PRIVATE(QQuickTextArea) | 
| 193 | }; | 
| 194 |  | 
| 195 | class QQuickTextAreaAttachedPrivate; | 
| 196 |  | 
| 197 | class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextAreaAttached : public QObject | 
| 198 | { | 
| 199 |     Q_OBJECT | 
| 200 |     Q_PROPERTY(QQuickTextArea *flickable READ flickable WRITE setFlickable NOTIFY flickableChanged FINAL) | 
| 201 |  | 
| 202 | public: | 
| 203 |     explicit QQuickTextAreaAttached(QObject *parent); | 
| 204 |  | 
| 205 |     QQuickTextArea *flickable() const; | 
| 206 |     void setFlickable(QQuickTextArea *control); | 
| 207 |  | 
| 208 | Q_SIGNALS: | 
| 209 |     void flickableChanged(); | 
| 210 |  | 
| 211 | private: | 
| 212 |     Q_DISABLE_COPY(QQuickTextAreaAttached) | 
| 213 |     Q_DECLARE_PRIVATE(QQuickTextAreaAttached) | 
| 214 | }; | 
| 215 |  | 
| 216 | QT_END_NAMESPACE | 
| 217 |  | 
| 218 | QML_DECLARE_TYPE(QQuickTextArea) | 
| 219 | QML_DECLARE_TYPEINFO(QQuickTextArea, QML_HAS_ATTACHED_PROPERTIES) | 
| 220 |  | 
| 221 | #endif // QQUICKTEXTAREA_P_H | 
| 222 |  |