axmol/cocos/ui/UIWebViewImpl-android.h

107 lines
3.5 KiB
C
Raw Normal View History

/****************************************************************************
2016-08-05 09:42:15 +08:00
Copyright (c) 2014-2016 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
2014-08-25 14:01:18 +08:00
2014-09-15 16:56:51 +08:00
#ifndef __COCOS2D__UI__WEBVIEWIMPL_ANDROID_H_
#define __COCOS2D__UI__WEBVIEWIMPL_ANDROID_H_
2015-03-24 20:23:51 +08:00
/// @cond DO_NOT_SHOW
2014-08-25 14:01:18 +08:00
Squashed commit of the following: commit b9181ae92541d11119bedd766773ddb01f0bb486 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:34:40 2014 -0700 Compiles luasocket on Mac commit 91fc79aa2101867fedfbcd7d846e9508009894e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:12:30 2014 -0700 disables luasockets commit 31f2ee462708ab7b604b9399eaabd275e2da9e02 Merge: 19099fd 0abe4cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 08:10:48 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into cmakefile_mac_osx Conflicts: cocos/3d/cocos3d.h commit 19099fd021b4ecf1f2eebd73ea14e84572d1ee33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:21:03 2014 -0700 compiles on Linux commit eec7b92817ac9208123468bb882612aad89f94bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:16:46 2014 -0700 all projecs compiles with CMake commit 40fcc8325b409a580fdbf26d2ee27aa2d1db0109 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:47:27 2014 -0700 CCUserDefualt.mm better includes commit 30709ec8243562858498cb118240bb45bf9b33b0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:26:36 2014 -0700 cpp-tests compiles and works on Mac using CMake commit 67f0fc8df887d08d3d7a27c5fdadd335d6841676 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 20:12:09 2014 -0700 Adds missing files to CMakeLists.txt commit 36f939ea7f157ca851aee138300c13d9888c0078 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:52:34 2014 -0700 Adds more box2d missing files commit 00f81e3b5ec97150974cc6022e86c394ff488ccb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:39:54 2014 -0700 Adds missing box2d files commit 9673227b4d7d0e6d9eced49bdd69b98cb519968a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 18:44:15 2014 -0700 Initial CMake support for Mac
2014-09-10 03:18:31 +08:00
#ifdef __ANDROID__
2014-08-25 14:01:18 +08:00
#include <iosfwd>
#include <stdint.h>
2014-08-25 14:01:18 +08:00
namespace cocos2d {
class Data;
class Renderer;
class Mat4;
namespace experimental {
namespace ui{
class WebView;
}
}
2014-08-25 14:01:18 +08:00
}
namespace cocos2d {
namespace experimental {
namespace ui{
2014-08-25 14:01:18 +08:00
class WebViewImpl {
public:
WebViewImpl(cocos2d::experimental::ui::WebView *webView);
2014-08-25 14:01:18 +08:00
virtual ~WebViewImpl();
2014-08-25 14:01:18 +08:00
void setJavascriptInterfaceScheme(const std::string &scheme);
2014-08-25 14:01:18 +08:00
void loadData(const cocos2d::Data &data, const std::string &MIMEType, const std::string &encoding, const std::string &baseURL);
2014-08-25 14:01:18 +08:00
void loadHTMLString(const std::string &string, const std::string &baseURL);
2014-08-25 14:01:18 +08:00
2014-09-15 18:14:04 +08:00
void loadURL(const std::string &url);
void loadURL(const std::string &url, bool cleanCachedData);
2014-08-25 14:01:18 +08:00
void loadFile(const std::string &fileName);
2014-08-25 14:01:18 +08:00
void stopLoading();
2014-08-25 14:01:18 +08:00
void reload();
2014-08-25 14:01:18 +08:00
bool canGoBack();
2014-08-25 14:01:18 +08:00
bool canGoForward();
2014-08-25 14:01:18 +08:00
void goBack();
2014-08-25 14:01:18 +08:00
void goForward();
2014-08-25 14:01:18 +08:00
void evaluateJS(const std::string &js);
2014-08-25 14:01:18 +08:00
void setScalesPageToFit(const bool scalesPageToFit);
2014-08-25 14:01:18 +08:00
virtual void draw(cocos2d::Renderer *renderer, cocos2d::Mat4 const &transform, uint32_t flags);
2014-08-25 14:01:18 +08:00
virtual void setVisible(bool visible);
2014-08-25 14:01:18 +08:00
void setBounces(bool bounces);
static bool shouldStartLoading(const int viewTag, const std::string &url);
static void didFinishLoading(const int viewTag, const std::string &url);
static void didFailLoading(const int viewTag, const std::string &url);
static void onJsCallback(const int viewTag, const std::string &message);
2014-08-25 14:01:18 +08:00
private:
int _viewTag;
WebView *_webView;
};
2014-08-25 14:01:18 +08:00
} // namespace ui
} // namespace experimental
} //cocos2d
2014-08-25 14:01:18 +08:00
Squashed commit of the following: commit b9181ae92541d11119bedd766773ddb01f0bb486 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:34:40 2014 -0700 Compiles luasocket on Mac commit 91fc79aa2101867fedfbcd7d846e9508009894e6 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 09:12:30 2014 -0700 disables luasockets commit 31f2ee462708ab7b604b9399eaabd275e2da9e02 Merge: 19099fd 0abe4cb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Tue Sep 9 08:10:48 2014 -0700 Merge remote-tracking branch 'cocos2d/v3' into cmakefile_mac_osx Conflicts: cocos/3d/cocos3d.h commit 19099fd021b4ecf1f2eebd73ea14e84572d1ee33 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:21:03 2014 -0700 compiles on Linux commit eec7b92817ac9208123468bb882612aad89f94bf Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 23:16:46 2014 -0700 all projecs compiles with CMake commit 40fcc8325b409a580fdbf26d2ee27aa2d1db0109 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:47:27 2014 -0700 CCUserDefualt.mm better includes commit 30709ec8243562858498cb118240bb45bf9b33b0 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 21:26:36 2014 -0700 cpp-tests compiles and works on Mac using CMake commit 67f0fc8df887d08d3d7a27c5fdadd335d6841676 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 20:12:09 2014 -0700 Adds missing files to CMakeLists.txt commit 36f939ea7f157ca851aee138300c13d9888c0078 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:52:34 2014 -0700 Adds more box2d missing files commit 00f81e3b5ec97150974cc6022e86c394ff488ccb Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 19:39:54 2014 -0700 Adds missing box2d files commit 9673227b4d7d0e6d9eced49bdd69b98cb519968a Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Mon Sep 8 18:44:15 2014 -0700 Initial CMake support for Mac
2014-09-10 03:18:31 +08:00
#endif // __ANDROID__
2015-03-24 20:23:51 +08:00
/// @endcond
2014-09-15 16:56:51 +08:00
#endif /* __COCOS2D__UI__WEBVIEWIMPL_ANDROID_H_ */