Support mouse & wheel event in web engine. 32/250532/10
authorhuayong.xu <huayong.xu@samsung.com>
Tue, 29 Dec 2020 06:07:06 +0000 (14:07 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Wed, 17 Mar 2021 07:27:29 +0000 (15:27 +0800)
Mouse and wheel events are supported in web engine.

Change-Id: I52b240ee8fe83fc17f5d2ec28bcb45e74832c693

dali/devel-api/adaptor-framework/web-engine-plugin.h
dali/devel-api/adaptor-framework/web-engine.cpp
dali/devel-api/adaptor-framework/web-engine.h
dali/internal/web-engine/common/web-engine-impl.cpp
dali/internal/web-engine/common/web-engine-impl.h

index 373b59d..ea6339e 100644 (file)
@@ -33,6 +33,8 @@ class WebEngineBackForwardList;
 class WebEngineContext;
 class WebEngineCookieManager;
 class WebEngineSettings;
+class HoverEvent;
+class WheelEvent;
 
 /**
  * @brief WebEnginePlugin is an abstract interface, used by dali-adaptor to access WebEngine plugin.
@@ -350,7 +352,20 @@ public:
   virtual bool SendKeyEvent(const KeyEvent& event) = 0;
 
   /**
+   * @brief Support mouse events or not.
+   * @param[in] enabled True if enabled, false othewise.
+   */
+  virtual void EnableMouseEvents( bool enabled ) = 0;
+
+  /**
+   * @brief Support key events or not.
+   * @param[in] enabled True if enabled, false othewise.
+   */
+  virtual void EnableKeyEvents( bool enabled ) = 0;
+
+  /**
    * @brief Sets focus.
+   * @param[in] focused True if focus is gained, false lost.
    */
   virtual void SetFocus(bool focused) = 0;
 
@@ -367,6 +382,18 @@ public:
   virtual void EnableVideoHole(bool enabled) = 0;
 
   /**
+   * @brief Sends Hover Events.
+   * @param[in] event The hover event would be sent.
+   */
+  virtual bool SendHoverEvent( const HoverEvent& event ) = 0;
+
+  /**
+   * @brief Sends Wheel Events.
+   * @param[in] event The wheel event would be sent.
+   */
+  virtual bool SendWheelEvent( const WheelEvent& event ) = 0;
+
+  /**
    * @brief Connects to this signal to be notified when page loading is started.
    *
    * @return A signal object to connect with.
index 2569cf6..f2df43e 100644 (file)
@@ -274,6 +274,16 @@ bool WebEngine::SendKeyEvent(const KeyEvent& event)
   return GetImplementation(*this).SendKeyEvent(event);
 }
 
+bool WebEngine::SendHoverEvent( const HoverEvent& event )
+{
+  return GetImplementation( *this ).SendHoverEvent( event );
+}
+
+bool WebEngine::SendWheelEvent( const WheelEvent& event )
+{
+  return GetImplementation( *this ).SendWheelEvent( event );
+}
+
 void WebEngine::SetFocus(bool focused)
 {
   GetImplementation(*this).SetFocus(focused);
@@ -284,6 +294,16 @@ void WebEngine::UpdateDisplayArea(Dali::Rect<int> displayArea)
   GetImplementation(*this).UpdateDisplayArea(displayArea);
 }
 
+void WebEngine::EnableMouseEvents(bool enabled)
+{
+  GetImplementation(*this).EnableMouseEvents(enabled);
+}
+
+void WebEngine::EnableKeyEvents(bool enabled)
+{
+  GetImplementation(*this).EnableKeyEvents(enabled);
+}
+
 void WebEngine::EnableVideoHole(bool enabled)
 {
   GetImplementation(*this).EnableVideoHole(enabled);
index 2d2d142..fc0ce9f 100644 (file)
@@ -336,6 +336,20 @@ public:
   void SetFocus(bool focused);
 
   /**
+   * @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 are enabled, false otherwise
+   */
+  void EnableKeyEvents( bool enabled );
+
+  /**
    * @brief Update display area.
    * @param[in] displayArea The area to display web page.
    */
@@ -348,6 +362,18 @@ public:
   void EnableVideoHole(bool enabled);
 
   /**
+   * @brief Sends hover events.
+   * @param[in] event The hover event would be sent.
+   */
+  bool SendHoverEvent( const HoverEvent& event );
+
+  /**
+   * @brief Sends wheel events.
+   * @param[in] event The wheel event would be sent.
+   */
+  bool SendWheelEvent( const WheelEvent& event );
+
+  /**
    * @brief Connects to this signal to be notified when page loading is started.
    *
    * @return A signal object to connect with.
index e4f54ba..0c998ad 100644 (file)
@@ -359,6 +359,16 @@ void WebEngine::SetSize(int width, int height)
   mPlugin->SetSize(width, height);
 }
 
+void WebEngine::EnableMouseEvents(bool enabled)
+{
+  mPlugin->EnableMouseEvents(enabled);
+}
+
+void WebEngine::EnableKeyEvents(bool enabled)
+{
+  mPlugin->EnableKeyEvents(enabled);
+}
+
 bool WebEngine::SendTouchEvent(const Dali::TouchEvent& touch)
 {
   return mPlugin->SendTouchEvent(touch);
@@ -384,6 +394,16 @@ void WebEngine::EnableVideoHole(bool enabled)
   mPlugin->EnableVideoHole(enabled);
 }
 
+bool WebEngine::SendHoverEvent( const Dali::HoverEvent& event )
+{
+  return mPlugin->SendHoverEvent( event );
+}
+
+bool WebEngine::SendWheelEvent( const Dali::WheelEvent& event )
+{
+  return mPlugin->SendWheelEvent( event );
+}
+
 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
 {
   return mPlugin->PageLoadStartedSignal();
index 057b831..a11211f 100644 (file)
@@ -250,6 +250,16 @@ public:
   void SetSize(int width, int height);
 
   /**
+   * @copydoc Dali::WebEngine::EnableMouseEvents()
+   */
+  void EnableMouseEvents( bool enabled );
+
+  /**
+   * @copydoc Dali::WebEngine::EnableKeyEvents()
+   */
+  void EnableKeyEvents( bool enabled );
+
+  /**
    * @copydoc Dali::WebEngine::SendTouchEvent()
    */
   bool SendTouchEvent(const Dali::TouchEvent& touch);
@@ -275,6 +285,16 @@ public:
   void EnableVideoHole(bool enabled);
 
   /**
+   * @copydoc Dali::WebEngine::SendHoverEvent()
+   */
+  bool SendHoverEvent( const Dali::HoverEvent& event );
+
+  /**
+   * @copydoc Dali::WebEngine::SendWheelEvent()
+   */
+  bool SendWheelEvent( const Dali::WheelEvent& event );
+
+  /**
    * @copydoc Dali::WebEngine::PageLoadStartedSignal()
    */
   Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal();