Revert "Move Some Devel Properties & APIs to the Public API"
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-field-impl.cpp
1 /*
2  * Copyright (c) 2017 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 <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
20
21 // EXTERNAL INCLUDES
22 #include <cstring>
23 #include <dali/public-api/adaptor-framework/key.h>
24 #include <dali/public-api/common/stage.h>
25 #include <dali/public-api/images/resource-image.h>
26 #include <dali/devel-api/object/property-helper-devel.h>
27 #include <dali/devel-api/actors/actor-devel.h>
28 #include <dali/public-api/object/type-registry-helper.h>
29 #include <dali/integration-api/adaptors/adaptor.h>
30 #include <dali/integration-api/debug.h>
31
32 // INTERNAL INCLUDES
33 #include <dali-toolkit/public-api/text/rendering-backend.h>
34 #include <dali-toolkit/public-api/text/text-enumerations.h>
35 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
36 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
37 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
38 #include <dali-toolkit/public-api/visuals/visual-properties.h>
39 #include <dali-toolkit/internal/text/text-enumerations-impl.h>
40 #include <dali-toolkit/internal/text/rendering/text-backend.h>
41 #include <dali-toolkit/internal/text/text-effects-style.h>
42 #include <dali-toolkit/internal/text/text-font-style.h>
43 #include <dali-toolkit/internal/text/text-view.h>
44 #include <dali-toolkit/internal/styling/style-manager-impl.h>
45
46 using namespace Dali::Toolkit::Text;
47
48 namespace Dali
49 {
50
51 namespace Toolkit
52 {
53
54 namespace Internal
55 {
56
57 namespace // unnamed namespace
58 {
59
60 #if defined(DEBUG_ENABLED)
61   Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
62 #endif
63
64   const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
65 } // unnamed namespace
66
67 namespace
68 {
69 // Type registration
70 BaseHandle Create()
71 {
72   return Toolkit::TextField::New();
73 }
74
75 // Setup properties, signals and actions using the type-registry.
76 DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextField, Toolkit::Control, Create );
77
78 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "renderingBackend",                     INTEGER,   RENDERING_BACKEND                    )
79 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "text",                                 STRING,    TEXT                                 )
80 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderText",                      STRING,    PLACEHOLDER_TEXT                     )
81 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextFocused",               STRING,    PLACEHOLDER_TEXT_FOCUSED             )
82 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontFamily",                           STRING,    FONT_FAMILY                          )
83 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "fontStyle",                            MAP,       FONT_STYLE                           )
84 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "pointSize",                            FLOAT,     POINT_SIZE                           )
85 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "maxLength",                            INTEGER,   MAX_LENGTH                           )
86 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "exceedPolicy",                         INTEGER,   EXCEED_POLICY                        )
87 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "horizontalAlignment",                  STRING,    HORIZONTAL_ALIGNMENT                 )
88 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "verticalAlignment",                    STRING,    VERTICAL_ALIGNMENT                   )
89 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "textColor",                            VECTOR4,   TEXT_COLOR                           )
90 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextColor",                 VECTOR4,   PLACEHOLDER_TEXT_COLOR               )
91 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadowOffset",                         VECTOR2,   SHADOW_OFFSET                        )
92 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadowColor",                          VECTOR4,   SHADOW_COLOR                         )
93 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "primaryCursorColor",                   VECTOR4,   PRIMARY_CURSOR_COLOR                 )
94 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "secondaryCursorColor",                 VECTOR4,   SECONDARY_CURSOR_COLOR               )
95 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableCursorBlink",                    BOOLEAN,   ENABLE_CURSOR_BLINK                  )
96 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "cursorBlinkInterval",                  FLOAT,     CURSOR_BLINK_INTERVAL                )
97 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "cursorBlinkDuration",                  FLOAT,     CURSOR_BLINK_DURATION                )
98 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "cursorWidth",                          INTEGER,   CURSOR_WIDTH                         )
99 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "grabHandleImage",                      STRING,    GRAB_HANDLE_IMAGE                    )
100 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "grabHandlePressedImage",               STRING,    GRAB_HANDLE_PRESSED_IMAGE            )
101 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "scrollThreshold",                      FLOAT,     SCROLL_THRESHOLD                     )
102 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "scrollSpeed",                          FLOAT,     SCROLL_SPEED                         )
103 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHandleImageLeft",             MAP,       SELECTION_HANDLE_IMAGE_LEFT          )
104 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHandleImageRight",            MAP,       SELECTION_HANDLE_IMAGE_RIGHT         )
105 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHandlePressedImageLeft",      MAP,       SELECTION_HANDLE_PRESSED_IMAGE_LEFT  )
106 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHandlePressedImageRight",     MAP,       SELECTION_HANDLE_PRESSED_IMAGE_RIGHT )
107 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHandleMarkerImageLeft",       MAP,       SELECTION_HANDLE_MARKER_IMAGE_LEFT   )
108 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHandleMarkerImageRight",      MAP,       SELECTION_HANDLE_MARKER_IMAGE_RIGHT  )
109 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "selectionHighlightColor",              VECTOR4,   SELECTION_HIGHLIGHT_COLOR            )
110 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "decorationBoundingBox",                RECTANGLE, DECORATION_BOUNDING_BOX              )
111 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputMethodSettings",                  MAP,       INPUT_METHOD_SETTINGS                )
112 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputColor",                           VECTOR4,   INPUT_COLOR                          )
113 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableMarkup",                         BOOLEAN,   ENABLE_MARKUP                        )
114 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontFamily",                      STRING,    INPUT_FONT_FAMILY                    )
115 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle",                       MAP,       INPUT_FONT_STYLE                     )
116 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputPointSize",                       FLOAT,     INPUT_POINT_SIZE                     )
117 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline",                            MAP,       UNDERLINE                            )
118 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline",                       MAP,       INPUT_UNDERLINE                      )
119 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow",                               MAP,       SHADOW                               )
120 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow",                          MAP,       INPUT_SHADOW                         )
121 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss",                               MAP,       EMBOSS                               )
122 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss",                          MAP,       INPUT_EMBOSS                         )
123 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline",                              MAP,       OUTLINE                              )
124 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline",                         MAP,       INPUT_OUTLINE                        )
125 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "hiddenInputSettings",                  MAP,       HIDDEN_INPUT_SETTINGS                )
126 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "pixelSize",                            FLOAT,     PIXEL_SIZE                           )
127 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableSelection",                      BOOLEAN,   ENABLE_SELECTION                     )
128 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholder",                          MAP,       PLACEHOLDER                          )
129 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "ellipsis",                             BOOLEAN,   ELLIPSIS                             )
130
131 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged",        SIGNAL_TEXT_CHANGED )
132 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached",   SIGNAL_MAX_LENGTH_REACHED )
133 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "inputStyleChanged",  SIGNAL_INPUT_STYLE_CHANGED )
134
135 DALI_TYPE_REGISTRATION_END()
136
137 } // namespace
138
139 Toolkit::TextField TextField::New()
140 {
141   // Create the implementation, temporarily owned by this handle on stack
142   IntrusivePtr< TextField > impl = new TextField();
143
144   // Pass ownership to CustomActor handle
145   Toolkit::TextField handle( *impl );
146
147   // Second-phase init of the implementation
148   // This can only be done after the CustomActor connection has been made...
149   impl->Initialize();
150
151   return handle;
152 }
153
154 void TextField::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
155 {
156   Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
157
158   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField SetProperty\n");
159
160
161   if( textField )
162   {
163     TextField& impl( GetImpl( textField ) );
164
165     switch( index )
166     {
167       case Toolkit::TextField::Property::RENDERING_BACKEND:
168       {
169         int backend = value.Get< int >();
170         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p RENDERING_BACKEND %d\n", impl.mController.Get(), backend );
171
172 #ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
173         if( Text::RENDERING_VECTOR_BASED == backend )
174         {
175           backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
176         }
177 #endif
178         if( impl.mRenderingBackend != backend )
179         {
180           impl.mRenderingBackend = backend;
181           impl.mRenderer.Reset();
182
183           if( impl.mController )
184           {
185             // When using the vector-based rendering, the size of the GLyphs are different
186             TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
187             impl.mController->SetGlyphType( glyphType );
188           }
189         }
190         break;
191       }
192       case Toolkit::TextField::Property::TEXT:
193       {
194         if( impl.mController )
195         {
196           const std::string& text = value.Get< std::string >();
197           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() );
198
199           impl.mController->SetText( text );
200         }
201         break;
202       }
203       case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
204       {
205         if( impl.mController )
206         {
207           const std::string& text = value.Get< std::string >();
208           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
209
210           impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
211         }
212         break;
213       }
214       case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED:
215       {
216         if( impl.mController )
217         {
218           const std::string& text = value.Get< std::string >();
219           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() );
220
221           impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
222         }
223         break;
224       }
225       case Toolkit::TextField::Property::FONT_FAMILY:
226       {
227         if( impl.mController )
228         {
229           const std::string& fontFamily = value.Get< std::string >();
230           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
231           impl.mController->SetDefaultFontFamily( fontFamily );
232         }
233         break;
234       }
235       case Toolkit::TextField::Property::FONT_STYLE:
236       {
237         SetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
238         break;
239       }
240       case Toolkit::TextField::Property::POINT_SIZE:
241       {
242         if( impl.mController )
243         {
244           const float pointSize = value.Get< float >();
245           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p POINT_SIZE %f\n", impl.mController.Get(), pointSize );
246
247           if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
248           {
249             impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
250           }
251         }
252         break;
253       }
254       case Toolkit::TextField::Property::MAX_LENGTH:
255       {
256         if( impl.mController )
257         {
258           const int max = value.Get< int >();
259           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max );
260
261           impl.mController->SetMaximumNumberOfCharacters( max );
262         }
263         break;
264       }
265       case Toolkit::TextField::Property::EXCEED_POLICY:
266       {
267         impl.mExceedPolicy = value.Get<int>();
268
269         if( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == impl.mExceedPolicy )
270         {
271           impl.EnableClipping();
272         }
273         else
274         {
275           UnparentAndReset( impl.mStencil );
276         }
277         impl.RequestTextRelayout();
278         break;
279       }
280       case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
281       {
282         if( impl.mController )
283         {
284           Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
285           if( GetHorizontalAlignmentEnumeration( value, alignment ) )
286           {
287             DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
288             impl.mController->SetHorizontalAlignment( alignment );
289           }
290         }
291         break;
292       }
293       case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
294       {
295         if( impl.mController )
296         {
297           Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
298           if( GetVerticalAlignmentEnumeration( value, alignment ) )
299           {
300             impl.mController->SetVerticalAlignment( alignment );
301             DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
302           }
303         }
304         break;
305       }
306       case Toolkit::TextField::Property::TEXT_COLOR:
307       {
308         if( impl.mController )
309         {
310           const Vector4& textColor = value.Get< Vector4 >();
311           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
312
313           if( impl.mController->GetDefaultColor() != textColor )
314           {
315             impl.mController->SetDefaultColor( textColor );
316             impl.mController->SetInputColor( textColor );
317             impl.mRenderer.Reset();
318           }
319         }
320         break;
321       }
322       case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR:
323       {
324         if( impl.mController )
325         {
326           const Vector4& textColor = value.Get< Vector4 >();
327           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
328
329           if( impl.mController->GetPlaceholderTextColor() != textColor )
330           {
331             impl.mController->SetPlaceholderTextColor( textColor );
332             impl.mRenderer.Reset();
333           }
334         }
335         break;
336       }
337       case Toolkit::TextField::Property::SHADOW_OFFSET:
338       {
339         if( impl.mController )
340         {
341           const Vector2& shadowOffset = value.Get< Vector2 >();
342           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_OFFSET %f,%f\n", impl.mController.Get(), shadowOffset.x, shadowOffset.y );
343
344           if ( impl.mController->GetShadowOffset() != shadowOffset )
345           {
346             impl.mController->SetShadowOffset( shadowOffset );
347             impl.mRenderer.Reset();
348           }
349         }
350         break;
351       }
352       case Toolkit::TextField::Property::SHADOW_COLOR:
353       {
354         if( impl.mController )
355         {
356           const Vector4& shadowColor = value.Get< Vector4 >();
357           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_COLOR %f,%f,%f,%f\n", impl.mController.Get(), shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a );
358
359           if ( impl.mController->GetShadowColor() != shadowColor )
360           {
361             impl.mController->SetShadowColor( shadowColor );
362             impl.mRenderer.Reset();
363           }
364         }
365         break;
366       }
367       case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
368       {
369         if( impl.mDecorator )
370         {
371           const Vector4& color = value.Get< Vector4 >();
372           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
373
374           impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
375           impl.RequestTextRelayout();
376         }
377         break;
378       }
379       case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
380       {
381         if( impl.mDecorator )
382         {
383           const Vector4& color = value.Get< Vector4 >();
384           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
385
386           impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
387           impl.RequestTextRelayout();
388         }
389         break;
390       }
391       case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
392       {
393         if( impl.mController )
394         {
395           const bool enable = value.Get< bool >();
396           DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable );
397
398           impl.mController->SetEnableCursorBlink( enable );
399           impl.RequestTextRelayout();
400         }
401         break;
402       }
403       case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
404       {
405         if( impl.mDecorator )
406         {
407           const float interval = value.Get< float >();
408           DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval );
409
410           impl.mDecorator->SetCursorBlinkInterval( interval );
411         }
412         break;
413       }
414       case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
415       {
416         if( impl.mDecorator )
417         {
418           const float duration = value.Get< float >();
419           DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration );
420
421           impl.mDecorator->SetCursorBlinkDuration( duration );
422         }
423         break;
424       }
425       case Toolkit::TextField::Property::CURSOR_WIDTH:
426       {
427         if( impl.mDecorator )
428         {
429           const int width = value.Get< int >();
430           DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_WIDTH %d\n", impl.mController.Get(), width );
431
432           impl.mDecorator->SetCursorWidth( width );
433           impl.mController->GetLayoutEngine().SetCursorWidth( width );
434         }
435         break;
436       }
437       case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
438       {
439         const ResourceImage image = ResourceImage::New( value.Get< std::string >() );
440         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() );
441
442         if( impl.mDecorator )
443         {
444           impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, image );
445           impl.RequestTextRelayout();
446         }
447         break;
448       }
449       case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
450       {
451         const ResourceImage image = ResourceImage::New( value.Get< std::string >() );
452         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() );
453
454         if( impl.mDecorator )
455         {
456           impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, image );
457           impl.RequestTextRelayout();
458         }
459         break;
460       }
461       case Toolkit::TextField::Property::SCROLL_THRESHOLD:
462       {
463         const float threshold = value.Get< float >();
464         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold );
465
466         if( impl.mDecorator )
467         {
468           impl.mDecorator->SetScrollThreshold( threshold );
469         }
470         break;
471       }
472       case Toolkit::TextField::Property::SCROLL_SPEED:
473       {
474         const float speed = value.Get< float >();
475         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_SPEED %f\n", impl.mController.Get(), speed );
476
477         if( impl.mDecorator )
478         {
479           impl.mDecorator->SetScrollSpeed( speed );
480         }
481         break;
482       }
483       case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
484       {
485         const Image image = Scripting::NewImage( value );
486
487         if( impl.mDecorator && image )
488         {
489           impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image );
490           impl.RequestTextRelayout();
491         }
492         break;
493       }
494       case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT:
495       {
496         const Image image = Scripting::NewImage( value );
497
498         if( impl.mDecorator && image )
499         {
500           impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image );
501           impl.RequestTextRelayout();
502         }
503         break;
504       }
505       case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT:
506       {
507         const Image image = Scripting::NewImage( value );
508
509         if( impl.mDecorator && image )
510         {
511           impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image );
512           impl.RequestTextRelayout();
513         }
514         break;
515       }
516       case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT:
517       {
518         const Image image = Scripting::NewImage( value );
519
520         if( impl.mDecorator && image )
521         {
522           impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image );
523           impl.RequestTextRelayout();
524         }
525         break;
526       }
527       case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT:
528       {
529         const Image image = Scripting::NewImage( value );
530
531         if( impl.mDecorator && image )
532         {
533           impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image );
534           impl.RequestTextRelayout();
535         }
536         break;
537       }
538       case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT:
539       {
540         const Image image = Scripting::NewImage( value );
541
542         if( impl.mDecorator && image )
543         {
544           impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image );
545           impl.RequestTextRelayout();
546         }
547         break;
548       }
549       case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
550       {
551         const Vector4 color = value.Get< Vector4 >();
552         DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SELECTION_HIGHLIGHT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
553
554         if( impl.mDecorator )
555         {
556           impl.mDecorator->SetHighlightColor( color );
557           impl.RequestTextRelayout();
558         }
559         break;
560       }
561       case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
562       {
563         if( impl.mDecorator )
564         {
565           const Rect<int> box = value.Get< Rect<int> >();
566           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
567
568           impl.mDecorator->SetBoundingBox( box );
569           impl.RequestTextRelayout();
570         }
571         break;
572       }
573       case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
574       {
575         const Property::Map* map = value.GetMap();
576         if (map)
577         {
578           impl.mInputMethodOptions.ApplyProperty( *map );
579         }
580         impl.mController->SetInputModePassword( impl.mInputMethodOptions.IsPassword() );
581
582         Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
583         if (control == textField)
584         {
585           impl.mImfManager.ApplyOptions( impl.mInputMethodOptions );
586         }
587         break;
588       }
589       case Toolkit::TextField::Property::INPUT_COLOR:
590       {
591         if( impl.mController )
592         {
593           const Vector4 inputColor = value.Get< Vector4 >();
594           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a );
595
596           impl.mController->SetInputColor( inputColor );
597         }
598         break;
599       }
600       case Toolkit::TextField::Property::ENABLE_MARKUP:
601       {
602         if( impl.mController )
603         {
604           const bool enableMarkup = value.Get<bool>();
605           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup );
606
607           impl.mController->SetMarkupProcessorEnabled( enableMarkup );
608         }
609         break;
610       }
611       case Toolkit::TextField::Property::INPUT_FONT_FAMILY:
612       {
613         if( impl.mController )
614         {
615           const std::string& fontFamily = value.Get< std::string >();
616           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
617           impl.mController->SetInputFontFamily( fontFamily );
618         }
619         break;
620       }
621       case Toolkit::TextField::Property::INPUT_FONT_STYLE:
622       {
623         SetFontStyleProperty( impl.mController, value, Text::FontStyle::INPUT );
624         break;
625       }
626       case Toolkit::TextField::Property::INPUT_POINT_SIZE:
627       {
628         if( impl.mController )
629         {
630           const float pointSize = value.Get< float >();
631           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize );
632           impl.mController->SetInputFontPointSize( pointSize );
633         }
634         break;
635       }
636       case Toolkit::TextField::Property::UNDERLINE:
637       {
638         const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
639         if( update )
640         {
641           impl.mRenderer.Reset();
642         }
643         break;
644       }
645       case Toolkit::TextField::Property::INPUT_UNDERLINE:
646       {
647         const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
648         if( update )
649         {
650           impl.mRenderer.Reset();
651         }
652         break;
653       }
654       case Toolkit::TextField::Property::SHADOW:
655       {
656         const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
657         if( update )
658         {
659           impl.mRenderer.Reset();
660         }
661         break;
662       }
663       case Toolkit::TextField::Property::INPUT_SHADOW:
664       {
665         const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
666         if( update )
667         {
668           impl.mRenderer.Reset();
669         }
670         break;
671       }
672       case Toolkit::TextField::Property::EMBOSS:
673       {
674         const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
675         if( update )
676         {
677           impl.mRenderer.Reset();
678         }
679         break;
680       }
681       case Toolkit::TextField::Property::INPUT_EMBOSS:
682       {
683         const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
684         if( update )
685         {
686           impl.mRenderer.Reset();
687         }
688         break;
689       }
690       case Toolkit::TextField::Property::OUTLINE:
691       {
692         const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
693         if( update )
694         {
695           impl.mRenderer.Reset();
696         }
697         break;
698       }
699       case Toolkit::TextField::Property::INPUT_OUTLINE:
700       {
701         const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
702         if( update )
703         {
704           impl.mRenderer.Reset();
705         }
706         break;
707       }
708       case Toolkit::TextField::Property::HIDDEN_INPUT_SETTINGS:
709       {
710         const Property::Map* map = value.GetMap();
711         if (map)
712         {
713           impl.mController->SetHiddenInputOption(*map);
714         }
715         break;
716       }
717       case Toolkit::TextField::Property::PIXEL_SIZE:
718       {
719         if( impl.mController )
720         {
721           const float pixelSize = value.Get< float >();
722           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
723
724           if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
725           {
726             impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
727           }
728         }
729         break;
730       }
731       case Toolkit::TextField::Property::ENABLE_SELECTION:
732       {
733         if( impl.mController )
734         {
735           const bool enableSelection = value.Get< bool >();
736            DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
737           impl.mController->SetSelectionEnabled( enableSelection );
738         }
739         break;
740       }
741       case Toolkit::TextField::Property::PLACEHOLDER:
742       {
743         const Property::Map* map = value.GetMap();
744         if( map )
745         {
746           impl.mController->SetPlaceholderProperty( *map );
747         }
748         break;
749       }
750       case Toolkit::TextField::Property::ELLIPSIS:
751       {
752         if( impl.mController )
753         {
754           const bool ellipsis = value.Get<bool>();
755           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis );
756
757           impl.mController->SetTextElideEnabled( ellipsis );
758         }
759         break;
760       }
761     } // switch
762   } // textfield
763 }
764
765 Property::Value TextField::GetProperty( BaseObject* object, Property::Index index )
766 {
767   Property::Value value;
768
769   Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
770
771   if( textField )
772   {
773     TextField& impl( GetImpl( textField ) );
774
775     switch( index )
776     {
777       case Toolkit::TextField::Property::RENDERING_BACKEND:
778       {
779         value = impl.mRenderingBackend;
780         break;
781       }
782       case Toolkit::TextField::Property::TEXT:
783       {
784         if( impl.mController )
785         {
786           std::string text;
787           impl.mController->GetText( text );
788           DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str() );
789           value = text;
790         }
791         break;
792       }
793       case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
794       {
795         if( impl.mController )
796         {
797           std::string text;
798           impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
799           value = text;
800         }
801         break;
802       }
803       case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED:
804       {
805         if( impl.mController )
806         {
807           std::string text;
808           impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
809           value = text;
810         }
811         break;
812       }
813       case Toolkit::TextField::Property::FONT_FAMILY:
814       {
815         if( impl.mController )
816         {
817           value = impl.mController->GetDefaultFontFamily();
818         }
819         break;
820       }
821       case Toolkit::TextField::Property::FONT_STYLE:
822       {
823         GetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
824         break;
825       }
826       case Toolkit::TextField::Property::POINT_SIZE:
827       {
828         if( impl.mController )
829         {
830           value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
831         }
832         break;
833       }
834       case Toolkit::TextField::Property::MAX_LENGTH:
835       {
836         if( impl.mController )
837         {
838           value = impl.mController->GetMaximumNumberOfCharacters();
839         }
840         break;
841       }
842       case Toolkit::TextField::Property::EXCEED_POLICY:
843       {
844         value = impl.mExceedPolicy;
845         break;
846       }
847       case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
848       {
849         if( impl.mController )
850         {
851           const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
852
853           if ( name )
854           {
855             value = std::string( name );
856           }
857         }
858         break;
859       }
860       case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
861       {
862         if( impl.mController )
863         {
864           const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
865
866           if( name )
867           {
868             value = std::string( name );
869           }
870         }
871         break;
872       }
873       case Toolkit::TextField::Property::TEXT_COLOR:
874       {
875         if ( impl.mController )
876         {
877           value = impl.mController->GetDefaultColor();
878         }
879         break;
880       }
881       case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR:
882       {
883         if ( impl.mController )
884         {
885           value = impl.mController->GetPlaceholderTextColor();
886         }
887         break;
888       }
889       case Toolkit::TextField::Property::SHADOW_OFFSET:
890       {
891         if ( impl.mController )
892         {
893           value = impl.mController->GetShadowOffset();
894         }
895         break;
896       }
897       case Toolkit::TextField::Property::SHADOW_COLOR:
898       {
899         if ( impl.mController )
900         {
901           value = impl.mController->GetShadowColor();
902         }
903         break;
904       }
905       case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
906       {
907         if( impl.mDecorator )
908         {
909           value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
910         }
911         break;
912       }
913       case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
914       {
915         if( impl.mDecorator )
916         {
917           value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
918         }
919         break;
920       }
921       case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
922       {
923         value = impl.mController->GetEnableCursorBlink();
924         break;
925       }
926       case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
927       {
928         if( impl.mDecorator )
929         {
930           value = impl.mDecorator->GetCursorBlinkInterval();
931         }
932         break;
933       }
934       case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
935       {
936         if( impl.mDecorator )
937         {
938           value = impl.mDecorator->GetCursorBlinkDuration();
939         }
940         break;
941       }
942       case Toolkit::TextField::Property::CURSOR_WIDTH:
943       {
944         if( impl.mDecorator )
945         {
946           value = impl.mDecorator->GetCursorWidth();
947         }
948         break;
949       }
950       case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
951       {
952         if( impl.mDecorator )
953         {
954           ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ) );
955           if( image )
956           {
957             value = image.GetUrl();
958           }
959         }
960         break;
961       }
962       case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
963       {
964         if( impl.mDecorator )
965         {
966           ResourceImage image = ResourceImage::DownCast( impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ) );
967           if( image )
968           {
969             value = image.GetUrl();
970           }
971         }
972         break;
973       }
974       case Toolkit::TextField::Property::SCROLL_THRESHOLD:
975       {
976         if( impl.mDecorator )
977         {
978           value = impl.mDecorator->GetScrollThreshold();
979         }
980         break;
981       }
982       case Toolkit::TextField::Property::SCROLL_SPEED:
983       {
984         if( impl.mDecorator )
985         {
986           value = impl.mDecorator->GetScrollSpeed();
987         }
988         break;
989       }
990       case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
991       {
992         impl.GetHandleImagePropertyValue( value, LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED );
993         break;
994       }
995       case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT:
996       {
997         impl.GetHandleImagePropertyValue( value, RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED ) ;
998         break;
999       }
1000       case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT:
1001       {
1002         impl.GetHandleImagePropertyValue( value, LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED );
1003         break;
1004       }
1005       case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT:
1006       {
1007         impl.GetHandleImagePropertyValue( value, RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED );
1008         break;
1009       }
1010       case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT:
1011       {
1012         impl.GetHandleImagePropertyValue( value, LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED );
1013         break;
1014       }
1015       case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT:
1016       {
1017         impl.GetHandleImagePropertyValue( value, RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED );
1018         break;
1019       }
1020       case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
1021       {
1022         if( impl.mDecorator )
1023         {
1024           value = impl.mDecorator->GetHighlightColor();
1025         }
1026         break;
1027       }
1028       case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
1029       {
1030         if( impl.mDecorator )
1031         {
1032           Rect<int> boundingBox;
1033           impl.mDecorator->GetBoundingBox( boundingBox );
1034           value = boundingBox;
1035         }
1036         break;
1037       }
1038       case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
1039       {
1040         Property::Map map;
1041         impl.mInputMethodOptions.RetrieveProperty( map );
1042         value = map;
1043         break;
1044       }
1045       case Toolkit::TextField::Property::INPUT_COLOR:
1046       {
1047         if( impl.mController )
1048         {
1049           value = impl.mController->GetInputColor();
1050         }
1051         break;
1052       }
1053       case Toolkit::TextField::Property::ENABLE_MARKUP:
1054       {
1055         if( impl.mController )
1056         {
1057           value = impl.mController->IsMarkupProcessorEnabled();
1058         }
1059         break;
1060       }
1061       case Toolkit::TextField::Property::INPUT_FONT_FAMILY:
1062       {
1063         if( impl.mController )
1064         {
1065           value = impl.mController->GetInputFontFamily();
1066         }
1067         break;
1068       }
1069       case Toolkit::TextField::Property::INPUT_FONT_STYLE:
1070       {
1071         GetFontStyleProperty( impl.mController, value, Text::FontStyle::INPUT );
1072         break;
1073       }
1074       case Toolkit::TextField::Property::INPUT_POINT_SIZE:
1075       {
1076         if( impl.mController )
1077         {
1078           value = impl.mController->GetInputFontPointSize();
1079         }
1080         break;
1081       }
1082       case Toolkit::TextField::Property::UNDERLINE:
1083       {
1084         GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
1085         break;
1086       }
1087       case Toolkit::TextField::Property::INPUT_UNDERLINE:
1088       {
1089         GetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
1090         break;
1091       }
1092       case Toolkit::TextField::Property::SHADOW:
1093       {
1094         GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
1095         break;
1096       }
1097       case Toolkit::TextField::Property::INPUT_SHADOW:
1098       {
1099         GetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
1100         break;
1101       }
1102       case Toolkit::TextField::Property::EMBOSS:
1103       {
1104         GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
1105         break;
1106       }
1107       case Toolkit::TextField::Property::INPUT_EMBOSS:
1108       {
1109         GetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
1110         break;
1111       }
1112       case Toolkit::TextField::Property::OUTLINE:
1113       {
1114         GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
1115         break;
1116       }
1117       case Toolkit::TextField::Property::INPUT_OUTLINE:
1118       {
1119         GetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
1120         break;
1121       }
1122       case Toolkit::TextField::Property::HIDDEN_INPUT_SETTINGS:
1123       {
1124         Property::Map map;
1125         impl.mController->GetHiddenInputOption(map);
1126         value = map;
1127         break;
1128       }
1129       case Toolkit::TextField::Property::PIXEL_SIZE:
1130       {
1131         if( impl.mController )
1132         {
1133           value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
1134         }
1135         break;
1136       }
1137       case Toolkit::TextField::Property::ENABLE_SELECTION:
1138       {
1139         if( impl.mController )
1140         {
1141           value = impl.mController->IsSelectionEnabled();
1142         }
1143         break;
1144       }
1145       case Toolkit::TextField::Property::PLACEHOLDER:
1146       {
1147         Property::Map map;
1148         impl.mController->GetPlaceholderProperty( map );
1149         value = map;
1150         break;
1151       }
1152       case Toolkit::TextField::Property::ELLIPSIS:
1153       {
1154         if( impl.mController )
1155         {
1156           value = impl.mController->IsTextElideEnabled();
1157         }
1158         break;
1159       }
1160     } //switch
1161   }
1162
1163   return value;
1164 }
1165
1166 bool TextField::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
1167 {
1168   Dali::BaseHandle handle( object );
1169
1170   bool connected( true );
1171   Toolkit::TextField field = Toolkit::TextField::DownCast( handle );
1172
1173   if( 0 == strcmp( signalName.c_str(), SIGNAL_TEXT_CHANGED ) )
1174   {
1175     field.TextChangedSignal().Connect( tracker, functor );
1176   }
1177   else if( 0 == strcmp( signalName.c_str(), SIGNAL_MAX_LENGTH_REACHED ) )
1178   {
1179     field.MaxLengthReachedSignal().Connect( tracker, functor );
1180   }
1181   else if( 0 == strcmp( signalName.c_str(), SIGNAL_INPUT_STYLE_CHANGED ) )
1182   {
1183     field.InputStyleChangedSignal().Connect( tracker, functor );
1184   }
1185   else
1186   {
1187     // signalName does not match any signal
1188     connected = false;
1189   }
1190
1191   return connected;
1192 }
1193
1194 Toolkit::TextField::TextChangedSignalType& TextField::TextChangedSignal()
1195 {
1196   return mTextChangedSignal;
1197 }
1198
1199 Toolkit::TextField::MaxLengthReachedSignalType& TextField::MaxLengthReachedSignal()
1200 {
1201   return mMaxLengthReachedSignal;
1202 }
1203
1204 Toolkit::TextField::InputStyleChangedSignalType& TextField::InputStyleChangedSignal()
1205 {
1206   return mInputStyleChangedSignal;
1207 }
1208
1209 void TextField::OnInitialize()
1210 {
1211   Actor self = Self();
1212
1213   mController = Text::Controller::New( this, this );
1214
1215   // When using the vector-based rendering, the size of the GLyphs are different
1216   TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
1217   mController->SetGlyphType( glyphType );
1218
1219   mDecorator = Text::Decorator::New( *mController,
1220                                      *mController );
1221
1222   mController->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX );
1223
1224   // Enables the text input.
1225   mController->EnableTextInput( mDecorator );
1226
1227   // Enables the horizontal scrolling after the text input has been enabled.
1228   mController->SetHorizontalScrollEnabled( true );
1229
1230   // Disables the vertical scrolling.
1231   mController->SetVerticalScrollEnabled( false );
1232
1233   // Disable the smooth handle panning.
1234   mController->SetSmoothHandlePanEnabled( false );
1235
1236   mController->SetNoTextDoubleTapAction( Controller::NoTextTap::HIGHLIGHT );
1237   mController->SetNoTextLongPressAction( Controller::NoTextTap::HIGHLIGHT );
1238
1239   // Forward input events to controller
1240   EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
1241   GetTapGestureDetector().SetMaximumTapsRequired( 2 );
1242
1243   mImfManager = ImfManager::Get();
1244
1245   self.TouchSignal().Connect( this, &TextField::OnTouched );
1246
1247   // Set BoundingBox to stage size if not already set.
1248   Rect<int> boundingBox;
1249   mDecorator->GetBoundingBox( boundingBox );
1250
1251   if( boundingBox.IsEmpty() )
1252   {
1253     Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
1254     mDecorator->SetBoundingBox( Rect<int>( 0.0f, 0.0f, stageSize.width, stageSize.height ) );
1255   }
1256
1257   // Flip vertically the 'left' selection handle
1258   mDecorator->FlipHandleVertically( LEFT_SELECTION_HANDLE, true );
1259
1260   // Fill-parent area by default
1261   self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
1262   self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
1263   self.OnStageSignal().Connect( this, &TextField::OnStageConnect );
1264
1265   if( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy )
1266   {
1267     EnableClipping();
1268   }
1269 }
1270
1271 void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
1272 {
1273   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnStyleChange\n");
1274
1275   switch ( change )
1276   {
1277     case StyleChange::DEFAULT_FONT_CHANGE:
1278     {
1279       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnStyleChange DEFAULT_FONT_CHANGE\n");
1280       const std::string& newFont = GetImpl( styleManager ).GetDefaultFontFamily();
1281       // Property system did not set the font so should update it.
1282       mController->UpdateAfterFontChange( newFont );
1283       RelayoutRequest();
1284       break;
1285     }
1286
1287     case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
1288     {
1289       GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
1290       RelayoutRequest();
1291       break;
1292     }
1293     case StyleChange::THEME_CHANGE:
1294     {
1295       // Nothing to do, let control base class handle this
1296       break;
1297     }
1298   }
1299
1300   // Up call to Control
1301   Control::OnStyleChange( styleManager, change );
1302 }
1303
1304 Vector3 TextField::GetNaturalSize()
1305 {
1306   Extents padding;
1307   padding = Self().GetProperty<Extents>( Toolkit::Control::Property::PADDING );
1308
1309   Vector3 naturalSize = mController->GetNaturalSize();
1310   naturalSize.width += ( padding.start + padding.end );
1311   naturalSize.height += ( padding.top + padding.bottom );
1312
1313   return naturalSize;
1314 }
1315
1316 float TextField::GetHeightForWidth( float width )
1317 {
1318   Extents padding;
1319   padding = Self().GetProperty<Extents>( Toolkit::Control::Property::PADDING );
1320   return mController->GetHeightForWidth( width ) + padding.top + padding.bottom;
1321 }
1322
1323 void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container )
1324 {
1325   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField OnRelayout\n");
1326
1327   Actor self = Self();
1328
1329   Extents padding;
1330   padding = self.GetProperty<Extents>( Toolkit::Control::Property::PADDING );
1331
1332   Vector2 contentSize( size.x - ( padding.start + padding.end ), size.y - ( padding.top + padding.bottom ) );
1333
1334   // Support Right-To-Left of padding
1335   Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
1336   if( Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection )
1337   {
1338     std::swap( padding.start, padding.end );
1339   }
1340
1341   if( mStencil )
1342   {
1343     mStencil.SetPosition( padding.start, padding.top );
1344   }
1345   if( mActiveLayer )
1346   {
1347     mActiveLayer.SetPosition( padding.start, padding.top );
1348   }
1349
1350   const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
1351
1352   if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
1353       !mRenderer )
1354   {
1355     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnRelayout %p Displaying new contents\n", mController.Get() );
1356
1357     if( mDecorator &&
1358         ( Text::Controller::NONE_UPDATED != ( Text::Controller::DECORATOR_UPDATED & updateTextType ) ) )
1359     {
1360       mDecorator->Relayout( size );
1361     }
1362
1363     if( !mRenderer )
1364     {
1365       mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
1366     }
1367
1368     RenderText( updateTextType );
1369
1370   }
1371
1372   // The text-field emits signals when the input style changes. These changes of style are
1373   // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
1374   // can't be emitted during the size negotiation as the callbacks may update the UI.
1375   // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
1376   if( !mController->IsInputStyleChangedSignalsQueueEmpty() )
1377   {
1378     if( Adaptor::IsAvailable() )
1379     {
1380       Adaptor& adaptor = Adaptor::Get();
1381
1382       if( NULL == mIdleCallback )
1383       {
1384         // @note: The callback manager takes the ownership of the callback object.
1385         mIdleCallback = MakeCallback( this, &TextField::OnIdleSignal );
1386         adaptor.AddIdle( mIdleCallback );
1387       }
1388     }
1389   }
1390 }
1391
1392 void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
1393 {
1394   Actor renderableActor;
1395
1396   if( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) )
1397   {
1398     if( mRenderer )
1399     {
1400       Dali::Toolkit::TextField handle = Dali::Toolkit::TextField( GetOwner() );
1401
1402       renderableActor = mRenderer->Render( mController->GetView(),
1403                                            handle,
1404                                            Property::INVALID_INDEX, // Animatable property not supported
1405                                            mAlignmentOffset,
1406                                            DepthIndex::CONTENT );
1407     }
1408
1409     if( renderableActor != mRenderableActor )
1410     {
1411       UnparentAndReset( mRenderableActor );
1412       mRenderableActor = renderableActor;
1413     }
1414   }
1415
1416   if( mRenderableActor )
1417   {
1418     const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
1419
1420     if( mStencil )
1421     {
1422       mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
1423     }
1424     else
1425     {
1426       Extents padding;
1427       padding = Self().GetProperty<Extents>( Toolkit::Control::Property::PADDING );
1428
1429       // Support Right-To-Left of padding
1430       Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( Self().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
1431       if( Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection )
1432       {
1433         std::swap( padding.start, padding.end );
1434       }
1435
1436       mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset + padding.start, scrollOffset.y + padding.top );
1437     }
1438
1439
1440     // Make sure the actors are parented correctly with/without clipping
1441     Actor self = mStencil ? mStencil : Self();
1442
1443     for( std::vector<Actor>::iterator it = mClippingDecorationActors.begin(),
1444            endIt = mClippingDecorationActors.end();
1445          it != endIt;
1446          ++it )
1447     {
1448       self.Add( *it );
1449       it->LowerToBottom();
1450     }
1451     mClippingDecorationActors.clear();
1452
1453     self.Add( mRenderableActor );
1454   }
1455 }
1456
1457 void TextField::OnKeyInputFocusGained()
1458 {
1459   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyInputFocusGained %p\n", mController.Get() );
1460
1461   mImfManager.ApplyOptions( mInputMethodOptions );
1462
1463   mImfManager.StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
1464
1465   mImfManager.EventReceivedSignal().Connect( this, &TextField::OnImfEvent );
1466
1467   // Notify that the text editing start.
1468   mImfManager.Activate();
1469
1470   // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
1471   mImfManager.SetRestoreAfterFocusLost( true );
1472
1473    ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
1474
1475    if ( notifier )
1476    {
1477       notifier.ContentSelectedSignal().Connect( this, &TextField::OnClipboardTextSelected );
1478    }
1479
1480   mController->KeyboardFocusGainEvent(); // Called in the case of no virtual keyboard to trigger this event
1481
1482   EmitKeyInputFocusSignal( true ); // Calls back into the Control hence done last.
1483 }
1484
1485 void TextField::OnKeyInputFocusLost()
1486 {
1487   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField:OnKeyInputFocusLost %p\n", mController.Get() );
1488
1489   mImfManager.StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
1490   // The text editing is finished. Therefore the imf manager don't have restore activation.
1491   mImfManager.SetRestoreAfterFocusLost( false );
1492
1493   // Notify that the text editing finish.
1494   mImfManager.Deactivate();
1495
1496   mImfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
1497
1498   ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
1499
1500   if ( notifier )
1501   {
1502     notifier.ContentSelectedSignal().Disconnect( this, &TextField::OnClipboardTextSelected );
1503   }
1504
1505   mController->KeyboardFocusLostEvent();
1506
1507   EmitKeyInputFocusSignal( false ); // Calls back into the Control hence done last.
1508 }
1509
1510 void TextField::OnTap( const TapGesture& gesture )
1511 {
1512   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get() );
1513
1514   mImfManager.Activate();
1515
1516   // Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
1517   Extents padding;
1518   padding = Self().GetProperty<Extents>( Toolkit::Control::Property::PADDING );
1519   mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x - padding.start, gesture.localPoint.y - padding.top );
1520
1521   SetKeyInputFocus();
1522 }
1523
1524 void TextField::OnPan( const PanGesture& gesture )
1525 {
1526   mController->PanEvent( gesture.state, gesture.displacement );
1527 }
1528
1529 void TextField::OnLongPress( const LongPressGesture& gesture )
1530 {
1531   mImfManager.Activate();
1532
1533   Extents padding;
1534   padding = Self().GetProperty<Extents>( Toolkit::Control::Property::PADDING );
1535   mController->LongPressEvent( gesture.state, gesture.localPoint.x - padding.start, gesture.localPoint.y - padding.top );
1536
1537   SetKeyInputFocus();
1538 }
1539
1540 bool TextField::OnKeyEvent( const KeyEvent& event )
1541 {
1542   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode );
1543
1544   if( Dali::DALI_KEY_ESCAPE == event.keyCode && mController->ShouldClearFocusOnEscape() )
1545   {
1546     // Make sure ClearKeyInputFocus when only key is up
1547     if( event.state == KeyEvent::Up )
1548     {
1549       ClearKeyInputFocus();
1550     }
1551
1552     return true;
1553   }
1554
1555   return mController->KeyEvent( event );
1556 }
1557
1558 void TextField::RequestTextRelayout()
1559 {
1560   RelayoutRequest();
1561 }
1562
1563 void TextField::TextChanged()
1564 {
1565   Dali::Toolkit::TextField handle( GetOwner() );
1566   mTextChangedSignal.Emit( handle );
1567 }
1568
1569 void TextField::MaxLengthReached()
1570 {
1571   Dali::Toolkit::TextField handle( GetOwner() );
1572   mMaxLengthReachedSignal.Emit( handle );
1573 }
1574
1575 void TextField::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
1576 {
1577   Dali::Toolkit::TextField handle( GetOwner() );
1578
1579   Toolkit::TextField::InputStyle::Mask fieldInputStyleMask = Toolkit::TextField::InputStyle::NONE;
1580
1581   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_COLOR ) )
1582   {
1583     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::COLOR );
1584   }
1585   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_FAMILY ) )
1586   {
1587     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_FAMILY );
1588   }
1589   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_POINT_SIZE ) )
1590   {
1591     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::POINT_SIZE );
1592   }
1593   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_WEIGHT ) )
1594   {
1595     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_STYLE );
1596   }
1597   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_WIDTH ) )
1598   {
1599     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_STYLE );
1600   }
1601   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_SLANT ) )
1602   {
1603     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_STYLE );
1604   }
1605   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_UNDERLINE ) )
1606   {
1607     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::UNDERLINE );
1608   }
1609   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_SHADOW ) )
1610   {
1611     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::SHADOW );
1612   }
1613   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_EMBOSS ) )
1614   {
1615     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::EMBOSS );
1616   }
1617   if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_OUTLINE ) )
1618   {
1619     fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::OUTLINE );
1620   }
1621
1622   mInputStyleChangedSignal.Emit( handle, fieldInputStyleMask );
1623 }
1624
1625 void TextField::AddDecoration( Actor& actor, bool needsClipping )
1626 {
1627   if( actor )
1628   {
1629     if( needsClipping )
1630     {
1631       mClippingDecorationActors.push_back( actor );
1632     }
1633     else
1634     {
1635       actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
1636       actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1637       Self().Add( actor );
1638       mActiveLayer = actor;
1639     }
1640   }
1641 }
1642
1643 void TextField::OnStageConnect( Dali::Actor actor )
1644 {
1645   if ( mHasBeenStaged )
1646   {
1647     RenderText( static_cast<Text::Controller::UpdateTextType>( Text::Controller::MODEL_UPDATED | Text::Controller::DECORATOR_UPDATED ) );
1648   }
1649   else
1650   {
1651     mHasBeenStaged = true;
1652   }
1653 }
1654
1655 ImfManager::ImfCallbackData TextField::OnImfEvent( Dali::ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
1656 {
1657   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnImfEvent %p eventName %d\n", mController.Get(), imfEvent.eventName );
1658   return mController->OnImfEvent( imfManager, imfEvent );
1659 }
1660
1661 void TextField::GetHandleImagePropertyValue(  Property::Value& value, Text::HandleType handleType, Text::HandleImageType handleImageType )
1662 {
1663   if( mDecorator )
1664   {
1665     ResourceImage image = ResourceImage::DownCast( mDecorator->GetHandleImage( handleType, handleImageType ) );
1666
1667     if ( image )
1668     {
1669       Property::Map map;
1670       Scripting::CreatePropertyMap( image, map );
1671       value = map;
1672     }
1673   }
1674 }
1675
1676 void TextField::EnableClipping()
1677 {
1678   if( !mStencil )
1679   {
1680     // Creates an extra control to be used as stencil buffer.
1681     mStencil = Control::New();
1682     mStencil.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1683     mStencil.SetParentOrigin( ParentOrigin::TOP_LEFT );
1684
1685     // Creates a background visual. Even if the color is transparent it updates the stencil.
1686     mStencil.SetProperty( Toolkit::Control::Property::BACKGROUND,
1687                           Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR ).
1688                           Add( ColorVisual::Property::MIX_COLOR, Color::TRANSPARENT ) );
1689
1690     // Enable the clipping property.
1691     mStencil.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
1692     mStencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
1693
1694     Self().Add( mStencil );
1695   }
1696 }
1697
1698 void TextField::OnClipboardTextSelected( ClipboardEventNotifier& clipboard )
1699 {
1700   mController->PasteClipboardItemEvent();
1701 }
1702
1703 void TextField::KeyboardStatusChanged(bool keyboardShown)
1704 {
1705   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::KeyboardStatusChanged %p keyboardShown %d\n", mController.Get(), keyboardShown );
1706
1707   // Just hide the grab handle when keyboard is hidden.
1708   if (!keyboardShown )
1709   {
1710     mController->KeyboardFocusLostEvent();
1711   }
1712   else
1713   {
1714     mController->KeyboardFocusGainEvent(); // Initially called by OnKeyInputFocusGained
1715   }
1716 }
1717
1718 void TextField::OnStageConnection( int depth )
1719 {
1720   // Sets the depth to the visuals inside the text's decorator.
1721   mDecorator->SetTextDepth( depth );
1722
1723   // The depth of the text renderer is set in the RenderText() called from OnRelayout().
1724
1725   // Call the Control::OnStageConnection() to set the depth of the background.
1726   Control::OnStageConnection( depth );
1727 }
1728
1729 bool TextField::OnTouched( Actor actor, const TouchData& touch )
1730 {
1731   return true;
1732 }
1733
1734 void TextField::OnIdleSignal()
1735 {
1736   // Emits the change of input style signals.
1737   mController->ProcessInputStyleChangedSignals();
1738
1739   // Set the pointer to null as the callback manager deletes the callback after execute it.
1740   mIdleCallback = NULL;
1741 }
1742
1743 TextField::TextField()
1744 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
1745   mIdleCallback( NULL ),
1746   mAlignmentOffset( 0.f ),
1747   mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
1748   mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ),
1749   mHasBeenStaged( false )
1750 {
1751 }
1752
1753 TextField::~TextField()
1754 {
1755   UnparentAndReset( mStencil );
1756
1757   if( ( NULL != mIdleCallback ) && Adaptor::IsAvailable() )
1758   {
1759     Adaptor::Get().RemoveIdle( mIdleCallback );
1760   }
1761 }
1762
1763 } // namespace Internal
1764
1765 } // namespace Toolkit
1766
1767 } // namespace Dali