[Tizen] Add AutofillContainer class and autofill implementation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / control / control-data-impl.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include "control-data-impl.h"
20
21 // EXTERNAL INCLUDES
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>
29 #include <dali/integration-api/adaptor-framework/adaptor.h>
30 #include <dali/devel-api/common/stage.h>
31 #include <dali-toolkit/public-api/controls/control.h>
32 #include <dali/public-api/object/object-registry.h>
33 #include <dali/devel-api/adaptor-framework/accessibility.h>
34 #include <dali-toolkit/public-api/controls/control-impl.h>
35 #include <dali/devel-api/actors/actor-devel.h>
36 #include <cstring>
37 #include <limits>
38
39 // INTERNAL INCLUDES
40 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
41 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
42 #include <dali-toolkit/public-api/visuals/visual-properties.h>
43 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
44 #include <dali-toolkit/devel-api/controls/control-devel.h>
45 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
46 #include <dali-toolkit/internal/styling/style-manager-impl.h>
47 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
48 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
49 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
50
51 namespace
52 {
53   const std::string READING_INFO_TYPE_NAME = "name";
54   const std::string READING_INFO_TYPE_ROLE = "role";
55   const std::string READING_INFO_TYPE_DESCRIPTION = "description";
56   const std::string READING_INFO_TYPE_STATE = "state";
57   const std::string READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
58   const std::string READING_INFO_TYPE_SEPARATOR = "|";
59 }
60
61 namespace Dali
62 {
63
64 namespace Toolkit
65 {
66
67 namespace Internal
68 {
69
70 extern const Dali::Scripting::StringEnum ControlStateTable[];
71 extern const unsigned int ControlStateTableCount;
72
73
74 // Not static or anonymous - shared with other translation units
75 const Scripting::StringEnum ControlStateTable[] = {
76   { "NORMAL",   Toolkit::DevelControl::NORMAL   },
77   { "FOCUSED",  Toolkit::DevelControl::FOCUSED  },
78   { "DISABLED", Toolkit::DevelControl::DISABLED },
79 };
80 const unsigned int ControlStateTableCount = sizeof( ControlStateTable ) / sizeof( ControlStateTable[0] );
81
82
83
84 namespace
85 {
86
87 #if defined(DEBUG_ENABLED)
88 Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
89 #endif
90
91
92 template<typename T>
93 void Remove( Dictionary<T>& keyValues, const std::string& name )
94 {
95   keyValues.Remove(name);
96 }
97
98 void Remove( DictionaryKeys& keys, const std::string& name )
99 {
100   DictionaryKeys::iterator iter = std::find( keys.begin(), keys.end(), name );
101   if( iter != keys.end())
102   {
103     keys.erase(iter);
104   }
105 }
106
107 /**
108  *  Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter
109  */
110 bool FindVisual( Property::Index targetIndex, const RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter )
111 {
112   for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
113   {
114     if ( (*iter)->index ==  targetIndex )
115     {
116       return true;
117     }
118   }
119   return false;
120 }
121
122 /**
123  *  Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter
124  */
125 bool FindVisual( std::string visualName, const RegisteredVisualContainer& visuals, RegisteredVisualContainer::Iterator& iter )
126 {
127   for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
128   {
129     Toolkit::Visual::Base visual = (*iter)->visual;
130     if( visual && visual.GetName() == visualName )
131     {
132       return true;
133     }
134   }
135   return false;
136 }
137
138 void FindChangableVisuals( Dictionary<Property::Map>& stateVisualsToAdd,
139                            Dictionary<Property::Map>& stateVisualsToChange,
140                            DictionaryKeys& stateVisualsToRemove)
141 {
142   DictionaryKeys copyOfStateVisualsToRemove = stateVisualsToRemove;
143
144   for( DictionaryKeys::iterator iter = copyOfStateVisualsToRemove.begin();
145        iter != copyOfStateVisualsToRemove.end(); ++iter )
146   {
147     const std::string& visualName = (*iter);
148     Property::Map* toMap = stateVisualsToAdd.Find( visualName );
149     if( toMap )
150     {
151       stateVisualsToChange.Add( visualName, *toMap );
152       stateVisualsToAdd.Remove( visualName );
153       Remove( stateVisualsToRemove, visualName );
154     }
155   }
156 }
157
158 Toolkit::Visual::Base GetVisualByName(
159   const RegisteredVisualContainer& visuals,
160   const std::string& visualName )
161 {
162   Toolkit::Visual::Base visualHandle;
163
164   RegisteredVisualContainer::Iterator iter;
165   for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
166   {
167     Toolkit::Visual::Base visual = (*iter)->visual;
168     if( visual && visual.GetName() == visualName )
169     {
170       visualHandle = visual;
171       break;
172     }
173   }
174   return visualHandle;
175 }
176
177 Toolkit::Visual::Base GetVisualByIndex(
178   const RegisteredVisualContainer& visuals,
179   Property::Index                  index)
180 {
181   Toolkit::Visual::Base visualHandle;
182
183   RegisteredVisualContainer::Iterator iter;
184   for(iter = visuals.Begin(); iter != visuals.End(); iter++)
185   {
186     if((*iter)->index == index)
187     {
188       visualHandle = (*iter)->visual;
189       break;
190     }
191   }
192   return visualHandle;
193 }
194
195 /**
196  * Move visual from source to destination container
197  */
198 void MoveVisual( RegisteredVisualContainer::Iterator sourceIter, RegisteredVisualContainer& source, RegisteredVisualContainer& destination )
199 {
200    Toolkit::Visual::Base visual = (*sourceIter)->visual;
201    if( visual )
202    {
203      RegisteredVisual* rv = source.Release( sourceIter );
204      destination.PushBack( rv );
205    }
206 }
207
208 /**
209  * Performs actions as requested using the action name.
210  * @param[in] object The object on which to perform the action.
211  * @param[in] actionName The action to perform.
212  * @param[in] attributes The attributes with which to perfrom this action.
213  * @return true if action has been accepted by this control
214  */
215 const char* ACTION_ACCESSIBILITY_ACTIVATED         = "accessibilityActivated";
216 const char* ACTION_ACCESSIBILITY_READING_CANCELLED = "ReadingCancelled";
217 const char* ACTION_ACCESSIBILITY_READING_PAUSED    = "ReadingPaused";
218 const char* ACTION_ACCESSIBILITY_READING_RESUMED   = "ReadingResumed";
219 const char* ACTION_ACCESSIBILITY_READING_SKIPPED   = "ReadingSkipped";
220 const char* ACTION_ACCESSIBILITY_READING_STOPPED   = "ReadingStopped";
221
222 static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
223 {
224   bool ret = true;
225
226   Dali::BaseHandle handle( object );
227
228   Toolkit::Control control = Toolkit::Control::DownCast( handle );
229
230   DALI_ASSERT_ALWAYS( control );
231
232   if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ||
233      actionName == "activate" )
234   {
235     // if cast succeeds there is an implementation so no need to check
236     if( !DevelControl::AccessibilityActivateSignal( control ).Empty() )
237       DevelControl::AccessibilityActivateSignal( control ).Emit();
238     else ret = Internal::GetImplementation( control ).OnAccessibilityActivated();
239   }
240   else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_SKIPPED ) )
241   {
242     // if cast succeeds there is an implementation so no need to check
243     if( !DevelControl::AccessibilityReadingSkippedSignal( control ).Empty() )
244       DevelControl::AccessibilityReadingSkippedSignal( control ).Emit();
245   }
246   else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_PAUSED ) )
247   {
248     // if cast succeeds there is an implementation so no need to check
249     if( !DevelControl::AccessibilityReadingPausedSignal( control ).Empty() )
250       DevelControl::AccessibilityReadingPausedSignal( control ).Emit();
251   }
252   else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_RESUMED ) )
253   {
254     // if cast succeeds there is an implementation so no need to check
255     if( !DevelControl::AccessibilityReadingResumedSignal( control ).Empty() )
256       DevelControl::AccessibilityReadingResumedSignal( control ).Emit();
257   }
258   else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_CANCELLED ) )
259   {
260     // if cast succeeds there is an implementation so no need to check
261     if( !DevelControl::AccessibilityReadingCancelledSignal( control ).Empty() )
262       DevelControl::AccessibilityReadingCancelledSignal( control ).Emit();
263   }
264   else if( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_READING_STOPPED ) )
265   {
266     // if cast succeeds there is an implementation so no need to check
267     if(!DevelControl::AccessibilityReadingStoppedSignal( control ).Empty())
268       DevelControl::AccessibilityReadingStoppedSignal( control ).Emit();
269   } else
270   {
271     ret = false;
272   }
273   return ret;
274 }
275
276 /**
277  * Connects a callback function with the object's signals.
278  * @param[in] object The object providing the signal.
279  * @param[in] tracker Used to disconnect the signal.
280  * @param[in] signalName The signal to connect to.
281  * @param[in] functor A newly allocated FunctorDelegate.
282  * @return True if the signal was connected.
283  * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
284  */
285 const char* SIGNAL_KEY_EVENT = "keyEvent";
286 const char* SIGNAL_KEY_INPUT_FOCUS_GAINED = "keyInputFocusGained";
287 const char* SIGNAL_KEY_INPUT_FOCUS_LOST = "keyInputFocusLost";
288 const char* SIGNAL_TAPPED = "tapped";
289 const char* SIGNAL_PANNED = "panned";
290 const char* SIGNAL_PINCHED = "pinched";
291 const char* SIGNAL_LONG_PRESSED = "longPressed";
292 const char* SIGNAL_GET_NAME = "getName";
293 const char* SIGNAL_GET_DESCRIPTION = "getDescription";
294 const char* SIGNAL_DO_GESTURE = "doGesture";
295 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
296 {
297   Dali::BaseHandle handle( object );
298
299   bool connected( false );
300   Toolkit::Control control = Toolkit::Control::DownCast( handle );
301   if ( control )
302   {
303     Internal::Control& controlImpl( Internal::GetImplementation( control ) );
304     connected = true;
305
306     if ( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
307     {
308       controlImpl.KeyEventSignal().Connect( tracker, functor );
309     }
310     else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_GAINED ) )
311     {
312       controlImpl.KeyInputFocusGainedSignal().Connect( tracker, functor );
313     }
314     else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_LOST ) )
315     {
316       controlImpl.KeyInputFocusLostSignal().Connect( tracker, functor );
317     }
318     else if( 0 == strcmp( signalName.c_str(), SIGNAL_TAPPED ) )
319     {
320       controlImpl.EnableGestureDetection( GestureType::TAP );
321       controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor );
322     }
323     else if( 0 == strcmp( signalName.c_str(), SIGNAL_PANNED ) )
324     {
325       controlImpl.EnableGestureDetection( GestureType::PAN );
326       controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor );
327     }
328     else if( 0 == strcmp( signalName.c_str(), SIGNAL_PINCHED ) )
329     {
330       controlImpl.EnableGestureDetection( GestureType::PINCH );
331       controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor );
332     }
333     else if( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESSED ) )
334     {
335       controlImpl.EnableGestureDetection( GestureType::LONG_PRESS );
336       controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor );
337     }
338     else if( 0 == strcmp( signalName.c_str(), SIGNAL_GET_NAME ) )
339     {
340       DevelControl::AccessibilityGetNameSignal( control ).Connect( tracker, functor );
341     }
342     else if( 0 == strcmp( signalName.c_str(), SIGNAL_GET_DESCRIPTION ) )
343     {
344       DevelControl::AccessibilityGetDescriptionSignal( control ).Connect( tracker, functor );
345     }
346     else if( 0 == strcmp( signalName.c_str(), SIGNAL_DO_GESTURE ) )
347     {
348       DevelControl::AccessibilityDoGestureSignal( control ).Connect( tracker, functor );
349     }
350
351   }
352   return connected;
353 }
354
355 /**
356  * Creates control through type registry
357  */
358 BaseHandle Create()
359 {
360   return Internal::Control::New();
361 }
362 // Setup signals and actions using the type-registry.
363 DALI_TYPE_REGISTRATION_BEGIN( Control, CustomActor, Create );
364
365 // Note: Properties are registered separately below.
366
367 SignalConnectorType registerSignal1( typeRegistration, SIGNAL_KEY_EVENT, &DoConnectSignal );
368 SignalConnectorType registerSignal2( typeRegistration, SIGNAL_KEY_INPUT_FOCUS_GAINED, &DoConnectSignal );
369 SignalConnectorType registerSignal3( typeRegistration, SIGNAL_KEY_INPUT_FOCUS_LOST, &DoConnectSignal );
370 SignalConnectorType registerSignal4( typeRegistration, SIGNAL_TAPPED, &DoConnectSignal );
371 SignalConnectorType registerSignal5( typeRegistration, SIGNAL_PANNED, &DoConnectSignal );
372 SignalConnectorType registerSignal6( typeRegistration, SIGNAL_PINCHED, &DoConnectSignal );
373 SignalConnectorType registerSignal7( typeRegistration, SIGNAL_LONG_PRESSED, &DoConnectSignal );
374 SignalConnectorType registerSignal8( typeRegistration, SIGNAL_GET_NAME, &DoConnectSignal );
375 SignalConnectorType registerSignal9( typeRegistration, SIGNAL_GET_DESCRIPTION, &DoConnectSignal );
376 SignalConnectorType registerSignal10( typeRegistration, SIGNAL_DO_GESTURE, &DoConnectSignal );
377
378 TypeAction registerAction1( typeRegistration, "activate", &DoAction );
379 TypeAction registerAction2( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &DoAction );
380 TypeAction registerAction3( typeRegistration, ACTION_ACCESSIBILITY_READING_SKIPPED, &DoAction );
381 TypeAction registerAction4( typeRegistration, ACTION_ACCESSIBILITY_READING_CANCELLED, &DoAction );
382 TypeAction registerAction5( typeRegistration, ACTION_ACCESSIBILITY_READING_STOPPED, &DoAction );
383 TypeAction registerAction6( typeRegistration, ACTION_ACCESSIBILITY_READING_PAUSED, &DoAction );
384 TypeAction registerAction7( typeRegistration, ACTION_ACCESSIBILITY_READING_RESUMED, &DoAction );
385
386 DALI_TYPE_REGISTRATION_END()
387
388 /**
389  * @brief Iterate through given container and setOffScene any visual found
390  *
391  * @param[in] container Container of visuals
392  * @param[in] parent Parent actor to remove visuals from
393  */
394 void SetVisualsOffScene( const RegisteredVisualContainer& container, Actor parent )
395 {
396   for( auto iter = container.Begin(), end = container.End() ; iter!= end; iter++)
397   {
398     if( (*iter)->visual )
399     {
400       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::SetOffScene Setting visual(%d) off stage\n", (*iter)->index );
401       Toolkit::GetImplementation((*iter)->visual).SetOffScene( parent );
402     }
403   }
404 }
405
406 } // unnamed namespace
407
408
409 // Properties registered without macro to use specific member variables.
410 const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName",              Toolkit::Control::Property::STYLE_NAME,                   Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
411 const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus",          Toolkit::Control::Property::KEY_INPUT_FOCUS,              Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
412 const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background",             Toolkit::Control::Property::BACKGROUND,                   Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
413 const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "margin",                 Toolkit::Control::Property::MARGIN,                       Property::EXTENTS, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
414 const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "padding",                Toolkit::Control::Property::PADDING,                      Property::EXTENTS, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
415 const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "tooltip",                Toolkit::DevelControl::Property::TOOLTIP,                 Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
416 const PropertyRegistration Control::Impl::PROPERTY_9( typeRegistration, "state",                  Toolkit::DevelControl::Property::STATE,                   Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
417 const PropertyRegistration Control::Impl::PROPERTY_10( typeRegistration, "subState",               Toolkit::DevelControl::Property::SUB_STATE,               Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
418 const PropertyRegistration Control::Impl::PROPERTY_11( typeRegistration, "leftFocusableActorId",   Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
419 const PropertyRegistration Control::Impl::PROPERTY_12( typeRegistration, "rightFocusableActorId", Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID,Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
420 const PropertyRegistration Control::Impl::PROPERTY_13( typeRegistration, "upFocusableActorId",    Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID,   Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
421 const PropertyRegistration Control::Impl::PROPERTY_14( typeRegistration, "downFocusableActorId",  Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
422 const PropertyRegistration Control::Impl::PROPERTY_15( typeRegistration, "shadow",                Toolkit::DevelControl::Property::SHADOW,                  Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
423 const PropertyRegistration Control::Impl::PROPERTY_16( typeRegistration, "accessibilityAttributes",         Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES,         Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
424 const PropertyRegistration Control::Impl::PROPERTY_17( typeRegistration, "accessibilityName",              Toolkit::DevelControl::Property::ACCESSIBILITY_NAME,               Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
425 const PropertyRegistration Control::Impl::PROPERTY_18( typeRegistration, "accessibilityDescription",       Toolkit::DevelControl::Property::ACCESSIBILITY_DESCRIPTION,         Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
426 const PropertyRegistration Control::Impl::PROPERTY_19( typeRegistration, "accessibilityTranslationDomain", Toolkit::DevelControl::Property::ACCESSIBILITY_TRANSLATION_DOMAIN, Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
427 const PropertyRegistration Control::Impl::PROPERTY_20( typeRegistration, "accessibilityRole",              Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE,               Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
428 const PropertyRegistration Control::Impl::PROPERTY_21( typeRegistration, "accessibilityHighlightable",     Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE,      Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
429 const PropertyRegistration Control::Impl::PROPERTY_22( typeRegistration, "accessibilityAnimated",          Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED,      Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
430
431 Control::Impl::Impl( Control& controlImpl )
432 : mControlImpl( controlImpl ),
433   mState( Toolkit::DevelControl::NORMAL ),
434   mSubStateName(""),
435   mLeftFocusableActorId( -1 ),
436   mRightFocusableActorId( -1 ),
437   mUpFocusableActorId( -1 ),
438   mDownFocusableActorId( -1 ),
439   mStyleName(""),
440   mBackgroundColor(Color::TRANSPARENT),
441   mStartingPinchScale(nullptr),
442   mMargin( 0, 0, 0, 0 ),
443   mPadding( 0, 0, 0, 0 ),
444   mKeyEventSignal(),
445   mKeyInputFocusGainedSignal(),
446   mKeyInputFocusLostSignal(),
447   mResourceReadySignal(),
448   mVisualEventSignal(),
449   mAccessibilityGetNameSignal(),
450   mAccessibilityGetDescriptionSignal(),
451   mAccessibilityDoGestureSignal(),
452   mPinchGestureDetector(),
453   mPanGestureDetector(),
454   mTapGestureDetector(),
455   mLongPressGestureDetector(),
456   mTooltip( NULL ),
457   mInputMethodContext(),
458   mIdleCallback(nullptr),
459   mAutofillItem(),
460   mAutofillContainer(),
461   mFlags( Control::ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
462   mIsKeyboardNavigationSupported( false ),
463   mIsKeyboardFocusGroup( false ),
464   mIsEmittingResourceReadySignal(false),
465   mNeedToEmitResourceReady(false),
466   mIsAutofillEnabled( false )
467 {
468   Dali::Accessibility::Accessible::RegisterControlAccessibilityGetter(
469       []( Dali::Actor actor ) -> Dali::Accessibility::Accessible* {
470         return Control::Impl::GetAccessibilityObject( actor );
471       } );
472
473   accessibilityConstructor =  []( Dali::Actor actor ) -> std::unique_ptr< Dali::Accessibility::Accessible > {
474         return std::unique_ptr< Dali::Accessibility::Accessible >( new AccessibleImpl( actor,
475                                 Dali::Accessibility::Role::UNKNOWN ) );
476       };
477
478   size_t len = static_cast<size_t>(Dali::Accessibility::RelationType::MAX_COUNT);
479   mAccessibilityRelations.reserve(len);
480   for (auto i = 0u; i < len; ++i)
481   {
482     mAccessibilityRelations.push_back({});
483   }
484 }
485
486 Control::Impl::~Impl()
487 {
488   for( auto&& iter : mVisuals )
489   {
490     StopObservingVisual( iter->visual );
491   }
492
493   for( auto&& iter : mRemoveVisuals )
494   {
495     StopObservingVisual( iter->visual );
496   }
497
498   AccessibilityDeregister();
499   // All gesture detectors will be destroyed so no need to disconnect.
500   delete mStartingPinchScale;
501
502   if(mIdleCallback && Adaptor::IsAvailable())
503   {
504     // Removes the callback from the callback manager in case the control is destroyed before the callback is executed.
505     Adaptor::Get().RemoveIdle(mIdleCallback);
506   }
507 }
508
509 Control::Impl& Control::Impl::Get( Internal::Control& internalControl )
510 {
511   return *internalControl.mImpl;
512 }
513
514 const Control::Impl& Control::Impl::Get( const Internal::Control& internalControl )
515 {
516   return *internalControl.mImpl;
517 }
518
519 // Gesture Detection Methods
520 void Control::Impl::PinchDetected(Actor actor, const PinchGesture& pinch)
521 {
522   mControlImpl.OnPinch(pinch);
523 }
524
525 void Control::Impl::PanDetected(Actor actor, const PanGesture& pan)
526 {
527   mControlImpl.OnPan(pan);
528 }
529
530 void Control::Impl::TapDetected(Actor actor, const TapGesture& tap)
531 {
532   mControlImpl.OnTap(tap);
533 }
534
535 void Control::Impl::LongPressDetected(Actor actor, const LongPressGesture& longPress)
536 {
537   mControlImpl.OnLongPress(longPress);
538 }
539
540 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
541 {
542   RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::NOT_SET );
543 }
544
545 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
546 {
547   RegisterVisual( index, visual, VisualState::ENABLED, DepthIndexValue::SET, depthIndex );
548 }
549
550 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
551 {
552   RegisterVisual( index, visual, ( enabled ? VisualState::ENABLED : VisualState::DISABLED ), DepthIndexValue::NOT_SET );
553 }
554
555 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
556 {
557   RegisterVisual( index, visual, ( enabled ? VisualState::ENABLED : VisualState::DISABLED ), DepthIndexValue::SET, depthIndex );
558 }
559
560 void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, VisualState::Type enabled, DepthIndexValue::Type depthIndexValueSet, int depthIndex )
561 {
562   DALI_LOG_INFO( gLogFilter, Debug::Concise, "RegisterVisual:%d \n", index );
563
564   bool visualReplaced ( false );
565   Actor self = mControlImpl.Self();
566
567   // Set the depth index, if not set by caller this will be either the current visual depth, max depth of all visuals
568   // or zero.
569   int requiredDepthIndex = visual.GetDepthIndex();
570
571   if( depthIndexValueSet == DepthIndexValue::SET )
572   {
573     requiredDepthIndex = depthIndex;
574   }
575
576   // Visual replacement, existing visual should only be removed from stage when replacement ready.
577   if( !mVisuals.Empty() )
578   {
579     RegisteredVisualContainer::Iterator registeredVisualsiter;
580     // Check if visual (index) is already registered, this is the current visual.
581     if( FindVisual( index, mVisuals, registeredVisualsiter ) )
582     {
583       Toolkit::Visual::Base& currentRegisteredVisual = (*registeredVisualsiter)->visual;
584       if( currentRegisteredVisual )
585       {
586         // Store current visual depth index as may need to set the replacement visual to same depth
587         const int currentDepthIndex = (*registeredVisualsiter)->visual.GetDepthIndex();
588
589         // No longer required to know if the replaced visual's resources are ready
590         StopObservingVisual( currentRegisteredVisual );
591
592         // If control staged and visual enabled then visuals will be swapped once ready
593         if(  self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) && enabled )
594         {
595           // Check if visual is currently in the process of being replaced ( is in removal container )
596           RegisteredVisualContainer::Iterator visualQueuedForRemoval;
597           if ( FindVisual( index, mRemoveVisuals, visualQueuedForRemoval ) )
598           {
599             // Visual with same index is already in removal container so current visual pending
600             // Only the the last requested visual will be displayed so remove current visual which is staged but not ready.
601             Toolkit::GetImplementation( currentRegisteredVisual ).SetOffScene( self );
602             mVisuals.Erase( registeredVisualsiter );
603           }
604           else
605           {
606             // current visual not already in removal container so add now.
607             DALI_LOG_INFO( gLogFilter, Debug::Verbose, "RegisterVisual Move current registered visual to removal Queue: %d \n", index );
608             MoveVisual( registeredVisualsiter, mVisuals, mRemoveVisuals );
609           }
610         }
611         else
612         {
613           // Control not staged or visual disabled so can just erase from registered visuals and new visual will be added later.
614           mVisuals.Erase( registeredVisualsiter );
615         }
616
617         // 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
618         if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
619             ( visual.GetDepthIndex() == 0 ) )
620         {
621           requiredDepthIndex = currentDepthIndex;
622         }
623       }
624
625       visualReplaced = true;
626     }
627   }
628
629   // If not set, set the name of the visual to the same name as the control's property.
630   // ( If the control has been type registered )
631   if( visual.GetName().empty() )
632   {
633     // returns empty string if index is not found as long as index is not -1
634     std::string visualName = self.GetPropertyName( index );
635     if( !visualName.empty() )
636     {
637       DALI_LOG_INFO( gLogFilter, Debug::Concise, "Setting visual name for property %d to %s\n",
638                      index, visualName.c_str() );
639       visual.SetName( visualName );
640     }
641   }
642
643   if( !visualReplaced ) // New registration entry
644   {
645     // 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
646     if( ( depthIndexValueSet == DepthIndexValue::NOT_SET ) &&
647         ( mVisuals.Size() > 0 ) &&
648         ( visual.GetDepthIndex() == 0 ) )
649     {
650       int maxDepthIndex = std::numeric_limits< int >::min();
651
652       RegisteredVisualContainer::ConstIterator iter;
653       const RegisteredVisualContainer::ConstIterator endIter = mVisuals.End();
654       for ( iter = mVisuals.Begin(); iter != endIter; iter++ )
655       {
656         const int visualDepthIndex = (*iter)->visual.GetDepthIndex();
657         if ( visualDepthIndex > maxDepthIndex )
658         {
659           maxDepthIndex = visualDepthIndex;
660         }
661       }
662       ++maxDepthIndex; // Add one to the current maximum depth index so that our added visual appears on top
663       requiredDepthIndex = std::max( 0, maxDepthIndex ); // Start at zero if maxDepth index belongs to a background
664     }
665   }
666
667   if( visual )
668   {
669     // Set determined depth index
670     visual.SetDepthIndex( requiredDepthIndex );
671
672     // Monitor when the visual resources are ready
673     StartObservingVisual( visual );
674
675     DALI_LOG_INFO( gLogFilter, Debug::Concise, "New Visual registration index[%d] depth[%d]\n", index, requiredDepthIndex );
676     RegisteredVisual* newRegisteredVisual  = new RegisteredVisual( index, visual,
677                                              ( enabled == VisualState::ENABLED ? true : false ),
678                                              ( visualReplaced && enabled ) ) ;
679     mVisuals.PushBack( newRegisteredVisual );
680
681     Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
682     // Put on stage if enabled and the control is already on the stage
683     if( ( enabled == VisualState::ENABLED ) && self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
684     {
685       visualImpl.SetOnScene( self );
686     }
687     else if( visualImpl.IsResourceReady() ) // When not being staged, check if visual already 'ResourceReady' before it was Registered. ( Resource may have been loaded already )
688     {
689       ResourceReady( visualImpl );
690     }
691
692   }
693
694   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::RegisterVisual() Registered %s(%d), enabled:%s\n",  visual.GetName().c_str(), index, enabled?"true":"false" );
695 }
696
697 void Control::Impl::UnregisterVisual( Property::Index index )
698 {
699   RegisteredVisualContainer::Iterator iter;
700   if ( FindVisual( index, mVisuals, iter ) )
701   {
702     // stop observing visual
703     StopObservingVisual( (*iter)->visual );
704
705     Actor self( mControlImpl.Self() );
706     Toolkit::GetImplementation((*iter)->visual).SetOffScene( self );
707     (*iter)->visual.Reset();
708     mVisuals.Erase( iter );
709   }
710
711   if( FindVisual( index, mRemoveVisuals, iter ) )
712   {
713     Actor self( mControlImpl.Self() );
714     Toolkit::GetImplementation( (*iter)->visual ).SetOffScene( self );
715     (*iter)->pending = false;
716     (*iter)->visual.Reset();
717     mRemoveVisuals.Erase( iter );
718   }
719 }
720
721 Toolkit::Visual::Base Control::Impl::GetVisual( Property::Index index ) const
722 {
723   RegisteredVisualContainer::Iterator iter;
724   if ( FindVisual( index, mVisuals, iter ) )
725   {
726     return (*iter)->visual;
727   }
728
729   return Toolkit::Visual::Base();
730 }
731
732 void Control::Impl::EnableVisual( Property::Index index, bool enable )
733 {
734   DALI_LOG_INFO( gLogFilter, Debug::General, "Control::EnableVisual(%d, %s)\n", index, enable?"T":"F");
735
736   RegisteredVisualContainer::Iterator iter;
737   if ( FindVisual( index, mVisuals, iter ) )
738   {
739     if (  (*iter)->enabled == enable )
740     {
741       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual %s(%d) already %s\n", (*iter)->visual.GetName().c_str(), index, enable?"enabled":"disabled");
742       return;
743     }
744
745     (*iter)->enabled = enable;
746     Actor parentActor = mControlImpl.Self();
747     if ( mControlImpl.Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ) // If control not on Scene then Visual will be added when SceneConnection is called.
748     {
749       if ( enable )
750       {
751         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) on stage \n", (*iter)->visual.GetName().c_str(), index );
752         Toolkit::GetImplementation((*iter)->visual).SetOnScene( parentActor );
753       }
754       else
755       {
756         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting %s(%d) off stage \n", (*iter)->visual.GetName().c_str(), index );
757         Toolkit::GetImplementation((*iter)->visual).SetOffScene( parentActor );  // No need to call if control not staged.
758       }
759     }
760   }
761   else
762   {
763     DALI_LOG_WARNING( "Control::EnableVisual(%d, %s) FAILED - NO SUCH VISUAL\n", index, enable?"T":"F" );
764   }
765 }
766
767 bool Control::Impl::IsVisualEnabled( Property::Index index ) const
768 {
769   RegisteredVisualContainer::Iterator iter;
770   if ( FindVisual( index, mVisuals, iter ) )
771   {
772     return (*iter)->enabled;
773   }
774   return false;
775 }
776
777 void Control::Impl::StopObservingVisual( Toolkit::Visual::Base& visual )
778 {
779   Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
780
781   // Stop observing the visual
782   visualImpl.RemoveEventObserver( *this );
783 }
784
785 void Control::Impl::StartObservingVisual( Toolkit::Visual::Base& visual)
786 {
787   Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
788
789   // start observing the visual for events
790   visualImpl.AddEventObserver( *this );
791 }
792
793 // Called by a Visual when it's resource is ready
794 void Control::Impl::ResourceReady( Visual::Base& object)
795 {
796   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::Impl::ResourceReady() replacements pending[%d]\n", mRemoveVisuals.Count() );
797
798   Actor self = mControlImpl.Self();
799
800   // A resource is ready, find resource in the registered visuals container and get its index
801   for( auto registeredIter = mVisuals.Begin(),  end = mVisuals.End(); registeredIter != end; ++registeredIter )
802   {
803     Internal::Visual::Base& registeredVisualImpl = Toolkit::GetImplementation( (*registeredIter)->visual );
804
805     if( &object == &registeredVisualImpl )
806     {
807       RegisteredVisualContainer::Iterator visualToRemoveIter;
808       // Find visual with the same index in the removal container
809       // Set if off stage as it's replacement is now ready.
810       // Remove if from removal list as now removed from stage.
811       // Set Pending flag on the ready visual to false as now ready.
812       if( FindVisual( (*registeredIter)->index, mRemoveVisuals, visualToRemoveIter ) )
813       {
814         (*registeredIter)->pending = false;
815         Toolkit::GetImplementation( (*visualToRemoveIter)->visual ).SetOffScene( self );
816         mRemoveVisuals.Erase( visualToRemoveIter );
817       }
818       break;
819     }
820   }
821
822   // A visual is ready so control may need relayouting if staged
823   if ( self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
824   {
825     mControlImpl.RelayoutRequest();
826   }
827
828   // Emit signal if all enabled visuals registered by the control are ready.
829   if( IsResourceReady() )
830   {
831     // Reset the flag
832     mNeedToEmitResourceReady = false;
833
834     EmitResourceReadySignal();
835   }
836 }
837
838 void Control::Impl::NotifyVisualEvent( Visual::Base& object, Property::Index signalId )
839 {
840   for( auto registeredIter = mVisuals.Begin(),  end = mVisuals.End(); registeredIter != end; ++registeredIter )
841   {
842     Internal::Visual::Base& registeredVisualImpl = Toolkit::GetImplementation( (*registeredIter)->visual );
843     if( &object == &registeredVisualImpl )
844     {
845       Dali::Toolkit::Control handle( mControlImpl.GetOwner() );
846       mVisualEventSignal.Emit( handle, (*registeredIter)->index, signalId );
847       break;
848     }
849   }
850 }
851
852 bool Control::Impl::IsResourceReady() const
853 {
854   // Iterate through and check all the enabled visuals are ready
855   for( auto visualIter = mVisuals.Begin();
856          visualIter != mVisuals.End(); ++visualIter )
857   {
858     const Toolkit::Visual::Base visual = (*visualIter)->visual;
859     const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
860
861     // one of the enabled visuals is not ready
862     if( !visualImpl.IsResourceReady() && (*visualIter)->enabled )
863     {
864       return false;
865     }
866   }
867   return true;
868 }
869
870 Toolkit::Visual::ResourceStatus Control::Impl::GetVisualResourceStatus( Property::Index index ) const
871 {
872   RegisteredVisualContainer::Iterator iter;
873   if ( FindVisual( index, mVisuals, iter ) )
874   {
875     const Toolkit::Visual::Base visual = (*iter)->visual;
876     const Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
877     return visualImpl.GetResourceStatus( );
878   }
879
880   return Toolkit::Visual::ResourceStatus::PREPARING;
881 }
882
883
884
885 void Control::Impl::AddTransitions( Dali::Animation& animation,
886                                     const Toolkit::TransitionData& handle,
887                                     bool createAnimation )
888 {
889   // Setup a Transition from TransitionData.
890   const Internal::TransitionData& transitionData = Toolkit::GetImplementation( handle );
891   TransitionData::Iterator end = transitionData.End();
892   for( TransitionData::Iterator iter = transitionData.Begin() ;
893        iter != end; ++iter )
894   {
895     TransitionData::Animator* animator = (*iter);
896
897     Toolkit::Visual::Base visual = GetVisualByName( mVisuals, animator->objectName );
898
899     if( visual )
900     {
901 #if defined(DEBUG_ENABLED)
902       Dali::TypeInfo typeInfo;
903       ControlWrapper* controlWrapperImpl = dynamic_cast<ControlWrapper*>(&mControlImpl);
904       if( controlWrapperImpl )
905       {
906         typeInfo = controlWrapperImpl->GetTypeInfo();
907       }
908
909       DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Found %s visual for %s\n",
910                      visual.GetName().c_str(), typeInfo?typeInfo.GetName().c_str():"Unknown" );
911 #endif
912       Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
913       visualImpl.AnimateProperty( animation, *animator );
914     }
915     else
916     {
917       DALI_LOG_INFO( gLogFilter, Debug::Concise, "CreateTransition: Could not find visual. Trying actors");
918       // Otherwise, try any actor children of control (Including the control)
919       Actor child = mControlImpl.Self().FindChildByName( animator->objectName );
920       if( child )
921       {
922         Property::Index propertyIndex = child.GetPropertyIndex( animator->propertyKey );
923         if( propertyIndex != Property::INVALID_INDEX )
924         {
925           if( animator->animate == false )
926           {
927             if( animator->targetValue.GetType() != Property::NONE )
928             {
929               child.SetProperty( propertyIndex, animator->targetValue );
930             }
931           }
932           else // animate the property
933           {
934             if( animator->initialValue.GetType() != Property::NONE )
935             {
936               child.SetProperty( propertyIndex, animator->initialValue );
937             }
938
939             if( createAnimation && !animation )
940             {
941               animation = Dali::Animation::New( 0.1f );
942             }
943
944             animation.AnimateTo( Property( child, propertyIndex ),
945                                  animator->targetValue,
946                                  animator->alphaFunction,
947                                  TimePeriod( animator->timePeriodDelay,
948                                              animator->timePeriodDuration ) );
949           }
950         }
951       }
952     }
953   }
954 }
955
956 Dali::Animation Control::Impl::CreateTransition( const Toolkit::TransitionData& transitionData )
957 {
958   Dali::Animation transition;
959
960   if( transitionData.Count() > 0 )
961   {
962     AddTransitions( transition, transitionData, true );
963   }
964   return transition;
965 }
966
967
968
969 void Control::Impl::DoAction( Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes )
970 {
971   RegisteredVisualContainer::Iterator iter;
972   if ( FindVisual( visualIndex, mVisuals, iter ) )
973   {
974     Toolkit::GetImplementation((*iter)->visual).DoAction( actionId, attributes );
975   }
976 }
977
978 void Control::Impl::AppendAccessibilityAttribute( const std::string& key,
979                                                const std::string value )
980 {
981   Property::Value* val = mAccessibilityAttributes.Find( key );
982   if( val )
983   {
984     mAccessibilityAttributes[key] = Property::Value( value );
985   }
986   else
987   {
988     mAccessibilityAttributes.Insert( key, value );
989   }
990 }
991
992 void Control::Impl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
993 {
994   Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
995
996   if ( control )
997   {
998     Control& controlImpl( GetImplementation( control ) );
999
1000     switch ( index )
1001     {
1002       case Toolkit::Control::Property::STYLE_NAME:
1003       {
1004         controlImpl.SetStyleName( value.Get< std::string >() );
1005         break;
1006       }
1007
1008       case Toolkit::DevelControl::Property::STATE:
1009       {
1010         bool withTransitions=true;
1011         const Property::Value* valuePtr=&value;
1012         const Property::Map* map = value.GetMap();
1013         if(map)
1014         {
1015           Property::Value* value2 = map->Find("withTransitions");
1016           if( value2 )
1017           {
1018             withTransitions = value2->Get<bool>();
1019           }
1020
1021           valuePtr = map->Find("state");
1022         }
1023
1024         if( valuePtr )
1025         {
1026           Toolkit::DevelControl::State state( controlImpl.mImpl->mState );
1027           if( Scripting::GetEnumerationProperty< Toolkit::DevelControl::State >( *valuePtr, ControlStateTable, ControlStateTableCount, state ) )
1028           {
1029             controlImpl.mImpl->SetState( state, withTransitions );
1030           }
1031         }
1032       }
1033       break;
1034
1035       case Toolkit::DevelControl::Property::SUB_STATE:
1036       {
1037         std::string subState;
1038         if( value.Get( subState ) )
1039         {
1040           controlImpl.mImpl->SetSubState( subState );
1041         }
1042       }
1043       break;
1044
1045       case Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID:
1046       {
1047         int focusId;
1048         if( value.Get( focusId ) )
1049         {
1050           controlImpl.mImpl->mLeftFocusableActorId = focusId;
1051         }
1052       }
1053       break;
1054
1055       case Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID:
1056       {
1057         int focusId;
1058         if( value.Get( focusId ) )
1059         {
1060           controlImpl.mImpl->mRightFocusableActorId = focusId;
1061         }
1062       }
1063       break;
1064
1065       case Toolkit::DevelControl::Property::ACCESSIBILITY_NAME:
1066       {
1067         std::string name;
1068         if( value.Get( name ) )
1069         {
1070           controlImpl.mImpl->mAccessibilityName = name;
1071           controlImpl.mImpl->mAccessibilityNameSet = true;
1072         }
1073         else
1074         {
1075           controlImpl.mImpl->mAccessibilityNameSet = false;
1076         }
1077       }
1078       break;
1079
1080       case Toolkit::DevelControl::Property::ACCESSIBILITY_DESCRIPTION:
1081       {
1082         std::string txt;
1083         if( value.Get( txt ) )
1084         {
1085           controlImpl.mImpl->mAccessibilityDescription = txt;
1086           controlImpl.mImpl->mAccessibilityDescriptionSet = true;
1087         }
1088         else
1089         {
1090           controlImpl.mImpl->mAccessibilityDescriptionSet = false;
1091         }
1092       }
1093       break;
1094
1095       case Toolkit::DevelControl::Property::ACCESSIBILITY_TRANSLATION_DOMAIN:
1096       {
1097         std::string txt;
1098         if( value.Get( txt ) )
1099         {
1100           controlImpl.mImpl->mAccessibilityTranslationDomain = txt;
1101           controlImpl.mImpl->mAccessibilityTranslationDomainSet = true;
1102         }
1103         else
1104         {
1105           controlImpl.mImpl->mAccessibilityTranslationDomainSet = false;
1106         }
1107       }
1108       break;
1109
1110       case Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE:
1111       {
1112         bool highlightable;
1113         if( value.Get( highlightable ) )
1114         {
1115           controlImpl.mImpl->mAccessibilityHighlightable = highlightable;
1116           controlImpl.mImpl->mAccessibilityHighlightableSet = true;
1117         }
1118         else
1119         {
1120           controlImpl.mImpl->mAccessibilityHighlightableSet = false;
1121         }
1122       }
1123       break;
1124
1125       case Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE:
1126       {
1127         Dali::Accessibility::Role val;
1128         if( value.Get( val ) )
1129         {
1130           controlImpl.mImpl->mAccessibilityRole = val;
1131         }
1132       }
1133       break;
1134
1135       case Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID:
1136       {
1137         int focusId;
1138         if( value.Get( focusId ) )
1139         {
1140           controlImpl.mImpl->mUpFocusableActorId = focusId;
1141         }
1142       }
1143       break;
1144
1145       case Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID:
1146       {
1147         int focusId;
1148         if( value.Get( focusId ) )
1149         {
1150           controlImpl.mImpl->mDownFocusableActorId = focusId;
1151         }
1152       }
1153       break;
1154
1155       case Toolkit::Control::Property::KEY_INPUT_FOCUS:
1156       {
1157         if ( value.Get< bool >() )
1158         {
1159           controlImpl.SetKeyInputFocus();
1160         }
1161         else
1162         {
1163           controlImpl.ClearKeyInputFocus();
1164         }
1165         break;
1166       }
1167
1168       case Toolkit::Control::Property::BACKGROUND:
1169       {
1170         std::string url;
1171         Vector4 color;
1172         const Property::Map* map = value.GetMap();
1173         if( map && !map->Empty() )
1174         {
1175           controlImpl.SetBackground( *map );
1176         }
1177         else if( value.Get( url ) )
1178         {
1179           // don't know the size to load
1180           Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( url, ImageDimensions() );
1181           if( visual )
1182           {
1183             controlImpl.mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
1184           }
1185         }
1186         else if( value.Get( color ) )
1187         {
1188           controlImpl.SetBackgroundColor(color);
1189         }
1190         else
1191         {
1192           // The background is an empty property map, so we should clear the background
1193           controlImpl.ClearBackground();
1194         }
1195         break;
1196       }
1197
1198       case Toolkit::Control::Property::MARGIN:
1199       {
1200         Extents margin;
1201         if( value.Get( margin ) )
1202         {
1203           controlImpl.mImpl->SetMargin( margin );
1204         }
1205         break;
1206       }
1207
1208       case Toolkit::Control::Property::PADDING:
1209       {
1210         Extents padding;
1211         if( value.Get( padding ) )
1212         {
1213           controlImpl.mImpl->SetPadding( padding );
1214         }
1215         break;
1216       }
1217
1218       case Toolkit::DevelControl::Property::TOOLTIP:
1219       {
1220         TooltipPtr& tooltipPtr = controlImpl.mImpl->mTooltip;
1221         if( ! tooltipPtr )
1222         {
1223           tooltipPtr = Tooltip::New( control );
1224         }
1225         tooltipPtr->SetProperties( value );
1226         break;
1227       }
1228
1229       case Toolkit::DevelControl::Property::SHADOW:
1230       {
1231         const Property::Map* map = value.GetMap();
1232         if( map && !map->Empty() )
1233         {
1234           controlImpl.mImpl->SetShadow( *map );
1235         }
1236         else
1237         {
1238           // The shadow is an empty property map, so we should clear the shadow
1239           controlImpl.mImpl->ClearShadow();
1240         }
1241         break;
1242       }
1243
1244       case Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES:
1245       {
1246         const Property::Map* map = value.GetMap();
1247         if( map && !map->Empty() )
1248         {
1249           controlImpl.mImpl->mAccessibilityAttributes = *map;
1250         }
1251         break;
1252       }
1253
1254       case Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED:
1255       {
1256         bool animated;
1257         if( value.Get( animated ) )
1258         {
1259           controlImpl.mImpl->mAccessibilityAnimated = animated;
1260         }
1261         break;
1262       }
1263     }
1264   }
1265 }
1266
1267 Property::Value Control::Impl::GetProperty( BaseObject* object, Property::Index index )
1268 {
1269   Property::Value value;
1270
1271   Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
1272
1273   if ( control )
1274   {
1275     Control& controlImpl( GetImplementation( control ) );
1276
1277     switch ( index )
1278     {
1279       case Toolkit::Control::Property::STYLE_NAME:
1280       {
1281         value = controlImpl.GetStyleName();
1282         break;
1283       }
1284
1285       case Toolkit::DevelControl::Property::STATE:
1286       {
1287         value = controlImpl.mImpl->mState;
1288         break;
1289       }
1290
1291       case Toolkit::DevelControl::Property::SUB_STATE:
1292       {
1293         value = controlImpl.mImpl->mSubStateName;
1294         break;
1295       }
1296
1297       case Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID:
1298       {
1299         value = controlImpl.mImpl->mLeftFocusableActorId;
1300         break;
1301       }
1302
1303       case Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID:
1304       {
1305         value = controlImpl.mImpl->mRightFocusableActorId;
1306         break;
1307       }
1308
1309       case Toolkit::DevelControl::Property::ACCESSIBILITY_NAME:
1310       {
1311         if (controlImpl.mImpl->mAccessibilityNameSet)
1312         {
1313           value = controlImpl.mImpl->mAccessibilityName;
1314         }
1315         break;
1316       }
1317
1318       case Toolkit::DevelControl::Property::ACCESSIBILITY_DESCRIPTION:
1319       {
1320         if (controlImpl.mImpl->mAccessibilityDescriptionSet)
1321         {
1322           value = controlImpl.mImpl->mAccessibilityDescription;
1323         }
1324         break;
1325       }
1326
1327       case Toolkit::DevelControl::Property::ACCESSIBILITY_TRANSLATION_DOMAIN:
1328       {
1329         if (controlImpl.mImpl->mAccessibilityTranslationDomainSet)
1330         {
1331           value = controlImpl.mImpl->mAccessibilityTranslationDomain;
1332         }
1333         break;
1334       }
1335
1336       case Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE:
1337       {
1338         if (controlImpl.mImpl->mAccessibilityHighlightableSet)
1339         {
1340           value = controlImpl.mImpl->mAccessibilityHighlightable;
1341         }
1342         break;
1343       }
1344
1345       case Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE:
1346       {
1347         value = Property::Value(controlImpl.mImpl->mAccessibilityRole);
1348         break;
1349       }
1350
1351       case Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID:
1352       {
1353         value = controlImpl.mImpl->mUpFocusableActorId;
1354         break;
1355       }
1356
1357       case Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID:
1358       {
1359         value = controlImpl.mImpl->mDownFocusableActorId;
1360         break;
1361       }
1362
1363       case Toolkit::Control::Property::KEY_INPUT_FOCUS:
1364       {
1365         value = controlImpl.HasKeyInputFocus();
1366         break;
1367       }
1368
1369       case Toolkit::Control::Property::BACKGROUND:
1370       {
1371         Property::Map map;
1372         Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::Control::Property::BACKGROUND );
1373         if( visual )
1374         {
1375           visual.CreatePropertyMap( map );
1376         }
1377
1378         value = map;
1379         break;
1380       }
1381
1382       case Toolkit::Control::Property::MARGIN:
1383       {
1384         value = controlImpl.mImpl->GetMargin();
1385         break;
1386       }
1387
1388       case Toolkit::Control::Property::PADDING:
1389       {
1390         value = controlImpl.mImpl->GetPadding();
1391         break;
1392       }
1393
1394       case Toolkit::DevelControl::Property::TOOLTIP:
1395       {
1396         Property::Map map;
1397         if( controlImpl.mImpl->mTooltip )
1398         {
1399           controlImpl.mImpl->mTooltip->CreatePropertyMap( map );
1400         }
1401         value = map;
1402         break;
1403       }
1404
1405       case Toolkit::DevelControl::Property::SHADOW:
1406       {
1407         Property::Map map;
1408         Toolkit::Visual::Base visual = controlImpl.mImpl->GetVisual( Toolkit::DevelControl::Property::SHADOW );
1409         if( visual )
1410         {
1411           visual.CreatePropertyMap( map );
1412         }
1413
1414         value = map;
1415         break;
1416       }
1417
1418       case Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES:
1419       {
1420         value = controlImpl.mImpl->mAccessibilityAttributes;
1421         break;
1422       }
1423
1424       case Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED:
1425       {
1426         value = controlImpl.mImpl->mAccessibilityAnimated;
1427         break;
1428       }
1429     }
1430   }
1431
1432   return value;
1433 }
1434
1435 void Control::Impl::RemoveAccessibilityAttribute( const std::string& key )
1436 {
1437   Property::Value* val = mAccessibilityAttributes.Find( key );
1438   if( val )
1439     mAccessibilityAttributes[key] = Property::Value();
1440 }
1441
1442 void Control::Impl::ClearAccessibilityAttributes()
1443 {
1444   mAccessibilityAttributes.Clear();
1445 }
1446
1447 void Control::Impl::SetAccessibilityReadingInfoType( const Dali::Accessibility::ReadingInfoTypes types )
1448 {
1449   std::string value;
1450   if ( types[ Dali::Accessibility::ReadingInfoType::NAME ] )
1451   {
1452     value += READING_INFO_TYPE_NAME;
1453   }
1454   if ( types[ Dali::Accessibility::ReadingInfoType::ROLE ] )
1455   {
1456     if( !value.empty() )
1457     {
1458       value += READING_INFO_TYPE_SEPARATOR;
1459     }
1460     value += READING_INFO_TYPE_ROLE;
1461   }
1462   if ( types[ Dali::Accessibility::ReadingInfoType::DESCRIPTION ] )
1463   {
1464     if( !value.empty() )
1465     {
1466       value += READING_INFO_TYPE_SEPARATOR;
1467     }
1468     value += READING_INFO_TYPE_DESCRIPTION;
1469   }
1470   if ( types[ Dali::Accessibility::ReadingInfoType::STATE ] )
1471   {
1472     if( !value.empty() )
1473     {
1474       value += READING_INFO_TYPE_SEPARATOR;
1475     }
1476     value += READING_INFO_TYPE_STATE;
1477   }
1478   AppendAccessibilityAttribute( READING_INFO_TYPE_ATTRIBUTE_NAME, value );
1479 }
1480
1481 Dali::Accessibility::ReadingInfoTypes Control::Impl::GetAccessibilityReadingInfoType() const
1482 {
1483   std::string value;
1484   auto place = mAccessibilityAttributes.Find( READING_INFO_TYPE_ATTRIBUTE_NAME );
1485   if( place )
1486   {
1487     place->Get( value );
1488   }
1489
1490   if ( value.empty() )
1491   {
1492     return {};
1493   }
1494
1495   Dali::Accessibility::ReadingInfoTypes types;
1496
1497   if ( value.find( READING_INFO_TYPE_NAME ) != std::string::npos )
1498   {
1499     types[ Dali::Accessibility::ReadingInfoType::NAME ] = true;
1500   }
1501   if ( value.find( READING_INFO_TYPE_ROLE ) != std::string::npos )
1502   {
1503     types[ Dali::Accessibility::ReadingInfoType::ROLE ] = true;
1504   }
1505   if ( value.find( READING_INFO_TYPE_DESCRIPTION ) != std::string::npos )
1506   {
1507     types[ Dali::Accessibility::ReadingInfoType::DESCRIPTION ] = true;
1508   }
1509   if ( value.find( READING_INFO_TYPE_STATE ) != std::string::npos )
1510   {
1511     types[ Dali::Accessibility::ReadingInfoType::STATE ] = true;
1512   }
1513
1514   return types;
1515 }
1516
1517 void  Control::Impl::CopyInstancedProperties( RegisteredVisualContainer& visuals, Dictionary<Property::Map>& instancedProperties )
1518 {
1519   for(RegisteredVisualContainer::Iterator iter = visuals.Begin(); iter!= visuals.End(); iter++)
1520   {
1521     if( (*iter)->visual )
1522     {
1523       Property::Map instanceMap;
1524       Toolkit::GetImplementation((*iter)->visual).CreateInstancePropertyMap(instanceMap);
1525       instancedProperties.Add( (*iter)->visual.GetName(), instanceMap );
1526     }
1527   }
1528 }
1529
1530
1531 void Control::Impl::RemoveVisual( RegisteredVisualContainer& visuals, const std::string& visualName )
1532 {
1533   Actor self( mControlImpl.Self() );
1534
1535   for ( RegisteredVisualContainer::Iterator visualIter = visuals.Begin();
1536         visualIter != visuals.End(); ++visualIter )
1537   {
1538     Toolkit::Visual::Base visual = (*visualIter)->visual;
1539     if( visual && visual.GetName() == visualName )
1540     {
1541       Toolkit::GetImplementation(visual).SetOffScene( self );
1542       (*visualIter)->visual.Reset();
1543       visuals.Erase( visualIter );
1544       break;
1545     }
1546   }
1547 }
1548
1549 void Control::Impl::RemoveVisuals( RegisteredVisualContainer& visuals, DictionaryKeys& removeVisuals )
1550 {
1551   Actor self( mControlImpl.Self() );
1552   for( DictionaryKeys::iterator iter = removeVisuals.begin(); iter != removeVisuals.end(); ++iter )
1553   {
1554     const std::string visualName = *iter;
1555     RemoveVisual( visuals, visualName );
1556   }
1557 }
1558
1559 void Control::Impl::RecreateChangedVisuals( Dictionary<Property::Map>& stateVisualsToChange,
1560                              Dictionary<Property::Map>& instancedProperties )
1561 {
1562   Dali::CustomActor handle( mControlImpl.GetOwner() );
1563   for( Dictionary<Property::Map>::iterator iter = stateVisualsToChange.Begin();
1564        iter != stateVisualsToChange.End(); ++iter )
1565   {
1566     const std::string& visualName = (*iter).key;
1567     const Property::Map& toMap = (*iter).entry;
1568
1569     Actor self = mControlImpl.Self();
1570     RegisteredVisualContainer::Iterator registeredVisualsiter;
1571     // Check if visual (visualName) is already registered, this is the current visual.
1572     if(FindVisual(visualName, mVisuals, registeredVisualsiter))
1573     {
1574       Toolkit::Visual::Base& visual = (*registeredVisualsiter)->visual;
1575       if(visual)
1576       {
1577         // No longer required to know if the replaced visual's resources are ready
1578         StopObservingVisual(visual);
1579
1580         // If control staged then visuals will be swapped once ready
1581         if(self.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
1582         {
1583           // Check if visual is currently in the process of being replaced ( is in removal container )
1584           RegisteredVisualContainer::Iterator visualQueuedForRemoval;
1585           if(FindVisual(visualName, mRemoveVisuals, visualQueuedForRemoval))
1586           {
1587             // Visual with same visual name is already in removal container so current visual pending
1588             // Only the the last requested visual will be displayed so remove current visual which is staged but not ready.
1589             Toolkit::GetImplementation(visual).SetOffScene(self);
1590             (*registeredVisualsiter)->visual.Reset();
1591             mVisuals.Erase(registeredVisualsiter);
1592           }
1593           else
1594           {
1595             // current visual not already in removal container so add now.
1596             DALI_LOG_INFO(gLogFilter, Debug::Verbose, "RegisterVisual Move current registered visual to removal Queue: %s \n", visualName.c_str());
1597             MoveVisual(registeredVisualsiter, mVisuals, mRemoveVisuals);
1598           }
1599         }
1600         else
1601         {
1602           // Control not staged or visual disabled so can just erase from registered visuals and new visual will be added later.
1603           (*registeredVisualsiter)->visual.Reset();
1604           mVisuals.Erase(registeredVisualsiter);
1605         }
1606       }
1607
1608       const Property::Map* instancedMap = instancedProperties.FindConst(visualName);
1609       Style::ApplyVisual(handle, visualName, toMap, instancedMap);
1610     }
1611   }
1612 }
1613
1614 void Control::Impl::ReplaceStateVisualsAndProperties( const StylePtr oldState, const StylePtr newState, const std::string& subState )
1615 {
1616   // Collect all old visual names
1617   DictionaryKeys stateVisualsToRemove;
1618   if( oldState )
1619   {
1620     oldState->visuals.GetKeys( stateVisualsToRemove );
1621     if( ! subState.empty() )
1622     {
1623       const StylePtr* oldSubState = oldState->subStates.FindConst(subState);
1624       if( oldSubState )
1625       {
1626         DictionaryKeys subStateVisualsToRemove;
1627         (*oldSubState)->visuals.GetKeys( subStateVisualsToRemove );
1628         Merge( stateVisualsToRemove, subStateVisualsToRemove );
1629       }
1630     }
1631   }
1632
1633   // Collect all new visual properties
1634   Dictionary<Property::Map> stateVisualsToAdd;
1635   if( newState )
1636   {
1637     stateVisualsToAdd = newState->visuals;
1638     if( ! subState.empty() )
1639     {
1640       const StylePtr* newSubState = newState->subStates.FindConst(subState);
1641       if( newSubState )
1642       {
1643         stateVisualsToAdd.Merge( (*newSubState)->visuals );
1644       }
1645     }
1646   }
1647
1648   // If a name is in both add/remove, move it to change list.
1649   Dictionary<Property::Map> stateVisualsToChange;
1650   FindChangableVisuals( stateVisualsToAdd, stateVisualsToChange, stateVisualsToRemove);
1651
1652   // Copy instanced properties (e.g. text label) of current visuals
1653   Dictionary<Property::Map> instancedProperties;
1654   CopyInstancedProperties( mVisuals, instancedProperties );
1655
1656   // For each visual in remove list, remove from mVisuals
1657   RemoveVisuals( mVisuals, stateVisualsToRemove );
1658
1659   // For each visual in add list, create and add to mVisuals
1660   Dali::CustomActor handle( mControlImpl.GetOwner() );
1661   Style::ApplyVisuals( handle, stateVisualsToAdd, instancedProperties );
1662
1663   // For each visual in change list, if it requires a new visual,
1664   // remove old visual, create and add to mVisuals
1665   RecreateChangedVisuals( stateVisualsToChange, instancedProperties );
1666 }
1667
1668 void Control::Impl::SetState( DevelControl::State newState, bool withTransitions )
1669 {
1670   DevelControl::State oldState = mState;
1671   Dali::CustomActor handle( mControlImpl.GetOwner() );
1672   DALI_LOG_INFO(gLogFilter, Debug::Concise, "Control::Impl::SetState: %s\n",
1673                 (mState == DevelControl::NORMAL ? "NORMAL" :(
1674                   mState == DevelControl::FOCUSED ?"FOCUSED" : (
1675                     mState == DevelControl::DISABLED?"DISABLED":"NONE" ))));
1676
1677   if( mState != newState )
1678   {
1679     // If mState was Disabled, and new state is Focused, should probably
1680     // store that fact, e.g. in another property that FocusManager can access.
1681     mState = newState;
1682
1683     // Trigger state change and transitions
1684     // Apply new style, if stylemanager is available
1685     Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
1686     if( styleManager )
1687     {
1688       const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
1689
1690       if( stylePtr )
1691       {
1692         std::string oldStateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( oldState, ControlStateTable, ControlStateTableCount );
1693         std::string newStateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( newState, ControlStateTable, ControlStateTableCount );
1694
1695         const StylePtr* newStateStyle = stylePtr->subStates.Find( newStateName );
1696         const StylePtr* oldStateStyle = stylePtr->subStates.Find( oldStateName );
1697         if( oldStateStyle && newStateStyle )
1698         {
1699           // Only change if both state styles exist
1700           ReplaceStateVisualsAndProperties( *oldStateStyle, *newStateStyle, mSubStateName );
1701         }
1702       }
1703     }
1704   }
1705 }
1706
1707 void Control::Impl::SetSubState( const std::string& subStateName, bool withTransitions )
1708 {
1709   if( mSubStateName != subStateName )
1710   {
1711     // Get existing sub-state visuals, and unregister them
1712     Dali::CustomActor handle( mControlImpl.GetOwner() );
1713
1714     Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
1715     if( styleManager )
1716     {
1717       const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
1718       if( stylePtr )
1719       {
1720         // Stringify state
1721         std::string stateName = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( mState, ControlStateTable, ControlStateTableCount );
1722
1723         const StylePtr* state = stylePtr->subStates.Find( stateName );
1724         if( state )
1725         {
1726           StylePtr stateStyle(*state);
1727
1728           const StylePtr* newStateStyle = stateStyle->subStates.Find( subStateName );
1729           const StylePtr* oldStateStyle = stateStyle->subStates.Find( mSubStateName );
1730           if( oldStateStyle && newStateStyle )
1731           {
1732             std::string empty;
1733             ReplaceStateVisualsAndProperties( *oldStateStyle, *newStateStyle, empty );
1734           }
1735         }
1736       }
1737     }
1738
1739     mSubStateName = subStateName;
1740   }
1741 }
1742
1743 void Control::Impl::OnSceneDisconnection()
1744 {
1745   Actor self = mControlImpl.Self();
1746
1747   // Any visuals set for replacement but not yet ready should still be registered.
1748   // Reason: If a request was made to register a new visual but the control removed from scene before visual was ready
1749   // then when this control appears back on stage it should use that new visual.
1750
1751   // Iterate through all registered visuals and set off scene
1752   SetVisualsOffScene( mVisuals, self );
1753
1754   // Visuals pending replacement can now be taken out of the removal list and set off scene
1755   // Iterate through all replacement visuals and add to a move queue then set off scene
1756   for( auto removalIter = mRemoveVisuals.Begin(), end = mRemoveVisuals.End(); removalIter != end; removalIter++ )
1757   {
1758     Toolkit::GetImplementation((*removalIter)->visual).SetOffScene( self );
1759   }
1760
1761   for( auto replacedIter = mVisuals.Begin(), end = mVisuals.End(); replacedIter != end; replacedIter++ )
1762   {
1763     (*replacedIter)->pending = false;
1764   }
1765
1766   mRemoveVisuals.Clear();
1767 }
1768
1769 void Control::Impl::SetMargin( Extents margin )
1770 {
1771   mControlImpl.mImpl->mMargin = margin;
1772
1773   // Trigger a size negotiation request that may be needed when setting a margin.
1774   mControlImpl.RelayoutRequest();
1775 }
1776
1777 Extents Control::Impl::GetMargin() const
1778 {
1779   return mControlImpl.mImpl->mMargin;
1780 }
1781
1782 void Control::Impl::SetPadding( Extents padding )
1783 {
1784   mControlImpl.mImpl->mPadding = padding;
1785
1786   // Trigger a size negotiation request that may be needed when setting a padding.
1787   mControlImpl.RelayoutRequest();
1788 }
1789
1790 Extents Control::Impl::GetPadding() const
1791 {
1792   return mControlImpl.mImpl->mPadding;
1793 }
1794
1795 void Control::Impl::SetInputMethodContext( InputMethodContext& inputMethodContext )
1796 {
1797   mInputMethodContext = inputMethodContext;
1798 }
1799
1800 bool Control::Impl::FilterKeyEvent( const KeyEvent& event )
1801 {
1802   bool consumed ( false );
1803
1804   if ( mInputMethodContext )
1805   {
1806     consumed = mInputMethodContext.FilterEventKey( event );
1807   }
1808   return consumed;
1809 }
1810
1811 DevelControl::VisualEventSignalType& Control::Impl::VisualEventSignal()
1812 {
1813   return mVisualEventSignal;
1814 }
1815
1816 void Control::Impl::SetShadow( const Property::Map& map )
1817 {
1818   Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
1819   visual.SetName("shadow");
1820
1821   if( visual )
1822   {
1823     mControlImpl.mImpl->RegisterVisual( Toolkit::DevelControl::Property::SHADOW, visual, DepthIndex::BACKGROUND_EFFECT );
1824
1825     mControlImpl.RelayoutRequest();
1826   }
1827 }
1828
1829 void Control::Impl::ClearShadow()
1830 {
1831    mControlImpl.mImpl->UnregisterVisual( Toolkit::DevelControl::Property::SHADOW );
1832
1833    // Trigger a size negotiation request that may be needed when unregistering a visual.
1834    mControlImpl.RelayoutRequest();
1835 }
1836
1837 Dali::Property Control::Impl::GetVisualProperty(Dali::Property::Index index, Dali::Property::Key visualPropertyKey)
1838 {
1839   Toolkit::Visual::Base visual = GetVisualByIndex(mVisuals, index);
1840   if(visual)
1841   {
1842     Internal::Visual::Base& visualImpl = Toolkit::GetImplementation(visual);
1843     return visualImpl.GetPropertyObject(visualPropertyKey);
1844   }
1845
1846   Handle handle;
1847   return Dali::Property(handle, Property::INVALID_INDEX);
1848 }
1849
1850 void Control::Impl::EmitResourceReadySignal()
1851 {
1852   if(!mIsEmittingResourceReadySignal)
1853   {
1854     // Guard against calls to emit the signal during the callback
1855     mIsEmittingResourceReadySignal = true;
1856
1857     // If the signal handler changes visual, it may become ready during this call & therefore this method will
1858     // get called again recursively. If so, mNeedToEmitResourceReady is set below, and we act on it after that secondary
1859     // invocation has completed by notifying in an Idle callback to prevent further recursion.
1860     Dali::Toolkit::Control handle(mControlImpl.GetOwner());
1861     mResourceReadySignal.Emit(handle);
1862
1863     if(mNeedToEmitResourceReady)
1864     {
1865       // Add idler to emit the signal again
1866       if(!mIdleCallback)
1867       {
1868         // The callback manager takes the ownership of the callback object.
1869         mIdleCallback = MakeCallback( this, &Control::Impl::OnIdleCallback);
1870         Adaptor::Get().AddIdle(mIdleCallback, false);
1871       }
1872     }
1873
1874     mIsEmittingResourceReadySignal = false;
1875   }
1876   else
1877   {
1878     mNeedToEmitResourceReady = true;
1879   }
1880 }
1881
1882 void Control::Impl::OnIdleCallback()
1883 {
1884   if(mNeedToEmitResourceReady)
1885   {
1886     // Reset the flag
1887     mNeedToEmitResourceReady = false;
1888
1889     // A visual is ready so control may need relayouting if staged
1890     if(mControlImpl.Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
1891     {
1892       mControlImpl.RelayoutRequest();
1893     }
1894
1895     EmitResourceReadySignal();
1896   }
1897
1898   // Set the pointer to null as the callback manager deletes the callback after execute it.
1899   mIdleCallback = nullptr;
1900 }
1901
1902 Dali::Accessibility::Accessible *Control::Impl::GetAccessibilityObject()
1903 {
1904   if( !accessibilityObject )
1905     accessibilityObject = accessibilityConstructor( mControlImpl.Self() );
1906   return accessibilityObject.get();
1907 }
1908
1909 Dali::Accessibility::Accessible *Control::Impl::GetAccessibilityObject(Dali::Actor actor)
1910 {
1911   if( actor )
1912   {
1913     auto q = Dali::Toolkit::Control::DownCast( actor );
1914     if( q )
1915     {
1916       auto q2 = static_cast< Internal::Control* >( &q.GetImplementation() );
1917       return q2->mImpl->GetAccessibilityObject();
1918     }
1919   }
1920   return nullptr;
1921 }
1922
1923 Control::Impl::AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
1924   : self(self), modal(modal)
1925 {
1926   auto control = Dali::Toolkit::Control::DownCast(self);
1927
1928   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( control );
1929   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
1930   if( controlImpl.mAccessibilityRole == Dali::Accessibility::Role::UNKNOWN )
1931     controlImpl.mAccessibilityRole = role;
1932
1933   self.PropertySetSignal().Connect(&controlImpl, [this, &controlImpl](Dali::Handle &handle, Dali::Property::Index index, Dali::Property::Value value)
1934   {
1935     if (this->self != Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
1936     {
1937       return;
1938     }
1939
1940     if (index == DevelControl::Property::ACCESSIBILITY_NAME
1941       || (index == GetNamePropertyIndex() && !controlImpl.mAccessibilityNameSet))
1942     {
1943       if (controlImpl.mAccessibilityGetNameSignal.Empty())
1944       {
1945         Emit(Dali::Accessibility::ObjectPropertyChangeEvent::NAME);
1946       }
1947     }
1948
1949     if (index == DevelControl::Property::ACCESSIBILITY_DESCRIPTION
1950       || (index == GetDescriptionPropertyIndex() && !controlImpl.mAccessibilityDescriptionSet))
1951     {
1952       if (controlImpl.mAccessibilityGetDescriptionSignal.Empty())
1953       {
1954         Emit(Dali::Accessibility::ObjectPropertyChangeEvent::DESCRIPTION);
1955       }
1956     }
1957   });
1958 }
1959
1960 std::string Control::Impl::AccessibleImpl::GetName()
1961 {
1962   auto control = Dali::Toolkit::Control::DownCast(self);
1963
1964   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( control );
1965   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
1966
1967   if (!controlImpl.mAccessibilityGetNameSignal.Empty()) {
1968       std::string ret;
1969       controlImpl.mAccessibilityGetNameSignal.Emit(ret);
1970       return ret;
1971   }
1972
1973   if (controlImpl.mAccessibilityNameSet)
1974     return controlImpl.mAccessibilityName;
1975
1976   if (auto raw = GetNameRaw(); !raw.empty())
1977     return raw;
1978
1979   return self.GetProperty< std::string >( Actor::Property::NAME );
1980 }
1981
1982 std::string Control::Impl::AccessibleImpl::GetNameRaw()
1983 {
1984   return {};
1985 }
1986
1987 std::string Control::Impl::AccessibleImpl::GetDescription()
1988 {
1989   auto control = Dali::Toolkit::Control::DownCast(self);
1990
1991   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( control );
1992   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
1993
1994   if (!controlImpl.mAccessibilityGetDescriptionSignal.Empty()) {
1995       std::string ret;
1996       controlImpl.mAccessibilityGetDescriptionSignal.Emit(ret);
1997       return ret;
1998   }
1999
2000   if (controlImpl.mAccessibilityDescriptionSet)
2001     return controlImpl.mAccessibilityDescription;
2002
2003   return GetDescriptionRaw();
2004 }
2005
2006 std::string Control::Impl::AccessibleImpl::GetDescriptionRaw()
2007 {
2008   return "";
2009 }
2010
2011 Dali::Accessibility::Accessible* Control::Impl::AccessibleImpl::GetParent()
2012 {
2013   return Dali::Accessibility::Accessible::Get( self.GetParent() );
2014 }
2015
2016 size_t Control::Impl::AccessibleImpl::GetChildCount()
2017 {
2018   return self.GetChildCount();
2019 }
2020
2021 Dali::Accessibility::Accessible* Control::Impl::AccessibleImpl::GetChildAtIndex( size_t index )
2022 {
2023   return Dali::Accessibility::Accessible::Get( self.GetChildAt( static_cast< unsigned int >( index ) ) );
2024 }
2025
2026 size_t Control::Impl::AccessibleImpl::GetIndexInParent()
2027 {
2028   auto s = self;
2029   auto parent = s.GetParent();
2030   DALI_ASSERT_ALWAYS( parent && "can't call GetIndexInParent on object without parent" );
2031   auto count = parent.GetChildCount();
2032   for( auto i = 0u; i < count; ++i )
2033   {
2034     auto c = parent.GetChildAt( i );
2035     if( c == s )
2036       return i;
2037   }
2038   DALI_ASSERT_ALWAYS( false && "object isn't child of it's parent" );
2039   return static_cast<size_t>(-1);
2040 }
2041
2042 Dali::Accessibility::Role Control::Impl::AccessibleImpl::GetRole()
2043 {
2044   return self.GetProperty<Dali::Accessibility::Role>( Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE );
2045 }
2046
2047 Dali::Accessibility::States Control::Impl::AccessibleImpl::CalculateStates()
2048 {
2049   Dali::Accessibility::States s;
2050   s[Dali::Accessibility::State::FOCUSABLE] = self.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE );
2051   s[Dali::Accessibility::State::FOCUSED] = Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor() == self;
2052   if(self.GetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE ).GetType() == Property::NONE )
2053     s[Dali::Accessibility::State::HIGHLIGHTABLE] = false;
2054   else
2055     s[Dali::Accessibility::State::HIGHLIGHTABLE] = self.GetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE ).Get< bool >();
2056   s[Dali::Accessibility::State::HIGHLIGHTED] = GetCurrentlyHighlightedActor() == self;
2057   s[Dali::Accessibility::State::ENABLED] = true;
2058   s[Dali::Accessibility::State::SENSITIVE] = true;
2059   s[Dali::Accessibility::State::ANIMATED] = self.GetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED ).Get< bool >();
2060   s[Dali::Accessibility::State::VISIBLE] = true;
2061   if( modal )
2062   {
2063     s[Dali::Accessibility::State::MODAL] = true;
2064   }
2065   s[Dali::Accessibility::State::SHOWING] = !self.GetProperty( Dali::DevelActor::Property::CULLED ).Get< bool >()
2066                                          && self.GetCurrentProperty< bool >( Actor::Property::VISIBLE );
2067
2068   s[Dali::Accessibility::State::DEFUNCT] = !self.GetProperty( Dali::DevelActor::Property::CONNECTED_TO_SCENE ).Get< bool >();
2069   return s;
2070 }
2071
2072 Dali::Accessibility::States Control::Impl::AccessibleImpl::GetStates()
2073 {
2074   return CalculateStates();
2075 }
2076
2077 Dali::Accessibility::Attributes Control::Impl::AccessibleImpl::GetAttributes()
2078 {
2079   std::unordered_map< std::string, std::string > attribute_map;
2080   auto q = Dali::Toolkit::Control::DownCast( self );
2081   auto w =
2082       q.GetProperty( Dali::Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES );
2083   auto z = w.GetMap();
2084
2085   if( z )
2086   {
2087     auto map_size = z->Count();
2088
2089     for( unsigned int i = 0; i < map_size; i++ )
2090     {
2091       auto map_key = z->GetKeyAt( i );
2092       if( map_key.type == Property::Key::STRING )
2093       {
2094         std::string map_value;
2095         if( z->GetValue( i ).Get( map_value ) )
2096         {
2097           attribute_map.emplace( std::move( map_key.stringKey ),
2098                                  std::move( map_value ) );
2099         }
2100       }
2101     }
2102   }
2103
2104   return attribute_map;
2105 }
2106
2107 Dali::Accessibility::ComponentLayer Control::Impl::AccessibleImpl::GetLayer()
2108 {
2109   return Dali::Accessibility::ComponentLayer::WINDOW;
2110 }
2111
2112 Dali::Rect<> Control::Impl::AccessibleImpl::GetExtents( Dali::Accessibility::CoordType ctype )
2113 {
2114   Vector2 screenPosition =
2115       self.GetProperty( Dali::DevelActor::Property::SCREEN_POSITION )
2116           .Get< Vector2 >();
2117   auto size = self.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) * self.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE );
2118   bool positionUsesAnchorPoint =
2119       self.GetProperty( Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
2120           .Get< bool >();
2121   Vector3 anchorPointOffSet =
2122       size * ( positionUsesAnchorPoint ? self.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT )
2123                                        : AnchorPoint::TOP_LEFT );
2124   Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x,
2125                               screenPosition.y - anchorPointOffSet.y );
2126
2127   return { position.x, position.y, size.x, size.y };
2128 }
2129
2130 int16_t Control::Impl::AccessibleImpl::GetMdiZOrder() { return 0; }
2131 double Control::Impl::AccessibleImpl::GetAlpha() { return 0; }
2132
2133 bool Control::Impl::AccessibleImpl::GrabFocus()
2134 {
2135   return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor( self );
2136 }
2137
2138 const char* const FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "keyboard_focus.9.png";
2139
2140 static Dali::Actor CreateHighlightIndicatorActor()
2141 {
2142   // Create the default if it hasn't been set and one that's shared by all the
2143   // keyboard focusable actors const char* const FOCUS_BORDER_IMAGE_PATH =
2144   // DALI_IMAGE_DIR "keyboard_focus.9.png";
2145   auto actor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH );
2146   actor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
2147   DevelControl::AppendAccessibilityAttribute( actor, "highlight", "" );
2148   actor.SetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED, true);
2149   actor.SetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, false );
2150
2151   return actor;
2152 }
2153
2154 bool Control::Impl::AccessibleImpl::GrabHighlight()
2155 {
2156   auto old = GetCurrentlyHighlightedActor();
2157
2158   if( !Dali::Accessibility::IsUp() )
2159       return false;
2160   if( self == old )
2161     return true;
2162   if( old )
2163   {
2164     auto c = dynamic_cast< Dali::Accessibility::Component* >( GetAccessibilityObject( old ) );
2165     if( c )
2166       c->ClearHighlight();
2167   }
2168   auto highlight = GetHighlightActor();
2169   if ( !highlight )
2170   {
2171     highlight = CreateHighlightIndicatorActor();
2172     SetHighlightActor( highlight );
2173   }
2174   highlight.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
2175   highlight.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
2176   highlight.SetProperty( Actor::Property::POSITION_Z, 1.0f );
2177   highlight.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f ));
2178
2179   EnsureSelfVisible();
2180   self.Add( highlight );
2181   SetCurrentlyHighlightedActor( self );
2182   EmitHighlighted( true );
2183
2184   return true;
2185 }
2186
2187
2188
2189 bool Control::Impl::AccessibleImpl::ClearHighlight()
2190 {
2191   if( !Dali::Accessibility::IsUp() )
2192     return false;
2193   if( GetCurrentlyHighlightedActor() == self )
2194   {
2195     self.Remove( GetHighlightActor() );
2196     SetCurrentlyHighlightedActor( {} );
2197     EmitHighlighted( false );
2198     return true;
2199   }
2200   return false;
2201 }
2202
2203 std::string Control::Impl::AccessibleImpl::GetActionName( size_t index )
2204 {
2205   if ( index >= GetActionCount() ) return "";
2206   Dali::TypeInfo type;
2207   self.GetTypeInfo( type );
2208   DALI_ASSERT_ALWAYS( type && "no TypeInfo object" );
2209   return type.GetActionName( index );
2210 }
2211 std::string Control::Impl::AccessibleImpl::GetLocalizedActionName( size_t index )
2212 {
2213   // TODO: add localization
2214   return GetActionName( index );
2215 }
2216 std::string Control::Impl::AccessibleImpl::GetActionDescription( size_t index )
2217 {
2218   return "";
2219 }
2220 size_t Control::Impl::AccessibleImpl::GetActionCount()
2221 {
2222   Dali::TypeInfo type;
2223   self.GetTypeInfo( type );
2224   DALI_ASSERT_ALWAYS( type && "no TypeInfo object" );
2225   return type.GetActionCount();
2226 }
2227 std::string Control::Impl::AccessibleImpl::GetActionKeyBinding( size_t index )
2228 {
2229   return "";
2230 }
2231 bool Control::Impl::AccessibleImpl::DoAction( size_t index )
2232 {
2233   std::string actionName = GetActionName( index );
2234   return self.DoAction( actionName, {} );
2235 }
2236 bool Control::Impl::AccessibleImpl::DoAction(const std::string& name)
2237 {
2238   return self.DoAction( name, {} );
2239 }
2240
2241 bool Control::Impl::AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo &gestureInfo)
2242 {
2243   auto control = Dali::Toolkit::Control::DownCast(self);
2244
2245   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( control );
2246   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
2247
2248   if (!controlImpl.mAccessibilityDoGestureSignal.Empty()) {
2249       auto ret = std::make_pair(gestureInfo, false);
2250       controlImpl.mAccessibilityDoGestureSignal.Emit(ret);
2251       return ret.second;
2252   }
2253
2254   return false;
2255 }
2256
2257 std::vector<Dali::Accessibility::Relation> Control::Impl::AccessibleImpl::GetRelationSet()
2258 {
2259   auto control = Dali::Toolkit::Control::DownCast(self);
2260
2261   Internal::Control& internalControl = Toolkit::Internal::GetImplementation( control );
2262   Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get( internalControl );
2263
2264   std::vector<Dali::Accessibility::Relation> ret;
2265
2266   auto &v = controlImpl.mAccessibilityRelations;
2267   for (auto i = 0u; i < v.size(); ++i)
2268   {
2269     if ( v[i].empty() )
2270       continue;
2271
2272     ret.emplace_back( Accessibility::Relation{ static_cast<Accessibility::RelationType>(i), v[i] } );
2273   }
2274
2275   return ret;
2276 }
2277
2278 void Control::Impl::AccessibleImpl::EnsureChildVisible(Actor child)
2279 {
2280 }
2281
2282 void Control::Impl::AccessibleImpl::EnsureSelfVisible()
2283 {
2284   auto parent = dynamic_cast<Control::Impl::AccessibleImpl*>(GetParent());
2285   if (parent)
2286   {
2287     parent->EnsureChildVisible(self);
2288   }
2289 }
2290
2291 Property::Index Control::Impl::AccessibleImpl::GetNamePropertyIndex()
2292 {
2293   return Actor::Property::NAME;
2294 }
2295
2296 Property::Index Control::Impl::AccessibleImpl::GetDescriptionPropertyIndex()
2297 {
2298   return Property::INVALID_INDEX;
2299 }
2300
2301 void Control::Impl::PositionOrSizeChangedCallback( PropertyNotification &p )
2302 {
2303   auto self = Dali::Actor::DownCast(p.GetTarget());
2304   if (Dali::Accessibility::IsUp() && !self.GetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_ANIMATED ).Get< bool >())
2305   {
2306     auto extents = DevelActor::CalculateScreenExtents( self );
2307     Dali::Accessibility::Accessible::Get( self )->EmitBoundsChanged( extents );
2308   }
2309 }
2310
2311 void Control::Impl::CulledChangedCallback( PropertyNotification &p)
2312 {
2313   if (Dali::Accessibility::IsUp())
2314   {
2315     auto self = Dali::Actor::DownCast(p.GetTarget());
2316     Dali::Accessibility::Accessible::Get(self)->EmitShowing( !self.GetProperty( DevelActor::Property::CULLED ).Get<bool>() );
2317   }
2318 }
2319
2320 void Control::Impl::AccessibilityRegister()
2321 {
2322   if (!accessibilityNotificationSet)
2323   {
2324     accessibilityNotificationPosition = mControlImpl.Self().AddPropertyNotification( Actor::Property::POSITION, StepCondition( 0.01f ) );
2325     accessibilityNotificationPosition.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED );
2326     accessibilityNotificationPosition.NotifySignal().Connect( &Control::Impl::PositionOrSizeChangedCallback );
2327
2328     accessibilityNotificationSize = mControlImpl.Self().AddPropertyNotification( Actor::Property::SIZE, StepCondition( 0.01f ) );
2329     accessibilityNotificationSize.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED );
2330     accessibilityNotificationSize.NotifySignal().Connect( &Control::Impl::PositionOrSizeChangedCallback );
2331
2332     accessibilityNotificationCulled = mControlImpl.Self().AddPropertyNotification( DevelActor::Property::CULLED, LessThanCondition( 0.5f ) );
2333     accessibilityNotificationCulled.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED );
2334     accessibilityNotificationCulled.NotifySignal().Connect( &Control::Impl::CulledChangedCallback );
2335
2336     accessibilityNotificationSet = true;
2337   }
2338 }
2339
2340 void Control::Impl::AccessibilityDeregister()
2341 {
2342   if (accessibilityNotificationSet)
2343   {
2344     accessibilityNotificationPosition = {};
2345     accessibilityNotificationSize = {};
2346     accessibilityNotificationCulled = {};
2347     accessibilityNotificationSet = false;
2348   }
2349 }
2350
2351 void Control::Impl::SetAutofillEnabled( bool autofillEnabled )
2352 {
2353   mIsAutofillEnabled = autofillEnabled;
2354 }
2355
2356 bool Control::Impl::IsAutofillEnabled()
2357 {
2358   return mIsAutofillEnabled;
2359 }
2360
2361 void Control::Impl::SetAutofillItemHandle( Dali::AutofillItem item )
2362 {
2363   mAutofillItem = item;
2364 }
2365
2366 Dali::AutofillItem Control::Impl::GetAutofillItemHandle()
2367 {
2368   return mAutofillItem;
2369 }
2370
2371 void Control::Impl::SetAutofillContainer( Toolkit::AutofillContainer container )
2372 {
2373   mAutofillContainer = container;
2374 }
2375
2376 Toolkit::AutofillContainer Control::Impl::GetAutofillContainer()
2377 {
2378   return mAutofillContainer;
2379 }
2380
2381 } // namespace Internal
2382
2383 } // namespace Toolkit
2384
2385 } // namespace Dali