#define DALI_TOOLKIT_WEB_VIEW_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <functional>
// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
#include <dali-toolkit/public-api/controls/control.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal DALI_INTERNAL
{
- class WebView;
-} // namespace Internal
+class WebView;
+} // namespace DALI_INTERNAL
/**
* @addtogroup dali_toolkit_controls_web_view
class DALI_TOOLKIT_API WebView : public Control
{
public:
-
/**
* @brief A structure used to contain the cache model enumeration.
*/
enum PropertyRange
{
PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000,
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000,
};
/**
* @details Name "defaultFontSize", type Property::INT.
* @note Default is 16.
*/
- DEFAULT_FONT_SIZE
+ DEFAULT_FONT_SIZE,
+
+ /**
+ * @brief The current position of scroll.
+ * @details Name "scrollPosition", type Property::VECTOR2.
+ */
+ SCROLL_POSITION,
+
+ /**
+ * @brief The current position of scroll.
+ * @details Name "scrollSize", type Property::VECTOR2. Read-only.
+ */
+ SCROLL_SIZE,
+
+ /**
+ * @brief The current position of scroll.
+ * @details Name "contentSize", type Property::VECTOR2. Read-only.
+ */
+ CONTENT_SIZE,
};
};
/**
* @brief WebView signal type related with page loading.
*/
- typedef Signal< void ( WebView, const std::string& ) > WebViewPageLoadSignalType;
+ typedef Signal<void(WebView, const std::string&)> WebViewPageLoadSignalType;
/**
* @brief WebView signal type related with page loading error.
*/
- typedef Signal< void ( WebView, const std::string&, LoadErrorCode ) > WebViewPageLoadErrorSignalType;
+ typedef Signal<void(WebView, const std::string&, LoadErrorCode)> WebViewPageLoadErrorSignalType;
-public:
+ /**
+ * @brief WebView signal type related with scroll edge reached.
+ */
+ typedef Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)> WebViewScrollEdgeReachedSignalType;
+public:
/**
* @brief Creates an initialized WebView.
* @return A handle to a newly allocated Dali WebView
* @param [in] locale The locale of Web
* @param [in] timezoneId The timezoneId of Web
*/
- static WebView New( const std::string& locale, const std::string& timezoneId );
+ static WebView New(const std::string& locale, const std::string& timezoneId);
/**
* @brief Creates an uninitialized WebView.
*
* @param[in] WebView WebView to copy. The copied WebView will point at the same implementation
*/
- WebView( const WebView& WebView );
+ WebView(const WebView& WebView);
/**
* @brief Assignment operator.
* @param[in] WebView The WebView to assign from
* @return The updated WebView
*/
- WebView& operator=( const WebView& WebView );
+ WebView& operator=(const WebView& WebView);
/**
* @brief Downcasts a handle to WebView handle.
* @param[in] handle Handle to an object
* @return Handle to a WebView or an uninitialized handle
*/
- static WebView DownCast( BaseHandle handle );
+ static WebView DownCast(BaseHandle handle);
/**
* @brief Loads a web page based on a given URL.
*
* @param [in] url The URL of the resource to load
*/
- void LoadUrl( const std::string& url );
+ void LoadUrl(const std::string& url);
/**
* @brief Loads a given string as web contents.
*
* @param [in] htmlString The string to use as the contents of the web page
*/
- void LoadHTMLString( const std::string& htmlString );
+ void LoadHTMLString(const std::string& htmlString);
/**
* @brief Reloads the Web.
void Resume();
/**
+ * @brief Scrolls the webpage of view by deltaX and deltaY.
+ * @param[in] deltaX The delta x of scroll
+ * @param[in] deltaY The delta y of scroll
+ */
+ void ScrollBy( int deltaX, int deltaY );
+
+ /**
* @brief Returns whether forward is possible.
*
* @return True if forward is possible, false otherwise
* @param[in] script The JavaScript code
* @param[in] resultHandler The callback function to be called by the JavaScript runtime. This carries evaluation result.
*/
- void EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler );
+ void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
/**
* @brief Evaluates JavaScript code represented as a string.
*
* @param[in] script The JavaScript code
*/
- void EvaluateJavaScript( const std::string& script );
+ void EvaluateJavaScript(const std::string& script);
/**
* @brief Inject a JavaScript object with a message handler into the WebView.
* @param[in] exposedObjectName The name of exposed object
* @param[in] handler The callback function
*/
- void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler );
+ void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
/**
* @brief Clears the history of Web.
*/
WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
-public: // Not intended for application developers
+ /**
+ * @brief Connects to this signal to be notified when scroll edge is reached.
+ *
+ * @return A signal object to connect with.
+ */
+ WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+public: // Not intended for application developers
/// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] implementation The WebView implementation
*/
- DALI_INTERNAL WebView( Internal::WebView& implementation );
+ DALI_INTERNAL WebView(Internal::WebView& implementation);
/**
* @brief Allows the creation of this WebView from an Internal::CustomActor pointer.
*
* @param[in] internal A pointer to the internal CustomActor
*/
- explicit DALI_INTERNAL WebView( Dali::Internal::CustomActor* internal );
+ explicit DALI_INTERNAL WebView(Dali::Internal::CustomActor* internal);
/// @endcond
-
};
/**