2 * Copyright (c) 2018 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 "control-data-impl.h"
22 #include <dali-toolkit/public-api/dali-toolkit-common.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/devel-api/object/handle-devel.h>
25 #include <dali/devel-api/scripting/enum-helper.h>
26 #include <dali/devel-api/scripting/scripting.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/public-api/object/type-registry-helper.h>
33 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
34 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
35 #include <dali-toolkit/public-api/visuals/visual-properties.h>
36 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
37 #include <dali-toolkit/devel-api/controls/control-devel.h>
38 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
39 #include <dali-toolkit/devel-api/layouting/bin-layout.h>
40 #include <dali-toolkit/devel-api/layouting/layout-item.h>
41 #include <dali-toolkit/internal/styling/style-manager-impl.h>
42 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
53 extern const Dali::Scripting::StringEnum ControlStateTable[];
54 extern const unsigned int ControlStateTableCount;
57 // Not static or anonymous - shared with other translation units
58 const Scripting::StringEnum ControlStateTable[] = {
59 { "NORMAL", Toolkit::DevelControl::NORMAL },
60 { "FOCUSED", Toolkit::DevelControl::FOCUSED },
61 { "DISABLED", Toolkit::DevelControl::DISABLED },
63 const unsigned int ControlStateTableCount = sizeof( ControlStateTable ) / sizeof( ControlStateTable[0] );
70 #if defined(DEBUG_ENABLED)
71 Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
72 Debug::Filter* gLogFilterLayout = Debug::Filter::New( Debug::NoLogging, false, "LOG_LAYOUT");
77 void Remove( Dictionary<T>& keyValues, const std::string& name )
79 keyValues.Remove(name);
82 void Remove( DictionaryKeys& keys, const std::string& name )
84 DictionaryKeys::iterator iter = std::find( keys.begin(), keys.end(), name );
85 if( iter != keys.end())
91 Toolkit::Visual::Type GetVisualTypeFromMap( const Property::Map& map )
93 Property::Value* typeValue = map.Find( Toolkit::Visual::Property::TYPE, VISUAL_TYPE );
94 Toolkit::Visual::Type type = Toolkit::Visual::IMAGE;
97 Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, type );
103 * Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter
105 bool FindVisual( Property::Index targetIndex, const RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter )
107 for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
109 if ( (*iter)->index == targetIndex )
117 void FindChangableVisuals( Dictionary<Property::Map>& stateVisualsToAdd,
118 Dictionary<Property::Map>& stateVisualsToChange,
119 DictionaryKeys& stateVisualsToRemove)
121 DictionaryKeys copyOfStateVisualsToRemove = stateVisualsToRemove;
123 for( DictionaryKeys::iterator iter = copyOfStateVisualsToRemove.begin();
124 iter != copyOfStateVisualsToRemove.end(); ++iter )
126 const std::string& visualName = (*iter);
127 Property::Map* toMap = stateVisualsToAdd.Find( visualName );
130 stateVisualsToChange.Add( visualName, *toMap );
131 stateVisualsToAdd.Remove( visualName );
132 Remove( stateVisualsToRemove, visualName );
137 Toolkit::Visual::Base GetVisualByName(
138 const RegisteredVisualContainer& visuals,
139 const std::string& visualName )
141 Toolkit::Visual::Base visualHandle;
143 RegisteredVisualContainer::Iterator iter;
144 for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
146 Toolkit::Visual::Base visual = (*iter)->visual;
147 if( visual && visual.GetName() == visualName )
149 visualHandle = visual;
157 * Move visual from source to destination container
159 void MoveVisual( RegisteredVisualContainer::Iterator sourceIter, RegisteredVisualContainer& source, RegisteredVisualContainer& destination )
161 Toolkit::Visual::Base visual = (*sourceIter)->visual;
164 RegisteredVisual* rv = source.Release( sourceIter );
165 destination.PushBack( rv );
170 * Performs actions as requested using the action name.
171 * @param[in] object The object on which to perform the action.
172 * @param[in] actionName The action to perform.
173 * @param[in] attributes The attributes with which to perfrom this action.
174 * @return true if action has been accepted by this control
176 const char* ACTION_ACCESSIBILITY_ACTIVATED = "accessibilityActivated";
177 static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
181 if( object && ( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ) )
183 Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
186 // if cast succeeds there is an implementation so no need to check
187 ret = Internal::GetImplementation( control ).OnAccessibilityActivated();
195 * Connects a callback function with the object's signals.
196 * @param[in] object The object providing the signal.
197 * @param[in] tracker Used to disconnect the signal.
198 * @param[in] signalName The signal to connect to.
199 * @param[in] functor A newly allocated FunctorDelegate.
200 * @return True if the signal was connected.
201 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
203 const char* SIGNAL_KEY_EVENT = "keyEvent";
204 const char* SIGNAL_KEY_INPUT_FOCUS_GAINED = "keyInputFocusGained";
205 const char* SIGNAL_KEY_INPUT_FOCUS_LOST = "keyInputFocusLost";
206 const char* SIGNAL_TAPPED = "tapped";
207 const char* SIGNAL_PANNED = "panned";
208 const char* SIGNAL_PINCHED = "pinched";
209 const char* SIGNAL_LONG_PRESSED = "longPressed";
210 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
212 Dali::BaseHandle handle( object );
214 bool connected( false );
215 Toolkit::Control control = Toolkit::Control::DownCast( handle );
218 Internal::Control& controlImpl( Internal::GetImplementation( control ) );
221 if ( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
223 controlImpl.KeyEventSignal().Connect( tracker, functor );
225 else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_GAINED ) )
227 controlImpl.KeyInputFocusGainedSignal().Connect( tracker, functor );
229 else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_LOST ) )
231 controlImpl.KeyInputFocusLostSignal().Connect( tracker, functor );
233 else if( 0 == strcmp( signalName.c_str(), SIGNAL_TAPPED ) )
235 controlImpl.EnableGestureDetection( Gesture::Tap );
236 controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor );
238 else if( 0 == strcmp( signalName.c_str(), SIGNAL_PANNED ) )
240 controlImpl.EnableGestureDetection( Gesture::Pan );
241 controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor );
243 else if( 0 == strcmp( signalName.c_str(), SIGNAL_PINCHED ) )
245 controlImpl.EnableGestureDetection( Gesture::Pinch );
246 controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor );
248 else if( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESSED ) )
250 controlImpl.EnableGestureDetection( Gesture::LongPress );
251 controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor );
258 * Creates control through type registry
262 return Internal::Control::New();
264 // Setup signals and actions using the type-registry.
265 DALI_TYPE_REGISTRATION_BEGIN( Control, CustomActor, Create );
267 // Note: Properties are registered separately below.
269 SignalConnectorType registerSignal1( typeRegistration, SIGNAL_KEY_EVENT, &DoConnectSignal );
270 SignalConnectorType registerSignal2( typeRegistration, SIGNAL_KEY_INPUT_FOCUS_GAINED, &DoConnectSignal );
271 SignalConnectorType registerSignal3( typeRegistration, SIGNAL_KEY_INPUT_FOCUS_LOST, &DoConnectSignal );
272 SignalConnectorType registerSignal4( typeRegistration, SIGNAL_TAPPED, &DoConnectSignal );
273 SignalConnectorType registerSignal5( typeRegistration, SIGNAL_PANNED, &DoConnectSignal );
274 SignalConnectorType registerSignal6( typeRegistration, SIGNAL_PINCHED, &DoConnectSignal );
275 SignalConnectorType registerSignal7( typeRegistration, SIGNAL_LONG_PRESSED, &DoConnectSignal );
277 TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &DoAction );
279 DALI_TYPE_REGISTRATION_END()
282 * @brief Iterate through given container and setOffStage any visual found
284 * @param[in] container Container of visuals
285 * @param[in] parent Parent actor to remove visuals from
287 void SetVisualsOffStage( const RegisteredVisualContainer& container, Actor parent )
289 for( auto iter = container.Begin(), end = container.End() ; iter!= end; iter++)
291 if( (*iter)->visual )
293 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::SetOffStage Setting visual(%d) off stage\n", (*iter)->index );
294 Toolkit::GetImplementation((*iter)->visual).SetOffStage( parent );
299 } // unnamed namespace
302 // Properties registered without macro to use specific member variables.
303 const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
304 const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "backgroundColor", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
305 const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
306 const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
307 const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
308 const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "margin", Toolkit::Control::Property::MARGIN, Property::EXTENTS, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
309 const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "padding", Toolkit::Control::Property::PADDING, Property::EXTENTS, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
310 const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
311 const PropertyRegistration Control::Impl::PROPERTY_9( typeRegistration, "state", Toolkit::DevelControl::Property::STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
312 const PropertyRegistration Control::Impl::PROPERTY_10( typeRegistration, "subState", Toolkit::DevelControl::Property::SUB_STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
313 const PropertyRegistration Control::Impl::PROPERTY_11( typeRegistration, "leftFocusableActorId", Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
314 const PropertyRegistration Control::Impl::PROPERTY_12( typeRegistration, "rightFocusableActorId", Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID,Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
315 const PropertyRegistration Control::Impl::PROPERTY_13( typeRegistration, "upFocusableActorId", Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
316 const PropertyRegistration Control::Impl::PROPERTY_14( typeRegistration, "downFocusableActorId", Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
319 Control::Impl::Impl( Control& controlImpl )
320 : mControlImpl( controlImpl ),
321 mState( Toolkit::DevelControl::NORMAL ),
324 mLeftFocusableActorId( -1 ),
325 mRightFocusableActorId( -1 ),
326 mUpFocusableActorId( -1 ),
327 mDownFocusableActorId( -1 ),
329 mBackgroundColor(Color::TRANSPARENT),
330 mStartingPinchScale( NULL ),
331 mMargin( 0, 0, 0, 0 ),
332 mPadding( 0, 0, 0, 0 ),
334 mKeyInputFocusGainedSignal(),
335 mKeyInputFocusLostSignal(),
336 mResourceReadySignal(),
337 mPinchGestureDetector(),
338 mPanGestureDetector(),
339 mTapGestureDetector(),
340 mLongPressGestureDetector(),
342 mInputMethodContext(),
343 mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
344 mIsKeyboardNavigationSupported( false ),
345 mIsKeyboardFocusGroup( false ),
346 mIsLayoutingRequired( false )
350 Control::Impl::~Impl()
352 // All gesture detectors will be destroyed so no need to disconnect.
353 delete mStartingPinchScale;
356 Control::Impl& Control::Impl::Get( Internal::Control& internalControl )
358 return *internalControl.mImpl;
361 const Control::Impl& Control::Impl::Get( const Internal::Control& internalControl )
363 return *internalControl.mImpl;
366 // Gesture Detection Methods
367 void Control::Impl::PinchDetected(Actor actor, const PinchGesture& pinch)
369 mControlImpl.OnPinch(pinch);
372 void Control::Impl::PanDetected(Actor actor, const PanGesture& pan)
374 mControlImpl.OnPan(pan);
377 void Control::Impl::TapDetected(Actor actor, const TapGesture& tap)
379 mControlImpl.OnTap(tap);
382 void Control::Impl::LongPressDetected(Actor actor, const LongPressGesture& longPress)
384 mControlImpl.OnLongPress(longPress);
387 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
389 RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::NOT_SET );
392 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
394 RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::SET, depthIndex );
397 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
399 RegisterVisual( index, visual, ( enabled ? VisualState::ENABLED : VisualState::DISABLED ), DepthIndexValue::NOT_SET );
402 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
404 RegisterVisual( index, visual, ( enabled ? VisualState::ENABLED : VisualState::DISABLED ), DepthIndexValue::SET, depthIndex );
407 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, VisualState::Type enabled, DepthIndexValue::Type depthIndexValueSet, int depthIndex )
409 DALI_LOG_INFO( gLogFilter, Debug::Concise, "RegisterVisual:%d \n", index );
411 bool visualReplaced ( false );
412 Actor self = mControlImpl.Self();
414 // Set the depth index, if not set by caller this will be either the current visual depth, max depth of all visuals
416 int requiredDepthIndex = visual.GetDepthIndex();
418 if( depthIndexValueSet == DepthIndexValue::SET )
420 requiredDepthIndex = depthIndex;
423 // Visual replacement, existing visual should only be removed from stage when replacement ready.
424 if( !mVisuals.Empty() )
426 RegisteredVisualContainer::Iterator registeredVisualsiter;
427 // Check if visual (index) is already registered, this is the current visual.
428 if( FindVisual( index, mVisuals, registeredVisualsiter ) )
430 Toolkit::Visual::Base& currentRegisteredVisual = (*registeredVisualsiter)->visual;
431 if( currentRegisteredVisual )
433 // Store current visual depth index as may need to set the replacement visual to same depth
434 const int currentDepthIndex = (*registeredVisualsiter)->visual.GetDepthIndex();
436 // No longer required to know if the replaced visual's resources are ready
437 StopObservingVisual( currentRegisteredVisual );
439 // If control staged and visual enabled then visuals will be swapped once ready
440 if( self.OnStage() && enabled )
442 // Check if visual is currently in the process of being replaced ( is in removal container )
443 RegisteredVisualContainer::Iterator visualQueuedForRemoval;
444 if ( FindVisual( index, mRemoveVisuals, visualQueuedForRemoval ) )
446 // Visual with same index is already in removal container so current visual pending
447 // Only the the last requested visual will be displayed so remove current visual which is staged but not ready.
448 Toolkit::GetImplementation( currentRegisteredVisual ).SetOffStage( self );
449 mVisuals.Erase( registeredVisualsiter );
453 // current visual not already in removal container so add now.
454 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "RegisterVisual Move current registered visual to removal Queue: %d \n", index );
455 MoveVisual( registeredVisualsiter, mVisuals, mRemoveVisuals );
460 // Control not staged or visual disabled so can just erase from registered visuals and new visual will be added later.
461 mVisuals.Erase( registeredVisualsiter );
464 // If we've not set the depth-index value and the new visual does not have a depth index applied to it, then use the previously set depth-index for this index
465 if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
466 ( visual.GetDepthIndex() == 0 ) )
468 requiredDepthIndex = currentDepthIndex;
472 visualReplaced = true;
476 // If not set, set the name of the visual to the same name as the control's property.
477 // ( If the control has been type registered )
478 if( visual.GetName().empty() )
482 std::string visualName = self.GetPropertyName( index );
483 if( !visualName.empty() )
485 DALI_LOG_INFO( gLogFilter, Debug::Concise, "Setting visual name for property %d to %s\n",
486 index, visualName.c_str() );
487 visual.SetName( visualName );
490 catch( Dali::DaliException e )
492 DALI_LOG_WARNING( "Attempting to register visual without a registered property, index: %d\n", index );
496 if( !visualReplaced ) // New registration entry
498 // If we've not set the depth-index value, we have more than one visual and the visual does not have a depth index, then set it to be the highest
499 if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
500 ( mVisuals.Size() > 0 ) &&
501 ( visual.GetDepthIndex() == 0 ) )
503 int maxDepthIndex = std::numeric_limits< int >::min();
505 RegisteredVisualContainer::ConstIterator iter;
506 const RegisteredVisualContainer::ConstIterator endIter = mVisuals.End();
507 for ( iter = mVisuals.Begin(); iter != endIter; iter++ )
509 const int visualDepthIndex = (*iter)->visual.GetDepthIndex();
510 if ( visualDepthIndex > maxDepthIndex )
512 maxDepthIndex = visualDepthIndex;
515 ++maxDepthIndex; // Add one to the current maximum depth index so that our added visual appears on top
516 requiredDepthIndex = std::max( 0, maxDepthIndex ); // Start at zero if maxDepth index belongs to a background
522 // Set determined depth index
523 visual.SetDepthIndex( requiredDepthIndex );
525 // Monitor when the visual resources are ready
526 StartObservingVisual( visual );
528 DALI_LOG_INFO( gLogFilter, Debug::Concise, "New Visual registration index[%d] depth[%d]\n", index, requiredDepthIndex );
529 RegisteredVisual* newRegisteredVisual = new RegisteredVisual( index, visual,
530 ( enabled == VisualState::ENABLED ? true : false ),
531 ( visualReplaced && enabled ) ) ;
532 mVisuals.PushBack( newRegisteredVisual );
534 Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
535 // Put on stage if enabled and the control is already on the stage
536 if( ( enabled == VisualState::ENABLED ) && self.OnStage() )
538 visualImpl.SetOnStage( self );
540 else if( visualImpl.IsResourceReady() ) // When not being staged, check if visual already 'ResourceReady' before it was Registered. ( Resource may have been loaded already )
542 ResourceReady( visualImpl );
547 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n", visual.GetName().c_str(), index, enabled?"true":"false" );
550 void Control::Impl::UnregisterVisual( Property::Index index )
552 RegisteredVisualContainer::Iterator iter;
553 if ( FindVisual( index, mVisuals, iter ) )
555 // stop observing visual
556 StopObservingVisual( (*iter)->visual );
558 Actor self( mControlImpl.Self() );
559 Toolkit::GetImplementation((*iter)->visual).SetOffStage( self );
560 (*iter)->visual.Reset();
561 mVisuals.Erase( iter );
564 if( FindVisual( index, mRemoveVisuals, iter ) )
566 Actor self( mControlImpl.Self() );
567 Toolkit::GetImplementation( (*iter)->visual ).SetOffStage( self );
568 (*iter)->pending = false;
569 (*iter)->visual.Reset();
570 mRemoveVisuals.Erase( iter );
574 Toolkit::Visual::Base Control::Impl::GetVisual( Property::Index index ) const
576 RegisteredVisualContainer::Iterator iter;
577 if ( FindVisual( index, mVisuals, iter ) )
579 return (*iter)->visual;
582 return Toolkit::Visual::Base();
585 void Control::Impl::EnableVisual( Property::Index index, bool enable )
587 DALI_LOG_INFO( gLogFilter, Debug::General, "Control::EnableVisual(%d, %s)\n", index, enable?"T":"F");
589 RegisteredVisualContainer::Iterator iter;
590 if ( FindVisual( index, mVisuals, iter ) )
592 if ( (*iter)->enabled == enable )
594 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual %s(%d) already %s\n", (*iter)->visual.GetName().c_str(), index, enable?"enabled":"disabled");
598 (*iter)->enabled = enable;
599 Actor parentActor = mControlImpl.Self();
600 if ( mControlImpl.Self().OnStage() ) // If control not on Stage then Visual will be added when StageConnection is called.
604 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) on stage \n", (*iter)->visual.GetName().c_str(), index );
605 Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor );
609 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) off stage \n", (*iter)->visual.GetName().c_str(), index );
610 Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged.
616 DALI_LOG_WARNING( "Control::EnableVisual(%d, %s) FAILED - NO SUCH VISUAL\n", index, enable?"T":"F" );
620 bool Control::Impl::IsVisualEnabled( Property::Index index ) const
622 RegisteredVisualContainer::Iterator iter;
623 if ( FindVisual( index, mVisuals, iter ) )
625 return (*iter)->enabled;
630 void Control::Impl::StopObservingVisual( Toolkit::Visual::Base& visual )
632 Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
634 // Stop observing the visual
635 visualImpl.RemoveResourceObserver( *this );
638 void Control::Impl::StartObservingVisual( Toolkit::Visual::Base& visual)
640 Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
642 // start observing the visual for resource ready
643 visualImpl.AddResourceObserver( *this );
646 // Called by a Visual when it's resource is ready
647 void Control::Impl::ResourceReady( Visual::Base& object)
649 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::Impl::ResourceReady() replacements pending[%d]\n", mRemoveVisuals.Count() );
651 Actor self = mControlImpl.Self();
653 // A resource is ready, find resource in the registered visuals container and get its index
654 for( auto registeredIter = mVisuals.Begin(), end = mVisuals.End(); registeredIter != end; ++registeredIter )
656 Internal::Visual::Base& registeredVisualImpl = Toolkit::GetImplementation( (*registeredIter)->visual );
658 if( &object == ®isteredVisualImpl )
660 RegisteredVisualContainer::Iterator visualToRemoveIter;
661 // Find visual with the same index in the removal container
662 // Set if off stage as it's replacement is now ready.
663 // Remove if from removal list as now removed from stage.
664 // Set Pending flag on the ready visual to false as now ready.
665 if( FindVisual( (*registeredIter)->index, mRemoveVisuals, visualToRemoveIter ) )
667 (*registeredIter)->pending = false;
668 Toolkit::GetImplementation( (*visualToRemoveIter)->visual ).SetOffStage( self );
669 mRemoveVisuals.Erase( visualToRemoveIter );
675 // A visual is ready so control may need relayouting if staged
676 if ( self.OnStage() )
678 mControlImpl.RelayoutRequest();
681 // Emit signal if all enabled visuals registered by the control are ready.
682 if( IsResourceReady() )
684 Dali::Toolkit::Control handle( mControlImpl.GetOwner() );
685 mResourceReadySignal.Emit( handle );
689 bool Control::Impl::IsResourceReady() const
691 // Iterate through and check all the enabled visuals are ready
692 for( auto visualIter = mVisuals.Begin();
693 visualIter != mVisuals.End(); ++visualIter )
695 const Toolkit::Visual::Base visual = (*visualIter)->visual;
696 const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
698 // one of the enabled visuals is not ready
699 if( !visualImpl.IsResourceReady() && (*visualIter)->enabled )
707 Toolkit::Visual::ResourceStatus Control::Impl::GetVisualResourceStatus( Property::Index index ) const
709 RegisteredVisualContainer::Iterator iter;
710 if ( FindVisual( index, mVisuals, iter ) )
712 const Toolkit::Visual::Base visual = (*iter)->visual;
713 const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
714 return visualImpl.GetResourceStatus( );
717 return Toolkit::Visual::ResourceStatus::PREPARING;
722 void Control::Impl::AddTransitions( Dali::Animation& animation,
723 const Toolkit::TransitionData& handle,
724 bool createAnimation )
726 // Setup a Transition from TransitionData.
727 const Internal::TransitionData& transitionData = Toolkit::GetImplementation( handle );
728 TransitionData::Iterator end = transitionData.End();
729 for( TransitionData::Iterator iter = transitionData.Begin() ;
730 iter != end; ++iter )
732 TransitionData::Animator* animator = (*iter);
734 Toolkit::Visual::Base visual = GetVisualByName( mVisuals, animator->objectName );
738 #if defined(DEBUG_ENABLED)
739 Dali::TypeInfo typeInfo;
740 ControlWrapper* controlWrapperImpl = dynamic_cast<ControlWrapper*>(&mControlImpl);
741 if( controlWrapperImpl )
743 typeInfo = controlWrapperImpl->GetTypeInfo();
746 DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Found %s visual for %s\n",
747 visual.GetName().c_str(), typeInfo?typeInfo.GetName().c_str():"Unknown" );
749 Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
750 visualImpl.AnimateProperty( animation, *animator );
754 DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Could not find visual. Trying actors");
755 // Otherwise, try any actor children of control (Including the control)
756 Actor child = mControlImpl.Self().FindChildByName( animator->objectName );
759 Property::Index propertyIndex = DevelHandle::GetPropertyIndex( child, animator->propertyKey );
760 if( propertyIndex != Property::INVALID_INDEX )
762 if( animator->animate == false )
764 if( animator->targetValue.GetType() != Property::NONE )
766 child.SetProperty( propertyIndex, animator->targetValue );
769 else // animate the property
771 if( animator->initialValue.GetType() != Property::NONE )
773 child.SetProperty( propertyIndex, animator->initialValue );
776 if( createAnimation && !animation )
778 animation = Dali::Animation::New( 0.1f );
781 animation.AnimateTo( Property( child, propertyIndex ),
782 animator->targetValue,
783 animator->alphaFunction,
784 TimePeriod( animator->timePeriodDelay,
785 animator->timePeriodDuration ) );
793 Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData& transitionData )
795 Dali::Animation transition;
797 if( transitionData.Count() > 0 )
799 AddTransitions( transition, transitionData, true );
806 void Control::Impl::DoAction( Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes )
808 RegisteredVisualContainer::Iterator iter;
809 if ( FindVisual( visualIndex, mVisuals, iter ) )
811 Toolkit::GetImplementation((*iter)->visual).DoAction( actionId, attributes );
815 void Control::Impl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
817 Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
821 Control& controlImpl( GetImplementation( control ) );
825 case Toolkit::Control::Property::STYLE_NAME:
827 controlImpl.SetStyleName( value.Get< std::string >() );
831 case Toolkit::DevelControl::Property::STATE:
833 bool withTransitions=true;
834 const Property::Value* valuePtr=&value;
835 Property::Map* map = value.GetMap();
838 Property::Value* value2 = map->Find("withTransitions");
841 withTransitions = value2->Get<bool>();
844 valuePtr = map->Find("state");
849 Toolkit::DevelControl::State state( controlImpl.mImpl->mState );
850 if( Scripting::GetEnumerationProperty< Toolkit::DevelControl::State >( *valuePtr, ControlStateTable, ControlStateTableCount, state ) )
852 controlImpl.mImpl->SetState( state, withTransitions );
858 case Toolkit::DevelControl::Property::SUB_STATE:
860 std::string subState;
861 if( value.Get( subState ) )
863 controlImpl.mImpl->SetSubState( subState );
868 case Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID:
871 if( value.Get( focusId ) )
873 controlImpl.mImpl->mLeftFocusableActorId = focusId;
878 case Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID:
881 if( value.Get( focusId ) )
883 controlImpl.mImpl->mRightFocusableActorId = focusId;
888 case Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID:
891 if( value.Get( focusId ) )
893 controlImpl.mImpl->mUpFocusableActorId = focusId;
898 case Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID:
901 if( value.Get( focusId ) )
903 controlImpl.mImpl->mDownFocusableActorId = focusId;
908 case Toolkit::Control::Property::BACKGROUND_COLOR:
910 DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
911 controlImpl.SetBackgroundColor( value.Get< Vector4 >() );
915 case Toolkit::Control::Property::BACKGROUND_IMAGE:
917 DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
918 Image image = Scripting::NewImage( value );
921 controlImpl.SetBackgroundImage( image );
925 // An empty image means the background is no longer required
926 controlImpl.ClearBackground();
931 case Toolkit::Control::Property::KEY_INPUT_FOCUS:
933 if ( value.Get< bool >() )
935 controlImpl.SetKeyInputFocus();
939 controlImpl.ClearKeyInputFocus();
944 case Toolkit::Control::Property::BACKGROUND:
948 const Property::Map* map = value.GetMap();
949 if( map && !map->Empty() )
951 controlImpl.SetBackground( *map );
953 else if( value.Get( url ) )
955 // don't know the size to load
956 Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( url, ImageDimensions() );
959 controlImpl.mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
962 else if( value.Get( color ) )
964 controlImpl.SetBackgroundColor(color);
968 // The background is an empty property map, so we should clear the background
969 controlImpl.ClearBackground();
974 case Toolkit::Control::Property::MARGIN:
977 if( value.Get( margin ) )
979 controlImpl.mImpl->SetMargin( margin );
984 case Toolkit::Control::Property::PADDING:
987 if( value.Get( padding ) )
989 controlImpl.mImpl->SetPadding( padding );
994 case Toolkit::DevelControl::Property::TOOLTIP:
996 TooltipPtr& tooltipPtr = controlImpl.mImpl->mTooltip;
999 tooltipPtr = Tooltip::New( control );
1001 tooltipPtr->SetProperties( value );
1009 Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index index )
1011 Property::Value value;
1013 Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
1017 Control& controlImpl( GetImplementation( control ) );
1021 case Toolkit::Control::Property::STYLE_NAME:
1023 value = controlImpl.GetStyleName();
1027 case Toolkit::DevelControl::Property::STATE:
1029 value = controlImpl.mImpl->mState;
1033 case Toolkit::DevelControl::Property::SUB_STATE:
1035 value = controlImpl.mImpl->mSubStateName;
1039 case Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID:
1041 value = controlImpl.mImpl->mLeftFocusableActorId;
1045 case Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID:
1047 value = controlImpl.mImpl->mRightFocusableActorId;
1051 case Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID:
1053 value = controlImpl.mImpl->mUpFocusableActorId;
1057 case Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID:
1059 value = controlImpl.mImpl->mDownFocusableActorId;
1063 case Toolkit::Control::Property::BACKGROUND_COLOR:
1065 DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
1066 value = controlImpl.GetBackgroundColor();
1070 case Toolkit::Control::Property::BACKGROUND_IMAGE:
1072 DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
1074 Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND );
1077 visual.CreatePropertyMap( map );
1083 case Toolkit::Control::Property::KEY_INPUT_FOCUS:
1085 value = controlImpl.HasKeyInputFocus();
1089 case Toolkit::Control::Property::BACKGROUND:
1092 Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND );
1095 visual.CreatePropertyMap( map );
1102 case Toolkit::Control::Property::MARGIN:
1104 value = controlImpl.mImpl->GetMargin();
1108 case Toolkit::Control::Property::PADDING:
1110 value = controlImpl.mImpl->GetPadding();
1114 case Toolkit::DevelControl::Property::TOOLTIP:
1117 if( controlImpl.mImpl->mTooltip )
1119 controlImpl.mImpl->mTooltip->CreatePropertyMap( map );
1131 void Control::Impl::CopyInstancedProperties( RegisteredVisualContainer& visuals, Dictionary<Property::Map>& instancedProperties )
1133 for(RegisteredVisualContainer::Iterator iter = visuals.Begin(); iter!= visuals.End(); iter++)
1135 if( (*iter)->visual )
1137 Property::Map instanceMap;
1138 Toolkit::GetImplementation((*iter)->visual).CreateInstancePropertyMap(instanceMap);
1139 instancedProperties.Add( (*iter)->visual.GetName(), instanceMap );
1145 void Control::Impl::RemoveVisual( RegisteredVisualContainer& visuals, const std::string& visualName )
1147 Actor self( mControlImpl.Self() );
1149 for ( RegisteredVisualContainer::Iterator visualIter = visuals.Begin();
1150 visualIter != visuals.End(); ++visualIter )
1152 Toolkit::Visual::Base visual = (*visualIter)->visual;
1153 if( visual && visual.GetName() == visualName )
1155 Toolkit::GetImplementation(visual).SetOffStage( self );
1156 (*visualIter)->visual.Reset();
1157 visuals.Erase( visualIter );
1163 void Control::Impl::RemoveVisuals( RegisteredVisualContainer& visuals, DictionaryKeys& removeVisuals )
1165 Actor self( mControlImpl.Self() );
1166 for( DictionaryKeys::iterator iter = removeVisuals.begin(); iter != removeVisuals.end(); ++iter )
1168 const std::string visualName = *iter;
1169 RemoveVisual( visuals, visualName );
1173 void Control::Impl::RecreateChangedVisuals( Dictionary<Property::Map>& stateVisualsToChange,
1174 Dictionary<Property::Map>& instancedProperties )
1176 Dali::CustomActor handle( mControlImpl.GetOwner() );
1177 for( Dictionary<Property::Map>::iterator iter = stateVisualsToChange.Begin();
1178 iter != stateVisualsToChange.End(); ++iter )
1180 const std::string& visualName = (*iter).key;
1181 const Property::Map& toMap = (*iter).entry;
1183 // is it a candidate for re-creation?
1184 bool recreate = false;
1186 Toolkit::Visual::Base visual = GetVisualByName( mVisuals, visualName );
1189 Property::Map fromMap;
1190 visual.CreatePropertyMap( fromMap );
1192 Toolkit::Visual::Type fromType = GetVisualTypeFromMap( fromMap );
1193 Toolkit::Visual::Type toType = GetVisualTypeFromMap( toMap );
1195 if( fromType != toType )
1201 if( fromType == Toolkit::Visual::IMAGE || fromType == Toolkit::Visual::N_PATCH
1202 || fromType == Toolkit::Visual::SVG || fromType == Toolkit::Visual::ANIMATED_IMAGE )
1204 Property::Value* fromUrl = fromMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
1205 Property::Value* toUrl = toMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
1207 if( fromUrl && toUrl )
1209 std::string fromUrlString;
1210 std::string toUrlString;
1211 fromUrl->Get(fromUrlString);
1212 toUrl->Get(toUrlString);
1214 if( fromUrlString != toUrlString )
1222 const Property::Map* instancedMap = instancedProperties.FindConst( visualName );
1223 if( recreate || instancedMap )
1225 RemoveVisual( mVisuals, visualName );
1226 Style::ApplyVisual( handle, visualName, toMap, instancedMap );
1230 // @todo check to see if we can apply toMap without recreating the visual
1231 // e.g. by setting only animatable properties
1232 // For now, recreate all visuals, but merge in instance data.
1233 RemoveVisual( mVisuals, visualName );
1234 Style::ApplyVisual( handle, visualName, toMap, instancedMap );
1240 void Control::Impl::ReplaceStateVisualsAndProperties( const StylePtr oldState, const StylePtr newState, const std::string& subState )
1242 // Collect all old visual names
1243 DictionaryKeys stateVisualsToRemove;
1246 oldState->visuals.GetKeys( stateVisualsToRemove );
1247 if( ! subState.empty() )
1249 const StylePtr* oldSubState = oldState->subStates.FindConst(subState);
1252 DictionaryKeys subStateVisualsToRemove;
1253 (*oldSubState)->visuals.GetKeys( subStateVisualsToRemove );
1254 Merge( stateVisualsToRemove, subStateVisualsToRemove );
1259 // Collect all new visual properties
1260 Dictionary<Property::Map> stateVisualsToAdd;
1263 stateVisualsToAdd = newState->visuals;
1264 if( ! subState.empty() )
1266 const StylePtr* newSubState = newState->subStates.FindConst(subState);
1269 stateVisualsToAdd.Merge( (*newSubState)->visuals );
1274 // If a name is in both add/remove, move it to change list.
1275 Dictionary<Property::Map> stateVisualsToChange;
1276 FindChangableVisuals( stateVisualsToAdd, stateVisualsToChange, stateVisualsToRemove);
1278 // Copy instanced properties (e.g. text label) of current visuals
1279 Dictionary<Property::Map> instancedProperties;
1280 CopyInstancedProperties( mVisuals, instancedProperties );
1282 // For each visual in remove list, remove from mVisuals
1283 RemoveVisuals( mVisuals, stateVisualsToRemove );
1285 // For each visual in add list, create and add to mVisuals
1286 Dali::CustomActor handle( mControlImpl.GetOwner() );
1287 Style::ApplyVisuals( handle, stateVisualsToAdd, instancedProperties );
1289 // For each visual in change list, if it requires a new visual,
1290 // remove old visual, create and add to mVisuals
1291 RecreateChangedVisuals( stateVisualsToChange, instancedProperties );
1294 void Control::Impl::SetState( DevelControl::State newState, bool withTransitions )
1296 DevelControl::State oldState = mState;
1297 Dali::CustomActor handle( mControlImpl.GetOwner() );
1298 DALI_LOG_INFO(gLogFilter, Debug::Concise, "Control::Impl::SetState: %s\n",
1299 (mState == DevelControl::NORMAL ? "NORMAL" :(
1300 mState == DevelControl::FOCUSED ?"FOCUSED" : (
1301 mState == DevelControl::DISABLED?"DISABLED":"NONE" ))));
1303 if( mState != newState )
1305 // If mState was Disabled, and new state is Focused, should probably
1306 // store that fact, e.g. in another property that FocusManager can access.
1309 // Trigger state change and transitions
1310 // Apply new style, if stylemanager is available
1311 Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
1314 const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
1318 std::string oldStateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( oldState, ControlStateTable, ControlStateTableCount );
1319 std::string newStateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( newState, ControlStateTable, ControlStateTableCount );
1321 const StylePtr* newStateStyle = stylePtr->subStates.Find( newStateName );
1322 const StylePtr* oldStateStyle = stylePtr->subStates.Find( oldStateName );
1323 if( oldStateStyle && newStateStyle )
1325 // Only change if both state styles exist
1326 ReplaceStateVisualsAndProperties( *oldStateStyle, *newStateStyle, mSubStateName );
1333 void Control::Impl::SetSubState( const std::string& subStateName, bool withTransitions )
1335 if( mSubStateName != subStateName )
1337 // Get existing sub-state visuals, and unregister them
1338 Dali::CustomActor handle( mControlImpl.GetOwner() );
1340 Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
1343 const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
1347 std::string stateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( mState, ControlStateTable, ControlStateTableCount );
1349 const StylePtr* state = stylePtr->subStates.Find( stateName );
1352 StylePtr stateStyle(*state);
1354 const StylePtr* newStateStyle = stateStyle->subStates.Find( subStateName );
1355 const StylePtr* oldStateStyle = stateStyle->subStates.Find( mSubStateName );
1356 if( oldStateStyle && newStateStyle )
1359 ReplaceStateVisualsAndProperties( *oldStateStyle, *newStateStyle, empty );
1365 mSubStateName = subStateName;
1369 void Control::Impl::OnStageDisconnection()
1371 Actor self = mControlImpl.Self();
1373 // Any visuals set for replacement but not yet ready should still be registered.
1374 // Reason: If a request was made to register a new visual but the control removed from stage before visual was ready
1375 // then when this control appears back on stage it should use that new visual.
1377 // Iterate through all registered visuals and set off stage
1378 SetVisualsOffStage( mVisuals, self );
1380 // Visuals pending replacement can now be taken out of the removal list and set off stage
1381 // Iterate through all replacement visuals and add to a move queue then set off stage
1382 for( auto removalIter = mRemoveVisuals.Begin(), end = mRemoveVisuals.End(); removalIter != end; removalIter++ )
1384 Toolkit::GetImplementation((*removalIter)->visual).SetOffStage( self );
1387 for( auto replacedIter = mVisuals.Begin(), end = mVisuals.End(); replacedIter != end; replacedIter++ )
1389 (*replacedIter)->pending = false;
1392 mRemoveVisuals.Clear();
1395 void Control::Impl::SetMargin( Extents margin )
1397 mControlImpl.mImpl->mMargin = margin;
1399 // Trigger a size negotiation request that may be needed when setting a margin.
1400 mControlImpl.RelayoutRequest();
1403 Extents Control::Impl::GetMargin() const
1405 return mControlImpl.mImpl->mMargin;
1408 void Control::Impl::SetPadding( Extents padding )
1410 mControlImpl.mImpl->mPadding = padding;
1412 // Trigger a size negotiation request that may be needed when setting a padding.
1413 mControlImpl.RelayoutRequest();
1416 Extents Control::Impl::GetPadding() const
1418 return mControlImpl.mImpl->mPadding;
1421 void Control::Impl::SetInputMethodContext( InputMethodContext& inputMethodContext )
1423 mInputMethodContext = inputMethodContext;
1426 bool Control::Impl::FilterKeyEvent( const KeyEvent& event )
1428 bool consumed ( false );
1430 if ( mInputMethodContext )
1432 consumed = mInputMethodContext.FilterEventKey( event );
1437 Toolkit::Internal::LayoutItemPtr Control::Impl::GetLayout() const
1442 void Control::Impl::SetLayout( Toolkit::Internal::LayoutItem& layout )
1444 DALI_LOG_INFO( gLogFilterLayout, Debug::Verbose, "Control::SetLayout control:%s existing layout:%s\n",
1445 mControlImpl.Self().GetName().c_str(),
1446 mLayout?"true":"false" );
1450 mLayout->Unparent();
1455 auto controlHandle = Toolkit::Control::DownCast( mControlImpl.Self() ); // Get a handle of this control implementation without copying internals.
1456 mLayout->Initialize( controlHandle, controlHandle.GetTypeName() ); // LayoutGroup takes ownership of existing children
1459 void Control::Impl::RemoveLayout()
1461 DALI_LOG_INFO( gLogFilterLayout, Debug::Verbose, "Control::Impl::RemoveLayout\n");
1463 Toolkit::BinLayout binLayout = Toolkit::BinLayout::New();
1465 mControlImpl.mImpl->SetLayout( GetImplementation( binLayout ) ) ;
1468 void Control::Impl::SetLayoutingRequired( bool layoutingRequired )
1470 mControlImpl.mImpl->mIsLayoutingRequired = layoutingRequired;
1473 bool Control::Impl::IsLayoutingRequired()
1475 return mControlImpl.mImpl->mIsLayoutingRequired;
1478 } // namespace Internal
1480 } // namespace Toolkit