2 * Copyright (c) 2016 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 "button-impl.h"
22 #include <cstring> // for strcmp
23 #include <dali/devel-api/scripting/enum-helper.h>
24 #include <dali/integration-api/debug.h>
25 #include <dali/public-api/events/touch-data.h>
26 #include <dali/public-api/images/resource-image.h>
27 #include <dali/public-api/object/type-registry.h>
28 #include <dali/public-api/object/type-registry-helper.h>
29 #include <dali/public-api/size-negotiation/relayout-container.h>
30 #include <dali/devel-api/scripting/scripting.h>
33 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
34 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
35 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
36 #include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
37 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
38 #include <dali-toolkit/devel-api/align-enums.h>
39 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
40 #include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
41 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
44 #if defined(DEBUG_ENABLED)
45 Debug::Filter* gLogButtonFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_BUTTON_CONTROL");
62 // empty handle as we cannot create button (but type registered for clicked signal)
66 // Setup properties, signals and actions using the type-registry.
67 DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Button, Toolkit::Control, Create )
69 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabled", BOOLEAN, DISABLED )
70 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "autoRepeating", BOOLEAN, AUTO_REPEATING )
71 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "initialAutoRepeatingDelay", FLOAT, INITIAL_AUTO_REPEATING_DELAY )
72 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "nextAutoRepeatingDelay", FLOAT, NEXT_AUTO_REPEATING_DELAY )
73 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "togglable", BOOLEAN, TOGGLABLE )
74 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selected", BOOLEAN, SELECTED )
75 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedStateImage", MAP, UNSELECTED_STATE_IMAGE ) // Deprecated property
76 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedStateImage", MAP, SELECTED_STATE_IMAGE ) // Deprecated property
77 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledStateImage", MAP, DISABLED_STATE_IMAGE ) // Deprecated property
78 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedColor", VECTOR4, UNSELECTED_COLOR ) // Deprecated property
79 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedColor", VECTOR4, SELECTED_COLOR ) // Deprecated property
80 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "label", MAP, LABEL )
81 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelText", STRING, LABEL_TEXT ) // Deprecated property
82 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedVisual", MAP, UNSELECTED_VISUAL )
83 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedVisual", MAP, SELECTED_VISUAL )
84 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedVisual", MAP, DISABLED_SELECTED_VISUAL )
85 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedVisual", MAP, DISABLED_UNSELECTED_VISUAL )
86 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "unselectedBackgroundVisual", MAP, UNSELECTED_BACKGROUND_VISUAL )
87 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "selectedBackgroundVisual", MAP, SELECTED_BACKGROUND_VISUAL )
88 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledUnselectedBackgroundVisual", MAP, DISABLED_UNSELECTED_BACKGROUND_VISUAL )
89 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "disabledSelectedBackgroundVisual", MAP, DISABLED_SELECTED_BACKGROUND_VISUAL )
90 DALI_PROPERTY_REGISTRATION( Toolkit, Button, "labelRelativeAlignment", STRING, LABEL_RELATIVE_ALIGNMENT )
93 DALI_SIGNAL_REGISTRATION( Toolkit, Button, "pressed", SIGNAL_PRESSED )
94 DALI_SIGNAL_REGISTRATION( Toolkit, Button, "released", SIGNAL_RELEASED )
95 DALI_SIGNAL_REGISTRATION( Toolkit, Button, "clicked", SIGNAL_CLICKED )
96 DALI_SIGNAL_REGISTRATION( Toolkit, Button, "stateChanged", SIGNAL_STATE_CHANGED )
99 DALI_ACTION_REGISTRATION( Toolkit, Button, "buttonClick", ACTION_BUTTON_CLICK )
101 DALI_TYPE_REGISTRATION_END()
103 DALI_ENUM_TO_STRING_TABLE_BEGIN( ALIGNMENT )
104 DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Internal::Button, BEGIN )
105 DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Internal::Button, END )
106 DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Internal::Button, TOP )
107 DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Internal::Button, BOTTOM )
108 DALI_ENUM_TO_STRING_TABLE_END( ALIGNMENT )
110 const Scripting::StringEnum ALIGNMENT_STRING_TABLE[] =
112 { "BEGIN", Button::BEGIN },
113 { "END", Button::END },
114 { "TOP", Button::TOP },
115 { "BOTTOM", Button::BOTTOM },
118 const unsigned int ALIGNMENT_STRING_TABLE_COUNT = sizeof( ALIGNMENT_STRING_TABLE ) / sizeof( ALIGNMENT_STRING_TABLE[0] );
120 const Property::Index GET_VISUAL_INDEX_FOR_STATE[][Button::STATE_COUNT] =
122 { Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::UNSELECTED_VISUAL },
123 { Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::SELECTED_VISUAL },
124 { Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL },
125 { Toolkit::Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL, Toolkit::Button::Property::DISABLED_SELECTED_VISUAL }
128 } // unnamed namespace
131 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
132 mAutoRepeatingTimer(),
133 mTextLabelAlignment( END ),
134 mAutoRepeating( false ),
135 mTogglableButton( false ),
136 mInitialAutoRepeatingDelay( 0.0f ),
137 mNextAutoRepeatingDelay( 0.0f ),
138 mAnimationTime( 0.0f ),
139 mButtonPressedState( UNPRESSED ),
140 mButtonState( UNSELECTED_STATE ),
141 mPreviousButtonState( mButtonState ),
142 mClickActionPerforming( false )
150 void Button::SetAutoRepeating( bool autoRepeating )
152 mAutoRepeating = autoRepeating;
154 // An autorepeating button can't be a togglable button.
157 mTogglableButton = false;
161 SetSelected( false );
166 bool Button::IsAutoRepeating() const
168 return mAutoRepeating;
171 void Button::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay )
173 DALI_ASSERT_DEBUG( initialAutoRepeatingDelay > 0.f );
174 mInitialAutoRepeatingDelay = initialAutoRepeatingDelay;
177 float Button::GetInitialAutoRepeatingDelay() const
179 return mInitialAutoRepeatingDelay;
182 void Button::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay )
184 DALI_ASSERT_DEBUG( nextAutoRepeatingDelay > 0.f );
185 mNextAutoRepeatingDelay = nextAutoRepeatingDelay;
188 float Button::GetNextAutoRepeatingDelay() const
190 return mNextAutoRepeatingDelay;
193 void Button::SetTogglableButton( bool togglable )
195 mTogglableButton = togglable;
197 // A toggle button can't be an autorepeating button.
200 mAutoRepeating = false;
204 bool Button::IsTogglableButton() const
206 return mTogglableButton;
209 void Button::SetSelected( bool selected )
211 if( mTogglableButton )
213 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetSelected (%s)\n", (selected?"true":"false") );
215 if ( selected && ( mButtonState != SELECTED_STATE ) )
217 ChangeState( SELECTED_STATE );
219 else if ( !selected && ( mButtonState != UNSELECTED_STATE ) )
221 ChangeState( UNSELECTED_STATE );
226 void Button::SetDisabled( bool disabled )
228 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetDisabled(%s) state(%d)\n", (disabled)?"disabled":"active", mButtonState );
232 if ( mButtonState == SELECTED_STATE )
234 ChangeState( DISABLED_SELECTED_STATE );
236 else if ( mButtonState == UNSELECTED_STATE )
238 ChangeState( DISABLED_UNSELECTED_STATE );
243 if ( mButtonState == DISABLED_SELECTED_STATE )
245 ChangeState( SELECTED_STATE );
247 else if ( mButtonState == DISABLED_UNSELECTED_STATE )
249 ChangeState( UNSELECTED_STATE );
254 bool Button::IsDisabled() const
256 return ( mButtonState == DISABLED_SELECTED_STATE || mButtonState == DISABLED_UNSELECTED_STATE ) ;
259 bool Button::ValidateState( State requestedState )
261 /* Below tables shows allowed state transitions
262 * Match rows in first column to following columns, if true then transition allowed.
263 * eg UNSELECTED_STATE to DISABLED_UNSELECTED_STATE is true so state transition allowed.
265 to| UNSELECTED_STATE | SELECTED_STATE | DISABLED_UNSELECTED_STATE | DISABLED_SELECTED_STATE |*/
267 bool transitionTable[4][4] = { /* UNSELECTED_STATE*/ { false, true, true, false },
268 /* SELECTED_STATE*/ { true, false, false, true },
269 /* DISABLED_UNSELECTED_STATE*/{ true, true, false, false },
270 /* DISABLED_SELECTED_STATE*/ { false, true, false, false }
273 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::ValidateState ReuestedState:%d, CurrentState:%d, result:%s\n",
274 requestedState, mButtonState, (transitionTable[mButtonState][requestedState])?"change-accepted":"change-denied");
276 return transitionTable[mButtonState][requestedState];
279 void Button::PerformFunctionOnVisualsInState( void(Button::*functionPtr)( Property::Index visualIndex), State state )
281 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::PerformFunctionOnVisualsInState BACKROUND visual(%d) for state (%d)\n",
282 GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND], state );
283 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::PerformFunctionOnVisualsInState FOREGROUND visuals(%d) for state (%d)\n",
284 GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND], state );
286 (this->*functionPtr)( GET_VISUAL_INDEX_FOR_STATE[state][BACKGROUND] );
287 (this->*functionPtr)( GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND] );
292 void Button::ChangeState( State requestedState )
294 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::ChangeState ReuestedState(%d)\n", requestedState );
296 // Validate State before changing
297 if ( !ValidateState( requestedState ))
299 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::ChangeState ReuestedState(%d) not validated\n", requestedState );
303 // If not on stage the button could have still been set to selected so update state/
304 mPreviousButtonState = mButtonState; // Store previous state for visual removal (used when animations ended)
305 mButtonState = requestedState; // Update current state
307 if ( Self().OnStage() )
309 OnStateChange( mButtonState ); // Notify derived buttons
310 PerformFunctionOnVisualsInState( &Button::SelectRequiredVisual, mButtonState );
311 // If animation supported then visual removal should be performed after any transition animation has completed.
312 PerformFunctionOnVisualsInState( &Button::OnButtonVisualRemoval, mPreviousButtonState ); // Derived button can override OnButtonVisualRemoval
315 Toolkit::Button handle( GetOwner() );
317 mStateChangedSignal.Emit( handle );
320 bool Button::IsSelected() const
322 bool selected = ( mButtonState == SELECTED_STATE ) || ( mButtonState == DISABLED_SELECTED_STATE );
323 return mTogglableButton && selected;
326 void Button::SetLabelText( const std::string& label )
328 Property::Map labelProperty;
329 labelProperty.Insert( "text", label );
330 SetupLabel( labelProperty );
333 std::string Button::GetLabelText() const
335 Toolkit::TextLabel label = Dali::Toolkit::TextLabel::DownCast( mLabel );
338 return label.GetProperty<std::string>( Dali::Toolkit::TextLabel::Property::TEXT );
340 return std::string();
343 void Button::SetupLabel( const Property::Map& properties )
345 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "SetupLabel\n");
347 // If we don't have a label yet, create one.
350 // If we don't have a label, create one and set it up.
351 // Note: The label text is set from the passed in property map after creation.
352 mLabel = Toolkit::TextLabel::New();
353 mLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
354 mLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
355 mLabel.SetParentOrigin( ParentOrigin::TOP_LEFT );
356 mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
359 mLabel.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
360 .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::COLOR )
361 .Add( Toolkit::ColorVisual::Property::MIX_COLOR, Color::RED )
364 ResizePolicy::Type policy = Self().GetResizePolicy( Dimension::ALL_DIMENSIONS );
365 if ( policy == ResizePolicy::USE_NATURAL_SIZE || policy == ResizePolicy::FIT_TO_CHILDREN )
367 mLabel.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
371 // todo Can't set Text Label to USE_ASSIGNED_SIZE as causes a relayout in it whilst doing a relayout = error
372 //mLabel.SetResizePolicy(ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS );
374 Self().Add( mLabel );
377 // Set any properties specified for the label by iterating through all property key-value pairs.
378 for( unsigned int i = 0, mapCount = properties.Count(); i < mapCount; ++i )
380 const StringValuePair& propertyPair( properties.GetPair( i ) );
382 // Convert the property string to a property index.
383 Property::Index setPropertyIndex = mLabel.GetPropertyIndex( propertyPair.first );
384 if( setPropertyIndex != Property::INVALID_INDEX )
386 // If the conversion worked, we have a valid property index,
387 // Set the property to the new value.
388 mLabel.SetProperty( setPropertyIndex, propertyPair.second );
395 void Button::SetLabelAlignment( Button::Align labelAlignment)
397 mTextLabelAlignment = labelAlignment;
401 Button::Align Button::GetLabelAlignment()
403 return mTextLabelAlignment;
406 void Button::CreateVisualsForComponent( Property::Index index, const Property::Value& value, const float visualDepth )
408 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent index(%d)\n", index );
409 Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
410 Toolkit::Visual::Base buttonVisual;
412 std::string imageUrl;
413 if( value.Get( imageUrl ) )
415 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent Using image URL(%d)\n", index );
416 if ( !imageUrl.empty() )
418 buttonVisual = visualFactory.CreateVisual( imageUrl, ImageDimensions() );
423 // if its not a string then get a Property::Map from the property if possible.
424 Property::Map *map = value.GetMap();
425 if( map && !map->Empty() ) // Empty map results in current visual removal.
427 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent Using Map(%d)\n", index );
428 buttonVisual = visualFactory.CreateVisual( *map );
434 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "RegisterVisual index(%d)\n", index );
435 buttonVisual.SetDepthIndex( visualDepth );
436 // Background Visuals take full size of control
437 RegisterVisual( index, buttonVisual, false );
441 UnregisterVisual( index );
442 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "Button visual not created or empty map provided (clearing visual).(%d)\n", index);
446 bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
450 Dali::BaseHandle handle( object );
452 Toolkit::Button button = Toolkit::Button::DownCast( handle );
454 DALI_ASSERT_DEBUG( button );
456 if( 0 == strcmp( actionName.c_str(), ACTION_BUTTON_CLICK ) )
458 ret = GetImplementation( button ).DoClickAction( attributes );
464 bool Button::DoClickAction( const Property::Map& attributes )
466 // Prevents the button signals from doing a recursive loop by sending an action
467 // and re-emitting the signals.
468 if( !mClickActionPerforming )
470 mClickActionPerforming = true;
472 if ( !mTogglableButton )
474 mButtonPressedState = DEPRESSED;
477 mClickActionPerforming = false;
485 void Button::ButtonDown()
487 if( mTogglableButton )
489 if ( mButtonState != SELECTED_STATE )
492 mButtonPressedState = TOGGLE_DEPRESSED;
496 mButtonPressedState = DEPRESSED;
502 mButtonPressedState = DEPRESSED;
505 SetUpTimer( mInitialAutoRepeatingDelay );
509 // The pressed signal should be emitted regardless of toggle mode.
510 Toolkit::Button handle( GetOwner() );
511 mPressedSignal.Emit( handle );
514 void Button::ButtonUp()
516 if( DEPRESSED == mButtonPressedState )
518 bool validButtonAction = false;
520 if( mTogglableButton ) // Button up will change state
522 OnToggleReleased(); // Derived toggle buttons can override this to provide custom behaviour
526 Released(); // Button up will result in unselected state
529 mAutoRepeatingTimer.Reset();
531 validButtonAction = true;
534 if ( validButtonAction )
536 // The clicked and released signals should be emitted regardless of toggle mode.
537 Toolkit::Button handle( GetOwner() );
538 mReleasedSignal.Emit( handle );
539 mClickedSignal.Emit( handle );
544 bool Button::OnToggleReleased()
546 SetSelected( !IsSelected() );
547 mButtonPressedState = UNPRESSED;
552 void Button::OnTouchPointLeave()
554 if( DEPRESSED == mButtonPressedState )
556 if( !mTogglableButton )
562 mAutoRepeatingTimer.Reset();
566 mButtonPressedState = UNPRESSED;
568 // The released signal should be emitted regardless of toggle mode.
569 Toolkit::Button handle( GetOwner() );
570 mReleasedSignal.Emit( handle );
574 void Button::OnTouchPointInterrupted()
579 Toolkit::Button::ButtonSignalType& Button::PressedSignal()
581 return mPressedSignal;
584 Toolkit::Button::ButtonSignalType& Button::ReleasedSignal()
586 return mReleasedSignal;
589 Toolkit::Button::ButtonSignalType& Button::ClickedSignal()
591 return mClickedSignal;
594 Toolkit::Button::ButtonSignalType& Button::StateChangedSignal()
596 return mStateChangedSignal;
599 bool Button::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
601 Dali::BaseHandle handle( object );
603 bool connected( true );
604 Toolkit::Button button = Toolkit::Button::DownCast( handle );
606 if( 0 == strcmp( signalName.c_str(), SIGNAL_PRESSED ) )
608 button.PressedSignal().Connect( tracker, functor );
610 else if( 0 == strcmp( signalName.c_str(), SIGNAL_RELEASED ) )
612 button.ReleasedSignal().Connect( tracker, functor );
614 else if( 0 == strcmp( signalName.c_str(), SIGNAL_CLICKED ) )
616 button.ClickedSignal().Connect( tracker, functor );
618 else if( 0 == strcmp( signalName.c_str(), SIGNAL_STATE_CHANGED ) )
620 button.StateChangedSignal().Connect( tracker, functor );
624 // signalName does not match any signal
631 void Button::OnInitialize()
633 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnInitialize\n" );
637 mTapDetector = TapGestureDetector::New();
638 mTapDetector.Attach( self );
639 mTapDetector.DetectedSignal().Connect(this, &Button::OnTap);
641 self.SetKeyboardFocusable( true );
643 self.TouchSignal().Connect( this, &Button::OnTouch );
646 bool Button::OnAccessibilityActivated()
648 return OnKeyboardEnter();
651 bool Button::OnTouch( Actor actor, const TouchData& touch )
654 // Only events are processed when the button is not disabled and the touch event has only
657 if( !IsDisabled() && ( 1 == touch.GetPointCount() ) )
659 switch( touch.GetState( 0 ) )
661 case PointState::DOWN:
671 case PointState::INTERRUPTED:
673 OnTouchPointInterrupted();
676 case PointState::LEAVE:
681 case PointState::MOTION:
682 case PointState::STATIONARY: // FALLTHROUGH
689 else if( 1 < touch.GetPointCount() )
691 OnTouchPointLeave(); // Notification for derived classes.
693 // Sets the button state to the default
694 mButtonPressedState = UNPRESSED;
700 bool Button::OnKeyboardEnter()
702 // When the enter key is pressed, or button is activated, the click action is performed.
703 Property::Map attributes;
704 bool ret = DoClickAction( attributes );
709 void Button::OnStageDisconnection()
711 if( DEPRESSED == mButtonPressedState )
713 if( !mTogglableButton )
719 mAutoRepeatingTimer.Reset();
724 mButtonPressedState = UNPRESSED;
726 Control::OnStageDisconnection(); // Visuals will be set off stage
729 void Button::OnStageConnection( int depth )
731 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnStageConnection ptr(%p) \n", this );
732 PerformFunctionOnVisualsInState( &Button::SelectRequiredVisual, mButtonState );
733 Control::OnStageConnection( depth ); // Enabled visuals will be put on stage
737 Vector3 Button::GetNaturalSize()
739 Vector3 size = Vector3::ZERO;
741 bool horizontalAlignment = mTextLabelAlignment == BEGIN || mTextLabelAlignment == END; // label and visual side by side
743 // Get natural size of foreground ( largest of the possible visuals )
744 Size largestForegroundVisual;
747 for ( int state = Button::UNSELECTED_STATE; state < Button::STATE_COUNT; state++)
749 Toolkit::Visual::Base visual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[state][FOREGROUND] );
753 visual.GetNaturalSize( visualSize );
754 largestForegroundVisual.width = std::max(largestForegroundVisual.width, visualSize.width );
755 largestForegroundVisual.height = std::max(largestForegroundVisual.height, visualSize.height );
759 // Get horizontal padding total
760 if ( largestForegroundVisual.width > 0 ) // if visual exists
762 size.width += largestForegroundVisual.width + mForegroundPadding.left + mForegroundPadding.right;
764 // Get vertical padding total
765 if ( largestForegroundVisual.height > 0 )
767 size.height += largestForegroundVisual.height + mForegroundPadding.top + mForegroundPadding.bottom;
770 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "GetNaturalSize visual Size(%f,%f)\n",
771 largestForegroundVisual.width, largestForegroundVisual.height );
773 // Get natural size of label
776 labelSize = Vector2( mLabel.GetNaturalSize());
778 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "GetNaturalSize labelSize(%f,%f) padding(%f,%f)\n",
779 labelSize.width, labelSize.height, mLabelPadding.left + mLabelPadding.right, mLabelPadding.top + mLabelPadding.bottom);
781 labelSize.width += mLabelPadding.left + mLabelPadding.right;
782 labelSize.height += mLabelPadding.top + mLabelPadding.bottom;
784 // Add label size to height or width depending on alignment position
785 if ( horizontalAlignment )
787 size.width += labelSize.width;
788 size.height = std::max(size.height, labelSize.height );
792 size.height += labelSize.height;
793 size.width = std::max(size.width, labelSize.width );
797 if( size.width < 1 && size.height < 1 )
799 // if no image or label then use Control's natural size
800 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "GetNaturalSize Using control natural size\n");
801 size = Control::GetNaturalSize();
804 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "Button GetNaturalSize (%f,%f)\n", size.width, size.height );
809 void Button::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
811 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnSetResizePolicy\n");
813 if ( policy != ResizePolicy::USE_NATURAL_SIZE || policy != ResizePolicy::FIT_TO_CHILDREN )
817 // todo Can't set Text Label to USE_ASSIGNED_SIZE as causes a relayout in it whilst doing a relayout = error
818 //mLabel.SetResizePolicy(ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS );
825 void Button::OnRelayout( const Vector2& size, RelayoutContainer& container )
827 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout targetSize(%f,%f) ptr(%p) state[%d]\n", size.width, size.height, this, mButtonState );
829 Toolkit::Visual::Base currentVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][FOREGROUND] );
831 Toolkit::Visual::Base currentBackGroundVisual = GetVisual( GET_VISUAL_INDEX_FOR_STATE[mButtonState][BACKGROUND] );
833 // Sizes and padding set to zero, if not present then values will no effect calculations.
834 Vector2 visualPosition = Vector2::ZERO;
835 Vector2 labelPosition = Vector2::ZERO;
836 Size visualSize = Size::ZERO;
837 Padding foregroundVisualPadding = Padding(0.0f, 0.0f, 0.0f, 0.0f );
838 Padding labelVisualPadding = Padding(0.0f, 0.0f, 0.0f, 0.0f );
842 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout Label padding setting padding:%f,%f,%f,%f\n", mLabelPadding.y, mLabelPadding.x, mLabelPadding.width,mLabelPadding.height );
843 labelVisualPadding = mLabelPadding;
848 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout Foreground Visual setting padding:%f,%f,%f,%f\n", mForegroundPadding.y, mForegroundPadding.x, mForegroundPadding.width,mForegroundPadding.height );
849 currentVisual.GetNaturalSize( visualSize );
850 foregroundVisualPadding = mForegroundPadding;
853 Toolkit::Align::Type visualAnchorPoint = Toolkit::Align::TOP_BEGIN;
855 Vector2 visualAndPaddingSize = Vector2( ( foregroundVisualPadding.x + visualSize.width + foregroundVisualPadding.y ),
856 ( foregroundVisualPadding.width + visualSize.height + foregroundVisualPadding.height ));
858 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout visualAndPaddingSize(%f,%f)\n", visualAndPaddingSize.width, visualAndPaddingSize.height);
860 switch ( mTextLabelAlignment )
864 visualAnchorPoint = Toolkit::Align::TOP_END;
865 visualPosition.x = foregroundVisualPadding.right;
866 visualPosition.y = foregroundVisualPadding.top;
868 labelPosition.x = labelVisualPadding.x;
869 labelPosition.y = labelVisualPadding.top;
874 visualAnchorPoint = Toolkit::Align::TOP_BEGIN;
875 visualPosition.x = foregroundVisualPadding.left;
876 visualPosition.y = foregroundVisualPadding.top;
878 labelPosition.x = visualAndPaddingSize.width + labelVisualPadding.x;
879 labelPosition.y = labelVisualPadding.top;
884 visualAnchorPoint = Toolkit::Align::BOTTOM_END;
885 visualPosition.x = foregroundVisualPadding.left;
886 visualPosition.y = foregroundVisualPadding.bottom;
888 labelPosition.x = labelVisualPadding.left;
889 labelPosition.y = labelVisualPadding.top;
894 visualAnchorPoint = Toolkit::Align::TOP_END;
895 visualPosition.x = foregroundVisualPadding.left;
896 visualPosition.y = foregroundVisualPadding.top;
898 labelPosition.x = labelVisualPadding.left;
899 labelPosition.y = visualAndPaddingSize.height + labelVisualPadding.top;
904 if ( currentBackGroundVisual )
906 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout Setting visual bakcground size to(%f,%f)\n", size.width, size.height);
908 Property::Map visualTransform;
910 visualTransform.Add( Toolkit::DevelVisual::Transform::Property::SIZE, size )
911 .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4( 0.0f, 0.0f, 1.0f, 1.0f) ); // Use relative size
913 currentBackGroundVisual.SetTransformAndSize( visualTransform, size );
918 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout Setting visual size to(%f,%f)\n", visualSize.width, visualSize.height);
920 currentVisual.SetProperty( Toolkit::Visual::DevelProperty::TRANSFORM,
921 Dali::Property::Map()
922 .Add( Toolkit::Visual::DevelProperty::Transform::Property::SIZE, visualSize )
923 .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET, visualPosition )
924 .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4(1.0f, 1.0f, 1.0f,1.0f) )
925 .Add( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN, Toolkit::Align::TOP_BEGIN )
926 .Add( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT, visualAnchorPoint )
932 // When Text visual size can be set, determine the size here.
933 // Text Visual should take all space available after foreground visual size and all padding is considered.
934 // Remaining Space priority, Foreground padding, foreground visual, Text padding then Text visual.
936 Size remainingSpaceForText = Size::ZERO;
937 remainingSpaceForText.width = size.width - visualAndPaddingSize.width - labelVisualPadding.x - labelVisualPadding.y;
938 remainingSpaceForText.height = size.height - visualAndPaddingSize.height - labelVisualPadding.width - labelVisualPadding.height;
940 if ( !currentVisual )
942 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout Only Text\n");
944 // Center Text if no foreground visual
945 Size labelNaturalSize = Vector2( mLabel.GetNaturalSize() );
947 // A Text visual will take up all the remainingSpaceForText, for now TextLabel natural size needed for positioning.
948 labelPosition.x = labelVisualPadding.left + remainingSpaceForText.width*0.5 - labelNaturalSize.width *0.5;
949 labelPosition.y = labelVisualPadding.height + remainingSpaceForText.height*0.5 - labelNaturalSize.height *0.5;
952 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout text Size(%f,%f) text Position(%f,%f) \n", remainingSpaceForText.width, remainingSpaceForText.height, labelPosition.x, labelPosition.y);
954 mLabel.SetPosition( labelPosition.x, labelPosition.y );
955 container.Add( mLabel, remainingSpaceForText ); // Currently a TextLabel is used and size can not be set here.
958 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnRelayout << \n");
961 void Button::OnTap(Actor actor, const TapGesture& tap)
963 DALI_LOG_INFO( gLogButtonFilter, Debug::General, "OnTap\n" );
966 void Button::SetUpTimer( float delay )
968 mAutoRepeatingTimer = Dali::Timer::New( static_cast<unsigned int>( 1000.f * delay ) );
969 mAutoRepeatingTimer.TickSignal().Connect( this, &Button::AutoRepeatingSlot );
970 mAutoRepeatingTimer.Start();
973 bool Button::AutoRepeatingSlot()
975 bool consumed = false;
978 // Restart the autorepeat timer.
979 SetUpTimer( mNextAutoRepeatingDelay );
983 Toolkit::Button handle( GetOwner() );
986 consumed = mReleasedSignal.Emit( handle );
987 consumed = mClickedSignal.Emit( handle );
988 consumed |= mPressedSignal.Emit( handle );
994 void Button::Pressed()
996 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::Pressed\n" );
998 if( mButtonState == UNSELECTED_STATE )
1000 ChangeState( SELECTED_STATE );
1001 OnPressed(); // Notifies the derived class the button has been pressed.
1005 void Button::Released()
1007 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::Released\n" );
1009 if( mButtonState == SELECTED_STATE && !mTogglableButton )
1011 ChangeState( UNSELECTED_STATE );
1012 OnReleased(); // // Notifies the derived class the button has been released.
1014 mButtonPressedState = UNPRESSED;
1017 void Button::SelectRequiredVisual( Property::Index visualIndex )
1019 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SelectRequiredVisual index(%d) state(%d)\n", visualIndex, mButtonState );
1021 EnableVisual( visualIndex, true );
1024 void Button::RemoveVisual( Property::Index visualIndex )
1026 // Use OnButtonVisualRemoval if want button developer to have the option to override removal.
1027 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::RemoveVisual index(%d) state(%d)\n", visualIndex, mButtonState );
1029 Toolkit::Visual::Base visual = GetVisual( visualIndex );
1033 EnableVisual( visualIndex, false );
1037 void Button::OnButtonVisualRemoval( Property::Index visualIndex )
1039 // Derived Buttons can over ride this to prevent default removal.
1040 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnButtonVisualRemoval index(%d)\n", visualIndex );
1041 RemoveVisual( visualIndex );
1044 void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
1046 Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) );
1048 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetProperty index[%d]\n", index );
1054 case Toolkit::Button::Property::DISABLED:
1056 GetImplementation( button ).SetDisabled( value.Get< bool >() );
1060 case Toolkit::Button::Property::AUTO_REPEATING:
1062 GetImplementation( button ).SetAutoRepeating( value.Get< bool >() );
1066 case Toolkit::Button::Property::INITIAL_AUTO_REPEATING_DELAY:
1068 GetImplementation( button ).SetInitialAutoRepeatingDelay( value.Get< float >() );
1072 case Toolkit::Button::Property::NEXT_AUTO_REPEATING_DELAY:
1074 GetImplementation( button ).SetNextAutoRepeatingDelay( value.Get< float >() );
1078 case Toolkit::Button::Property::TOGGLABLE:
1080 GetImplementation( button ).SetTogglableButton( value.Get< bool >() );
1084 case Toolkit::Button::Property::SELECTED:
1086 GetImplementation( button ).SetSelected( value.Get< bool >() );
1090 case Toolkit::Button::Property::UNSELECTED_STATE_IMAGE: // Legacy Tizen 3.0
1092 GetImplementation( button ).CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
1095 case Toolkit::Button::Property::DISABLED_STATE_IMAGE: // Legacy Tizen 3.0
1097 GetImplementation( button ).CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL, value, DepthIndex::CONTENT );
1100 case Toolkit::Button::Property::SELECTED_STATE_IMAGE: // Legacy Tizen 3.0
1102 GetImplementation( button ).CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_VISUAL, value, DepthIndex::CONTENT );
1105 case Toolkit::Button::Property::UNSELECTED_VISUAL:
1106 case Toolkit::Button::Property::SELECTED_VISUAL:
1107 case Toolkit::Button::Property::DISABLED_SELECTED_VISUAL:
1108 case Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL:
1110 GetImplementation( button ).CreateVisualsForComponent( index, value, DepthIndex::CONTENT );
1114 case Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL:
1115 case Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL:
1116 case Toolkit::Button::Property::DISABLED_SELECTED_BACKGROUND_VISUAL:
1117 case Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL:
1119 GetImplementation( button ).CreateVisualsForComponent( index , value, DepthIndex::BACKGROUND);
1123 case Toolkit::Button::Property::UNSELECTED_COLOR:
1125 DALI_LOG_WARNING("[%s] Using deprecated Property Button::Property::UNSELECTED_COLOR instead use Button::Property::UNSELECTED_BACKGROUND_VISUAL\n", __FUNCTION__);
1126 GetImplementation( button ).SetColor( value.Get< Vector4 >(), Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL );
1130 case Toolkit::Button::Property::SELECTED_COLOR:
1132 DALI_LOG_WARNING("[%s] Using deprecated Property Button::Property::SELECTED_COLOR instead use Button::Property::SELECTED_BACKGROUND_VISUAL\n", __FUNCTION__);
1133 GetImplementation( button ).SetColor( value.Get< Vector4 >(), Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL );
1137 case Toolkit::Button::Property::LABEL_TEXT:
1139 DALI_LOG_WARNING("[%s] Using deprecated Property Button::Property::LABEL_TEXT instead use Button::Property::LABEL\n", __FUNCTION__);
1140 Property::Map labelTextProperty;
1141 labelTextProperty.Insert( "text", value.Get< std::string >() );
1142 GetImplementation( button ).SetupLabel( labelTextProperty );
1146 case Toolkit::Button::Property::LABEL:
1148 // Get a Property::Map from the property if possible.
1149 Property::Map setPropertyMap;
1150 if( value.Get( setPropertyMap ) )
1152 GetImplementation( button ).SetupLabel( setPropertyMap );
1157 case Toolkit::Button::Property::LABEL_RELATIVE_ALIGNMENT:
1159 Button::Align labelAlignment(END);
1160 Scripting::GetEnumeration< Button::Align> ( value.Get< std::string >().c_str(),
1161 ALIGNMENT_TABLE, ALIGNMENT_TABLE_COUNT,
1164 GetImplementation( button ).SetLabelAlignment( labelAlignment );
1171 Property::Value Button::GetProperty( BaseObject* object, Property::Index propertyIndex )
1173 Property::Value value;
1175 Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) );
1179 switch ( propertyIndex )
1181 case Toolkit::Button::Property::DISABLED:
1183 value = GetImplementation( button ).IsDisabled();
1187 case Toolkit::Button::Property::AUTO_REPEATING:
1189 value = GetImplementation( button ).mAutoRepeating;
1193 case Toolkit::Button::Property::INITIAL_AUTO_REPEATING_DELAY:
1195 value = GetImplementation( button ).mInitialAutoRepeatingDelay;
1199 case Toolkit::Button::Property::NEXT_AUTO_REPEATING_DELAY:
1201 value = GetImplementation( button ).mNextAutoRepeatingDelay;
1205 case Toolkit::Button::Property::TOGGLABLE:
1207 value = GetImplementation( button ).mTogglableButton;
1211 case Toolkit::Button::Property::SELECTED:
1213 value = GetImplementation( button ).IsSelected();
1217 case Toolkit::Button::Property::UNSELECTED_STATE_IMAGE:
1219 value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::Button::Property::UNSELECTED_VISUAL );
1223 case Toolkit::Button::Property::SELECTED_STATE_IMAGE:
1225 value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::Button::Property::SELECTED_VISUAL );
1229 case Toolkit::Button::Property::DISABLED_STATE_IMAGE:
1231 value = GetImplementation( button ).GetUrlForImageVisual( Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL );
1235 case Toolkit::Button::Property::UNSELECTED_COLOR:
1237 value = GetImplementation( button ).GetUnselectedColor();
1241 case Toolkit::Button::Property::SELECTED_COLOR:
1243 value = GetImplementation( button ).GetSelectedColor();
1247 case Toolkit::Button::Property::LABEL_TEXT:
1249 value = GetImplementation( button ).GetLabelText();
1253 case Toolkit::Button::Property::LABEL:
1255 Property::Map emptyMap;
1260 case Toolkit::Button::Property::LABEL_STRUT_LENGTH:
1262 value = GetImplementation( button ).GetLabelStrutLength();
1266 case Toolkit::Button::Property::LABEL_RELATIVE_ALIGNMENT:
1268 const char* alignment = Scripting::GetEnumerationName< Button::Align >( GetImplementation( button ).GetLabelAlignment(),
1269 ALIGNMENT_STRING_TABLE,
1270 ALIGNMENT_STRING_TABLE_COUNT );
1273 value = std::string( alignment );
1284 void Button::SetLabelPadding( const Padding& padding)
1286 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetLabelPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.bottom, padding.top );
1287 mLabelPadding = Padding( padding.left, padding.right, padding.bottom, padding.top );
1291 Padding Button::GetLabelPadding()
1293 return mLabelPadding;
1296 void Button::SetForegroundPadding( const Padding& padding)
1298 DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::SetForegroundPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.bottom, padding.top );
1299 mForegroundPadding = Padding( padding.left, padding.right, padding.bottom, padding.top );
1303 Padding Button::GetForegroundPadding()
1305 return mForegroundPadding;
1308 ////////////////////////////////////////////////////////////////////////
1309 // Legacy functions from Tizen 2.4 and 3.0
1311 // Legacy code needed whilst Color can be set by direct Property setting ( deprecated ) instead of setting a Visual
1312 void Button::SetColor( const Vector4& color, Property::Index visualIndex )
1314 if ( visualIndex == Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL )
1316 mSelectedColor = color;
1320 mUnselectedColor = color;
1324 map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
1325 map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
1327 CreateVisualsForComponent( visualIndex, map, DepthIndex::BACKGROUND );
1330 const Vector4 Button::GetUnselectedColor() const
1332 return mUnselectedColor;
1335 const Vector4 Button::GetSelectedColor() const
1337 return mSelectedColor;
1340 void Button::SetAnimationTime( float animationTime )
1342 // Used by depreciated API
1343 mAnimationTime = animationTime;
1346 float Button::GetAnimationTime() const
1348 // Used by depreciated API
1349 return mAnimationTime;
1352 void Button::SetLabel( Actor label )
1356 Property::Value value ="";
1357 value = label.GetProperty(Toolkit::TextLabel::Property::TEXT);
1359 SetLabelText( value.Get<std::string>() );
1363 void Button::SetUnselectedImage( const std::string& filename )
1365 if( !filename.empty() )
1367 CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
1371 void Button::SetBackgroundImage( const std::string& filename )
1373 if( !filename.empty() )
1375 CreateVisualsForComponent( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
1379 void Button::SetSelectedImage( const std::string& filename )
1381 if( !filename.empty() )
1383 CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_VISUAL, filename, DepthIndex::CONTENT );
1387 void Button::SetSelectedBackgroundImage( const std::string& filename )
1389 if( !filename.empty() )
1391 CreateVisualsForComponent( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
1395 void Button::SetDisabledBackgroundImage( const std::string& filename )
1397 if( !filename.empty() )
1399 CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_UNSELECTED_BACKGROUND_VISUAL, filename, DepthIndex::BACKGROUND );
1403 void Button::SetDisabledImage( const std::string& filename )
1405 if( !filename.empty() )
1407 CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_UNSELECTED_VISUAL, filename, DepthIndex::CONTENT );
1411 void Button::SetDisabledSelectedImage( const std::string& filename )
1413 if( !filename.empty() )
1415 CreateVisualsForComponent( Toolkit::Button::Property::DISABLED_SELECTED_VISUAL, filename, DepthIndex::CONTENT );
1419 std::string Button::GetUrlForImageVisual( Property::Index index )
1421 Toolkit::Visual::Base visual = GetVisual( index );
1426 Dali::Property::Map retreivedMap;
1427 visual.CreatePropertyMap( retreivedMap );
1428 Property::Value* value = retreivedMap.Find( Toolkit::ImageVisual::Property::URL, Property::STRING );
1431 result = value->Get<std::string>();
1438 // Below functions DEPRECATED_1_0.50 - Return empty Actors
1440 Actor Button::GetButtonImage() const
1442 DALI_LOG_WARNING("Button::GetButtonImage @DEPRECATED_1_0.50 Returning empty Actor \n");
1446 Actor Button::GetSelectedImage() const
1448 DALI_LOG_WARNING("Button::GetSelectedImage @DEPRECATED_1_0.50 Returning empty Actor \n");
1452 } // namespace Internal
1454 } // namespace Toolkit