X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fbuttons%2Fbutton.cpp;h=450d43248708b6f63ca532ebde9109fdd5cee533;hb=7bc9bb47cb9c552982e9144b202861190eeadc96;hp=c7b7b89de40b8d2fd91964fb6c8d0b329c104e11;hpb=6c8eb158ad2fb68a20bdcfabf8e07dd017da0528;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/public-api/controls/buttons/button.cpp b/dali-toolkit/public-api/controls/buttons/button.cpp index c7b7b89..450d432 100644 --- a/dali-toolkit/public-api/controls/buttons/button.cpp +++ b/dali-toolkit/public-api/controls/buttons/button.cpp @@ -22,9 +22,7 @@ // INTERNAL INCLUDES #include - -// EXTERNAL INCLUDES -#include +#include namespace Dali { @@ -128,64 +126,49 @@ float Button::GetAnimationTime() const return Dali::Toolkit::GetImplementation( *this ).GetAnimationTime(); } -void Button::SetLabel( const std::string& label ) +void Button::SetLabelText( const std::string& label ) { - Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); + Dali::Toolkit::GetImplementation( *this ).SetLabelText( label ); } -void Button::SetLabel( Actor label ) +std::string Button::GetLabelText() const { - Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); + return Dali::Toolkit::GetImplementation( *this ).GetLabelText(); } -Actor Button::GetLabel() const +void Button::SetUnselectedImage( const std::string& filename ) { - return Dali::Toolkit::GetImplementation( *this ).GetLabel(); + Dali::Toolkit::GetImplementation( *this ).SetUnselectedImage( filename ); } -void Button::SetButtonImage( Image image ) +void Button::SetBackgroundImage( const std::string& filename ) { - Actor imageActor = ImageActor::New( image ); - Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageActor ); + Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( filename ); } -void Button::SetBackgroundImage( Image image ) +void Button::SetSelectedImage( const std::string& filename ) { - Actor imageActor = ImageActor::New( image ); - Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( imageActor ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( filename ); } -void Button::SetSelectedImage( Image image ) +void Button::SetSelectedBackgroundImage( const std::string& filename ) { - Actor imageActor = ImageActor::New( image ); - imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageActor ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( filename ); } -void Button::SetSelectedBackgroundImage( Image image ) +void Button::SetDisabledBackgroundImage( const std::string& filename ) { - Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( ImageActor::New( image ) ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( filename ); } -void Button::SetDisabledBackgroundImage( Image image ) +void Button::SetDisabledImage( const std::string& filename ) { - Actor imageActor = ImageActor::New( image ); - imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( imageActor ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( filename ); } -void Button::SetDisabledImage( Image image ) +void Button::SetDisabledSelectedImage( const std::string& filename ) { - Actor imageActor = ImageActor::New( image ); - imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( imageActor ); -} - -void Button::SetDisabledSelectedImage( Image image ) -{ - Actor imageActor = ImageActor::New( image ); - imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( imageActor ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( filename ); } Button::ButtonSignalType& Button::PressedSignal() @@ -208,6 +191,38 @@ Button::ButtonSignalType& Button::StateChangedSignal() return Dali::Toolkit::GetImplementation( *this ).StateChangedSignal(); } +// Deprecated API + +void Button::SetLabel( Actor label ) +{ + Dali::Toolkit::GetImplementation( *this ).SetLabel( label ); +} + +void Button::SetButtonImage( Image image ) +{ + Actor imageView = Toolkit::ImageView::New( image ); + imageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageView ); +} + +void Button::SetSelectedImage( Image image ) +{ + Actor imageView = Toolkit::ImageView::New( image ); + imageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageView ); +} + +Actor Button::GetButtonImage() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetButtonImage(); +} + +Actor Button::GetSelectedImage() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetSelectedImage(); +} + + Button::Button( Internal::Button& implementation ) : Control( implementation ) {