Support mouse & wheel events in web view.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.h
index 5a76ab5..9abfd49 100644 (file)
@@ -164,9 +164,34 @@ public:
   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
 
   /**
-   * @brief Clears all tiles resources of Web.
+   * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback()
    */
-  void ClearAllTilesResources();
+  void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::JavaScriptAlertReply()
+   */
+  void JavaScriptAlertReply();
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptConfirmCallback()
+   */
+  void RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::JavaScriptConfirmReply()
+   */
+  void JavaScriptConfirmReply(bool confirmed);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptPromptCallback()
+   */
+  void RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback);
+
+  /**
+   * @copydoc Dali::Toolkit::WebView::JavaScriptPromptReply()
+   */
+  void JavaScriptPromptReply(const std::string& result);
 
   /**
    * @copydoc Dali::Toolkit::WebView::ClearHistory()
@@ -174,11 +199,21 @@ public:
   void ClearHistory();
 
   /**
+   * @brief Clears all tiles resources of Web.
+   */
+  void ClearAllTilesResources();
+
+  /**
    * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
    */
   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
 
   /**
+   * @copydoc Dali::Toolkit::WebView::PageLoadInProgressSignal()
+   */
+  Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadInProgressSignal();
+
+  /**
    * @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal()
    */
   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadFinishedSignal();
@@ -193,6 +228,11 @@ public:
    */
   Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::UrlChangedSignal()
+   */
+  Dali::Toolkit::WebView::WebViewUrlChangedSignalType& UrlChangedSignal();
+
 public: // Properties
   /**
    * @brief Called when a property of an object of this type is set.
@@ -235,14 +275,6 @@ private: // From Control
   Vector3 GetNaturalSize() override;
 
   /**
-   * Signal occurs when the Web View has been touched.
-   * @param[in] actor The Actor Touched
-   * @param[in] touch The Touch Data.
-   * @return Whether to consume event or not.
-   */
-  bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch);
-
-  /**
    * @copydoc Toolkit::Control::OnKeyEvent()
    */
   bool OnKeyEvent(const Dali::KeyEvent& event) override;
@@ -334,12 +366,32 @@ private:
   void EnableBlendMode(bool blendEnabled);
 
   /**
+   * @brief Enables/disables mouse events. The default is enabled.
+   *
+   * @param[in] enabled True if mouse events are enabled, false otherwise
+   */
+  void EnableMouseEvents(bool enabled);
+
+  /**
+   * @brief Enables/disables key events. The default is enabled.
+   *
+   * @param[in] enabled True if key events enabled, false otherwise
+   */
+  void EnableKeyEvents(bool enabled);
+
+  /**
    * @brief Callback function to be called when page load started.
    * @param[in] url The url currently being loaded
    */
   void OnPageLoadStarted(const std::string& url);
 
   /**
+   * @brief Callback function to be called when page is loading in progress.
+   * @param[in] url The url currently being loaded
+   */
+  void OnPageLoadInProgress(const std::string& url);
+
+  /**
    * @brief Callback function to be called when page load finished.
    * @param[in] url The url currently being loaded
    */
@@ -358,6 +410,36 @@ private:
    */
   void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge);
 
+  /**
+   * @brief Callback function to be called when url is changed.
+   * @param[in] url The url currently being loaded
+   */
+  void OnUrlChanged(const std::string& url);
+
+  /**
+   * Signal occurs when the Web View has been touched.
+   * @param[in] actor The Actor Touched
+   * @param[in] touch The Touch Data.
+   * @return Whether to consume event or not.
+   */
+  bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch);
+
+  /**
+   * Signal occurs when the Web View has been hovered.
+   * @param[in] actor The Actor Hovered
+   * @param[in] hover The Hover Data.
+   * @return Whether to consume event or not.
+   */
+  bool OnHoverEvent(Actor actor, const Dali::HoverEvent& hover);
+
+  /**
+   * Signal occurs when the Web View receives wheel event.
+   * @param[in] actor The Actor that receives Wheel event.
+   * @param[in] wheel The Wheel Data.
+   * @return Whether to consume event or not.
+   */
+  bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel);
+
 private:
   std::string                 mUrl;
   Dali::Toolkit::Visual::Base mVisual;
@@ -365,6 +447,7 @@ private:
   Dali::WebEngine             mWebEngine;
 
   Dali::Toolkit::WebView::WebViewPageLoadSignalType          mPageLoadStartedSignal;
+  Dali::Toolkit::WebView::WebViewPageLoadSignalType          mPageLoadInProgressSignal;
   Dali::Toolkit::WebView::WebViewPageLoadSignalType          mPageLoadFinishedSignal;
   Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType     mPageLoadErrorSignal;
   Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
@@ -375,11 +458,14 @@ private:
   std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
   Dali::Toolkit::ImageView                           mFaviconView;
 
-  Dali::PropertyNotification mPositionUpdateNotification;
-  Dali::PropertyNotification mSizeUpdateNotification;
-  Dali::PropertyNotification mScaleUpdateNotification;
-  bool                       mVideoHoleEnabled;
-  Dali::Rect<int>            mWebViewArea;
+  Dali::PropertyNotification                          mPositionUpdateNotification;
+  Dali::PropertyNotification                          mSizeUpdateNotification;
+  Dali::PropertyNotification                          mScaleUpdateNotification;
+  bool                                                mVideoHoleEnabled;
+  Dali::Rect<int>                                     mWebViewArea;
+  Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
+  bool                                                mMouseEventsEnabled;
+  bool                                                mKeyEventsEnabled;
 };
 
 } // namespace Internal