- if( ButtonDown == GetState() )
- {
- // Don't allow selection on an already selected radio button
- if( !IsSelected() )
- {
- SetSelected( !IsSelected() );
- }
- }
-}
-
-void RadioButton::OnLabelSet( bool noPadding )
-{
- Actor& label = GetLabelActor();
-
- if( label )
- {
- label.SetParentOrigin( ParentOrigin::CENTER_LEFT );
- label.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
-
- // Radio button width is FIT_TO_CHILDREN, so the label must have a sensible policy to fill out the space
- if( label.GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FILL_TO_PARENT )
- {
- label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH );
- }
-
- if( IsSelected() && GetSelectedImage() )
- {
- label.SetX( GetSelectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
- }
- else if( GetUnselectedImage() )
- {
- label.SetX( GetUnselectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL );
- }
- else
- {
- label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
- }
- }