2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/public-api/controls/buttons/button.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/object/property-map.h>
24 #include <dali/public-api/images/resource-image.h>
27 #include <dali-toolkit/internal/controls/buttons/button-impl.h>
28 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
29 #include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
40 Button::Button( const Button& button )
45 Button& Button::operator=( const Button& button )
49 Control::operator=( button );
58 Button Button::DownCast( BaseHandle handle )
60 return Control::DownCast<Button, Internal::Button>(handle);
63 void Button::SetDisabled( bool disabled )
65 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabled() is deprecated and will be removed from next release. Use SetProperty DISABLED or Styling file instead.\n" );
67 Dali::Toolkit::GetImplementation( *this ).SetDisabled( disabled );
70 bool Button::IsDisabled() const
72 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IsDisabled() is deprecated and will be removed from next release. Use GetProperty DISABLED instead.\n" );
74 return Dali::Toolkit::GetImplementation( *this ).IsDisabled();
77 void Button::SetAutoRepeating( bool autoRepeating )
79 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetAutoRepeating() is deprecated and will be removed from next release. Use SetProperty AUTO_REPEATING or Styling file instead.\n" );
81 Dali::Toolkit::GetImplementation( *this ).SetAutoRepeating( autoRepeating );
84 bool Button::IsAutoRepeating() const
86 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IsAutoRepeating() is deprecated and will be removed from next release. Use GetProperty AUTO_REPEATING instead.\n" );
88 return Dali::Toolkit::GetImplementation( *this ).IsAutoRepeating();
91 void Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay )
93 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetInitialAutoRepeatingDelay() is deprecated and will be removed from next release. Use SetProperty INITIAL_AUTO_REPEATING_DELAY or Styling file instead.\n" );
95 Dali::Toolkit::GetImplementation( *this ).SetInitialAutoRepeatingDelay( initialAutoRepeatingDelay );
98 float Button::GetInitialAutoRepeatingDelay() const
100 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetPositionInheritanceMode() is deprecated and will be removed from next release. Use GetProperty INITIAL_AUTO_REPEATING_DELAY or Styling file instead.\n" );
102 return Dali::Toolkit::GetImplementation( *this ).GetInitialAutoRepeatingDelay();
105 void Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay )
107 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetNextAutoRepeatingDelay() is deprecated and will be removed from next release. Use SetProperty NEXT_AUTO_REPEATING_DELAY or Styling file instead.\n" );
109 Dali::Toolkit::GetImplementation( *this ).SetNextAutoRepeatingDelay( nextAutoRepeatingDelay );
112 float Button::GetNextAutoRepeatingDelay() const
114 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetNextAutoRepeatingDelay() is deprecated and will be removed from next release. Use GetProperty NEXT_AUTO_REPEATING_DELAY instead.\n" );
116 return Dali::Toolkit::GetImplementation( *this ).GetNextAutoRepeatingDelay();
119 void Button::SetTogglableButton( bool togglable )
121 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetTogglableButton() is deprecated and will be removed from next release. Use SetProperty TOGGLABLE or Styling file instead.\n" );
123 Dali::Toolkit::GetImplementation( *this ).SetTogglableButton( togglable );
126 bool Button::IsTogglableButton() const
128 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IsTogglableButton() is deprecated and will be removed from next release. Use GetProperty TOGGLABLE instead.\n" );
130 return Dali::Toolkit::GetImplementation( *this ).IsTogglableButton();
133 void Button::SetSelected( bool selected )
135 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelected() is deprecated and will be removed from next release. Use SetProperty SELECTED instead.\n" );
137 Dali::Toolkit::GetImplementation( *this ).SetSelected( selected );
140 bool Button::IsSelected() const
142 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IsSelected() is deprecated and will be removed from next release. Use GetProperty SELECTED instead.\n" );
144 return Dali::Toolkit::GetImplementation( *this ).IsSelected();
147 void Button::SetAnimationTime( float animationTime )
149 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetAnimationTime() is deprecated and will be removed from next release. Use Styling file to set animation instead.\n" );
151 Dali::Toolkit::GetImplementation( *this ).SetAnimationTime( animationTime );
154 float Button::GetAnimationTime() const
156 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetAnimationTime() is deprecated and will be removed from next release.\n" );
158 return Dali::Toolkit::GetImplementation( *this ).GetAnimationTime();
161 void Button::SetLabelText( const std::string& label )
163 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetLabelText() is deprecated and will be removed from next release. Use SetProperty LABEL or Styling file instead.\n" );
165 Dali::Toolkit::GetImplementation( *this ).SetLabelText( label );
168 std::string Button::GetLabelText() const
170 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetLabelText() is deprecated and will be removed from next release. Use GetProperty LABEL instead.\n" );
172 return Dali::Toolkit::GetImplementation( *this ).GetLabelText();
175 void Button::SetUnselectedImage( const std::string& filename )
177 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetUnselectedImage() is deprecated and will be removed from next release. Use SetProperty UNSELECTED_STATE_IMAGE or Styling file instead.\n" );
179 Dali::Toolkit::GetImplementation( *this ).SetUnselectedImage( filename );
182 void Button::SetBackgroundImage( const std::string& filename )
184 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release. Use Styling file instead.\n" );
186 Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( filename );
189 void Button::SetSelectedImage( const std::string& filename )
191 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedImage() is deprecated and will be removed from next release. Use SetProperty SELECTED_STATE_IMAGE or Styling file instead.\n" );
193 Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( filename );
196 void Button::SetSelectedBackgroundImage( const std::string& filename )
198 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedBackgroundImage() is deprecated and will be removed from next release. Use Styling file instead.\n" );
200 Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( filename );
203 void Button::SetDisabledBackgroundImage( const std::string& filename )
205 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledBackgroundImage() is deprecated and will be removed from next release. Use SetProperty DISABLED_STATE_IMAGE or Styling file instead.\n" );
207 Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( filename );
210 void Button::SetDisabledImage( const std::string& filename )
212 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledImage() is deprecated and will be removed from next release. Use Styling file instead.\n" );
214 Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( filename );
217 void Button::SetDisabledSelectedImage( const std::string& filename )
219 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledSelectedImage() is deprecated and will be removed from next release. Use Styling file instead.\n" );
221 Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( filename );
224 Button::ButtonSignalType& Button::PressedSignal()
226 return Dali::Toolkit::GetImplementation( *this ).PressedSignal();
229 Button::ButtonSignalType& Button::ReleasedSignal()
231 return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal();
234 Button::ButtonSignalType& Button::ClickedSignal()
236 return Dali::Toolkit::GetImplementation( *this ).ClickedSignal();
239 Button::ButtonSignalType& Button::StateChangedSignal()
241 return Dali::Toolkit::GetImplementation( *this ).StateChangedSignal();
246 void Button::SetLabel( Actor label )
248 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetLabel() is deprecated and will be removed from next release. Use SetProperty LABEL instead.\n" );
250 Dali::Toolkit::GetImplementation( *this ).SetLabel( label );
253 void Button::SetButtonImage( Image image )
255 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetButtonImage() is deprecated and will be removed from next release. Use Styling file instead.\n" );
257 Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image );
260 void Button::SetSelectedImage( Image image )
262 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedImage() is deprecated and will be removed from next release. Use Styling file instead.\n" );
264 Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image );
267 Actor Button::GetButtonImage() const
269 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetButtonImage() is deprecated and will be removed from next release.\n" );
271 return Dali::Toolkit::GetImplementation( *this ).GetButtonImage();
274 Actor Button::GetSelectedImage() const
276 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: GetSelectedImage() is deprecated and will be removed from next release.\n" );
278 return Dali::Toolkit::GetImplementation( *this ).GetSelectedImage();
281 Button::Button( Internal::Button& implementation )
282 : Control( implementation )
286 Button::Button( Dali::Internal::CustomActor* internal )
287 : Control( internal )
289 VerifyCustomActorPointer<Internal::Button>(internal);
292 } // namespace Toolkit