}
DummyControlImpl::DummyControlImpl()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_HOVER_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mCustomSlot1Called(false)
{
}
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; }
virtual void OnTap(const TapGesture& tap);
virtual void OnLongPress(const LongPressGesture& longPress);
virtual Vector3 GetNaturalSize();
+ virtual bool OnKeyEvent(const KeyEvent& event);
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 );
}
TestButton::TestButton()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS|REQUIRES_STYLE_CHANGE_SIGNALS ) )
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) )
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////
-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;
///////////////////////////////////////////////////////////////////////////////////////////////////
-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)
{
}
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),
mWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnWheelEventFinished );
SetRefreshInterval(DEFAULT_REFRESH_INTERVAL_LAYOUT_POSITIONS);
+
+ // Connect wheel event
+ self.WheelEventSignal().Connect( this, &ItemView::OnWheelEvent );
}
ItemView::~ItemView()
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)
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
}
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),
UpdatePropertyDomain();
SetInternalConstraints();
+
+ // Connect wheel event
+ self.WheelEventSignal().Connect( this, &ScrollView::OnWheelEvent );
}
void ScrollView::OnSceneConnection( int depth )
return false;
}
-bool ScrollView::OnWheelEvent(const WheelEvent& event)
+bool ScrollView::OnWheelEvent( Actor actor, const WheelEvent& event)
{
if(!mSensitive)
{
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()
// @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 )
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;
*/
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
/**