axmol/core/ui/UIWebView/UIWebViewImpl-android.h

116 lines
3.1 KiB
C
Raw Normal View History

/****************************************************************************
Copyright (c) 2014-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
2021-12-25 10:04:45 +08:00
https://axis-project.github.io/
2021-12-25 10:04:45 +08:00
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:
2021-12-25 10:04:45 +08:00
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
2021-12-25 10:04:45 +08:00
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.
****************************************************************************/
2019-10-23 14:58:31 +08:00
#pragma once
2014-08-25 14:01:18 +08:00
2015-03-24 20:23:51 +08:00
/// @cond DO_NOT_SHOW
2014-08-25 14:01:18 +08:00
#include <iosfwd>
#include <stdint.h>
2021-12-27 19:18:36 +08:00
#include <string>
#include <string_view>
2014-08-25 14:01:18 +08:00
#include "platform/CCPlatformMacros.h"
NS_AX_BEGIN
2021-12-25 10:04:45 +08:00
class Data;
class Renderer;
class Mat4;
2021-12-25 10:04:45 +08:00
namespace ui
{
class WebView;
2014-08-25 14:01:18 +08:00
}
NS_AX_END // namespace axis
NS_AX_BEGIN
2021-12-25 10:04:45 +08:00
namespace ui
{
class WebViewImpl
{
public:
WebViewImpl(axis::ui::WebView* webView);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
virtual ~WebViewImpl();
2014-08-25 14:01:18 +08:00
2021-12-26 23:26:34 +08:00
void setJavascriptInterfaceScheme(std::string_view scheme);
2014-08-25 14:01:18 +08:00
void loadData(const axis::Data& data,
2021-12-26 23:26:34 +08:00
std::string_view MIMEType,
std::string_view encoding,
std::string_view baseURL);
2014-08-25 14:01:18 +08:00
2021-12-26 23:26:34 +08:00
void loadHTMLString(std::string_view string, std::string_view baseURL);
2014-08-25 14:01:18 +08:00
2021-12-26 23:26:34 +08:00
void loadURL(std::string_view url);
void loadURL(std::string_view url, bool cleanCachedData);
2014-08-25 14:01:18 +08:00
2021-12-26 23:26:34 +08:00
void loadFile(std::string_view fileName);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void stopLoading();
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void reload();
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
bool canGoBack();
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
bool canGoForward();
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void goBack();
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void goForward();
2014-08-25 14:01:18 +08:00
2021-12-26 23:26:34 +08:00
void evaluateJS(std::string_view js);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void setScalesPageToFit(const bool scalesPageToFit);
2014-08-25 14:01:18 +08:00
virtual void draw(axis::Renderer* renderer, axis::Mat4 const& transform, uint32_t flags);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
virtual void setVisible(bool visible);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void setBounces(bool bounces);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
void setOpacityWebView(float opacity);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
float getOpacityWebView() const;
2021-12-25 10:04:45 +08:00
void setBackgroundTransparent();
2014-08-25 14:01:18 +08:00
2021-12-26 23:26:34 +08:00
static bool shouldStartLoading(const int viewTag, std::string_view url);
static void didFinishLoading(const int viewTag, std::string_view url);
static void didFailLoading(const int viewTag, std::string_view url);
static void onJsCallback(const int viewTag, std::string_view message);
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
private:
int _viewTag;
WebView* _webView;
};
2014-08-25 14:01:18 +08:00
2021-12-25 10:04:45 +08:00
} // namespace ui
NS_AX_END // namespace axis
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
2015-03-24 20:23:51 +08:00
/// @endcond