UIWebViewImpl-win32.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __cocos2d_plugin_WebViewImpl_win32_H_
  2. #define __cocos2d_plugin_WebViewImpl_win32_H_
  3. #include "platform/CCPlatformConfig.h"
  4. #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
  5. #include <string>
  6. #include "platform/CCStdC.h"
  7. namespace cocos2d {
  8. class Data;
  9. class Renderer;
  10. class Mat4;
  11. namespace experimental {
  12. namespace ui {
  13. class WebView;
  14. }
  15. }
  16. }
  17. class Win32WebControl;
  18. namespace cocos2d {
  19. namespace experimental {
  20. namespace ui {
  21. class WebViewImpl
  22. {
  23. public:
  24. WebViewImpl(cocos2d::experimental::ui::WebView *webView);
  25. virtual ~WebViewImpl();
  26. void setJavascriptInterfaceScheme(const std::string &scheme);
  27. void loadData(const cocos2d::Data &data, const std::string &MIMEType, const std::string &encoding, const std::string &baseURL);
  28. void loadHTMLString(const std::string &string, const std::string &baseURL);
  29. void loadURL(const std::string &url);
  30. void loadURL(const std::string &url, bool cleanCachedData);
  31. void loadFile(const std::string &fileName);
  32. void PostURL(const std::string &url, const std::string &data);
  33. void stopLoading();
  34. void reload();
  35. bool canGoBack();
  36. bool canGoForward();
  37. void goBack();
  38. void goForward();
  39. void evaluateJS(const std::string &js);
  40. void setScalesPageToFit(const bool scalesPageToFit);
  41. virtual void draw(cocos2d::Renderer *renderer, cocos2d::Mat4 const &transform, uint32_t flags);
  42. virtual void setVisible(bool visible);
  43. void setBounces(bool bounces);
  44. void setOpacityWebView(float opacity);
  45. float getOpacityWebView()const;
  46. void setBackgroundTransparent();
  47. static bool shouldStartLoading(const int viewTag, const std::string &url);
  48. static void didFinishLoading(const int viewTag, const std::string &url);
  49. static void didFailLoading(const int viewTag, const std::string &url);
  50. static void onJsCallback(const int viewTag, const std::string &message);
  51. private:
  52. bool _createSucceeded;
  53. Win32WebControl *_systemWebControl;
  54. WebView *_webView;
  55. };
  56. } // namespace ui
  57. } // namespace experimental
  58. } //cocos2d
  59. #endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
  60. #endif //__cocos2d_plugin_WebViewImpl_win32_H_