+void PushButton::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+{
+ ConfigureSizeNegotiation();
+}
+
+void PushButton::ConfigureSizeNegotiation()
+{
+ std::vector< Actor > images;
+ images.reserve( 7 );
+
+ images.push_back( GetUnselectedImage() );
+ images.push_back( GetSelectedImage() );
+ images.push_back( GetSelectedBackgroundImage() );
+ images.push_back( GetBackgroundImage() );
+ images.push_back( GetDisabledImage() );
+ images.push_back( GetDisabledSelectedImage() );
+ images.push_back( GetDisabledBackgroundImage() );
+
+ Actor label = GetLabelActor();
+
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+ {
+ ConfigureSizeNegotiationDimension( static_cast< Dimension::Type >( 1 << i ), images, label );
+ }
+
+ // Add any vertical padding directly to the actors.
+ Actor icon = GetDecoration( UNSELECTED_DECORATION );
+ Actor selectedIcon = GetDecoration( SELECTED_DECORATION );
+ bool iconExists = icon || selectedIcon;
+
+ if( label )
+ {
+ label.SetPadding( mLabelPadding );
+ }
+ if( icon )
+ {
+ icon.SetPadding( mIconPadding );
+ }
+ if( selectedIcon )
+ {
+ selectedIcon.SetPadding( mIconPadding );
+ }
+
+ // Calculate and apply horizontal alignments and offsets
+ // to text and icon (depending on existence).
+ Vector3 iconPosition( Vector3::ZERO );
+ Vector3 labelPosition( Vector3::ZERO );
+ Vector3 iconAnchoring( AnchorPoint::CENTER );
+ Vector3 labelAnchoring( AnchorPoint::CENTER );
+ std::string horizontalLabelAlignment = "CENTER";
+ std::string verticalLabelAlignment = "CENTER";
+
+ if( iconExists && label )
+ {
+ // There is an icon and a label to lay out.
+ switch( mIconAlignment )
+ {
+ case LEFT: