1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #ifndef __cocos2d_plugin_WebViewImpl_win32_H_
- #define __cocos2d_plugin_WebViewImpl_win32_H_
- #include "platform/CCPlatformConfig.h"
- #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
- #include <string>
- #include "platform/CCStdC.h"
- namespace cocos2d {
- class Data;
- class Renderer;
- class Mat4;
- namespace experimental {
- namespace ui {
- class WebView;
- }
- }
- }
- class Win32WebControl;
- namespace cocos2d {
- namespace experimental {
- namespace ui {
- class WebViewImpl
- {
- public:
- WebViewImpl(cocos2d::experimental::ui::WebView *webView);
- virtual ~WebViewImpl();
- void setJavascriptInterfaceScheme(const std::string &scheme);
- void loadData(const cocos2d::Data &data, const std::string &MIMEType, const std::string &encoding, const std::string &baseURL);
- void loadHTMLString(const std::string &string, const std::string &baseURL);
- void loadURL(const std::string &url);
-
- void loadURL(const std::string &url, bool cleanCachedData);
- void loadFile(const std::string &fileName);
-
- void PostURL(const std::string &url, const std::string &data);
- void stopLoading();
- void reload();
- bool canGoBack();
- bool canGoForward();
- void goBack();
- void goForward();
- void evaluateJS(const std::string &js);
- void setScalesPageToFit(const bool scalesPageToFit);
- virtual void draw(cocos2d::Renderer *renderer, cocos2d::Mat4 const &transform, uint32_t flags);
- virtual void setVisible(bool visible);
-
- void setBounces(bool bounces);
-
- void setOpacityWebView(float opacity);
-
- float getOpacityWebView()const;
-
- void setBackgroundTransparent();
- 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);
- private:
- bool _createSucceeded;
- Win32WebControl *_systemWebControl;
- WebView *_webView;
- };
- } // namespace ui
- } // namespace experimental
- } //cocos2d
- #endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
- #endif //__cocos2d_plugin_WebViewImpl_win32_H_
|