Showing the changes to interface/src/scripting/WebWindow.h (1 of 3 files). Show all
Unified · Split
| @@ -0,0 +1,53 @@ | |||
| 1 | // | ||
| 2 | // WebWindow.h | ||
| 3 | // interface/src/scripting | ||
| 4 | // | ||
| 5 | // Created by Ryan Huffman on 11/06/14. | ||
| 6 | // Copyright 2014 High Fidelity, Inc. | ||
| 7 | // | ||
| 8 | // Distributed under the Apache License, Version 2.0. | ||
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
| 10 | // | ||
| 11 | |||
| 12 | #ifndef hifi_WebWindow_h | ||
| 13 | #define hifi_WebWindow_h | ||
| 14 | |||
| 15 | #include <QScriptContext> | ||
| 16 | #include <QScriptEngine> | ||
| 17 | |||
| 18 | // #include "ScriptWebView.h" | ||
| 19 | |||
| 20 | class ScriptEventBridge : public QObject { | ||
| 21 | Q_OBJECT | ||
| 22 | public: | ||
| 23 | ScriptEventBridge(QObject* parent = NULL); | ||
| 24 | |||
| 25 | public slots: | ||
| 26 | void emitWebEvent(const QString& data); | ||
| 27 | void emitScriptEvent(const QString& data); | ||
| 28 | |||
| 29 | signals: | ||
| 30 | void webEventReceived(const QString& data); | ||
| 31 | void scriptEventReceived(const QString& data); | ||
| 32 | |||
| 33 | }; | ||
| 34 | |||
| 35 | class WebWindow : public QObject { | ||
| 36 | Q_OBJECT | ||
| 37 | Q_PROPERTY(QObject* eventBridge READ getEventBridge) | ||
| 38 | public: | ||
| 39 | WebWindow(const QString& url, int width, int height); | ||
| 40 | ~WebWindow(); | ||
| 41 | |||
| 42 | static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine); | ||
| 43 | |||
| 44 | public slots: | ||
| 45 | void setVisible(bool visible); | ||
| 46 | ScriptEventBridge* getEventBridge() const { return _eventBridge; } | ||
| 47 | |||
| 48 | private: | ||
| 49 | QWidget* _window; | ||
| 50 | ScriptEventBridge* _eventBridge; | ||
| 51 | }; | ||
| 52 | |||
| 53 | #endif | ||