Merge "Support Asynchronous Loading of Animated Image" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control-impl.cpp
index 066fb3b..f17092f 100755 (executable)
@@ -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.
@@ -185,11 +185,6 @@ void Control::SetBackgroundColor( const Vector4& color )
   SetBackground( map );
 }
 
-Vector4 Control::GetBackgroundColor() const
-{
-  return mImpl->mBackgroundColor;
-}
-
 void Control::SetBackground( const Property::Map& map )
 {
   Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
@@ -203,15 +198,6 @@ void Control::SetBackground( const Property::Map& map )
   }
 }
 
-void Control::SetBackgroundImage( Image image )
-{
-  Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( image );
-  if( visual )
-  {
-    mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
-  }
-}
-
 void Control::ClearBackground()
 {
    mImpl->UnregisterVisual( Toolkit::Control::Property::BACKGROUND );
@@ -311,7 +297,7 @@ bool Control::IsKeyboardNavigationSupported()
 
 void Control::SetKeyInputFocus()
 {
-  if( Self().OnStage() )
+  if( Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
   {
     Toolkit::KeyInputFocusManager::Get().SetFocus(Toolkit::Control::DownCast(Self()));
   }
@@ -320,7 +306,7 @@ void Control::SetKeyInputFocus()
 bool Control::HasKeyInputFocus()
 {
   bool result = false;
-  if( Self().OnStage() )
+  if( Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
   {
     Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
     if( Self() == control )
@@ -333,7 +319,7 @@ bool Control::HasKeyInputFocus()
 
 void Control::ClearKeyInputFocus()
 {
-  if( Self().OnStage() )
+  if( Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
   {
     Toolkit::KeyInputFocusManager::Get().RemoveFocus(Toolkit::Control::DownCast(Self()));
   }
@@ -487,14 +473,6 @@ void Control::OnInitialize()
 {
 }
 
-void Control::OnControlChildAdd( Actor& child )
-{
-}
-
-void Control::OnControlChildRemove( Actor& child )
-{
-}
-
 void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
 {
   // By default the control is only interested in theme (not font) changes
@@ -515,10 +493,10 @@ void Control::OnPinch(const PinchGesture& pinch)
 
   if( pinch.state == Gesture::Started )
   {
-    *( mImpl->mStartingPinchScale ) = Self().GetCurrentScale();
+    *( mImpl->mStartingPinchScale ) = Self().GetCurrentProperty< Vector3 >( Actor::Property::SCALE );
   }
 
-  Self().SetScale( *( mImpl->mStartingPinchScale ) * pinch.scale );
+  Self().SetProperty( Actor::Property::SCALE, *( mImpl->mStartingPinchScale ) * pinch.scale );
 }
 
 void Control::OnPan( const PanGesture& pan )
@@ -596,21 +574,17 @@ void Control::OnKeyInputFocusLost()
 
 void Control::OnChildAdd(Actor& child)
 {
-  // Notify derived classes.
-  OnControlChildAdd( child );
 }
 
 void Control::OnChildRemove(Actor& child)
 {
-  // Notify derived classes.
-  OnControlChildRemove( child );
 }
 
 void Control::OnPropertySet( Property::Index index, Property::Value propertyValue )
 {
   // If the clipping mode has been set, we may need to create a renderer.
   // Only do this if we are already on-stage as the OnStageConnection will handle the off-stage clipping controls.
-  if( ( index == Actor::Property::CLIPPING_MODE ) && Self().OnStage() )
+  if( ( index == Actor::Property::CLIPPING_MODE ) && Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
   {
     // Note: This method will handle whether creation of the renderer is required.
     CreateClippingRenderer( *this );
@@ -682,7 +656,7 @@ void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
       childOffset.x += ( mImpl->mMargin.start + padding.start );
       childOffset.y += ( mImpl->mMargin.top + padding.top );
 
-      child.SetPosition( childOffset.x, childOffset.y );
+      child.SetProperty( Actor::Property::POSITION, Vector2( childOffset.x, childOffset.y ) );
     }
     container.Add( child, newChildSize );
   }
@@ -700,7 +674,7 @@ void Control::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dime
 
 Vector3 Control::GetNaturalSize()
 {
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::GetNaturalSize for %s\n", Self().GetName().c_str() );
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::GetNaturalSize for %s\n", Self().GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() );
   Toolkit::Visual::Base visual = mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND );
   if( visual )
   {