Project

General

Profile

SO3Engine
SO3WebNavigatorWidget.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25#ifndef _SO3_PLUGIN_WEB_NAVIGATOR_H_
26#define _SO3_PLUGIN_WEB_NAVIGATOR_H_
27
29#include "SO3Widget.h"
32
33#if SO3_WEB_NAVIGATOR_BUILD == 1
34
35namespace SO3
36{
37
38#define SO3_WEB_NAVIGATOR_WIDGET_TYPE "WebNavigator"
39
44{
45public:
46protected:
47private:
48 SWebNavigatorWidget* targetWidget;
49
50public:
54
58 virtual void OnExternalCall(SO3::EmbeddedWebNavigator::WebNavigator* sourceWebNavigator, const SO3::SScriptFunction& functionCalled);
59
63 virtual void OnExternalCallStr(SO3::EmbeddedWebNavigator::WebNavigator* sourceWebNavigator, const SO3::SScriptFunction& functionCalled);
64
68 virtual void OnLoadStart(SO3::EmbeddedWebNavigator::WebNavigator* sourceWebNavigator, const std::string& frameName);
69
73 virtual void OnLoadEnd(SO3::EmbeddedWebNavigator::WebNavigator* sourceWebNavigator, const std::string& frameName, int httpStatusCode);
74
78 virtual void OnLoadError(SO3::EmbeddedWebNavigator::WebNavigator* sourceWebNavigator, const std::string& frameName, int errorCode, const std::string& failedUrl, std::string& errorText);
79
83 virtual void OnCursorChange(SO3::EmbeddedWebNavigator::WebNavigator* sourceWebNavigator, HCURSOR newCursor);
84protected:
85private:
86};
87
90class _SO3_Export SWebNavigatorWidget : public SWidget
91{
92public:
93protected:
94private:
95 EmbeddedWebNavigator::WebNavigator* embeddedWebNavigator;
96 SO3WebNavigatorWidgetListener* webNavigatorListener;
97 HCURSOR lastCursor;
98 ScolWindowHandle parentWindow;
99
100public:
104 SWebNavigatorWidget(SScene* targetScene, const std::string& webNavigatorName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport, const unsigned int& widgetZOrder);
105
109 SWebNavigatorWidget(SScene* targetScene, const std::string& webNavigatorName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport);
110
114 SWebNavigatorWidget(SScene* targetScene, const std::string& webNavigatorName, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SMaterial* targetMaterial, const unsigned short& targetTechnique, const unsigned short& targetPass, const unsigned short& targetTextureUnit);
115
119
123 virtual void LoadURL(const std::string& url);
124
128 virtual void LoadFile(const std::string& file);
129
130 /*
131 Loads a string of HTML.
132 @note Relative URLs will be resolved using the base directory.
133 */
134 void LoadHTML(const std::string& html);
135
139 virtual void InjectMouseMove(const int& xPos, const int& yPos, const MouseButtonId& button);
140
144 virtual void InjectMouseWheel(const int& scrollX, const int& scrollY, const int& relativeScroll);
145
149 virtual void InjectMouseDown(const int& xPos, const int& yPos, const MouseButtonId& button);
150
154 virtual void InjectMouseUp(const int& xPos, const int& yPos, const MouseButtonId& button);
155
159 virtual void InjectTouchAdd(const int& xPos, const int& yPos, const int& touchid);
160
164 virtual void InjectTouchRemove(const int& touchid);
165
169 virtual void InjectTouchUpdate(const int& xPos, const int& yPos, const int& vx, const int& vy, const int& touchid);
170
174 virtual void InjectKeyEvent(const UINT& msg, const ScolWindowHandle& hwnd, const WPARAM& wParam, const LPARAM& lParam);
175
179 virtual void InjectTextEvent(const std::string& utf8);
180
183 void Update(const bool& forceUpdate);
184
188 virtual void RunScriptFunction(const std::string& functionName, const std::vector<std::string>& argumentList);
189
193 virtual HCURSOR GetCurrentMouseCursor();
194
198 void _SetCurrentMouseCursor(const HCURSOR& newCursor);
199
202 bool CanGoBack();
203
206 void GoBack();
207
210 bool CanGoForward();
211
214 void GoForward();
215
218 void Reload();
219
222 void ReloadIgnoreCache();
223
226 void StopLoad();
227
230 void Find(const int& identifier, const std::string& searchText, const bool& forward, const bool& matchCase, const bool& findNext);
231
234 void StopFinding(const bool& clearSelection);
235
238 float GetZoomLevel();
239
242 void SetZoomLevel(const float& zoomLevel);
243
246 void ClearHistory();
247
250 void ShowDevTools();
251
254 void CloseDevTools();
255
258 std::string GetURL(const std::string& frameName="");
259
262 void Undo(const std::string& frameName="");
263
266 void Redo(const std::string& frameName="");
267
270 void Cut(const std::string& frameName="");
271
274 void Copy(const std::string& frameName="");
275
278 void Paste(const std::string& frameName="");
279
282 void Delete(const std::string& frameName="");
283
286 void SelectAll(const std::string& frameName="");
287
290 void Print(const std::string& frameName="");
291
294 void ViewSource(const std::string& frameName="");
295
298 std::string GetSource(const std::string& frameName="");
299
302 std::string GetText(const std::string& frameName="");
303protected:
304private:
309
313 void CommonConstructorSequence();
314
317 void CreateWebNavigator();
318
321 void DestroyWebNavigator();
322
326 virtual void SetFocusImpl(const bool& focusOnWidget);
327
331 virtual void SetTransparencyImpl(const bool& enableTransparency);
332
336 virtual void SetKeyboardEnableImpl(const bool& enableKeyboardOnWidget);
337
341 virtual void SetMouseEnableImpl(const bool& enableMouseOnWidget);
342
345 virtual void SetSizeImpl(const unsigned short& newWidth, const unsigned short& newHeight);
346
350 virtual bool CheckPixelAlpha(const int& posX, const int& posY);
351};
352
353}
354
355#endif
356#endif
unsigned int UINT
Definition SO3Android.h:58
void * HCURSOR
Definition SO3Android.h:60
librairies include
virtual void OnCursorChange(SO3::EmbeddedWebNavigator::WebNavigator *sourceWebNavigator, HCURSOR newCursor)
virtual void OnExternalCallStr(SO3::EmbeddedWebNavigator::WebNavigator *sourceWebNavigator, const SO3::SScriptFunction &functionCalled)
virtual void OnLoadStart(SO3::EmbeddedWebNavigator::WebNavigator *sourceWebNavigator, const std::string &frameName)
virtual void OnExternalCall(SO3::EmbeddedWebNavigator::WebNavigator *sourceWebNavigator, const SO3::SScriptFunction &functionCalled)
virtual void OnLoadError(SO3::EmbeddedWebNavigator::WebNavigator *sourceWebNavigator, const std::string &frameName, int errorCode, const std::string &failedUrl, std::string &errorText)
virtual void OnLoadEnd(SO3::EmbeddedWebNavigator::WebNavigator *sourceWebNavigator, const std::string &frameName, int httpStatusCode)