childRemoveCalled(false),
sizeSetCalled(false),
sizeAnimationCalled(false),
- touchEventCalled(false),
hoverEventCalled(false),
wheelEventCalled(false),
keyEventCalled(false),
void Impl::DummyControl::OnInitialize() { initializeCalled = true; }
bool Impl::DummyControl::OnAccessibilityActivated() { activatedCalled = true; return true; }
-bool Impl::DummyControl::OnAccessibilityTouch(const TouchEvent& touchEvent) { onAccTouchedCalled = true; return true; }
+bool Impl::DummyControl::OnAccessibilityTouch(const TouchData& touchData) { onAccTouchedCalled = true; return true; }
bool Impl::DummyControl::OnAccessibilityValueChange( bool isIncrease )
{
onAccValueChangeCalled = true; return 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::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; }
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;}
virtual void OnInitialize();
virtual bool OnAccessibilityActivated();
- virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
+ virtual bool OnAccessibilityTouch( const TouchData& touchData );
virtual bool OnAccessibilityValueChange( bool isIncrease );
virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
virtual void OnChildRemove(Actor& child);
virtual void OnSizeSet(const Vector3& targetSize);
virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
- virtual bool OnTouchEvent(const TouchEvent& event);
virtual bool OnHoverEvent(const HoverEvent& event);
virtual bool OnWheelEvent(const WheelEvent& event);
virtual bool OnKeyEvent(const KeyEvent& event);
bool childRemoveCalled;
bool sizeSetCalled;
bool sizeAnimationCalled;
- bool touchEventCalled;
bool hoverEventCalled;
bool wheelEventCalled;
bool keyEventCalled;
+++ /dev/null
-#ifndef TEST_TOUCH_UTILS_H
-#define TEST_TOUCH_UTILS_H
-
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali/public-api/actors/actor.h>
-
-namespace Dali
-{
-
-// Data for touch events
-struct TouchEventData
-{
- TouchEventData()
- : functorCalled(false),
- receivedTouch(),
- touchActor()
- {
- }
-
- void Reset()
- {
- functorCalled = false;
-
- receivedTouch.points.clear();
- receivedTouch.time = 0;
-
- touchActor.Reset();
- }
-
- bool functorCalled;
- TouchEvent receivedTouch;
- Actor touchActor;
-};
-
-// Functor that sets the data when called
-struct TouchEventDataFunctor
-{
- TouchEventDataFunctor(TouchEventData& data) : touchEventData(data) { }
-
- bool operator()(Actor actor, const TouchEvent& touch)
- {
- touchEventData.functorCalled = true;
- touchEventData.touchActor = actor;
- touchEventData.receivedTouch = touch;
- return false;
- }
-
- // Generate a touch-event
- Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition ) const
- {
- Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- touchEvent.points.push_back( point );
- return touchEvent;
- }
-
- TouchEventData& touchEventData;
-};
-
-
-} // namespace Dali
-
-#endif // TEST_TOUCH_UTILS_H
#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-event.h>
+#include <dali/integration-api/events/touch-data-integ.h>
namespace Dali
{
{
if( mActionHandler )
{
- Dali::TouchEvent touchEvent;
- touchEvent.points.push_back( point );
- return mActionHandler->AccessibilityActionScroll( touchEvent );
+ Dali::TouchData touchData = Integration::NewTouchData(timeStamp, point);
+ return mActionHandler->AccessibilityActionScroll( touchData );
}
return false;
}
{
if( mActionHandler )
{
- Dali::TouchEvent touchEvent;
- touchEvent.points.push_back( point );
- return mActionHandler->AccessibilityActionTouch( touchEvent );
+ Dali::TouchData touchData = Integration::NewTouchData(timeStamp, point);
+ return mActionHandler->AccessibilityActionTouch( touchData );
}
return false;
}
{
}
- bool Callback( AccessibilityManager& accessibilityManager, const Dali::TouchEvent& touchEvent )
+ bool Callback( AccessibilityManager& accessibilityManager, const Dali::TouchData& touchEvent )
{
mCalls++;
- mTouchEvent = touchEvent;
+ Dali::TouchData handle(touchEvent); // Ensure it's ref-counted
+ mTouchData = handle;
tet_infoline( "Signal called" );
return true;
}
return mCalls;
}
- const Dali::TouchEvent& GetTouchEvent() const
+ const Dali::TouchData& GetTouchData() const
{
- return mTouchEvent;
+ return mTouchData;
}
private:
unsigned int mCalls; ///< Keeps track of how many times the signal has been called.
- Dali::TouchEvent mTouchEvent; ///< Stores the last touch event received.
+ Dali::TouchData mTouchData ; ///< Stores the last touch event received.
};
int UtcDaliAccessibilityManagerActionScrollSignalP(void)
DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
- const TouchEvent& signalTouchEvent = callback.GetTouchEvent();
- DALI_TEST_EQUALS( signalTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ const TouchData& signalTouchData = callback.GetTouchData();
+ DALI_TEST_EQUALS( signalTouchData.GetPointCount(), 1u, TEST_LOCATION );
- const TouchPoint& signalTouchPoint = signalTouchEvent.GetPoint( 0u );
- DALI_TEST_EQUALS( signalTouchPoint.state, TouchPoint::Started, TEST_LOCATION );
- DALI_TEST_EQUALS( signalTouchPoint.screen.x, 100.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( signalTouchPoint.screen.y, 200.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( signalTouchData.GetState(0), PointState::STARTED, TEST_LOCATION );
+ DALI_TEST_EQUALS( signalTouchData.GetScreenPosition(0).x, 100.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( signalTouchData.GetScreenPosition(0).y, 200.0f, TEST_LOCATION );
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
-int UtcDaliControlImplTouchEvent(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.touchEventCalled, false, TEST_LOCATION );
- Integration::TouchEvent touchEvent(1);
- Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
- touchEvent.AddPoint(point);
- application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( dummyImpl.touchEventCalled, 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::TouchEvent touchEvent(1);
- Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
- touchEvent.AddPoint(point);
- application.ProcessEvent(touchEvent);
-
- application.GetScene().Remove(dummy);
- }
- END_TEST;
-}
-
int UtcDaliControlImplHoverEvent(void)
{
ToolkitTestApplication application;
ToolkitTestApplication application;
Control dummy = Control::New();
Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( dummy );
- TouchEvent touch;
+ TouchData touch;
DALI_TEST_EQUALS( false, controlImpl.OnAccessibilityTouch( touch ), TEST_LOCATION );
END_TEST;
mTargetSize = targetSize;
Control::OnSizeAnimation( animation, targetSize );
}
- virtual bool OnTouchEvent( const TouchEvent& event )
- {
- return true;
- }
virtual bool OnHoverEvent( const HoverEvent& event )
{
return true;
* @SINCE_1_0.0
*/
typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType; ///< Generic signal type @SINCE_1_0.0
- typedef Signal< bool ( AccessibilityManager&, const Dali::TouchEvent& )> AccessibilityActionScrollSignalType; ///< Scroll signal type @SINCE_1_0.0
+ typedef Signal< bool ( AccessibilityManager&, const Dali::TouchData& )> AccessibilityActionScrollSignalType; ///< Scroll signal type @SINCE_1_0.0
/**
* @brief Enumeration for accessibility that needs four information which will be read by screen-reader.
*
* A callback of the following type may be connected:
* @code
- * bool YourCallback( AccessibilityManager& manager, const TouchEvent& event );
+ * bool YourCallback( AccessibilityManager& manager, const TouchData& event );
* @endcode
* @SINCE_1_0.0
* @return The signal to connect to
}
}
-bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchEvent& touchEvent )
+bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchData& touchData )
{
Dali::Toolkit::AccessibilityManager handle( this );
if( !mActionScrollSignal.Empty() )
{
- mActionScrollSignal.Emit( handle, touchEvent );
+ mActionScrollSignal.Emit( handle, touchData );
}
return true;
return mIsAccessibilityTtsEnabled;
}
-bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
+bool AccessibilityManager::AccessibilityActionTouch(const TouchData& touchData)
{
bool handled = false;
Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
if(control)
{
- handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
+ handled = GetImplementation( control ).OnAccessibilityTouch(touchData);
}
return handled;
/**
* Perform the accessibility action associated with a scroll event.
- * @param touchEvent The touch point (and time) of the event.
+ * @param touchData The touch point (and time) of the event.
* @return whether the focus is cleared or not.
*/
- virtual bool AccessibilityActionScroll( Dali::TouchEvent& touchEvent );
+ virtual bool AccessibilityActionScroll( Dali::TouchData& touchData );
/**
* Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up).
/**
* Perform the accessibility action to mouse move (by one finger tap & hold and move).
- * @param touchEvent touch event structure
+ * @param touchData touch point and time of the event
* @return whether the accessibility action is performed or not.
*/
- virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent);
+ virtual bool AccessibilityActionTouch(const TouchData& touchData);
/**
* This function is connected to the TtsPlayer StateChangeSignal.
return false; // Accessibility pan gesture is not handled by default
}
-bool Control::OnAccessibilityTouch(const TouchEvent& touchEvent)
+bool Control::OnAccessibilityTouch(const TouchData& touchData)
{
return false; // Accessibility touch event is not handled by default
}
// @todo size negotiate background to new size, animate as well?
}
-bool Control::OnTouchEvent(const TouchEvent& event)
-{
- return false; // Do not consume
-}
-
bool Control::OnHoverEvent(const HoverEvent& event)
{
return false; // Do not consume
virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ) override;
/**
- * @copydoc CustomActorImpl::OnTouchEvent()
- */
- virtual bool OnTouchEvent( const TouchEvent& event ) override;
-
- /**
* @copydoc CustomActorImpl::OnHoverEvent()
*/
virtual bool OnHoverEvent( const HoverEvent& event ) override;
* touch event.
*
* @SINCE_1_0.0
- * @param[in] touchEvent The touch event
+ * @param[in] touchData The touch event
* @return true if the touch event has been consumed by this control
*/
- virtual bool OnAccessibilityTouch( const TouchEvent& touchEvent );
+ virtual bool OnAccessibilityTouch( const TouchData& touchData );
/**
* @brief This method should be overridden by deriving classes when they wish to respond