-void RadioButton::SetLabel(const std::string& label)
-{
- // TODO
-
- RelayoutRequest();
-}
-
-void RadioButton::SetLabel(Actor label)
-{
- if( mLabel != label )
- {
- if( mLabel )
- {
- mRadioIcon.Remove( mLabel );
- }
-
- if( label )
- {
- label.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
- label.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- label.MoveBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
- mRadioIcon.Add( label );
- }
-
- mLabel = label;
-
- RelayoutRequest();
- }
-}
-
-Actor RadioButton::GetLabel() const
-{
- return mLabel;
-}
-
-void RadioButton::SetSelected(bool selected)
-{
- if( mSelected != selected )
- {
- if( selected )
- {
- Actor parent = Self().GetParent();
- if( parent )
- {
- for( unsigned int i = 0; i < parent.GetChildCount(); ++i )
- {
- Dali::Toolkit::RadioButton rbChild = Dali::Toolkit::RadioButton::DownCast(parent.GetChildAt(i));
-
- if( rbChild )
- {
- rbChild.SetSelected(false);
- }
- }
- }
-
- mSelected = true;
- mRadioIcon.SetImage(mSelectedImage);
- }
- else
- {
- mSelected = false;
- mRadioIcon.SetImage(mUnselectedImage);
- }
-
- // Raise state changed signal
- Toolkit::RadioButton handle( GetOwner() );
- mStateChangedSignal.Emit( handle, mSelected );
-
- RelayoutRequest();
- }
-}
-
-bool RadioButton::IsSelected()const
-{
- return mSelected;
-}
-
-void RadioButton::ToggleState()
-{
- SetSelected(!mSelected);
-}
-
-void RadioButton::OnRelayout( const Vector2& /*size*/, ActorSizeContainer& container )
-{
- Vector3 newSize( mRadioIcon.GetNaturalSize() );
-
- if( mLabel )
- {
- // Offset the label from the radio button image
- newSize.width += DISTANCE_BETWEEN_IMAGE_AND_LABEL.width;
-
- // Find the size of the control using size negotiation
- Vector3 actorNaturalSize( mLabel.GetNaturalSize() );
- Control::Relayout( mLabel, Vector2( actorNaturalSize.width, actorNaturalSize.height ), container );
-
- Vector3 actorSize( mLabel.GetSize() );
- newSize.width += actorSize.width;
- newSize.height = std::max( newSize.height, actorSize.height );
- }
-
- Self().SetSize( newSize );
-}
-