Refactor SceneGraphProperty handling code in event side to make RegisterProperty...
[platform/core/uifw/dali-core.git] / dali / internal / event / events / hover-event-processor.cpp
index c4d5440..2ddd84a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -168,6 +168,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty HoverEvent sent from Integration\n" );
 
   Stage& stage = mStage;
+  TouchPoint::State state = static_cast< TouchPoint::State >( event.points[0].GetState() );
 
   PRINT_HIERARCHY(gLogFilter);
 
@@ -177,10 +178,10 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   // 1) Check if it is an interrupted event - we should inform our last primary hit actor about this
   //    and emit the stage signal as well.
 
-  if ( event.points[0].state == TouchPoint::Interrupted )
+  if ( state == TouchPoint::Interrupted )
   {
     Dali::Actor consumingActor;
-    hoverEvent.points.push_back(event.points[0]);
+    hoverEvent.points.push_back( event.points[0].GetTouchPoint() );
 
     Actor* lastPrimaryHitActor( mLastPrimaryHitActor.GetActor() );
     if ( lastPrimaryHitActor )
@@ -228,23 +229,23 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   DALI_LOG_INFO( gLogFilter, Debug::Concise, "\n" );
   DALI_LOG_INFO( gLogFilter, Debug::General, "Point(s): %d\n", event.GetPointCount() );
 
-  Dali::RenderTask currentRenderTask;
+  RenderTaskPtr currentRenderTask;
 
-  for ( TouchPointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
+  for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
   {
     HitTestAlgorithm::Results hitTestResults;
     ActorHoverableCheck actorHoverableCheck;
-    HitTestAlgorithm::HitTest( stage, iter->screen, hitTestResults, actorHoverableCheck );
+    HitTestAlgorithm::HitTest( stage, iter->GetScreenPosition(), hitTestResults, actorHoverableCheck );
 
-    TouchPoint newPoint( iter->deviceId, iter->state, iter->screen.x, iter->screen.y );
+    TouchPoint newPoint( iter->GetTouchPoint() );
     newPoint.hitActor = hitTestResults.actor;
     newPoint.local = hitTestResults.actorCoordinates;
 
     hoverEvent.points.push_back( newPoint );
 
     DALI_LOG_INFO( gLogFilter, Debug::General, "  State(%s), Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n",
-                   TOUCH_POINT_STATE[iter->state], iter->screen.x, iter->screen.y,
-                   ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ),
+                   TOUCH_POINT_STATE[iter->GetState()], iter->GetScreenPosition().x, iter->GetScreenPosition().y,
+                   ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ),
                    ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ),
                    hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
 
@@ -268,8 +269,8 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   Dali::Actor primaryHitActor = primaryPoint.hitActor;
   TouchPoint::State primaryPointState = primaryPoint.state;
 
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor:     (%p) %s\n", primaryPoint.hitActor ? (void*)&primaryPoint.hitActor.GetBaseObject() : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" );
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor:       (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" );
+  DALI_LOG_INFO( gLogFilter, Debug::Concise, "PrimaryHitActor:     (%p) %s\n", primaryPoint.hitActor ? reinterpret_cast< void* >( &primaryPoint.hitActor.GetBaseObject() ) : NULL, primaryPoint.hitActor ? primaryPoint.hitActor.GetName().c_str() : "" );
+  DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor:       (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetName().c_str() : "" );
 
   if ( ( primaryPointState == TouchPoint::Started ) &&
        ( hoverEvent.GetPointCount() == 1 ) &&
@@ -288,7 +289,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
     if ( mLastRenderTask )
     {
       Dali::Actor leaveEventConsumer;
-      RenderTask& lastRenderTaskImpl( GetImplementation( mLastRenderTask ) );
+      RenderTask& lastRenderTaskImpl = *mLastRenderTask.Get();
 
       if( lastPrimaryHitActor &&
           lastPrimaryHitActor != primaryHitActor &&
@@ -298,7 +299,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
         {
           if ( lastPrimaryHitActor->GetLeaveRequired() )
           {
-            DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit):     (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() );
+            DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Hit):     (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() );
             leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Leave );
           }
         }
@@ -306,7 +307,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
         {
           // At this point mLastPrimaryHitActor was touchable and sensitive in the previous touch event process but is not in the current one.
           // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls)
-          DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit):     (%p) %s\n", (void*)lastPrimaryHitActor, lastPrimaryHitActor->GetName().c_str() );
+          DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Hit):     (%p) %s\n", reinterpret_cast< void* >( lastPrimaryHitActor ), lastPrimaryHitActor->GetName().c_str() );
           leaveEventConsumer = EmitHoverSignals( mLastPrimaryHitActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted );
         }
       }
@@ -324,7 +325,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
         {
           if( lastConsumedActor->GetLeaveRequired() )
           {
-            DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() );
+            DALI_LOG_INFO( gLogFilter, Debug::Concise, "LeaveActor(Consume): (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() );
             EmitHoverSignals( lastConsumedActor, lastRenderTaskImpl, hoverEvent, TouchPoint::Leave );
           }
         }
@@ -332,7 +333,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
         {
           // At this point mLastConsumedActor was touchable and sensitive in the previous touch event process but is not in the current one.
           // An interrupted event is send to allow some actors to go back to their original state (i.e. Button controls)
-          DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume):     (%p) %s\n", (void*)lastConsumedActor, lastConsumedActor->GetName().c_str() );
+          DALI_LOG_INFO( gLogFilter, Debug::Concise, "InterruptedActor(Consume):     (%p) %s\n", reinterpret_cast< void* >( lastConsumedActor ), lastConsumedActor->GetName().c_str() );
           EmitHoverSignals( mLastConsumedActor.GetActor(), lastRenderTaskImpl, hoverEvent, TouchPoint::Interrupted );
         }
       }