UIWebViewImpl-ios.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /****************************************************************************
  2. Copyright (c) 2014-2016 Chukong Technologies Inc.
  3. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  4. http://www.cocos2d-x.org
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. ****************************************************************************/
  21. #ifndef __COCOS2D_UI_WEBVIEWIMPL_IOS_H_
  22. #define __COCOS2D_UI_WEBVIEWIMPL_IOS_H_
  23. /// @cond DO_NOT_SHOW
  24. #include <stdint.h>
  25. #include <iosfwd>
  26. @class UIWebViewWrapper;
  27. namespace cocos2d {
  28. class Data;
  29. class Renderer;
  30. class Mat4;
  31. namespace experimental {
  32. namespace ui{
  33. class WebView;
  34. class WebViewImpl {
  35. public:
  36. WebViewImpl(WebView *webView);
  37. virtual ~WebViewImpl();
  38. void setJavascriptInterfaceScheme(const std::string &scheme);
  39. void loadData(const cocos2d::Data &data,
  40. const std::string &MIMEType,
  41. const std::string &encoding,
  42. const std::string &baseURL);
  43. void loadHTMLString(const std::string &string, const std::string &baseURL);
  44. void loadURL(const std::string &url);
  45. void loadURL(const std::string &url, bool cleanCachedData);
  46. void loadFile(const std::string &fileName);
  47. void PostURL(const std::string &url, const std::string &data);
  48. void stopLoading();
  49. void reload();
  50. bool canGoBack();
  51. bool canGoForward();
  52. void goBack();
  53. void goForward();
  54. void evaluateJS(const std::string &js);
  55. void setScalesPageToFit(const bool scalesPageToFit);
  56. virtual void draw(cocos2d::Renderer *renderer, cocos2d::Mat4 const &transform, uint32_t flags);
  57. virtual void setVisible(bool visible);
  58. void setBounces(bool bounces);
  59. virtual void setOpacityWebView(float opacity);
  60. virtual float getOpacityWebView() const;
  61. virtual void setBackgroundTransparent();
  62. private:
  63. UIWebViewWrapper *_uiWebViewWrapper;
  64. WebView *_webView;
  65. };
  66. } // namespace ui
  67. } // namespace experimental
  68. }//namespace cocos2d
  69. /// @endcond
  70. #endif /* __COCOS2D_UI_WEBVIEWIMPL_IOS_H_ */