(Buttons) Creating actor from property-maps
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 25 Mar 2014 16:36:28 +0000 (16:36 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Thu, 3 Apr 2014 18:39:08 +0000 (19:39 +0100)
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
automated-tests/dali-test-suite/buttons/utc-Dali-PushButton.cpp
capi/dali-toolkit/public-api/controls/buttons/push-button.h
dali-toolkit/internal/builder/builder-actor.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp

index a60a379..525a5a1 100644 (file)
@@ -1305,31 +1305,51 @@ void UtcDaliPushButtonProperties()
   DALI_TEST_CHECK( button.IsToggled() ) ;
   DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) );
 
   DALI_TEST_CHECK( button.IsToggled() ) ;
   DALI_TEST_CHECK( button.GetProperty< bool >( PushButton::PROPERTY_TOGGLE ) );
 
-  //  PushButton::PROPERTY_BUTTON_IMAGE
-  DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_BUTTON_IMAGE ).empty() );
-  button.SetButtonImage( Image::New( "FunctionButtonImage") );
-  DALI_TEST_EQUALS( "FunctionButtonImage", button.GetProperty< std::string >( PushButton::PROPERTY_BUTTON_IMAGE ), TEST_LOCATION );
-  button.SetProperty( PushButton::PROPERTY_BUTTON_IMAGE, "PropertyButtonImage" );
-  DALI_TEST_EQUALS( "PropertyButtonImage", button.GetProperty< std::string >( PushButton::PROPERTY_BUTTON_IMAGE ), TEST_LOCATION );
+  //  PushButton::PROPERTY_NORMAL_STATE_ACTOR
+  {
+    button.SetButtonImage( Image::New( "IMAGE_PATH_1") );
+    DALI_TEST_EQUALS( "IMAGE_PATH_1", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
+
+    Property::Map map;
+    map.push_back( Property::StringValuePair( "type", "ImageActor" ) );
+
+    button.SetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR, map );
+    DALI_TEST_EQUALS( "ImageActor", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+  }
 
   //  PushButton::PROPERTY_PRESSED_IMAGE
 
   //  PushButton::PROPERTY_PRESSED_IMAGE
-  DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_PRESSED_IMAGE ).empty() );
-  button.SetPressedImage( Image::New( "FunctionPressedImage") );
-  DALI_TEST_EQUALS( "FunctionPressedImage", button.GetProperty< std::string >( PushButton::PROPERTY_PRESSED_IMAGE ), TEST_LOCATION );
-  button.SetProperty( PushButton::PROPERTY_PRESSED_IMAGE, "PropertyPressedImage" );
-  DALI_TEST_EQUALS( "PropertyPressedImage", button.GetProperty< std::string >( PushButton::PROPERTY_PRESSED_IMAGE ), TEST_LOCATION );
-
-  //  PushButton::PROPERTY_DIMMED_IMAGE
-  DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_DIMMED_IMAGE ).empty() );
-  button.SetDimmedImage( Image::New( "FunctionDimmedImage") );
-  DALI_TEST_EQUALS( "FunctionDimmedImage", button.GetProperty< std::string >( PushButton::PROPERTY_DIMMED_IMAGE ), TEST_LOCATION );
-  button.SetProperty( PushButton::PROPERTY_DIMMED_IMAGE, "PropertyDimmedImage" );
-  DALI_TEST_EQUALS( "PropertyDimmedImage", button.GetProperty< std::string >( PushButton::PROPERTY_DIMMED_IMAGE ), TEST_LOCATION );
-
-  //  PushButton::PROPERTY_LABEL_TEXT
-  DALI_TEST_CHECK( button.GetProperty< std::string >( PushButton::PROPERTY_LABEL_TEXT ).empty() );
-  button.SetLabelText( "FunctionLabel" );
-  DALI_TEST_EQUALS( "FunctionLabel", button.GetProperty< std::string >( PushButton::PROPERTY_LABEL_TEXT ), TEST_LOCATION );
-  button.SetProperty( PushButton::PROPERTY_LABEL_TEXT, "PropertyLabel" );
-  DALI_TEST_EQUALS( "PropertyLabel", button.GetProperty< std::string >( PushButton::PROPERTY_LABEL_TEXT ), TEST_LOCATION );
+  {
+    button.SetPressedImage( Image::New( "IMAGE_PATH_2") );
+    DALI_TEST_EQUALS( "IMAGE_PATH_2", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
+
+    Property::Map map;
+    map.push_back( Property::StringValuePair( "type", "TextActor" ) );
+
+    button.SetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR, map );
+    DALI_TEST_EQUALS( "TextActor", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+  }
+
+  //  PushButton::PROPERTY_DIMMED_STATE_ACTOR
+  {
+    button.SetDimmedImage( Image::New( "IMAGE_PATH_3") );
+    DALI_TEST_EQUALS( "IMAGE_PATH_3", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION );
+
+    Property::Map map;
+    map.push_back( Property::StringValuePair( "type", "Actor" ) );
+
+    button.SetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR, map );
+    DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+  }
+
+  //  PushButton::PROPERTY_LABEL_ACTOR
+  {
+    button.SetLabelText( "LABEL_TEXT_CUSTOM" );
+    DALI_TEST_EQUALS( "TextView", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+
+    Property::Map map;
+    map.push_back( Property::StringValuePair( "type", "Actor" ) );
+
+    button.SetProperty( PushButton::PROPERTY_LABEL_ACTOR, map );
+    DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION );
+  }
 }
 }
index 98ae002..4382cfb 100644 (file)
@@ -92,15 +92,15 @@ public:
   static const char* const ACTION_PUSH_BUTTON_CLICK; ///< name "push-button-click"
 
   // Properties
   static const char* const ACTION_PUSH_BUTTON_CLICK; ///< name "push-button-click"
 
   // Properties
-  static const Property::Index PROPERTY_AUTO_REPEATING;               ///< name "auto-repeating",               @see SetAutoRepeating(),               type BOOLEAN
-  static const Property::Index PROPERTY_INITIAL_AUTO_REPEATING_DELAY; ///< name "initial-auto-repeating-delay", @see SetInitialAutoRepeatingDelay(),   type FLOAT
-  static const Property::Index PROPERTY_NEXT_AUTO_REPEATING_DELAY;    ///< name "next-auto-repeating-delay",    @see SetNextAutoRepeatingDelay(),      type FLOAT
-  static const Property::Index PROPERTY_TOGGLABLE;                    ///< name "togglable",                    @see SetToggleButton(),                type BOOLEAN
-  static const Property::Index PROPERTY_TOGGLE;                       ///< name "toggle",                       @see SetToggled(),                     type BOOLEAN
-  static const Property::Index PROPERTY_BUTTON_IMAGE;                 ///< name "button-image",                 @see SetButtonImage(Image),            type STRING
-  static const Property::Index PROPERTY_PRESSED_IMAGE;                ///< name "pressed-image",                @see SetPressedImage(Image),           type STRING
-  static const Property::Index PROPERTY_DIMMED_IMAGE;                 ///< name "dimmed-image",                 @see SetDimmedImage(Image),            type STRING
-  static const Property::Index PROPERTY_LABEL_TEXT;                   ///< name "label-text",                   @see SetLabelText(const std::string&), type STRING
+  static const Property::Index PROPERTY_AUTO_REPEATING;               ///< name "auto-repeating",               @see SetAutoRepeating(),             type BOOLEAN
+  static const Property::Index PROPERTY_INITIAL_AUTO_REPEATING_DELAY; ///< name "initial-auto-repeating-delay", @see SetInitialAutoRepeatingDelay(), type FLOAT
+  static const Property::Index PROPERTY_NEXT_AUTO_REPEATING_DELAY;    ///< name "next-auto-repeating-delay",    @see SetNextAutoRepeatingDelay(),    type FLOAT
+  static const Property::Index PROPERTY_TOGGLABLE;                    ///< name "togglable",                    @see SetToggleButton(),              type BOOLEAN
+  static const Property::Index PROPERTY_TOGGLE;                       ///< name "toggle",                       @see SetToggled(),                   type BOOLEAN
+  static const Property::Index PROPERTY_NORMAL_STATE_ACTOR;           ///< name "button-state-actor",           @see SetButtonImage(),               type MAP
+  static const Property::Index PROPERTY_PRESSED_STATE_ACTOR;          ///< name "pressed-state-actor",          @see SetPressedImage(),              type MAP
+  static const Property::Index PROPERTY_DIMMED_STATE_ACTOR;           ///< name "dimmed-state-actor",           @see SetDimmedImage(),               type MAP
+  static const Property::Index PROPERTY_LABEL_ACTOR;                  ///< name "label-actor",                  @see SetLabelText(),                 type STRING
 
 public:
 
 
 public:
 
index 84705f2..a57129f 100644 (file)
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
 
-namespace // unnamed namespace
-{
-
-using namespace Dali;
-using namespace Dali::Scripting;
-
-ColorMode GetColorMode( const std::string& value )
-{
-  ColorMode v( USE_OWN_COLOR );
-
-  bool set = \
-    SetIfEqual(value, "USE_OWN_COLOR"                , v, USE_OWN_COLOR                 ) || \
-    SetIfEqual(value, "USE_PARENT_COLOR"             , v, USE_PARENT_COLOR              ) || \
-    SetIfEqual(value, "USE_OWN_MULTIPLY_PARENT_COLOR", v, USE_OWN_MULTIPLY_PARENT_COLOR);
-
-  if( !set )
-  {
-    DALI_ASSERT_ALWAYS( !"Unknown Color mode" );
-  }
-
-  return v;
-}
-
-PositionInheritanceMode GetPositionInheritanceMode( const std::string& value )
-{
-  PositionInheritanceMode v(INHERIT_PARENT_POSITION);
-
-  bool set = \
-    SetIfEqual(value, "INHERIT_PARENT_POSITION", v, INHERIT_PARENT_POSITION                                    ) || \
-    SetIfEqual(value, "USE_PARENT_POSITION"    , v, USE_PARENT_POSITION                                        ) || \
-    SetIfEqual(value, "USE_PARENT_POSITION_PLUS_LOCAL_POSITION", v, USE_PARENT_POSITION_PLUS_LOCAL_POSITION    ) || \
-    SetIfEqual(value, "DONT_INHERIT_POSITION"  , v, DONT_INHERIT_POSITION);
-
-  if( !set )
-  {
-    DALI_ASSERT_ALWAYS( !"Unknown position inheritance mode" );
-  }
-
-  return v;
-}
-
-DrawMode::Type GetDrawMode( const std::string& value )
-{
-  DrawMode::Type e(DrawMode::NORMAL);
-
-  bool set = \
-    SetIfEqual(value, "NORMAL", e, DrawMode::NORMAL  ) || \
-    SetIfEqual(value, "OVERLAY",e, DrawMode::OVERLAY ) || \
-    SetIfEqual(value, "STENCIL",e, DrawMode::STENCIL);
-
-  if(!set)
-  {
-    DALI_ASSERT_ALWAYS( !"Unknown DrawMode type" );
-  }
-
-  return e;
-}
-
-
-Vector3 GetAnchorConstant( const std::string& value )
-{
-  Vector3 v = ParentOrigin::CENTER; // a Vector3x
-
-  bool set =
-    SetIfEqual( value, "BACK_TOP_LEFT",        v, ParentOrigin::BACK_TOP_LEFT      ) ||
-    SetIfEqual( value, "BACK_TOP_CENTER",      v, ParentOrigin::BACK_TOP_CENTER    ) ||
-    SetIfEqual( value, "BACK_TOP_RIGHT",       v, ParentOrigin::BACK_TOP_RIGHT     ) ||
-    SetIfEqual( value, "BACK_CENTER_LEFT",     v, ParentOrigin::BACK_CENTER_LEFT   ) ||
-    SetIfEqual( value, "BACK_CENTER",          v, ParentOrigin::BACK_CENTER        ) ||
-    SetIfEqual( value, "BACK_CENTER_RIGHT",    v, ParentOrigin::BACK_CENTER_RIGHT  ) ||
-    SetIfEqual( value, "BACK_BOTTOM_LEFT",     v, ParentOrigin::BACK_BOTTOM_LEFT   ) ||
-    SetIfEqual( value, "BACK_BOTTOM_CENTER",   v, ParentOrigin::BACK_BOTTOM_CENTER ) ||
-    SetIfEqual( value, "BACK_BOTTOM_RIGHT",    v, ParentOrigin::BACK_BOTTOM_RIGHT  ) ||
-    SetIfEqual( value, "TOP_LEFT",             v, ParentOrigin::TOP_LEFT           ) ||
-    SetIfEqual( value, "TOP_CENTER",           v, ParentOrigin::TOP_CENTER         ) ||
-    SetIfEqual( value, "TOP_RIGHT",            v, ParentOrigin::TOP_RIGHT          ) ||
-    SetIfEqual( value, "CENTER_LEFT",          v, ParentOrigin::CENTER_LEFT        ) ||
-    SetIfEqual( value, "CENTER",               v, ParentOrigin::CENTER             ) ||
-    SetIfEqual( value, "CENTER_RIGHT",         v, ParentOrigin::CENTER_RIGHT       ) ||
-    SetIfEqual( value, "BOTTOM_LEFT",          v, ParentOrigin::BOTTOM_LEFT        ) ||
-    SetIfEqual( value, "BOTTOM_CENTER",        v, ParentOrigin::BOTTOM_CENTER      ) ||
-    SetIfEqual( value, "BOTTOM_RIGHT",         v, ParentOrigin::BOTTOM_RIGHT       ) ||
-    SetIfEqual( value, "FRONT_TOP_LEFT",       v, ParentOrigin::FRONT_TOP_LEFT     ) ||
-    SetIfEqual( value, "FRONT_TOP_CENTER",     v, ParentOrigin::FRONT_TOP_CENTER   ) ||
-    SetIfEqual( value, "FRONT_TOP_RIGHT",      v, ParentOrigin::FRONT_TOP_RIGHT    ) ||
-    SetIfEqual( value, "FRONT_CENTER_LEFT",    v, ParentOrigin::FRONT_CENTER_LEFT  ) ||
-    SetIfEqual( value, "FRONT_CENTER",         v, ParentOrigin::FRONT_CENTER       ) ||
-    SetIfEqual( value, "FRONT_CENTER_RIGHT",   v, ParentOrigin::FRONT_CENTER_RIGHT ) ||
-    SetIfEqual( value, "FRONT_BOTTOM_LEFT",    v, ParentOrigin::FRONT_BOTTOM_LEFT  ) ||
-    SetIfEqual( value, "FRONT_BOTTOM_CENTER",  v, ParentOrigin::FRONT_BOTTOM_CENTER) ||
-    SetIfEqual( value, "FRONT_BOTTOM_RIGHT",   v, ParentOrigin::FRONT_BOTTOM_RIGHT );
-
-  if(!set)
-  {
-    DALI_ASSERT_ALWAYS(!"Unknown Parent origin Constant" );
-  }
-
-  return v;
-}
-
-
-}; // unnamed namespace
-
-
 namespace Dali
 {
 
 namespace Dali
 {
 
@@ -135,6 +31,8 @@ namespace Toolkit
 namespace Internal
 {
 
 namespace Internal
 {
 
+using namespace Dali::Scripting;
+
 /*
  * Handles special case actor configuration (anything thats not already a property)
  *
 /*
  * Handles special case actor configuration (anything thats not already a property)
  *
@@ -162,7 +60,7 @@ Actor SetupActor( const TreeNode& child, Actor& actor )
   {
     if( OptionalVector3 v = IsVector3(child, "anchor-point") )
     {
   {
     if( OptionalVector3 v = IsVector3(child, "anchor-point") )
     {
-      actor.SetParentOrigin( *v );
+      actor.SetAnchorPoint( *v );
     }
     else if( OptionalString anchor = IsString(child, "anchor-point") )
     {
     }
     else if( OptionalString anchor = IsString(child, "anchor-point") )
     {
@@ -170,56 +68,6 @@ Actor SetupActor( const TreeNode& child, Actor& actor )
     }
   }
 
     }
   }
 
-  if( OptionalFloat opacity = IsFloat(child, "opacity") )
-  {
-    actor.SetOpacity( *opacity );
-  }
-
-  if( OptionalFloat opacity = IsFloat(child, "opacity-by") )
-  {
-    actor.OpacityBy( *opacity );
-  }
-
-  if( OptionalString colorMode = IsString(child, "color-mode") )
-  {
-    actor.SetColorMode( GetColorMode(*colorMode) );
-  }
-
-  if( OptionalBoolean inherit = IsBoolean(child, "inherit-shader-effect") )
-  {
-    actor.SetInheritShaderEffect( *inherit );
-  }
-
-  if( OptionalBoolean sensitive = IsBoolean(child, "sensitive") )
-  {
-    actor.SetSensitive( *sensitive );
-  }
-
-  if( OptionalBoolean leaveRequired = IsBoolean(child, "leave-required") )
-  {
-    actor.SetLeaveRequired( *leaveRequired );
-  }
-
-  if( OptionalString v = IsString(child, "position-inheritance") )
-  {
-    actor.SetPositionInheritanceMode( GetPositionInheritanceMode(*v) );
-  }
-
-  if( OptionalString v = IsString(child, "draw-mode") )
-  {
-    actor.SetDrawMode( GetDrawMode(*v) );
-  }
-
-  if( OptionalBoolean v = IsBoolean(child, "inherit-rotation") )
-  {
-    actor.SetInheritRotation( *v );
-  }
-
-  if( OptionalBoolean v = IsBoolean(child, "inherit-scale") )
-  {
-    actor.SetInheritScale( *v );
-  }
-
   return actor;
 }
 
   return actor;
 }
 
index 8b96ba5..03752f1 100644 (file)
@@ -39,10 +39,10 @@ const Property::Index PushButton::PROPERTY_INITIAL_AUTO_REPEATING_DELAY = Intern
 const Property::Index PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY    = Internal::Button::BUTTON_PROPERTY_END_INDEX + 3;
 const Property::Index PushButton::PROPERTY_TOGGLABLE                    = Internal::Button::BUTTON_PROPERTY_END_INDEX + 4;
 const Property::Index PushButton::PROPERTY_TOGGLE                       = Internal::Button::BUTTON_PROPERTY_END_INDEX + 5;
 const Property::Index PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY    = Internal::Button::BUTTON_PROPERTY_END_INDEX + 3;
 const Property::Index PushButton::PROPERTY_TOGGLABLE                    = Internal::Button::BUTTON_PROPERTY_END_INDEX + 4;
 const Property::Index PushButton::PROPERTY_TOGGLE                       = Internal::Button::BUTTON_PROPERTY_END_INDEX + 5;
-const Property::Index PushButton::PROPERTY_BUTTON_IMAGE                 = Internal::Button::BUTTON_PROPERTY_END_INDEX + 6;
-const Property::Index PushButton::PROPERTY_PRESSED_IMAGE                = Internal::Button::BUTTON_PROPERTY_END_INDEX + 8;
-const Property::Index PushButton::PROPERTY_DIMMED_IMAGE                 = Internal::Button::BUTTON_PROPERTY_END_INDEX + 9;
-const Property::Index PushButton::PROPERTY_LABEL_TEXT                   = Internal::Button::BUTTON_PROPERTY_END_INDEX + 11;
+const Property::Index PushButton::PROPERTY_NORMAL_STATE_ACTOR           = Internal::Button::BUTTON_PROPERTY_END_INDEX + 6;
+const Property::Index PushButton::PROPERTY_PRESSED_STATE_ACTOR          = Internal::Button::BUTTON_PROPERTY_END_INDEX + 7;
+const Property::Index PushButton::PROPERTY_DIMMED_STATE_ACTOR           = Internal::Button::BUTTON_PROPERTY_END_INDEX + 8;
+const Property::Index PushButton::PROPERTY_LABEL_ACTOR                  = Internal::Button::BUTTON_PROPERTY_END_INDEX + 9;
 
 namespace Internal
 {
 
 namespace Internal
 {
@@ -68,10 +68,10 @@ PropertyRegistration property2( typeRegistration, "initial-auto-repeating-delay"
 PropertyRegistration property3( typeRegistration, "next-auto-repeating-delay",    Toolkit::PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY,    Property::FLOAT,   &PushButton::SetProperty, &PushButton::GetProperty );
 PropertyRegistration property4( typeRegistration, "togglable",                    Toolkit::PushButton::PROPERTY_TOGGLABLE,                    Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
 PropertyRegistration property5( typeRegistration, "toggle",                       Toolkit::PushButton::PROPERTY_TOGGLE,                       Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
 PropertyRegistration property3( typeRegistration, "next-auto-repeating-delay",    Toolkit::PushButton::PROPERTY_NEXT_AUTO_REPEATING_DELAY,    Property::FLOAT,   &PushButton::SetProperty, &PushButton::GetProperty );
 PropertyRegistration property4( typeRegistration, "togglable",                    Toolkit::PushButton::PROPERTY_TOGGLABLE,                    Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
 PropertyRegistration property5( typeRegistration, "toggle",                       Toolkit::PushButton::PROPERTY_TOGGLE,                       Property::BOOLEAN, &PushButton::SetProperty, &PushButton::GetProperty );
-PropertyRegistration property6( typeRegistration, "button-image",                 Toolkit::PushButton::PROPERTY_BUTTON_IMAGE,                 Property::STRING,  &PushButton::SetProperty, &PushButton::GetProperty );
-PropertyRegistration property7( typeRegistration, "pressed-image",                Toolkit::PushButton::PROPERTY_PRESSED_IMAGE,                Property::STRING,  &PushButton::SetProperty, &PushButton::GetProperty );
-PropertyRegistration property8( typeRegistration, "dimmed-image",                 Toolkit::PushButton::PROPERTY_DIMMED_IMAGE,                 Property::STRING,  &PushButton::SetProperty, &PushButton::GetProperty );
-PropertyRegistration property9( typeRegistration, "label-text",                   Toolkit::PushButton::PROPERTY_LABEL_TEXT,                   Property::STRING,  &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property6( typeRegistration, "normal-state-actor",           Toolkit::PushButton::PROPERTY_NORMAL_STATE_ACTOR,           Property::MAP,     &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property7( typeRegistration, "pressed-state-actor",          Toolkit::PushButton::PROPERTY_PRESSED_STATE_ACTOR,          Property::MAP,     &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property8( typeRegistration, "dimmed-state-actor",           Toolkit::PushButton::PROPERTY_DIMMED_STATE_ACTOR,           Property::MAP,     &PushButton::SetProperty, &PushButton::GetProperty );
+PropertyRegistration property9( typeRegistration, "label-actor",                  Toolkit::PushButton::PROPERTY_LABEL_ACTOR,                  Property::MAP,     &PushButton::SetProperty, &PushButton::GetProperty );
 
 } // unnamed namespace
 
 
 } // unnamed namespace
 
@@ -87,31 +87,6 @@ PushButtonDefaultPainterPtr GetPushButtonPainter( Dali::Toolkit::Internal::Butto
   return static_cast<PushButtonDefaultPainter*>( painter.Get() );
 }
 
   return static_cast<PushButtonDefaultPainter*>( painter.Get() );
 }
 
-/**
- * Helper function to checks if the specified actor is an ImageActor and if it has an Image with a path.
- *
- * @param[in]  actor  Actor handle to check.
- * @param[out] path   The image path will be applied to this parameter, if available.
- *                    If not available then this will be an empty string.
- */
-void GetImageActorFilename( Actor& actor, std::string& path )
-{
-  path = ""; // Just return an empty string if not using ImageActor with an image
-
-  if ( actor )
-  {
-    ImageActor imageActor = ImageActor::DownCast( actor );
-    if ( imageActor )
-    {
-      Image image = imageActor.GetImage();
-      if ( image )
-      {
-        path = image.GetFilename();
-      }
-    }
-  }
-}
-
 } // unnamed namespace
 
 Dali::Toolkit::PushButton PushButton::New()
 } // unnamed namespace
 
 Dali::Toolkit::PushButton PushButton::New()
@@ -438,30 +413,27 @@ void PushButton::SetProperty( BaseObject* object, Property::Index propertyIndex,
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_BUTTON_IMAGE:
+      case Toolkit::PushButton::PROPERTY_NORMAL_STATE_ACTOR:
       {
       {
-        Image image = Image::New( value.Get<std::string>() );
-        pushButtonImpl.SetButtonImage( image );
+        pushButtonImpl.SetButtonImage( Scripting::NewActor( value.Get< Property::Map >() ) );
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_PRESSED_IMAGE:
+      case Toolkit::PushButton::PROPERTY_PRESSED_STATE_ACTOR:
       {
       {
-        Image image = Image::New( value.Get<std::string>() );
-        pushButtonImpl.SetPressedImage( image );
+        pushButtonImpl.SetPressedImage( Scripting::NewActor( value.Get< Property::Map >() ) );
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_DIMMED_IMAGE:
+      case Toolkit::PushButton::PROPERTY_DIMMED_STATE_ACTOR:
       {
       {
-        Image image = Image::New( value.Get<std::string>() );
-        pushButtonImpl.SetDimmedImage( image );
+        pushButtonImpl.SetDimmedImage( Scripting::NewActor( value.Get< Property::Map >() ) );
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_LABEL_TEXT:
+      case Toolkit::PushButton::PROPERTY_LABEL_ACTOR:
       {
       {
-        pushButtonImpl.SetLabelText( value.Get< std::string >() );
+        pushButtonImpl.SetLabelText( Scripting::NewActor( value.Get< Property::Map >() ) );
         break;
       }
     }
         break;
       }
     }
@@ -510,42 +482,35 @@ Property::Value PushButton::GetProperty( BaseObject* object, Property::Index pro
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_BUTTON_IMAGE:
+      case Toolkit::PushButton::PROPERTY_NORMAL_STATE_ACTOR:
       {
       {
-        std::string path;
-        GetImageActorFilename( pushButtonImpl.mButtonImage, path );
-        value = path;
+        Property::Map map;
+        Scripting::CreatePropertyMap( pushButtonImpl.mButtonImage, map );
+        value = map;
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_PRESSED_IMAGE:
+      case Toolkit::PushButton::PROPERTY_PRESSED_STATE_ACTOR:
       {
       {
-        std::string path;
-        GetImageActorFilename( pushButtonImpl.mPressedImage, path );
-        value = path;
+        Property::Map map;
+        Scripting::CreatePropertyMap( pushButtonImpl.mPressedImage, map );
+        value = map;
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_DIMMED_IMAGE:
+      case Toolkit::PushButton::PROPERTY_DIMMED_STATE_ACTOR:
       {
       {
-        std::string path;
-        GetImageActorFilename( pushButtonImpl.mDimmedImage, path );
-        value = path;
+        Property::Map map;
+        Scripting::CreatePropertyMap( pushButtonImpl.mDimmedImage, map );
+        value = map;
         break;
       }
 
         break;
       }
 
-      case Toolkit::PushButton::PROPERTY_LABEL_TEXT:
+      case Toolkit::PushButton::PROPERTY_LABEL_ACTOR:
       {
       {
-        value = ""; // Just return an empty string if not using a TextView
-
-        if ( pushButtonImpl.mLabel )
-        {
-          Toolkit::TextView textView = Toolkit::TextView::DownCast( pushButtonImpl.mLabel );
-          if ( textView )
-          {
-            value = textView.GetText();
-          }
-        }
+        Property::Map map;
+        Scripting::CreatePropertyMap( pushButtonImpl.mLabel, map );
+        value = map;
         break;
       }
     }
         break;
       }
     }