Removed On(...)Event() 59/242359/9
authoradam.b <adam.b@samsung.com>
Thu, 3 Sep 2020 16:11:02 +0000 (17:11 +0100)
committeradam.b <adam.b@samsung.com>
Thu, 3 Sep 2020 16:11:15 +0000 (17:11 +0100)
Change-Id: I09dcd36368f97c03cfda6d004e240df4dc13264b

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-button.cpp
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h

index 66e0bcc..7ca109c 100644 (file)
@@ -93,7 +93,7 @@ DummyControl DummyControlImpl::New()
 }
 
 DummyControlImpl::DummyControlImpl()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_HOVER_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mCustomSlot1Called(false)
 {
 }
@@ -267,8 +267,6 @@ void Impl::DummyControl::OnChildAdd(Actor& child) { childAddCalled = true; }
 void Impl::DummyControl::OnChildRemove(Actor& child) { childRemoveCalled = true; }
 void Impl::DummyControl::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; }
 void Impl::DummyControl::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; }
-bool Impl::DummyControl::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; }
-bool Impl::DummyControl::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; }
 bool Impl::DummyControl::OnKeyEvent(const KeyEvent& event) { keyEventCalled = true; return false;}
 void Impl::DummyControl::OnKeyInputFocusGained() { keyInputFocusGained = true; }
 void Impl::DummyControl::OnKeyInputFocusLost() { keyInputFocusLost = true; }
index 6321c1e..0b257a1 100644 (file)
@@ -162,6 +162,7 @@ private: // From Internal::Control
   virtual void OnTap(const TapGesture& tap);
   virtual void OnLongPress(const LongPressGesture& longPress);
   virtual Vector3 GetNaturalSize();
+  virtual bool OnKeyEvent(const KeyEvent& event);
 
 private: // From CustomActorImpl
 
@@ -171,9 +172,6 @@ private: // From CustomActorImpl
   virtual void OnChildRemove(Actor& child);
   virtual void OnSizeSet(const Vector3& targetSize);
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
-  virtual bool OnHoverEvent(const HoverEvent& event);
-  virtual bool OnWheelEvent(const WheelEvent& event);
-  virtual bool OnKeyEvent(const KeyEvent& event);
   virtual void OnKeyInputFocusGained();
   virtual void OnKeyInputFocusLost();
   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
index 3d25205..69b60b5 100644 (file)
@@ -57,7 +57,7 @@ Test::TestButton TestButton::New()
 }
 
 TestButton::TestButton()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS|REQUIRES_STYLE_CHANGE_SIGNALS ) )
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) )
 {
 }
 
index baa6b9e..a3ed827 100644 (file)
@@ -465,65 +465,6 @@ int UtcDaliControlImplSizeAnimation(void)
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-int UtcDaliControlImplHoverEvent(void)
-{
-  ToolkitTestApplication application;
-
-  {
-    DummyControl dummy = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-
-    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
-    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    application.GetScene().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, false, TEST_LOCATION );
-    Integration::HoverEvent event(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::MOTION );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    event.AddPoint(point);
-    application.ProcessEvent( event );
-    DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, true, TEST_LOCATION );
-
-    application.GetScene().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-
-    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
-    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    application.GetScene().Add(dummy);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    Integration::HoverEvent event(1);
-    Integration::Point point;
-    point.SetDeviceId( 1 );
-    point.SetState( PointState::MOTION );
-    point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
-    event.AddPoint(point);
-    application.ProcessEvent( event );
-
-    application.GetScene().Remove(dummy);
-  }
-  END_TEST;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-
 int UtcDaliControlImplKeyEvent(void)
 {
   ToolkitTestApplication application;
@@ -654,68 +595,6 @@ int UtcDaliControlImplTypeRegistry(void)
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-namespace
-{
-static bool WheelEventCallback(Actor actor, const WheelEvent& event)
-{
-  return false;
-}
-}
-
-int UtcDaliControlImplWheelEvent(void)
-{
-  ToolkitTestApplication application;
-
-  {
-    DummyControl dummy = DummyControl::New( true );
-    Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummy.GetImplementation());
-
-    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
-    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    application.GetScene().Add(dummy);
-
-    dummy.WheelEventSignal().Connect(&WheelEventCallback);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    DALI_TEST_EQUALS( dummyImpl.wheelEventCalled, false, TEST_LOCATION );
-
-    // simulate a wheel event
-    Vector2 screenCoordinates( 10.0f, 10.0f );
-    Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
-    application.ProcessEvent( event );
-    DALI_TEST_EQUALS( dummyImpl.wheelEventCalled, true, TEST_LOCATION );
-
-    application.GetScene().Remove(dummy);
-  }
-
-  // Ensure full code coverage
-  {
-    DummyControl dummy = DummyControl::New();
-
-    dummy.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
-    dummy.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-    application.GetScene().Add(dummy);
-
-    dummy.WheelEventSignal().Connect(&WheelEventCallback);
-
-    application.Render();
-    application.SendNotification();
-    application.Render();
-    application.SendNotification();
-
-    // simulate a wheel event
-    Vector2 screenCoordinates( 20.0f, 20.0f );
-    Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
-    application.ProcessEvent( event );
-
-    application.GetScene().Remove(dummy);
-  }
-  END_TEST;
-}
 
 int UtcDaliControlImplSetStyleName(void)
 {
index dc329ed..c442fb8 100644 (file)
@@ -333,7 +333,7 @@ Dali::Toolkit::ItemView ItemView::New(ItemFactory& factory)
 }
 
 ItemView::ItemView(ItemFactory& factory)
-: Scrollable( ControlBehaviour( DISABLE_SIZE_NEGOTIATION | DISABLE_STYLE_CHANGE_SIGNALS | REQUIRES_WHEEL_EVENTS | REQUIRES_KEYBOARD_NAVIGATION_SUPPORT ) ),
+: Scrollable( ControlBehaviour( DISABLE_SIZE_NEGOTIATION | DISABLE_STYLE_CHANGE_SIGNALS | REQUIRES_KEYBOARD_NAVIGATION_SUPPORT ) ),
   mItemFactory(factory),
   mItemsParentOrigin(ParentOrigin::CENTER),
   mItemsAnchorPoint(AnchorPoint::CENTER),
@@ -374,6 +374,9 @@ void ItemView::OnInitialize()
   mWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnWheelEventFinished );
 
   SetRefreshInterval(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS);
+
+  // Connect wheel event
+  self.WheelEventSignal().Connect( this, &ItemView::OnWheelEvent );
 }
 
 ItemView::~ItemView()
@@ -1022,7 +1025,7 @@ void ItemView::OnChildAdd(Actor& child)
   Scrollable::OnChildAdd( child );
 }
 
-bool ItemView::OnWheelEvent(const WheelEvent& event)
+bool ItemView::OnWheelEvent(Actor actor, const WheelEvent& event)
 {
   // Respond the wheel event to scroll
   if (mActiveLayout)
index 0cfa9ab..12894af 100755 (executable)
@@ -412,11 +412,12 @@ private: // From CustomActorImpl
   virtual void OnChildAdd(Actor& child);
 
   /**
-   * From CustomActorImpl; called after a wheel-event is received by the owning actor.
+   * Called after a wheel-event is received by the owning actor.
+   * @param[in] actor Actor associated with the wheel event.
    * @param[in] event The wheel event.
    * @return True if the event should be consumed.
    */
-  virtual bool OnWheelEvent(const WheelEvent& event);
+  bool OnWheelEvent(Actor actor, const WheelEvent& event);
 
 private: // From Control
 
index c0fb772..1273cd1 100644 (file)
@@ -629,7 +629,7 @@ Dali::Toolkit::ScrollView ScrollView::New()
 }
 
 ScrollView::ScrollView()
-: ScrollBase( ControlBehaviour( REQUIRES_WHEEL_EVENTS | DISABLE_STYLE_CHANGE_SIGNALS ) ),   // Enable size negotiation
+: ScrollBase( ControlBehaviour( DISABLE_STYLE_CHANGE_SIGNALS ) ),   // Enable size negotiation
   mTouchDownTime(0u),
   mGestureStackDepth(0),
   mScrollStateFlags(0),
@@ -703,6 +703,9 @@ void ScrollView::OnInitialize()
 
   UpdatePropertyDomain();
   SetInternalConstraints();
+
+  // Connect wheel event
+  self.WheelEventSignal().Connect( this, &ScrollView::OnWheelEvent );
 }
 
 void ScrollView::OnSceneConnection( int depth )
@@ -2129,7 +2132,7 @@ bool ScrollView::OnTouch( Actor actor, const TouchEvent& touch )
   return false;
 }
 
-bool ScrollView::OnWheelEvent(const WheelEvent& event)
+bool ScrollView::OnWheelEvent( Actor actor, const WheelEvent& event)
 {
   if(!mSensitive)
   {
index d85a156..ec7b893 100644 (file)
@@ -566,11 +566,12 @@ private: // private overridden functions from CustomActorImpl and Controls
   virtual void OnChildRemove(Actor& child);
 
   /**
-   * From CustomActorImpl; called after a wheelEvent is received by the owning actor.
+   * Called after a wheelEvent is received by the owning actor.
+   * @param[in] actor Actor associated with the event.
    * @param[in] event The wheel event.
    * @return True if the event should be consumed.
    */
-  virtual bool OnWheelEvent(const WheelEvent& event);
+  bool OnWheelEvent(Actor actor, const WheelEvent& event);
 
   /**
    * @copydoc Toolkit::Control::OnInitialize()
index 506b833..4916474 100644 (file)
@@ -622,21 +622,11 @@ void Control::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
   // @todo size negotiate background to new size, animate as well?
 }
 
-bool Control::OnHoverEvent(const HoverEvent& event)
-{
-  return false; // Do not consume
-}
-
 bool Control::OnKeyEvent(const KeyEvent& event)
 {
   return false; // Do not consume
 }
 
-bool Control::OnWheelEvent(const WheelEvent& event)
-{
-  return false; // Do not consume
-}
-
 void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
 {
   for( unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i )
index 237c462..745d444 100644 (file)
@@ -339,21 +339,6 @@ protected: // From CustomActorImpl
   virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ) override;
 
   /**
-   * @copydoc CustomActorImpl::OnHoverEvent()
-   */
-  virtual bool OnHoverEvent( const HoverEvent& event ) override;
-
-  /**
-   * @copydoc CustomActorImpl::OnKeyEvent()
-   */
-  virtual bool OnKeyEvent( const KeyEvent& event ) override;
-
-  /**
-   * @copydoc CustomActorImpl::OnWheelEvent()
-   */
-  virtual bool OnWheelEvent( const WheelEvent& event ) override;
-
-  /**
    * @copydoc CustomActorImpl::OnRelayout()
    */
   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
@@ -546,6 +531,15 @@ public: // API for derived classes to override
    */
   virtual bool OnKeyboardEnter();
 
+  /**
+   * @brief Called after a key-event is received by the actor that has had its focus set.
+   *
+   * @SINCE_1_0.0
+   * @param[in] event The Key Event
+   * @return True if the event should be consumed
+   */
+  virtual bool OnKeyEvent( const KeyEvent& event );
+
   // Gestures
 
   /**