X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fbuttons%2Fbutton.cpp;h=f4723753214fd95a8c23d12221ce1103e844e9b8;hb=bea7b708b28cb38349ff99c3a656d40c065a8c54;hp=1fbe69e6eff38b578dbd5689e8d5fda3bf4dbe91;hpb=bf2155ead4441b35df9e85eb10743c5bedba777e;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 1fbe69e..f472375 100644 --- a/dali-toolkit/public-api/controls/buttons/button.cpp +++ b/dali-toolkit/public-api/controls/buttons/button.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // CLASS HEADER @@ -22,14 +23,15 @@ #include +// EXTERNAL INCLUDES +#include + namespace Dali { namespace Toolkit { -const char* const Button::SIGNAL_CLICKED = "clicked"; - Button::Button() {} @@ -56,14 +58,64 @@ Button Button::DownCast( BaseHandle handle ) return Control::DownCast(handle); } -void Button::SetDimmed( bool dimmed ) +void Button::SetDisabled( bool disabled ) +{ + Dali::Toolkit::GetImplementation( *this ).SetDisabled( disabled ); +} + +bool Button::IsDisabled() const +{ + return Dali::Toolkit::GetImplementation( *this ).IsDisabled(); +} + +void Button::SetAutoRepeating( bool autoRepeating ) +{ + Dali::Toolkit::GetImplementation( *this ).SetAutoRepeating( autoRepeating ); +} + +bool Button::IsAutoRepeating() const { - Dali::Toolkit::GetImplementation( *this ).SetDimmed( dimmed ); + return Dali::Toolkit::GetImplementation( *this ).IsAutoRepeating(); } -bool Button::IsDimmed() const +void Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay ) { - return Dali::Toolkit::GetImplementation( *this ).IsDimmed(); + Dali::Toolkit::GetImplementation( *this ).SetInitialAutoRepeatingDelay( initialAutoRepeatingDelay ); +} + +float Button::GetInitialAutoRepeatingDelay() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetInitialAutoRepeatingDelay(); +} + +void Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay ) +{ + Dali::Toolkit::GetImplementation( *this ).SetNextAutoRepeatingDelay( nextAutoRepeatingDelay ); +} + +float Button::GetNextAutoRepeatingDelay() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetNextAutoRepeatingDelay(); +} + +void Button::SetTogglableButton( bool togglable ) +{ + Dali::Toolkit::GetImplementation( *this ).SetTogglableButton( togglable ); +} + +bool Button::IsTogglableButton() const +{ + return Dali::Toolkit::GetImplementation( *this ).IsTogglableButton(); +} + +void Button::SetSelected( bool selected ) +{ + Dali::Toolkit::GetImplementation( *this ).SetSelected( selected ); +} + +bool Button::IsSelected() const +{ + return Dali::Toolkit::GetImplementation( *this ).IsSelected(); } void Button::SetAnimationTime( float animationTime ) @@ -76,11 +128,103 @@ float Button::GetAnimationTime() const return Dali::Toolkit::GetImplementation( *this ).GetAnimationTime(); } -Button::ClickedSignalV2& Button::ClickedSignal() +void Button::SetLabelText( const std::string& label ) +{ + Dali::Toolkit::GetImplementation( *this ).SetLabelText( label ); +} + +std::string Button::GetLabelText() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetLabelText(); +} + +void Button::SetUnselectedImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetUnselectedImage( filename ); +} + +void Button::SetBackgroundImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( filename ); +} + +void Button::SetSelectedImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( filename ); +} + +void Button::SetSelectedBackgroundImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( filename ); +} + +void Button::SetDisabledBackgroundImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( filename ); +} + +void Button::SetDisabledImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( filename ); +} + +void Button::SetDisabledSelectedImage( const std::string& filename ) +{ + Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( filename ); +} + +Button::ButtonSignalType& Button::PressedSignal() +{ + return Dali::Toolkit::GetImplementation( *this ).PressedSignal(); +} + +Button::ButtonSignalType& Button::ReleasedSignal() +{ + return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal(); +} + +Button::ButtonSignalType& Button::ClickedSignal() { return Dali::Toolkit::GetImplementation( *this ).ClickedSignal(); } +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 imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageActor ); +} + +void Button::SetSelectedImage( Image image ) +{ + Actor imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageActor ); +} + +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 ) {