Merge "Removed TouchEvent from dali-core" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / accessibility-manager / accessibility-manager-impl.cpp
index 7f69861..e67cb27 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -25,7 +25,6 @@
 #include <dali/devel-api/adaptor-framework/sound-player.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/devel-api/events/hit-test-algorithm.h>
-#include <dali/public-api/images/resource-image.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -76,8 +75,8 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType
     case Dali::HitTestAlgorithm::CHECK_ACTOR:
     {
       // Check whether the actor is visible and not fully transparent.
-      if( actor.IsVisible()
-       && actor.GetCurrentWorldColor().a > 0.01f) // not FULLY_TRANSPARENT
+      if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE )
+       && actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) // not FULLY_TRANSPARENT
       {
         // Check whether the actor is focusable
         Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
@@ -90,7 +89,7 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType
     }
     case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
     {
-      if( actor.IsVisible() ) // Actor is visible, if not visible then none of its children are visible.
+      if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible.
       {
         hittable = true;
       }
@@ -165,7 +164,7 @@ void AccessibilityManager::SetAccessibilityAttribute(Actor actor, Toolkit::Acces
 {
   if(actor)
   {
-    unsigned int actorID = actor.GetId();
+    unsigned int actorID = actor.GetProperty< int >( Actor::Property::ID );
 
     ActorAdditionalInfo info = GetActorAdditionalInfo(actorID);
     info.mAccessibilityAttributes[type] = text;
@@ -181,7 +180,7 @@ std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, Toolkit
 
   if(actor)
   {
-    ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId());
+    ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetProperty< int >( Actor::Property::ID ));
     text = data.mAccessibilityAttributes[type];
   }
 
@@ -243,11 +242,11 @@ void AccessibilityManager::SetFocusOrder(Actor actor, const unsigned int order)
       actor.SetProperty(propertyActorFocusable, true);
 
       // Now we insert the actor into the focus chain with the specified focus order
-      mFocusIDContainer.insert(FocusIDPair(order, actor.GetId()));
+      mFocusIDContainer.insert(FocusIDPair(order, actor.GetProperty< int >( Actor::Property::ID )));
     }
 
     // Update the actor's focus order in its additional data
-    SynchronizeActorAdditionalInfo(actor.GetId(), order);
+    SynchronizeActorAdditionalInfo(actor.GetProperty< int >( Actor::Property::ID ), order);
   }
 }
 
@@ -257,7 +256,7 @@ unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const
 
   if(actor)
   {
-    ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId());
+    ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetProperty< int >( Actor::Property::ID ));
     focusOrder = data.mFocusOrder;
   }
 
@@ -295,7 +294,7 @@ bool AccessibilityManager::SetCurrentFocusActor(Actor actor)
 {
   if(actor)
   {
-    return DoSetCurrentFocusActor(actor.GetId());
+    return DoSetCurrentFocusActor(actor.GetProperty< int >( Actor::Property::ID ));
   }
 
   return false;
@@ -331,16 +330,16 @@ bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID)
     }
 
     // Go through the actor's hierarchy to check whether the actor is visible
-    bool actorVisible = actor.IsVisible();
+    bool actorVisible = actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE );
     Actor parent = actor.GetParent();
     while (actorVisible && parent && parent != rootActor)
     {
-      actorVisible = parent.IsVisible();
+      actorVisible = parent.GetCurrentProperty< bool >( Actor::Property::VISIBLE );
       parent = parent.GetParent();
     }
 
     // Check whether the actor is fully transparent
-    bool actorOpaque = actor.GetCurrentWorldColor().a > 0.01f;
+    bool actorOpaque = actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f;
 
     // Set the focus only when the actor is focusable and visible and not fully transparent
     if(actorVisible && actorFocusable && actorOpaque)
@@ -610,8 +609,8 @@ Actor AccessibilityManager::GetFocusIndicatorActor()
     const std::string focusBorderImagePath = imageDirPath + FOCUS_BORDER_IMAGE_FILE_NAME;
 
     mFocusIndicatorActor = Toolkit::ImageView::New(focusBorderImagePath);
-    mFocusIndicatorActor.SetParentOrigin( ParentOrigin::CENTER );
-    mFocusIndicatorActor.SetZ( 1.0f );
+    mFocusIndicatorActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+    mFocusIndicatorActor.SetProperty( Actor::Property::POSITION_Z,  1.0f );
 
     // Apply size constraint to the focus indicator
     mFocusIndicatorActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
@@ -964,12 +963,12 @@ bool AccessibilityManager::ClearAccessibilityFocus()
   }
 }
 
-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;
@@ -1303,7 +1302,7 @@ bool AccessibilityManager::AccessibilityActionStartStop()
   return mIsAccessibilityTtsEnabled;
 }
 
-bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
+bool AccessibilityManager::AccessibilityActionTouch(const TouchData& touchData)
 {
   bool handled = false;
 
@@ -1312,7 +1311,7 @@ bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent
   Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
   if(control)
   {
-    handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
+    handled = GetImplementation( control ).OnAccessibilityTouch(touchData);
   }
 
   return handled;