{
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 ),
}
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 ),
{
AddToCallStacks("OnChildRemove");
}
-void TestCustomActor::OnPropertySet( Property::Index index, Property::Value propertyValue )
+void TestCustomActor::OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{
AddToCallStacks("OnPropertySet");
}
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");
void OnSceneDisconnection() override;
void OnChildAdd(Dali::Actor& child) override;
void OnChildRemove(Dali::Actor& child) override;
- void OnPropertySet( Dali::Property::Index index, Dali::Property::Value propertyValue ) override;
+ void OnPropertySet( Dali::Property::Index index, const 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;
* Constructor
*/
SimpleTestCustomActor()
- : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | DISABLE_SIZE_NEGOTIATION ) )
+ : CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) )
{
}
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 );
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;
{ }
virtual void OnChildRemove(Actor& child)
{ }
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{ }
virtual void OnSizeSet(const Vector3& targetSize)
{ }
virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
{ }
virtual bool OnHoverEvent(const HoverEvent& event)
- { return false; }
- virtual bool OnKeyEvent(const KeyEvent& event)
{ return false; }
virtual bool OnWheelEvent(const WheelEvent& event)
{ return false; }
/**
* @copydoc Internal::Actor::OnPropertySet
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{
mImpl->OnPropertySet(index, propertyValue);
}
}
/**
- * @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 )
return CustomActor(mOwner);
}
-void CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue )
+void CustomActorImpl::OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{
}
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;
* @param[in] index The Property index that was set
* @param[in] propertyValue The value to set
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue );
/**
* @brief Called when the owning actor's size is set e.g. using Actor::SetSize().
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.
{
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
};
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
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
};
/**