Replace some Dali::Actor public APIs with new properties
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control-impl.cpp
index d8cd9f8..991a578 100755 (executable)
@@ -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()));
   }
@@ -515,10 +501,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 )
@@ -575,9 +561,10 @@ void Control::OnStageConnection( int depth )
   CreateClippingRenderer( *this );
 
   // Request to be laid out when the control is connected to the Stage.
-  Toolkit::DevelControl::RequestLayout( *this );
+  // Signal that a Relayout may be needed
 }
 
+
 void Control::OnStageDisconnection()
 {
   mImpl->OnStageDisconnection();
@@ -609,7 +596,7 @@ void Control::OnPropertySet( Property::Index index, Property::Value propertyValu
 {
   // 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 );
@@ -681,7 +668,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 );
   }
@@ -699,7 +686,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 )
   {