X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fradio-button-impl.cpp;h=e980ec91a40d822bd1b44fbc8ce957256b0e84ee;hb=refs%2Fchanges%2F84%2F44684%2F2;hp=81b6a5d9c6c47cbef01a9eba85ff75cecaa124a0;hpb=fc72d9dfdefd7434202ed73ac579d425279947f3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp index 81b6a5d..e980ec9 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp @@ -44,6 +44,8 @@ TypeRegistration typeRegistration( typeid( Toolkit::RadioButton ), typeid( Toolk const char* const UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-unselected.png"; const char* const SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-selected.png"; +const char* const DISABLED_UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-unselected-disabled.png"; +const char* const DISABLED_SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-selected-disabled.png"; const float DISTANCE_BETWEEN_IMAGE_AND_LABEL( 5.0f ); } @@ -79,11 +81,10 @@ void RadioButton::OnButtonInitialize() // Wrap size of radio button around all its children self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS ); - Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR ); - Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR ); - - SetButtonImage( ImageActor::New( buttonImage ) ); - SetSelectedImage( ImageActor::New( selectedImage ) ); + SetUnselectedImage( UNSELECTED_BUTTON_IMAGE_DIR ); + SetSelectedImage( SELECTED_BUTTON_IMAGE_DIR ); + SetDisabledImage( DISABLED_UNSELECTED_BUTTON_IMAGE_DIR ); + SetDisabledSelectedImage( DISABLED_SELECTED_BUTTON_IMAGE_DIR ); RelayoutRequest(); } @@ -100,9 +101,9 @@ void RadioButton::OnButtonUp() } } -void RadioButton::OnLabelSet() +void RadioButton::OnLabelSet( bool noPadding ) { - Actor& label = GetLabel(); + Actor& label = GetLabelActor(); if( label ) { @@ -115,25 +116,26 @@ void RadioButton::OnLabelSet() label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); } - if( IsSelected() ) + 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( GetButtonImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } } } -bool RadioButton::OnSelected() +void RadioButton::OnSelected() { - Actor& buttonImage = GetButtonImage(); - Actor& selectedImage = GetSelectedImage(); - Actor& label = GetLabel(); + Actor& label = GetLabelActor(); PaintState paintState = GetPaintState(); - switch( paintState ) { case UnselectedState: @@ -151,9 +153,8 @@ bool RadioButton::OnSelected() } } - RemoveChild( buttonImage ); - - if( label ) + Actor& selectedImage = GetSelectedImage(); + if( label && selectedImage ) { label.SetX( selectedImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } @@ -161,9 +162,8 @@ bool RadioButton::OnSelected() } case SelectedState: { - RemoveChild( selectedImage ); - - if( label ) + Actor& buttonImage = GetUnselectedImage(); + if( label && buttonImage ) { label.SetX( buttonImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } @@ -174,9 +174,6 @@ bool RadioButton::OnSelected() break; } } - - // there is no animation - return false; } } // namespace Internal