Removed On(...)Event() 58/242358/7
authoradam.b <adam.b@samsung.com>
Thu, 3 Sep 2020 15:55:40 +0000 (16:55 +0100)
committeradam.b <adam.b@samsung.com>
Thu, 3 Sep 2020 16:06:46 +0000 (17:06 +0100)
Change-Id: Ia14b294a1fbdde5bf82cac93ff3101285f86727f

automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.cpp
automated-tests/src/dali/dali-test-suite-utils/test-custom-actor.h
automated-tests/src/dali/utc-Dali-CustomActor.cpp
automated-tests/src/dali/utc-Dali-TypeRegistry.cpp
automated-tests/src/dali/utc-Dali-WeakHandle.cpp
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/actors/custom-actor-internal.cpp
dali/internal/event/actors/custom-actor-internal.h
dali/public-api/actors/custom-actor-impl.cpp
dali/public-api/actors/custom-actor-impl.h

index 5723f7f..acfcd05 100644 (file)
@@ -240,7 +240,7 @@ namespace Impl
 {
 
 TestCustomActor::TestCustomActor()
-: CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS | DISABLE_SIZE_NEGOTIATION ) ),
+: CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) ),
   mDaliProperty( Property::INVALID_INDEX ),
   mSizeSet( Vector3::ZERO ),
   mTargetSize( Vector3::ZERO ),
@@ -251,7 +251,7 @@ TestCustomActor::TestCustomActor()
 }
 
 TestCustomActor::TestCustomActor(bool nego)
-: CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS ) ),
+: CustomActorImpl( ActorFlags() ),
   mDaliProperty( Property::INVALID_INDEX ),
   mSizeSet( Vector3::ZERO ),
   mTargetSize( Vector3::ZERO ),
@@ -336,21 +336,6 @@ void TestCustomActor::OnSizeAnimation(Animation& animation, const Vector3& targe
   mTargetSize = targetSize;
   AddToCallStacks("OnSizeAnimation");
 }
-bool TestCustomActor::OnHoverEvent(const HoverEvent& event)
-{
-  AddToCallStacks("OnHoverEvent");
-  return true;
-}
-bool TestCustomActor::OnWheelEvent(const WheelEvent& event)
-{
-  AddToCallStacks("OnWheelEvent");
-  return true;
-}
-bool TestCustomActor::OnKeyEvent(const KeyEvent& event)
-{
-  AddToCallStacks("OnKeyEvent");
-  return true;
-}
 void TestCustomActor::OnKeyInputFocusGained()
 {
   AddToCallStacks("OnKeyInputFocusGained");
index 907072f..822687d 100644 (file)
@@ -138,9 +138,6 @@ public:
   void OnPropertySet( Dali::Property::Index index, Dali::Property::Value propertyValue ) override;
   void OnSizeSet(const Dali::Vector3& targetSize) override;
   void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override;
-  bool OnHoverEvent(const Dali::HoverEvent& event) override;
-  bool OnWheelEvent(const Dali::WheelEvent& event) override;
-  bool OnKeyEvent(const Dali::KeyEvent& event) override;
   virtual void OnKeyInputFocusGained();
   virtual void OnKeyInputFocusLost();
   Dali::Vector3 GetNaturalSize() override;
@@ -431,7 +428,7 @@ public:
    * Constructor
    */
   SimpleTestCustomActor()
-  : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | DISABLE_SIZE_NEGOTIATION ) )
+  : CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) )
   {
   }
 
@@ -461,25 +458,12 @@ public:
   void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override
   {
   }
-  bool OnHoverEvent(const Dali::HoverEvent& event) override
-  {
-    return true;
-  }
-  bool OnWheelEvent(const Dali::WheelEvent& event) override
-  {
-    return true;
-  }
-  bool OnKeyEvent(const Dali::KeyEvent& event) override
-  {
-    return true;
-  }
   virtual void OnKeyInputFocusGained()
   {
   }
   virtual void OnKeyInputFocusLost()
   {
   }
-
   Dali::Vector3 GetNaturalSize() override
   {
     return Dali::Vector3( 0.0f, 0.0f, 0.0f );
index bce0c34..f6d0e60 100644 (file)
@@ -999,69 +999,6 @@ int UtcDaliCustomActorSizeComponentAnimation(void)
   END_TEST;
 }
 
-int UtcDaliCustomActorOnHoverEvent(void)
-{
-  TestApplication application;
-  tet_infoline("Testing Dali::CustomActor::OnHoverEvent()");
-
-  Test::TestCustomActor custom = Test::TestCustomActor::New();
-  DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
-  // set size for custom actor
-  custom.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
-  // add the custom actor to stage
-  application.GetScene().Add( custom );
-  custom.ResetCallStack();
-
-  // Render and notify a couple of times
-  application.SendNotification();
-  application.Render();
-  application.SendNotification();
-  application.Render();
-
-  // simulate a hover event
-  Dali::Integration::Point point;
-  point.SetState( PointState::MOTION );
-  point.SetScreenPosition( Vector2( 1, 1 ) );
-  Dali::Integration::HoverEvent event;
-  event.AddPoint( point );
-  application.ProcessEvent( event );
-
-  DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-  DALI_TEST_EQUALS( "OnHoverEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliCustomActorOnWheelEvent(void)
-{
-  TestApplication application;
-  tet_infoline("Testing Dali::CustomActor::OnWheelEvent()");
-
-  Test::TestCustomActor custom = Test::TestCustomActor::New();
-  DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
-  // set size for custom actor
-  custom.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
-  // add the custom actor to stage
-  application.GetScene().Add( custom );
-  custom.ResetCallStack();
-
-  // Render and notify a couple of times
-  application.SendNotification();
-  application.Render();
-  application.SendNotification();
-  application.Render();
-
-  // 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( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-  DALI_TEST_EQUALS( "OnWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
-  END_TEST;
-}
-
 int UtcDaliCustomActorImplOnPropertySet(void)
 {
   TestApplication application;
@@ -1416,8 +1353,6 @@ struct UnregisteredCustomActor : public Dali::CustomActorImpl
   { }
   virtual bool OnHoverEvent(const HoverEvent& event)
   { return false; }
-  virtual bool OnKeyEvent(const KeyEvent& event)
-  { return false; }
   virtual bool OnWheelEvent(const WheelEvent& event)
   { return false; }
   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
index ebe23b6..5388fe9 100644 (file)
@@ -123,7 +123,7 @@ struct MyTestCustomActor : public CustomActorImpl
   typedef Signal< void ()> SignalType;
   typedef Signal< void (float)> SignalTypeFloat;
 
-  MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
+  MyTestCustomActor() : CustomActorImpl( ActorFlags() )
   { }
 
   virtual ~MyTestCustomActor()
@@ -152,18 +152,6 @@ struct MyTestCustomActor : public CustomActorImpl
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
   {
   }
-  virtual bool OnHoverEvent(const HoverEvent& event)
-  {
-    return true;
-  }
-  virtual bool OnWheelEvent(const WheelEvent& event)
-  {
-    return true;
-  }
-  virtual bool OnKeyEvent(const KeyEvent& event)
-  {
-    return true;
-  }
   virtual void OnKeyInputFocusGained()
   {
   }
index a30b03d..5bfd5c3 100644 (file)
@@ -35,7 +35,7 @@ struct MyTestCustomActor : public CustomActorImpl
   typedef Signal< void ()> SignalType;
   typedef Signal< void (float)> SignalTypeFloat;
 
-  MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
+  MyTestCustomActor() : CustomActorImpl( ActorFlags() )
   { }
 
   virtual ~MyTestCustomActor()
@@ -64,18 +64,6 @@ struct MyTestCustomActor : public CustomActorImpl
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
   {
   }
-  virtual bool OnHoverEvent(const HoverEvent& event)
-  {
-    return true;
-  }
-  virtual bool OnWheelEvent(const WheelEvent& event)
-  {
-    return true;
-  }
-  virtual bool OnKeyEvent(const KeyEvent& event)
-  {
-    return true;
-  }
   virtual void OnKeyInputFocusGained()
   {
   }
index 478f973..70fce36 100644 (file)
@@ -1788,17 +1788,17 @@ bool Actor::IsKeyboardFocusable() const
 
 bool Actor::GetTouchRequired() const
 {
-  return !mTouchedSignal.Empty() || mDerivedRequiresTouch;
+  return !mTouchedSignal.Empty();
 }
 
 bool Actor::GetHoverRequired() const
 {
-  return !mHoveredSignal.Empty() || mDerivedRequiresHover;
+  return !mHoveredSignal.Empty();
 }
 
 bool Actor::GetWheelEventRequired() const
 {
-  return !mWheelEventSignal.Empty() || mDerivedRequiresWheelEvent;
+  return !mWheelEventSignal.Empty();
 }
 
 bool Actor::IsHittable() const
@@ -1845,12 +1845,6 @@ bool Actor::EmitHoverEventSignal( const Dali::HoverEvent& event )
     consumed = mHoveredSignal.Emit( handle, event );
   }
 
-  if( !consumed )
-  {
-    // Notification for derived classes
-    consumed = OnHoverEvent( event );
-  }
-
   return consumed;
 }
 
@@ -1864,12 +1858,6 @@ bool Actor::EmitWheelEventSignal( const Dali::WheelEvent& event )
     consumed = mWheelEventSignal.Emit( handle, event );
   }
 
-  if( !consumed )
-  {
-    // Notification for derived classes
-    consumed = OnWheelEvent( event );
-  }
-
   return consumed;
 }
 
@@ -2055,9 +2043,6 @@ Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node )
   mSensitive( true ),
   mLeaveRequired( false ),
   mKeyboardFocusable( false ),
-  mDerivedRequiresTouch( false ),
-  mDerivedRequiresHover( false ),
-  mDerivedRequiresWheelEvent( false ),
   mOnSceneSignalled( false ),
   mInsideOnSizeSet( false ),
   mInheritPosition( true ),
index 81bc969..7b83acf 100644 (file)
@@ -1830,28 +1830,6 @@ private:
   }
 
   /**
-   * For use in derived classes.
-   * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
-   * @param[in] event The hover event.
-   * @return True if the event should be consumed.
-   */
-  virtual bool OnHoverEvent( const HoverEvent& event )
-  {
-    return false;
-  }
-
-  /**
-   * For use in derived classes.
-   * This is only called if the wheel signal was not consumed.
-   * @param[in] event The wheel event.
-   * @return True if the event should be consumed.
-   */
-  virtual bool OnWheelEvent( const WheelEvent& event )
-  {
-    return false;
-  }
-
-  /**
    * @brief Retrieves the cached event side value of a default property.
    * @param[in]  index  The index of the property
    * @param[out] value  Is set with the cached value of the property if found.
@@ -1996,9 +1974,6 @@ protected:
   bool mSensitive                                  : 1; ///< Whether the actor emits touch event signals
   bool mLeaveRequired                              : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
   bool mKeyboardFocusable                          : 1; ///< Whether the actor should be focusable by keyboard navigation
-  bool mDerivedRequiresTouch                       : 1; ///< Whether the derived actor type requires touch event signals
-  bool mDerivedRequiresHover                       : 1; ///< Whether the derived actor type requires hover event signals
-  bool mDerivedRequiresWheelEvent                  : 1; ///< Whether the derived actor type requires wheel event signals
   bool mOnSceneSignalled                           : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
   bool mInsideOnSizeSet                            : 1; ///< Whether we are inside OnSizeSet
   bool mInheritPosition                            : 1; ///< Cached: Whether the parent's position should be inherited.
index eb6549e..f85f07b 100644 (file)
@@ -40,9 +40,6 @@ CustomActor::CustomActor( const SceneGraph::Node& node, CustomActorImpl& extensi
 : Actor( Actor::BASIC, node ),
   mImpl( &extension )
 {
-  mDerivedRequiresTouch = extension.RequiresTouchEvents();
-  mDerivedRequiresHover = extension.RequiresHoverEvents();
-  mDerivedRequiresWheelEvent = extension.RequiresWheelEvents();
   SetRelayoutEnabled( extension.IsRelayoutEnabled() );
 }
 
index c2a42be..bc96af1 100644 (file)
@@ -134,30 +134,6 @@ private:
   }
 
   /**
-   * @copydoc Internal::Actor::OnHoverEvent
-   */
-  virtual bool OnHoverEvent(const HoverEvent& event)
-  {
-    return mImpl->OnHoverEvent(event);
-  }
-
-  /**
-   * @copydoc Internal::Actor::OnKeyEvent
-   */
-  virtual bool OnKeyEvent(const KeyEvent& event)
-  {
-    return mImpl->OnKeyEvent(event);
-  }
-
-  /**
-   * @copydoc Internal::Actor::OnWheelEvent
-   */
-  virtual bool OnWheelEvent(const WheelEvent& event)
-  {
-    return mImpl->OnWheelEvent(event);
-  }
-
-  /**
    * @copydoc Internal::Actor::OnRelayout
    */
   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
index 5170eba..1486ba8 100644 (file)
@@ -56,21 +56,6 @@ Internal::CustomActor* CustomActorImpl::GetOwner() const
   return mOwner;
 }
 
-bool CustomActorImpl::RequiresTouchEvents() const
-{
-  return ( mFlags & REQUIRES_TOUCH_EVENTS );
-}
-
-bool CustomActorImpl::RequiresHoverEvents() const
-{
-  return ( mFlags & REQUIRES_HOVER_EVENTS );
-}
-
-bool CustomActorImpl::RequiresWheelEvents() const
-{
-  return ( mFlags & REQUIRES_WHEEL_EVENTS );
-}
-
 bool CustomActorImpl::IsRelayoutEnabled() const
 {
   return ( mFlags & DISABLE_SIZE_NEGOTIATION ) == 0;
index 4714bc2..39672af 100644 (file)
@@ -175,35 +175,6 @@ public:
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) = 0;
 
   /**
-   * @brief Called after a hover-event is received by the owning actor.
-   *
-   * @SINCE_1_0.0
-   * @param[in] event The hover event
-   * @return True if the event should be consumed
-   * @note CustomActorImpl::REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomActorImpl::CustomActorImpl( ActorFlags flags ).
-   */
-  virtual bool OnHoverEvent(const HoverEvent& event) = 0;
-
-  /**
-   * @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) = 0;
-
-  /**
-   * @brief Called after a wheel-event is received by the owning actor.
-   *
-   * @SINCE_1_0.0
-   * @param[in] event The wheel event
-   * @return True if the event should be consumed
-   * @note CustomActorImpl::REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomActorImpl::CustomActorImpl( ActorFlags flags ).
-   */
-  virtual bool OnWheelEvent(const WheelEvent& event) = 0;
-
-  /**
    * @brief Called after the size negotiation has been finished for this control.
    *
    * The control is expected to assign this given size to itself/its children.
@@ -319,9 +290,6 @@ protected: // For derived classes
   {
     ACTOR_BEHAVIOUR_DEFAULT       = 0,          ///< Use to provide default behaviour (size negotiation is on, event callbacks are not called). @SINCE_1_2_10
     DISABLE_SIZE_NEGOTIATION      = 1 << 0,     ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm @SINCE_1_0.0
-    REQUIRES_TOUCH_EVENTS         = 1 << 1,     ///< True if the OnTouchEvent() callback is required. @SINCE_1_0.0
-    REQUIRES_HOVER_EVENTS         = 1 << 2,     ///< True if the OnHoverEvent() callback is required. @SINCE_1_0.0
-    REQUIRES_WHEEL_EVENTS   = 1 << 3,     ///< True if the OnWheelEvent() callback is required. @SINCE_1_0.0
 
     LAST_ACTOR_FLAG                             ///< Special marker for last actor flag @SINCE_1_0.0
   };
@@ -408,30 +376,6 @@ public: // Not intended for application developers
   Internal::CustomActor* GetOwner() const;
 
   /**
-   * @brief Returns whether the OnTouchEvent() callback is required.
-   * @SINCE_1_0.0
-   * @return True if the OnTouchEvent() callback is required
-   * @note Called when ownership of the CustomActorImpl is passed to a CustomActor.
-   */
-  bool RequiresTouchEvents() const;
-
-  /**
-   * @brief Returns whether the OnHoverEvent() callback is required.
-   * @SINCE_1_0.0
-   * @return True if the OnHoverEvent() callback is required
-   * @note Called when ownership of the CustomActorImpl is passed to a CustomActor.
-   */
-  bool RequiresHoverEvents() const;
-
-  /**
-   * @brief Returns whether the OnWheelEvent() callback is required.
-   * @SINCE_1_0.0
-   * @return True if the OnWheelEvent() callback is required
-   * @note Called when ownership of the CustomActorImpl is passed to a CustomActor.
-   */
-  bool RequiresWheelEvents() const;
-
-  /**
    * @brief Returns whether relayout is enabled.
    * @SINCE_1_0.0
    * @return Return true if relayout is enabled on the custom actor
@@ -442,7 +386,7 @@ public: // Not intended for application developers
 private:
 
   Internal::CustomActor* mOwner;        ///< Internal owner of this custom actor implementation
-  ActorFlags mFlags :ACTOR_FLAG_COUNT;  ///< ActorFlags flags to determine behaviour
+  ActorFlags mFlags;  ///< ActorFlags flags to determine behaviour
 };
 
 /**