| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2017 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the examples of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:BSD$ |
| 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 https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** BSD License Usage |
| 18 | ** Alternatively, you may use this file under the terms of the BSD license |
| 19 | ** as follows: |
| 20 | ** |
| 21 | ** "Redistribution and use in source and binary forms, with or without |
| 22 | ** modification, are permitted provided that the following conditions are |
| 23 | ** met: |
| 24 | ** * Redistributions of source code must retain the above copyright |
| 25 | ** notice, this list of conditions and the following disclaimer. |
| 26 | ** * Redistributions in binary form must reproduce the above copyright |
| 27 | ** notice, this list of conditions and the following disclaimer in |
| 28 | ** the documentation and/or other materials provided with the |
| 29 | ** distribution. |
| 30 | ** * Neither the name of The Qt Company Ltd nor the names of its |
| 31 | ** contributors may be used to endorse or promote products derived |
| 32 | ** from this software without specific prior written permission. |
| 33 | ** |
| 34 | ** |
| 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
| 46 | ** |
| 47 | ** $QT_END_LICENSE$ |
| 48 | ** |
| 49 | ****************************************************************************/ |
| 50 | |
| 51 | #ifndef ENVIRONMENT_H |
| 52 | #define ENVIRONMENT_Hcxx . . $ `examples/script/context2d/environment.h:52:9`! |
| 53 | |
| 54 | #include <qobject.h> |
| 55 | #include <qlist.h> |
| 56 | #include <qhash.h> |
| 57 | #include <QTimerEvent> |
| 58 | #include <QMouseEvent> |
| 59 | #include <QKeyEvent> |
| 60 | #include <QScriptEngine>cxx . . $ `<file>/include/QtScript/QScriptEngine`/ |
| 61 | #include <QScriptable>cxx . . $ `<file>/include/QtScript/QScriptable`/ |
| 62 | class QContext2DCanvascxx . . $ QContext2DCanvas#; |
| 63 | |
| 64 | //! [0] |
| 65 | class Environmentcxx . . $ Environment# : public QObjectcxx . . $ QObject# |
| 66 | { |
| 67 | Q_OBJECTcxx . . $ Environment#trUtf8(75d9f1c324b4579d). |
| 68 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QScriptValue document READ document) |
| 69 | public: |
| 70 | Environmentcxx . . $ Environment#Environment(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent = 0); |
| 71 | ~cxx . . $ Environment#`~Environment`(49f6e7a06ebc5aa8).Environmentcxx . . $ Environment#(); |
| 72 | |
| 73 | QScriptValuecxx . . $ QScriptValue# documentcxx . . $ Environment#document(73013aefd0020d47).() const; |
| 74 | |
| 75 | void addCanvascxx . . $ Environment#addCanvas(d906aada46f7dd30).(QContext2DCanvascxx . . $ QContext2DCanvas# *canvas); |
| 76 | QContext2DCanvascxx . . $ QContext2DCanvas# *canvasByNamecxx . . $ Environment#canvasByName(9510d518aeb98fc3).(const QStringcxx . . $ QString# &name) const; |
| 77 | QListcxx . . $ QList#<QContext2DCanvascxx . . $ QContext2DCanvas#*> canvasescxx . . $ Environment#canvases(16e452e425a20607).() const; |
| 78 | |
| 79 | QScriptValuecxx . . $ QScriptValue# evaluatecxx . . $ Environment#evaluate(b0ff8ca0890150ef).(const QStringcxx . . $ QString# &code, |
| 80 | const QStringcxx . . $ QString# &fileName = QStringcxx . . $ QString#QString(ced63f7c635d850d).()); |
| 81 | |
| 82 | QScriptValuecxx . . $ QScriptValue# toWrappercxx . . $ Environment#toWrapper(d326e16f4a22f9bc).(QObjectcxx . . $ QObject# *object); |
| 83 | |
| 84 | void handleEventcxx . . $ Environment#handleEvent(9d56bc8eee0e55c9).(QContext2DCanvascxx . . $ QContext2DCanvas# *canvas, QMouseEventcxx . . $ QMouseEvent# *e); |
| 85 | void handleEventcxx . . $ Environment#handleEvent(1ce74e96c8be075e).(QContext2DCanvascxx . . $ QContext2DCanvas# *canvas, QKeyEventcxx . . $ QKeyEvent# *e); |
| 86 | |
| 87 | void resetcxx . . $ Environment#reset(49f6e7a06ebc5aa8).(); |
| 88 | //! [0] |
| 89 | |
| 90 | QScriptEnginecxx . . $ QScriptEngine# *enginecxx . . $ Environment#engine(18bf45d2c163ce9b).() const; |
| 91 | bool hasIntervalTimerscxx . . $ Environment#hasIntervalTimers(50ce9a9e25b4a850).() const; |
| 92 | void triggerTimerscxx . . $ Environment#triggerTimers(49f6e7a06ebc5aa8).(); |
| 93 | |
| 94 | //! [1] |
| 95 | public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 96 | int setIntervalcxx . . $ Environment#setInterval(b5281c1bdf454133).(const QScriptValuecxx . . $ QScriptValue# &expression, int delay); |
| 97 | void clearIntervalcxx . . $ Environment#clearInterval(d4f767463ce0a6b3).(int timerId); |
| 98 | |
| 99 | int setTimeoutcxx . . $ Environment#setTimeout(b5281c1bdf454133).(const QScriptValuecxx . . $ QScriptValue# &expression, int delay); |
| 100 | void clearTimeoutcxx . . $ Environment#clearTimeout(d4f767463ce0a6b3).(int timerId); |
| 101 | //! [1] |
| 102 | |
| 103 | //! [2] |
| 104 | signalscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:89:14`!: |
| 105 | void scriptErrorcxx . . $ Environment#scriptError(6b35c8bde2804237).(const QScriptValuecxx . . $ QScriptValue# &error); |
| 106 | //! [2] |
| 107 | |
| 108 | protected: |
| 109 | void timerEventcxx . . $ Environment#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent# *event); |
| 110 | |
| 111 | private: |
| 112 | QScriptValuecxx . . $ QScriptValue# eventHandlercxx . . $ Environment#eventHandler(ffe26509fe2424ae).(QContext2DCanvascxx . . $ QContext2DCanvas# *canvas, |
| 113 | const QStringcxx . . $ QString# &type, QScriptValuecxx . . $ QScriptValue# *who); |
| 114 | QScriptValuecxx . . $ QScriptValue# newFakeDomEventcxx . . $ Environment#newFakeDomEvent(f7c7ae51ff825b25).(const QStringcxx . . $ QString# &type, |
| 115 | const QScriptValuecxx . . $ QScriptValue# &target); |
| 116 | void maybeEmitScriptErrorcxx . . $ Environment#maybeEmitScriptError(49f6e7a06ebc5aa8).(); |
| 117 | |
| 118 | QScriptEnginecxx . . $ QScriptEngine# *m_enginecxx . . $ Environment#m_engine.; |
| 119 | QScriptValuecxx . . $ QScriptValue# m_originalGlobalObjectcxx . . $ Environment#m_originalGlobalObject.; |
| 120 | QScriptValuecxx . . $ QScriptValue# m_documentcxx . . $ Environment#m_document.; |
| 121 | QListcxx . . $ QList#<QContext2DCanvascxx . . $ QContext2DCanvas#*> m_canvasescxx . . $ Environment#m_canvases.; |
| 122 | QHashcxx . . $ QHash#<int, QScriptValuecxx . . $ QScriptValue#> m_intervalHashcxx . . $ Environment#m_intervalHash.; |
| 123 | QHashcxx . . $ QHash#<int, QScriptValuecxx . . $ QScriptValue#> m_timeoutHashcxx . . $ Environment#m_timeoutHash.; |
| 124 | }; |
| 125 | |
| 126 | //! [3] |
| 127 | class Documentcxx . . $ Document# : public QObjectcxx . . $ QObject# |
| 128 | { |
| 129 | Q_OBJECTcxx . . $ QMetaObject#Call# |
| 130 | public: |
| 131 | Documentcxx . . $ Document#Document(43d646fc31e9320).(Environmentcxx . . $ Environment# *env); |
| 132 | ~cxx . . $ Document#`~Document`(49f6e7a06ebc5aa8).Documentcxx . . $ Document#(); |
| 133 | |
| 134 | public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 135 | QScriptValuecxx . . $ QScriptValue# getElementByIdcxx . . $ Document#getElementById(a2a41913dabf50d6).(const QStringcxx . . $ QString# &id) const; |
| 136 | QScriptValuecxx . . $ QScriptValue# getElementsByTagNamecxx . . $ Document#getElementsByTagName(a2a41913dabf50d6).(const QStringcxx . . $ QString# &name) const; |
| 137 | |
| 138 | // EventTarget |
| 139 | void addEventListenercxx . . $ Document#addEventListener(32d10e5558e2d27f).(const QStringcxx . . $ QString# &type, const QScriptValuecxx . . $ QScriptValue# &listener, |
| 140 | bool useCapture); |
| 141 | }; |
| 142 | //! [3] |
| 143 | |
| 144 | class CanvasGradientPrototypecxx . . $ CanvasGradientPrototype# : public QObjectcxx . . $ QObject#, public QScriptablecxx . . $ QScriptable# |
| 145 | { |
| 146 | Q_OBJECTcxx . . $ QMetaObject#Call# |
| 147 | protected: |
| 148 | CanvasGradientPrototypecxx . . $ CanvasGradientPrototype#CanvasGradientPrototype(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent = 0); |
| 149 | public: |
| 150 | static void setupcxx . . $ CanvasGradientPrototype#setup(d3e0164fcca5dac6).(QScriptEnginecxx . . $ QScriptEngine# *engine); |
| 151 | |
| 152 | public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 153 | void addColorStopcxx . . $ CanvasGradientPrototype#addColorStop(95649c7ad5e29c3d).(qrealcxx . . $ qreal# offset, const QStringcxx . . $ QString# &color); |
| 154 | }; |
| 155 | |
| 156 | #endif |