{
Vector3 size;
- // 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 );
// If label, test against it's size
- Toolkit::TextView textView = Toolkit::TextView::DownCast( GetLabel() );
- if( textView )
+ Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( GetLabel() );
+ if( label )
{
- Vector3 textViewSize = textView.GetNaturalSize();
+ Vector3 labelSize = label.GetNaturalSize();
- size.width = std::max( size.width, textViewSize.width + TEXT_PADDING * 2.0f );
- size.height = std::max( size.height, textViewSize.height + TEXT_PADDING * 2.0f );
+ size.width = std::max( size.width, labelSize.width + TEXT_PADDING * 2.0f );
+ size.height = std::max( size.height, labelSize.height + TEXT_PADDING * 2.0f );
}
return size;