- // If background and background not scale9 try get size from that
- ImageActor imageActor = FindImageActor( GetButtonImage() );
- if( imageActor && imageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
- {
- size.width = imageActor.GetRelayoutSize( WIDTH );
- size.height = imageActor.GetRelayoutSize( HEIGHT );
- }
-
- ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() );
- if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
- {
- size.width = std::max( size.width, backgroundImageActor.GetRelayoutSize( WIDTH ) );
- size.height = std::max( size.height, backgroundImageActor.GetRelayoutSize( HEIGHT ) );
- }
+ // Check Image and Background image and use the largest size as the control's Natural size.
+ SizeOfActorIfLarger( GetButtonImage(), size );
+ SizeOfActorIfLarger( GetBackgroundImage(), size );