0ba45acd347ce7df760a9fe39e01dc6c19ebe573
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextEditor.cs
1 /*
2  * Copyright(c) 2021 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 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
20
21 using System;
22 using System.Globalization;
23 using System.ComponentModel;
24 using Tizen.NUI.Text;
25 using Tizen.NUI.Binding;
26
27 namespace Tizen.NUI.BaseComponents
28 {
29     /// <summary>
30     /// A control which provides a multi-line editable text editor.
31     /// </summary>
32     /// <since_tizen> 3 </since_tizen>
33     public partial class TextEditor : View
34     {
35         static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextEditor";
36         static private string defaultFontFamily = "TizenSans";
37         private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
38         private static SystemFontSizeChanged systemFontSizeChanged = new SystemFontSizeChanged();
39         private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
40         private string textEditorTextSid = null;
41         private string textEditorPlaceHolderTextSid = null;
42         private InputMethodContext inputMethodContext = null;
43         private string fontFamily = defaultFontFamily;
44         private float fontSizeScale = 1.0f;
45         private bool hasSystemLanguageChanged = false;
46         private bool hasSystemFontSizeChanged = false;
47         private bool hasSystemFontTypeChanged = false;
48         private bool isSettingTextInCSharp = false;
49
50         private Color internalPlaceholderTextColor = null;
51         private Vector4 internalPrimaryCursorColor = null;
52         private Vector4 internalSecondaryCursorColor = null;
53         private Vector4 internalSelectionHighlightColor = null;
54         private Vector4 internalInputColor = null;
55         private Vector4 internalTextColor = null;
56         private Color internalGrabHandleColor = null;
57
58
59         static TextEditor() { }
60
61         /// <summary>
62         /// Creates the TextEditor control.
63         /// </summary>
64         /// <since_tizen> 3 </since_tizen>
65         public TextEditor() : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
66         {
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68         }
69
70         /// <summary>
71         /// Creates the TextEditor with specified style.
72         /// </summary>
73         [EditorBrowsable(EditorBrowsableState.Never)]
74         public TextEditor(TextEditorStyle style) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, style: style)
75         {
76         }
77
78         /// <summary>
79         /// Creates the TextEditor with setting the status of shown or hidden.
80         /// </summary>
81         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
82         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
83         [EditorBrowsable(EditorBrowsableState.Never)]
84         public TextEditor(bool shown) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
85         {
86             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87             SetVisible(shown);
88         }
89
90         internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
91         {
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93         }
94
95         internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
96         {
97             if (!shown)
98             {
99                 SetVisible(false);
100             }
101             Focusable = true;
102             TextChanged += TextEditorTextChanged;
103         }
104
105         private bool HasStyle()
106         {
107             return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
108         }
109
110         /// <summary>
111         /// The TranslatableText property.<br />
112         /// The text can set the SID value.<br />
113         /// </summary>
114         /// <exception cref='ArgumentNullException'>
115         /// ResourceManager about multilingual is null.
116         /// </exception>
117         /// <since_tizen> 4 </since_tizen>
118         public string TranslatableText
119         {
120             get
121             {
122                 return GetValue(TranslatableTextProperty) as string;
123             }
124             set
125             {
126                 SetValue(TranslatableTextProperty, value);
127             }
128         }
129
130         private string InternalTranslatableText
131         {
132             get
133             {
134                 return textEditorTextSid;
135             }
136             set
137             {
138                 if (NUIApplication.MultilingualResourceManager == null)
139                 {
140                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
141                 }
142                 textEditorTextSid = value;
143                 Text = SetTranslatable(textEditorTextSid);
144                 NotifyPropertyChanged();
145             }
146         }
147         /// <summary>
148         /// The TranslatablePlaceholderText property.<br />
149         /// The text can set the SID value.<br />
150         /// </summary>
151         /// <exception cref='ArgumentNullException'>
152         /// ResourceManager about multilingual is null.
153         /// </exception>
154         /// <since_tizen> 4 </since_tizen>
155         public string TranslatablePlaceholderText
156         {
157             get
158             {
159                 return GetValue(TranslatablePlaceholderTextProperty) as string;
160             }
161             set
162             {
163                 SetValue(TranslatablePlaceholderTextProperty, value);
164             }
165         }
166
167         private string InternalTranslatablePlaceholderText
168         {
169             get
170             {
171                 return textEditorPlaceHolderTextSid;
172             }
173             set
174             {
175                 if (NUIApplication.MultilingualResourceManager == null)
176                 {
177                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
178                 }
179                 textEditorPlaceHolderTextSid = value;
180                 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
181                 NotifyPropertyChanged();
182             }
183         }
184
185         /// <summary>
186         /// The Text property.<br />
187         /// The text to display in the UTF-8 format.<br />
188         /// </summary>
189         /// <since_tizen> 3 </since_tizen>
190         public string Text
191         {
192             get
193             {
194                 return (string)GetValue(TextProperty);
195             }
196             set
197             {
198                 SetValue(TextProperty, value);
199                 NotifyPropertyChanged();
200             }
201         }
202
203         /// <summary>
204         /// The TextColor property.<br />
205         /// The color of the text.<br />
206         /// </summary>
207         /// <remarks>
208         /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
209         /// </remarks>
210         /// <since_tizen> 3 </since_tizen>
211         public Vector4 TextColor
212         {
213             get
214             {
215                 Vector4 temp = (Vector4)GetValue(TextColorProperty);
216                 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
217             }
218             set
219             {
220                 SetValue(TextColorProperty, value);
221                 NotifyPropertyChanged();
222             }
223         }
224
225         /// <summary>
226         /// The FontFamily property.<br />
227         /// The requested font family to use.<br />
228         /// </summary>
229         /// <since_tizen> 3 </since_tizen>
230         public string FontFamily
231         {
232             get
233             {
234                 return (string)GetValue(FontFamilyProperty);
235             }
236             set
237             {
238                 SetValue(FontFamilyProperty, value);
239                 NotifyPropertyChanged();
240             }
241         }
242
243         private string InternalFontFamily
244         {
245             get
246             {
247                 if (HasStyle())
248                     return fontFamily;
249                 else
250                     return Object.InternalGetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily);
251             }
252             set
253             {
254                 string newFontFamily;
255
256                 if (string.Equals(fontFamily, value)) return;
257
258                 fontFamily = value;
259                 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
260                 {
261                     try
262                     {
263                         newFontFamily = SystemSettings.FontType;
264                     }
265                     catch (Exception e)
266                     {
267                         Console.WriteLine("{0} Exception caught.", e);
268                         newFontFamily = defaultFontFamily;
269                     }
270                     AddSystemSettingsFontTypeChanged();
271                 }
272                 else
273                 {
274                     newFontFamily = fontFamily;
275                     RemoveSystemSettingsFontTypeChanged();
276                 }
277
278                 SetInternalFontFamily(newFontFamily);
279             }
280         }
281
282         private void SetInternalFontFamily(string fontFamily)
283         {
284             Object.InternalSetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily, (string)fontFamily);
285         }
286
287         /// <summary>
288         /// The FontStyle property.<br />
289         /// The requested font style to use.<br />
290         /// The fontStyle map contains the following keys :<br />
291         /// <list type="table">
292         /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
293         /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
294         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
295         /// </list>
296         /// </summary>
297         /// <since_tizen> 3 </since_tizen>
298         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
299         public PropertyMap FontStyle
300         {
301             get
302             {
303                 return (PropertyMap)GetValue(FontStyleProperty);
304             }
305             set
306             {
307                 SetValue(FontStyleProperty, value);
308                 NotifyPropertyChanged();
309             }
310         }
311
312         /// <summary>
313         /// Set FontStyle to TextEditor. <br />
314         /// </summary>
315         /// <param name="fontStyle">The FontStyle</param>
316         /// <remarks>
317         /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
318         /// </remarks>
319         /// <example>
320         /// The following example demonstrates how to use the SetFontStyle method.
321         /// <code>
322         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
323         /// fontStyle.Width = FontWidthType.Expanded;
324         /// fontStyle.Weight = FontWeightType.Bold;
325         /// fontStyle.Slant = FontSlantType.Italic;
326         /// editor.SetFontStyle(fontStyle);
327         /// </code>
328         /// </example>
329         [EditorBrowsable(EditorBrowsableState.Never)]
330         public void SetFontStyle(FontStyle fontStyle)
331         {
332             using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
333             {
334                 SetValue(FontStyleProperty, fontStyleMap);
335             }
336         }
337
338         /// <summary>
339         /// Get FontStyle from TextEditor. <br />
340         /// </summary>
341         /// <returns>The FontStyle</returns>
342         /// <remarks>
343         /// <see cref="Tizen.NUI.Text.FontStyle"/>
344         /// </remarks>
345         [EditorBrowsable(EditorBrowsableState.Never)]
346         public FontStyle GetFontStyle()
347         {
348             FontStyle fontStyle;
349             using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
350             {
351                 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
352             }
353             return fontStyle;
354         }
355
356         /// <summary>
357         /// The PointSize property.<br />
358         /// The size of font in points.<br />
359         /// </summary>
360         /// <since_tizen> 3 </since_tizen>
361         [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
362         public float PointSize
363         {
364             get
365             {
366                 return (float)GetValue(PointSizeProperty);
367             }
368             set
369             {
370                 SetValue(PointSizeProperty, value);
371                 NotifyPropertyChanged();
372             }
373         }
374
375         /// <summary>
376         /// The HorizontalAlignment property.<br />
377         /// The line horizontal alignment.<br />
378         /// </summary>
379         /// <since_tizen> 3 </since_tizen>
380         public HorizontalAlignment HorizontalAlignment
381         {
382             get
383             {
384                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
385             }
386             set
387             {
388                 SetValue(HorizontalAlignmentProperty, value);
389                 NotifyPropertyChanged();
390             }
391         }
392
393         /// <summary>
394         /// The VerticalAlignment property.<br />
395         /// The line vertical alignment.
396         /// </summary>
397         [EditorBrowsable(EditorBrowsableState.Never)]
398         public VerticalAlignment VerticalAlignment
399         {
400             get
401             {
402                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
403             }
404             set
405             {
406                 SetValue(VerticalAlignmentProperty, value);
407                 NotifyPropertyChanged();
408             }
409         }
410
411         /// <summary>
412         /// The ScrollThreshold property.<br />
413         /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
414         /// </summary>
415         /// <since_tizen> 3 </since_tizen>
416         public float ScrollThreshold
417         {
418             get
419             {
420                 return (float)GetValue(ScrollThresholdProperty);
421             }
422             set
423             {
424                 SetValue(ScrollThresholdProperty, value);
425                 NotifyPropertyChanged();
426             }
427         }
428
429         /// <summary>
430         /// The ScrollSpeed property.<br />
431         /// The scroll speed in pixels per second.<br />
432         /// </summary>
433         /// <since_tizen> 3 </since_tizen>
434         public float ScrollSpeed
435         {
436             get
437             {
438                 return (float)GetValue(ScrollSpeedProperty);
439             }
440             set
441             {
442                 SetValue(ScrollSpeedProperty, value);
443                 NotifyPropertyChanged();
444             }
445         }
446
447         /// <summary>
448         /// The PrimaryCursorColor property.<br />
449         /// The color to apply to the primary cursor.<br />
450         /// </summary>
451         /// <remarks>
452         /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
453         /// </remarks>
454         /// <since_tizen> 3 </since_tizen>
455         public Vector4 PrimaryCursorColor
456         {
457             get
458             {
459                 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
460                 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
461             }
462             set
463             {
464                 SetValue(PrimaryCursorColorProperty, value);
465                 NotifyPropertyChanged();
466             }
467         }
468
469         /// <summary>
470         /// The SecondaryCursorColor property.<br />
471         /// The color to apply to the secondary cursor.<br />
472         /// </summary>
473         /// <remarks>
474         /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
475         /// </remarks>
476         /// <since_tizen> 3 </since_tizen>
477         public Vector4 SecondaryCursorColor
478         {
479             get
480             {
481                 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
482                 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
483             }
484             set
485             {
486                 SetValue(SecondaryCursorColorProperty, value);
487                 NotifyPropertyChanged();
488             }
489         }
490
491         /// <summary>
492         /// The EnableCursorBlink property.<br />
493         /// Whether the cursor should blink or not.<br />
494         /// </summary>
495         /// <since_tizen> 3 </since_tizen>
496         public bool EnableCursorBlink
497         {
498             get
499             {
500                 return (bool)GetValue(EnableCursorBlinkProperty);
501             }
502             set
503             {
504                 SetValue(EnableCursorBlinkProperty, value);
505                 NotifyPropertyChanged();
506             }
507         }
508
509         /// <summary>
510         /// The CursorBlinkInterval property.<br />
511         /// The time interval in seconds between cursor on/off states.<br />
512         /// </summary>
513         /// <since_tizen> 3 </since_tizen>
514         public float CursorBlinkInterval
515         {
516             get
517             {
518                 return (float)GetValue(CursorBlinkIntervalProperty);
519             }
520             set
521             {
522                 SetValue(CursorBlinkIntervalProperty, value);
523                 NotifyPropertyChanged();
524             }
525         }
526
527         /// <summary>
528         /// The CursorBlinkDuration property.<br />
529         /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
530         /// </summary>
531         /// <since_tizen> 3 </since_tizen>
532         public float CursorBlinkDuration
533         {
534             get
535             {
536                 return (float)GetValue(CursorBlinkDurationProperty);
537             }
538             set
539             {
540                 SetValue(CursorBlinkDurationProperty, value);
541                 NotifyPropertyChanged();
542             }
543         }
544
545         /// <summary>
546         /// The CursorWidth property.
547         /// </summary>
548         /// <since_tizen> 3 </since_tizen>
549         public int CursorWidth
550         {
551             get
552             {
553                 return (int)GetValue(CursorWidthProperty);
554             }
555             set
556             {
557                 SetValue(CursorWidthProperty, value);
558                 NotifyPropertyChanged();
559             }
560         }
561
562         /// <summary>
563         /// The GrabHandleImage property.<br />
564         /// The image to display for the grab handle.<br />
565         /// </summary>
566         /// <since_tizen> 3 </since_tizen>
567         public string GrabHandleImage
568         {
569             get
570             {
571                 return (string)GetValue(GrabHandleImageProperty);
572             }
573             set
574             {
575                 SetValue(GrabHandleImageProperty, value);
576                 NotifyPropertyChanged();
577             }
578         }
579
580         /// <summary>
581         /// The GrabHandlePressedImage property.<br />
582         /// The image to display when the grab handle is pressed.<br />
583         /// </summary>
584         /// <since_tizen> 3 </since_tizen>
585         public string GrabHandlePressedImage
586         {
587             get
588             {
589                 return (string)GetValue(GrabHandlePressedImageProperty);
590             }
591             set
592             {
593                 SetValue(GrabHandlePressedImageProperty, value);
594                 NotifyPropertyChanged();
595             }
596         }
597
598         /// <summary>
599         /// The SelectionPopupStyle property.<br />
600         /// The style of the text selection popup can be set through SelectionPopupStyle property.
601         /// </summary>
602         [EditorBrowsable(EditorBrowsableState.Never)]
603         public PropertyMap SelectionPopupStyle
604         {
605             get
606             {
607                 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
608             }
609             set
610             {
611                 SetValue(SelectionPopupStyleProperty, value);
612                 NotifyPropertyChanged();
613             }
614         }
615
616         /// <summary>
617         /// The SelectionHandleImageLeft property.<br />
618         /// The image to display for the left selection handle.<br />
619         /// The selectionHandleImageLeft map contains the following key :<br />
620         /// <list type="table">
621         /// <item><term>filename (string)</term><description>The path of image file</description></item>
622         /// </list>
623         /// </summary>
624         /// <since_tizen> 3 </since_tizen>
625         public PropertyMap SelectionHandleImageLeft
626         {
627             get
628             {
629                 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
630             }
631             set
632             {
633                 SetValue(SelectionHandleImageLeftProperty, value);
634                 NotifyPropertyChanged();
635             }
636         }
637
638         /// <summary>
639         /// The SelectionHandleImageRight property.<br />
640         /// The image to display for the right selection handle.<br />
641         /// The selectionHandleImageRight map contains the following key :<br />
642         /// <list type="table">
643         /// <item><term>filename (string)</term><description>The path of image file</description></item>
644         /// </list>
645         /// </summary>
646         /// <since_tizen> 3 </since_tizen>
647         public PropertyMap SelectionHandleImageRight
648         {
649             get
650             {
651                 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
652             }
653             set
654             {
655                 SetValue(SelectionHandleImageRightProperty, value);
656                 NotifyPropertyChanged();
657             }
658         }
659
660         /// <summary>
661         /// Set SelectionHandleImage to TextEditor. <br />
662         /// </summary>
663         /// <param name="selectionHandleImage">The SelectionHandleImage</param>
664         /// <remarks>
665         /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
666         /// </remarks>
667         /// <example>
668         /// The following example demonstrates how to use the SetSelectionHandleImage method.
669         /// <code>
670         /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
671         /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
672         /// selectionHandleImage.RightImageUrl = "handle_downright.png";
673         /// editor.SetSelectionHandleImage(selectionHandleImage);
674         /// </code>
675         /// </example>
676         [EditorBrowsable(EditorBrowsableState.Never)]
677         public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
678         {
679             if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
680             {
681                 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
682                 {
683                     SetValue(SelectionHandleImageLeftProperty, leftImageMap);
684                 }
685             }
686
687             if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
688             {
689                 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
690                 {
691                     SetValue(SelectionHandleImageRightProperty, rightImageMap);
692                 }
693             }
694         }
695
696         /// <summary>
697         /// Get SelectionHandleImage from TextEditor. <br />
698         /// </summary>
699         /// <returns>The SelectionHandleImage</returns>
700         /// <remarks>
701         /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
702         /// </remarks>
703         [EditorBrowsable(EditorBrowsableState.Never)]
704         public SelectionHandleImage GetSelectionHandleImage()
705         {
706             SelectionHandleImage selectionHandleImage;
707             using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
708             using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
709             {
710                 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
711             }
712             return selectionHandleImage;
713         }
714
715         /// <summary>
716         /// The SelectionHandlePressedImageLeft property.<br />
717         /// The image to display when the left selection handle is pressed.<br />
718         /// The selectionHandlePressedImageLeft map contains the following key :<br />
719         /// <list type="table">
720         /// <item><term>filename (string)</term><description>The path of image file</description></item>
721         /// </list>
722         /// </summary>
723         /// <since_tizen> 3 </since_tizen>
724         public PropertyMap SelectionHandlePressedImageLeft
725         {
726             get
727             {
728                 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
729             }
730             set
731             {
732                 SetValue(SelectionHandlePressedImageLeftProperty, value);
733                 NotifyPropertyChanged();
734             }
735         }
736
737         /// <summary>
738         /// The SelectionHandlePressedImageRight property.<br />
739         /// The image to display when the right selection handle is pressed.<br />
740         /// The selectionHandlePressedImageRight map contains the following key :<br />
741         /// <list type="table">
742         /// <item><term>filename (string)</term><description>The path of image file</description></item>
743         /// </list>
744         /// </summary>
745         /// <since_tizen> 3 </since_tizen>
746         public PropertyMap SelectionHandlePressedImageRight
747         {
748             get
749             {
750                 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
751             }
752             set
753             {
754                 SetValue(SelectionHandlePressedImageRightProperty, value);
755                 NotifyPropertyChanged();
756             }
757         }
758
759         /// <summary>
760         /// Set SelectionHandlePressedImage to TextEditor. <br />
761         /// </summary>
762         /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
763         /// <remarks>
764         /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
765         /// </remarks>
766         /// <example>
767         /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
768         /// <code>
769         /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
770         /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
771         /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
772         /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
773         /// </code>
774         /// </example>
775         [EditorBrowsable(EditorBrowsableState.Never)]
776         public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
777         {
778             if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
779             {
780                 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
781                 {
782                     SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
783                 }
784             }
785
786             if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
787             {
788                 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
789                 {
790                     SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
791                 }
792             }
793         }
794
795         /// <summary>
796         /// Get SelectionHandlePressedImage from TextEditor. <br />
797         /// </summary>
798         /// <returns>The SelectionHandlePressedImage</returns>
799         /// <remarks>
800         /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
801         /// </remarks>
802         [EditorBrowsable(EditorBrowsableState.Never)]
803         public SelectionHandleImage GetSelectionHandlePressedImage()
804         {
805             SelectionHandleImage selectionHandleImage;
806             using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
807             using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
808             {
809                 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
810             }
811             return selectionHandleImage;
812         }
813
814         /// <summary>
815         /// The SelectionHandleMarkerImageLeft property.<br />
816         /// The image to display for the left selection handle marker.<br />
817         /// The selectionHandleMarkerImageLeft map contains the following key :<br />
818         /// <list type="table">
819         /// <item><term>filename (string)</term><description>The path of image file</description></item>
820         /// </list>
821         /// </summary>
822         /// <since_tizen> 3 </since_tizen>
823         public PropertyMap SelectionHandleMarkerImageLeft
824         {
825             get
826             {
827                 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
828             }
829             set
830             {
831                 SetValue(SelectionHandleMarkerImageLeftProperty, value);
832                 NotifyPropertyChanged();
833             }
834         }
835
836         /// <summary>
837         /// The SelectionHandleMarkerImageRight property.<br />
838         /// The image to display for the right selection handle marker.<br />
839         /// The selectionHandleMarkerImageRight map contains the following key :<br />
840         /// <list type="table">
841         /// <item><term>filename (string)</term><description>The path of image file</description></item>
842         /// </list>
843         /// </summary>
844         /// <since_tizen> 3 </since_tizen>
845         public PropertyMap SelectionHandleMarkerImageRight
846         {
847             get
848             {
849                 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
850             }
851             set
852             {
853                 SetValue(SelectionHandleMarkerImageRightProperty, value);
854                 NotifyPropertyChanged();
855             }
856         }
857
858         /// <summary>
859         /// Set SelectionHandleMarkerImage to TextEditor. <br />
860         /// </summary>
861         /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
862         /// <remarks>
863         /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
864         /// </remarks>
865         /// <example>
866         /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
867         /// <code>
868         /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
869         /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
870         /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
871         /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
872         /// </code>
873         /// </example>
874         [EditorBrowsable(EditorBrowsableState.Never)]
875         public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
876         {
877             if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
878             {
879                 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
880                 {
881                     SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
882                 }
883             }
884
885             if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
886             {
887                 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
888                 {
889                     SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
890                 }
891             }
892         }
893
894         /// <summary>
895         /// Get SelectionHandleMarkerImage from TextEditor. <br />
896         /// </summary>
897         /// <returns>The SelectionHandleMarkerImage</returns>
898         /// <remarks>
899         /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
900         /// </remarks>
901         [EditorBrowsable(EditorBrowsableState.Never)]
902         public SelectionHandleImage GetSelectionHandleMarkerImage()
903         {
904             SelectionHandleImage selectionHandleImage;
905             using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
906             using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
907             {
908                 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
909             }
910             return selectionHandleImage;
911         }
912
913         /// <summary>
914         /// The SelectionHighlightColor property.<br />
915         /// The color of the selection highlight.<br />
916         /// </summary>
917         /// <remarks>
918         /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
919         /// </remarks>
920         /// <since_tizen> 3 </since_tizen>
921         public Vector4 SelectionHighlightColor
922         {
923             get
924             {
925                 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
926                 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
927             }
928             set
929             {
930                 SetValue(SelectionHighlightColorProperty, value);
931                 NotifyPropertyChanged();
932             }
933         }
934
935         /// <summary>
936         /// The DecorationBoundingBox property.<br />
937         /// The decorations (handles etc) will positioned within this area on-screen.<br />
938         /// </summary>
939         /// <remarks>
940         /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
941         /// </remarks>
942         /// <since_tizen> 3 </since_tizen>
943         public Rectangle DecorationBoundingBox
944         {
945             get
946             {
947                 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
948                 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
949             }
950             set
951             {
952                 SetValue(DecorationBoundingBoxProperty, value);
953                 NotifyPropertyChanged();
954             }
955         }
956
957         /// <summary>
958         /// The EnableMarkup property.<br />
959         /// Whether the mark-up processing is enabled.<br />
960         /// </summary>
961         /// <since_tizen> 3 </since_tizen>
962         public bool EnableMarkup
963         {
964             get
965             {
966                 return (bool)GetValue(EnableMarkupProperty);
967             }
968             set
969             {
970                 SetValue(EnableMarkupProperty, value);
971                 NotifyPropertyChanged();
972             }
973         }
974
975         /// <summary>
976         /// The InputColor property.<br />
977         /// The color of the new input text.<br />
978         /// </summary>
979         /// <remarks>
980         /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
981         /// </remarks>
982         /// <since_tizen> 3 </since_tizen>
983         public Vector4 InputColor
984         {
985             get
986             {
987                 Vector4 temp = (Vector4)GetValue(InputColorProperty);
988                 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
989             }
990             set
991             {
992                 SetValue(InputColorProperty, value);
993                 NotifyPropertyChanged();
994             }
995         }
996
997         /// <summary>
998         /// The InputFontFamily property.<br />
999         /// The font's family of the new input text.<br />
1000         /// </summary>
1001         /// <since_tizen> 3 </since_tizen>
1002         public string InputFontFamily
1003         {
1004             get
1005             {
1006                 return (string)GetValue(InputFontFamilyProperty);
1007             }
1008             set
1009             {
1010                 SetValue(InputFontFamilyProperty, value);
1011                 NotifyPropertyChanged();
1012             }
1013         }
1014
1015         /// <summary>
1016         /// The InputFontStyle property.<br />
1017         /// The font's style of the new input text.<br />
1018         /// The inputFontStyle map contains the following keys :<br />
1019         /// <list type="table">
1020         /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
1021         /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
1022         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1023         /// </list>
1024         /// </summary>
1025         /// <since_tizen> 3 </since_tizen>
1026         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1027         public PropertyMap InputFontStyle
1028         {
1029             get
1030             {
1031                 return (PropertyMap)GetValue(InputFontStyleProperty);
1032             }
1033             set
1034             {
1035                 SetValue(InputFontStyleProperty, value);
1036                 NotifyPropertyChanged();
1037             }
1038         }
1039
1040         /// <summary>
1041         /// Set InputFontStyle to TextEditor. <br />
1042         /// </summary>
1043         /// <param name="fontStyle">The FontStyle</param>
1044         /// <remarks>
1045         /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1046         /// </remarks>
1047         /// <example>
1048         /// The following example demonstrates how to use the SetInputFontStyle method.
1049         /// <code>
1050         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1051         /// fontStyle.Width = FontWidthType.Expanded;
1052         /// fontStyle.Weight = FontWeightType.Bold;
1053         /// fontStyle.Slant = FontSlantType.Italic;
1054         /// editor.SetInputFontStyle(fontStyle);
1055         /// </code>
1056         /// </example>
1057         [EditorBrowsable(EditorBrowsableState.Never)]
1058         public void SetInputFontStyle(FontStyle fontStyle)
1059         {
1060             using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1061             {
1062                 SetValue(InputFontStyleProperty, fontStyleMap);
1063             }
1064         }
1065
1066         /// <summary>
1067         /// Get InputFontStyle from TextEditor. <br />
1068         /// </summary>
1069         /// <returns>The FontStyle</returns>
1070         /// <remarks>
1071         /// <see cref="Tizen.NUI.Text.FontStyle"/>
1072         /// </remarks>
1073         [EditorBrowsable(EditorBrowsableState.Never)]
1074         public FontStyle GetInputFontStyle()
1075         {
1076             FontStyle fontStyle;
1077             using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1078             {
1079                 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1080             }
1081             return fontStyle;
1082         }
1083
1084         /// <summary>
1085         /// The InputPointSize property.<br />
1086         /// The font's size of the new input text in points.<br />
1087         /// </summary>
1088         /// <since_tizen> 3 </since_tizen>
1089         [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1090         public float InputPointSize
1091         {
1092             get
1093             {
1094                 return (float)GetValue(InputPointSizeProperty);
1095             }
1096             set
1097             {
1098                 SetValue(InputPointSizeProperty, value);
1099                 NotifyPropertyChanged();
1100             }
1101         }
1102
1103         /// <summary>
1104         /// The LineSpacing property.<br />
1105         /// The default extra space between lines in points.<br />
1106         /// </summary>
1107         /// <since_tizen> 3 </since_tizen>
1108         public float LineSpacing
1109         {
1110             get
1111             {
1112                 return (float)GetValue(LineSpacingProperty);
1113             }
1114             set
1115             {
1116                 SetValue(LineSpacingProperty, value);
1117                 NotifyPropertyChanged();
1118             }
1119         }
1120
1121         /// <summary>
1122         /// The InputLineSpacing property.<br />
1123         /// The extra space between lines in points.<br />
1124         /// </summary>
1125         /// <since_tizen> 3 </since_tizen>
1126         public float InputLineSpacing
1127         {
1128             get
1129             {
1130                 return (float)GetValue(InputLineSpacingProperty);
1131             }
1132             set
1133             {
1134                 SetValue(InputLineSpacingProperty, value);
1135                 NotifyPropertyChanged();
1136             }
1137         }
1138
1139         /// <summary>
1140         /// The relative height of the line (a factor that will be multiplied by text height). <br />
1141         /// If the value is less than 1, the lines could to be overlapped.
1142         /// </summary>
1143         [EditorBrowsable(EditorBrowsableState.Never)]
1144         public float RelativeLineHeight
1145         {
1146             get
1147             {
1148                 return (float)GetValue(RelativeLineHeightProperty);
1149             }
1150             set
1151             {
1152                 SetValue(RelativeLineHeightProperty, value);
1153                 NotifyPropertyChanged();
1154             }
1155         }
1156
1157         /// <summary>
1158         /// The Underline property.<br />
1159         /// The default underline parameters.<br />
1160         /// The underline map contains the following keys :<br />
1161         /// <list type="table">
1162         /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1163         /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1164         /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1165         /// </list>
1166         /// </summary>
1167         /// <since_tizen> 3 </since_tizen>
1168         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1169         public PropertyMap Underline
1170         {
1171             get
1172             {
1173                 return (PropertyMap)GetValue(UnderlineProperty);
1174             }
1175             set
1176             {
1177                 SetValue(UnderlineProperty, value);
1178                 NotifyPropertyChanged();
1179             }
1180         }
1181
1182         /// <summary>
1183         /// Set Underline to TextEditor. <br />
1184         /// </summary>
1185         /// <param name="underline">The Underline</param>
1186         /// <remarks>
1187         /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1188         /// </remarks>
1189         /// <example>
1190         /// The following example demonstrates how to use the SetUnderline method.
1191         /// <code>
1192         /// var underline = new Tizen.NUI.Text.Underline();
1193         /// underline.Enable = true;
1194         /// underline.Color = new Color("#3498DB");
1195         /// underline.Height = 2.0f;
1196         /// editor.SetUnderline(underline);
1197         /// </code>
1198         /// </example>
1199         [EditorBrowsable(EditorBrowsableState.Never)]
1200         public void SetUnderline(Underline underline)
1201         {
1202             using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1203             {
1204                 SetValue(UnderlineProperty, underlineMap);
1205             }
1206         }
1207
1208         /// <summary>
1209         /// Get Underline from TextEditor. <br />
1210         /// </summary>
1211         /// <returns>The Underline</returns>
1212         /// <remarks>
1213         /// <see cref="Tizen.NUI.Text.Underline"/>
1214         /// </remarks>
1215         [EditorBrowsable(EditorBrowsableState.Never)]
1216         public Underline GetUnderline()
1217         {
1218             Underline underline;
1219             using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1220             {
1221                 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1222             }
1223             return underline;
1224         }
1225
1226         /// <summary>
1227         /// The InputUnderline property.<br />
1228         /// The underline parameters of the new input text.<br />
1229         /// </summary>
1230         /// <since_tizen> 3 </since_tizen>
1231         public string InputUnderline
1232         {
1233             get
1234             {
1235                 return (string)GetValue(InputUnderlineProperty);
1236             }
1237             set
1238             {
1239                 SetValue(InputUnderlineProperty, value);
1240                 NotifyPropertyChanged();
1241             }
1242         }
1243
1244         /// <summary>
1245         /// The Shadow property.<br />
1246         /// The default shadow parameters.<br />
1247         /// The shadow map contains the following keys :<br />
1248         /// <list type="table">
1249         /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1250         /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1251         /// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
1252         /// </list>
1253         /// </summary>
1254         /// <since_tizen> 3 </since_tizen>
1255         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1256         public PropertyMap Shadow
1257         {
1258             get
1259             {
1260                 return (PropertyMap)GetValue(ShadowProperty);
1261             }
1262             set
1263             {
1264                 SetValue(ShadowProperty, value);
1265                 NotifyPropertyChanged();
1266             }
1267         }
1268
1269         /// <summary>
1270         /// Set Shadow to TextEditor. <br />
1271         /// </summary>
1272         /// <param name="shadow">The Shadow</param>
1273         /// <remarks>
1274         /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1275         /// </remarks>
1276         /// <example>
1277         /// The following example demonstrates how to use the SetShadow method.
1278         /// <code>
1279         /// var shadow = new Tizen.NUI.Text.Shadow();
1280         /// shadow.Offset = new Vector2(3, 3);
1281         /// shadow.Color = new Color("#F1C40F");
1282         /// editor.SetShadow(shadow);
1283         /// </code>
1284         /// </example>
1285         [EditorBrowsable(EditorBrowsableState.Never)]
1286         public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1287         {
1288             using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1289             {
1290                 SetValue(ShadowProperty, shadowMap);
1291             }
1292         }
1293
1294         /// <summary>
1295         /// Get Shadow from TextEditor. <br />
1296         /// </summary>
1297         /// <returns>The Shadow</returns>
1298         /// <remarks>
1299         /// <see cref="Tizen.NUI.Text.Shadow"/>
1300         /// </remarks>
1301         [EditorBrowsable(EditorBrowsableState.Never)]
1302         public Tizen.NUI.Text.Shadow GetShadow()
1303         {
1304             Tizen.NUI.Text.Shadow shadow;
1305             using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1306             {
1307                 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1308             }
1309             return shadow;
1310         }
1311
1312         /// <summary>
1313         /// The InputShadow property.<br />
1314         /// The shadow parameters of the new input text.<br />
1315         /// </summary>
1316         /// <since_tizen> 3 </since_tizen>
1317         public string InputShadow
1318         {
1319             get
1320             {
1321                 return (string)GetValue(InputShadowProperty);
1322             }
1323             set
1324             {
1325                 SetValue(InputShadowProperty, value);
1326                 NotifyPropertyChanged();
1327             }
1328         }
1329
1330         /// <summary>
1331         /// The Emboss property.<br />
1332         /// The default emboss parameters.<br />
1333         /// </summary>
1334         /// <since_tizen> 3 </since_tizen>
1335         public string Emboss
1336         {
1337             get
1338             {
1339                 return (string)GetValue(EmbossProperty);
1340             }
1341             set
1342             {
1343                 SetValue(EmbossProperty, value);
1344                 NotifyPropertyChanged();
1345             }
1346         }
1347
1348         /// <summary>
1349         /// The InputEmboss property.<br />
1350         /// The emboss parameters of the new input text.<br />
1351         /// </summary>
1352         /// <since_tizen> 3 </since_tizen>
1353         public string InputEmboss
1354         {
1355             get
1356             {
1357                 return (string)GetValue(InputEmbossProperty);
1358             }
1359             set
1360             {
1361                 SetValue(InputEmbossProperty, value);
1362                 NotifyPropertyChanged();
1363             }
1364         }
1365
1366         /// <summary>
1367         /// The Outline property.<br />
1368         /// The default outline parameters.<br />
1369         /// The outline map contains the following keys :<br />
1370         /// <list type="table">
1371         /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1372         /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1373         /// </list>
1374         /// </summary>
1375         /// <since_tizen> 3 </since_tizen>
1376         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1377         public PropertyMap Outline
1378         {
1379             get
1380             {
1381                 return (PropertyMap)GetValue(OutlineProperty);
1382             }
1383             set
1384             {
1385                 SetValue(OutlineProperty, value);
1386                 NotifyPropertyChanged();
1387             }
1388         }
1389
1390         /// <summary>
1391         /// Set Outline to TextEditor. <br />
1392         /// </summary>
1393         /// <param name="outline">The Outline</param>
1394         /// <remarks>
1395         /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1396         /// </remarks>
1397         /// <example>
1398         /// The following example demonstrates how to use the SetOutline method.
1399         /// <code>
1400         /// var outline = new Tizen.NUI.Text.Outline();
1401         /// outline.Width = 2.0f;
1402         /// outline.Color = new Color("#45B39D");
1403         /// editor.SetOutline(outline);
1404         /// </code>
1405         /// </example>
1406         [EditorBrowsable(EditorBrowsableState.Never)]
1407         public void SetOutline(Outline outline)
1408         {
1409             using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1410             {
1411                 SetValue(OutlineProperty, outlineMap);
1412             }
1413         }
1414
1415         /// <summary>
1416         /// Get Outline from TextEditor. <br />
1417         /// </summary>
1418         /// <returns>The Outline</returns>
1419         /// <remarks>
1420         /// <see cref="Tizen.NUI.Text.Outline"/>
1421         /// </remarks>
1422         [EditorBrowsable(EditorBrowsableState.Never)]
1423         public Outline GetOutline()
1424         {
1425             Outline outline;
1426             using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1427             {
1428                 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1429             }
1430             return outline;
1431         }
1432
1433         /// <summary>
1434         /// The InputOutline property.<br />
1435         /// The outline parameters of the new input text.<br />
1436         /// </summary>
1437         /// <since_tizen> 3 </since_tizen>
1438         public string InputOutline
1439         {
1440             get
1441             {
1442                 return (string)GetValue(InputOutlineProperty);
1443             }
1444             set
1445             {
1446                 SetValue(InputOutlineProperty, value);
1447                 NotifyPropertyChanged();
1448             }
1449         }
1450
1451         /// <summary>
1452         /// The SmoothScroll property.<br />
1453         /// Enable or disable the smooth scroll animation.<br />
1454         /// </summary>
1455         /// <since_tizen> 3 </since_tizen>
1456         public bool SmoothScroll
1457         {
1458             get
1459             {
1460                 return (bool)GetValue(SmoothScrollProperty);
1461             }
1462             set
1463             {
1464                 SetValue(SmoothScrollProperty, value);
1465                 NotifyPropertyChanged();
1466             }
1467         }
1468
1469         /// <summary>
1470         /// The SmoothScrollDuration property.<br />
1471         /// Sets the duration of smooth scroll animation.<br />
1472         /// </summary>
1473         /// <since_tizen> 3 </since_tizen>
1474         public float SmoothScrollDuration
1475         {
1476             get
1477             {
1478                 return (float)GetValue(SmoothScrollDurationProperty);
1479             }
1480             set
1481             {
1482                 SetValue(SmoothScrollDurationProperty, value);
1483                 NotifyPropertyChanged();
1484             }
1485         }
1486
1487         /// <summary>
1488         /// The EnableScrollBar property.<br />
1489         /// Enable or disable the scroll bar.<br />
1490         /// </summary>
1491         /// <since_tizen> 3 </since_tizen>
1492         public bool EnableScrollBar
1493         {
1494             get
1495             {
1496                 return (bool)GetValue(EnableScrollBarProperty);
1497             }
1498             set
1499             {
1500                 SetValue(EnableScrollBarProperty, value);
1501                 NotifyPropertyChanged();
1502             }
1503         }
1504
1505         /// <summary>
1506         /// The ScrollBarShowDuration property.<br />
1507         /// Sets the duration of scroll bar to show.<br />
1508         /// </summary>
1509         /// <since_tizen> 3 </since_tizen>
1510         public float ScrollBarShowDuration
1511         {
1512             get
1513             {
1514                 return (float)GetValue(ScrollBarShowDurationProperty);
1515             }
1516             set
1517             {
1518                 SetValue(ScrollBarShowDurationProperty, value);
1519                 NotifyPropertyChanged();
1520             }
1521         }
1522
1523         /// <summary>
1524         /// The ScrollBarFadeDuration property.<br />
1525         /// Sets the duration of scroll bar to fade out.<br />
1526         /// </summary>
1527         /// <since_tizen> 3 </since_tizen>
1528         public float ScrollBarFadeDuration
1529         {
1530             get
1531             {
1532                 return (float)GetValue(ScrollBarFadeDurationProperty);
1533             }
1534             set
1535             {
1536                 SetValue(ScrollBarFadeDurationProperty, value);
1537                 NotifyPropertyChanged();
1538             }
1539         }
1540
1541         /// <summary>
1542         /// The PixelSize property.<br />
1543         /// The size of font in pixels.<br />
1544         /// </summary>
1545         /// <since_tizen> 3 </since_tizen>
1546         [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1547         public float PixelSize
1548         {
1549             get
1550             {
1551                 return (float)GetValue(PixelSizeProperty);
1552             }
1553             set
1554             {
1555                 SetValue(PixelSizeProperty, value);
1556                 NotifyPropertyChanged();
1557             }
1558         }
1559
1560         /// <summary>
1561         /// The line count of the text.
1562         /// </summary>
1563         /// <since_tizen> 3 </since_tizen>
1564         public int LineCount
1565         {
1566             get
1567             {
1568                 int lineCount = 0;
1569                 using (var propertyValue = GetProperty(TextEditor.Property.LineCount))
1570                 {
1571                     propertyValue.Get(out lineCount);
1572                 }
1573                 return lineCount;
1574             }
1575         }
1576
1577         /// <summary>
1578         /// The text to display when the TextEditor is empty and inactive.
1579         /// </summary>
1580         /// <since_tizen> 3 </since_tizen>
1581         public string PlaceholderText
1582         {
1583             get
1584             {
1585                 return (string)GetValue(PlaceholderTextProperty);
1586             }
1587             set
1588             {
1589                 SetValue(PlaceholderTextProperty, value);
1590                 NotifyPropertyChanged();
1591             }
1592         }
1593
1594         /// <summary>
1595         /// The portion of the text that has been selected by the user.
1596         /// </summary>
1597         /// <remarks>
1598         /// Empty string when nothing is selected.
1599         /// </remarks>
1600         /// <since_tizen> 9 </since_tizen>
1601         public string SelectedText
1602         {
1603             get
1604             {
1605                 string selectedText;
1606                 using (var propertyValue = GetProperty(TextEditor.Property.SelectedText))
1607                 {
1608                     propertyValue.Get(out selectedText);
1609                 }
1610                 return selectedText;
1611             }
1612         }
1613
1614         /// <summary>
1615         /// The Placeholder text color.
1616         /// </summary>
1617         /// <remarks>
1618         /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1619         /// </remarks>
1620         /// <since_tizen> 3 </since_tizen>
1621         public Color PlaceholderTextColor
1622         {
1623             get
1624             {
1625                 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1626                 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1627             }
1628             set
1629             {
1630                 SetValue(PlaceholderTextColorProperty, value);
1631                 NotifyPropertyChanged();
1632             }
1633         }
1634
1635         /// <summary>
1636         /// The Enable selection property.<br />
1637         /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1638         /// </summary>
1639         /// <since_tizen> 3 </since_tizen>
1640         public bool EnableSelection
1641         {
1642             get
1643             {
1644                 return (bool)GetValue(EnableSelectionProperty);
1645             }
1646             set
1647             {
1648                 SetValue(EnableSelectionProperty, value);
1649                 NotifyPropertyChanged();
1650             }
1651         }
1652
1653         /// <summary>
1654         /// The start index for selection.
1655         /// </summary>
1656         /// <remarks>
1657         /// When there is no selection, the index is current cursor position.
1658         /// </remarks>
1659         /// <since_tizen> 9 </since_tizen>
1660         public int SelectedTextStart
1661         {
1662             get
1663             {
1664                 int selectedTextStart;
1665                 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextStart))
1666                 {
1667                     propertyValue.Get(out selectedTextStart);
1668                 }
1669                 return selectedTextStart;
1670             }
1671         }
1672
1673         /// <summary>
1674         /// The end index for selection.
1675         /// </summary>
1676         /// <remarks>
1677         /// When there is no selection, the index is current cursor position.
1678         /// </remarks>
1679         /// <since_tizen> 9 </since_tizen>
1680         public int SelectedTextEnd
1681         {
1682             get
1683             {
1684                 int selectedTextEnd;
1685                 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextEnd))
1686                 {
1687                     propertyValue.Get(out selectedTextEnd);
1688                 }
1689                 return selectedTextEnd;
1690             }
1691         }
1692
1693         /// <summary>
1694         /// Enable editing in text control.
1695         /// </summary>
1696         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1697         [EditorBrowsable(EditorBrowsableState.Never)]
1698         public bool EnableEditing
1699         {
1700             get
1701             {
1702                 return (bool)GetValue(EnableEditingProperty);
1703             }
1704             set
1705             {
1706                 SetValue(EnableEditingProperty, value);
1707             }
1708         }
1709
1710         private bool InternalEnableEditing
1711         {
1712             get
1713             {
1714                 bool enableEditing;
1715                 using (var propertyValue = GetProperty(TextEditor.Property.EnableEditing))
1716                 {
1717                     propertyValue.Get(out enableEditing);
1718                 }
1719                 return enableEditing;
1720             }
1721             set
1722             {
1723                 using (var propertyValue = new PropertyValue(value))
1724                 {
1725                     SetProperty(TextEditor.Property.EnableEditing, propertyValue);
1726                     NotifyPropertyChanged();
1727                 }
1728             }
1729         }
1730
1731         /// <summary>
1732         /// Specify horizontal scroll position in text control.
1733         /// </summary>
1734         [EditorBrowsable(EditorBrowsableState.Never)]
1735         public int HorizontalScrollPosition
1736         {
1737             get
1738             {
1739                 return (int)GetValue(HorizontalScrollPositionProperty);
1740             }
1741             set
1742             {
1743                 SetValue(HorizontalScrollPositionProperty, value);
1744             }
1745         }
1746
1747         private int InternalHorizontalScrollPosition
1748         {
1749             get
1750             {
1751                 int horizontalScrollPosition;
1752                 using (var propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1753                 {
1754                     propertyValue.Get(out horizontalScrollPosition);
1755                 }
1756                 return horizontalScrollPosition;
1757             }
1758             set
1759             {
1760                 using (var propertyValue = new PropertyValue(value))
1761                 {
1762                     SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1763                     NotifyPropertyChanged();
1764                 }
1765             }
1766         }
1767
1768         /// <summary>
1769         /// Specify vertical scroll position in text control.
1770         /// </summary>
1771         [EditorBrowsable(EditorBrowsableState.Never)]
1772         public int VerticalScrollPosition
1773         {
1774             get
1775             {
1776                 return (int)GetValue(VerticalScrollPositionProperty);
1777             }
1778             set
1779             {
1780                 SetValue(VerticalScrollPositionProperty, value);
1781             }
1782         }
1783
1784         private int InternalVerticalScrollPosition
1785         {
1786             get
1787             {
1788                 int verticalScrollPosition;
1789                 using (var propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1790                 {
1791                     propertyValue.Get(out verticalScrollPosition);
1792                 }
1793                 return verticalScrollPosition;
1794             }
1795             set
1796             {
1797                 using (var propertyValue = new PropertyValue(value))
1798                 {
1799                     SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1800                     NotifyPropertyChanged();
1801                 }
1802             }
1803         }
1804
1805         /// <summary>
1806         /// PrimaryCursorPosition property.<br />
1807         /// Specify the position of the primary cursor (caret) in text control.
1808         /// </summary>
1809         /// <remarks>
1810         /// If the value set is out of range (negative or greater than or equal the number of characters in Text) then the PrimaryCursorPosition is moved to the end of Text (the number of characters in Text).
1811         /// </remarks>
1812         /// <since_tizen> 10 </since_tizen>
1813         public int PrimaryCursorPosition
1814         {
1815             get
1816             {
1817                 return (int)GetValue(PrimaryCursorPositionProperty);
1818             }
1819             set
1820             {
1821                 SetValue(PrimaryCursorPositionProperty, value);
1822             }
1823         }
1824
1825         private int InternalPrimaryCursorPosition
1826         {
1827             get
1828             {
1829                 int primaryCursorPosition;
1830                 using (var propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1831                 {
1832                     propertyValue.Get(out primaryCursorPosition);
1833                 }
1834                 return primaryCursorPosition;
1835             }
1836             set
1837             {
1838                 using (var propertyValue = new PropertyValue(value))
1839                 {
1840                     SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1841                     NotifyPropertyChanged();
1842                 }
1843             }
1844         }
1845
1846         /// <summary>
1847         /// The GrabHandleColor property.
1848         /// </summary>
1849         /// <remarks>
1850         /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1851         /// </remarks>
1852         [EditorBrowsable(EditorBrowsableState.Never)]
1853         public Color GrabHandleColor
1854         {
1855             get
1856             {
1857                 Color temp = (Color)GetValue(GrabHandleColorProperty);
1858                 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1859             }
1860             set
1861             {
1862                 SetValue(GrabHandleColorProperty, value);
1863                 NotifyPropertyChanged();
1864             }
1865         }
1866
1867         /// <summary>
1868         /// Set InputFilter to TextEditor.
1869         /// </summary>
1870         /// <param name="inputFilter">The InputFilter</param>
1871         /// <remarks>
1872         /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1873         /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1874         /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1875         /// </remarks>
1876         /// <example>
1877         /// The following example demonstrates how to use the SetInputFilter method.
1878         /// <code>
1879         /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1880         /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1881         /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1882         /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1883         /// </code>
1884         /// </example>
1885         /// <since_tizen> 9 </since_tizen>
1886         public void SetInputFilter(InputFilter inputFilter)
1887         {
1888             using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1889             using (var propertyValue = new PropertyValue(map))
1890             {
1891                 SetProperty(TextEditor.Property.InputFilter, propertyValue);
1892             }
1893         }
1894
1895         /// <summary>
1896         /// Get InputFilter from TextEditor. <br />
1897         /// </summary>
1898         /// <returns>The InputFilter</returns>
1899         /// <remarks>
1900         /// <see cref="Tizen.NUI.Text.InputFilter"/>
1901         /// </remarks>
1902         /// <since_tizen> 9 </since_tizen>
1903         public InputFilter GetInputFilter()
1904         {
1905             InputFilter inputFilter;
1906             using (var propertyValue = GetProperty(TextEditor.Property.InputFilter))
1907             using (var map = new PropertyMap())
1908             {
1909                 propertyValue.Get(map);
1910                 inputFilter = TextMapHelper.GetInputFilterStruct(map);
1911             }
1912             return inputFilter;
1913         }
1914
1915         /// <summary>
1916         /// Set Strikethrough to TextEditor. <br />
1917         /// </summary>
1918         /// <param name="strikethrough">The Strikethrough</param>
1919         /// <remarks>
1920         /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1921         /// </remarks>
1922         /// <example>
1923         /// The following example demonstrates how to use the SetStrikethrough method.
1924         /// <code>
1925         /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1926         /// strikethrough.Enable = true;
1927         /// strikethrough.Color = new Color("#3498DB");
1928         /// strikethrough.Height = 2.0f;
1929         /// editor.SetStrikethrough(strikethrough);
1930         /// </code>
1931         /// </example>
1932         [EditorBrowsable(EditorBrowsableState.Never)]
1933         public void SetStrikethrough(Strikethrough strikethrough)
1934         {
1935             using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1936             using (var propertyValue = new PropertyValue(map))
1937             {
1938                 SetProperty(TextEditor.Property.Strikethrough, propertyValue);
1939             }
1940         }
1941
1942         /// <summary>
1943         /// Get Strikethrough from TextEditor. <br />
1944         /// </summary>
1945         /// <returns>The Strikethrough</returns>
1946         /// <remarks>
1947         /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1948         /// </remarks>
1949         [EditorBrowsable(EditorBrowsableState.Never)]
1950         public Strikethrough GetStrikethrough()
1951         {
1952             Strikethrough strikethrough;
1953             using (var propertyValue = GetProperty(TextEditor.Property.Strikethrough))
1954             using (var map = new PropertyMap())
1955             {
1956                 propertyValue.Get(map);
1957                 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1958             }
1959             return strikethrough;
1960         }
1961
1962         /// <summary>
1963         /// The Placeholder property.
1964         /// The placeholder map contains the following keys :<br />
1965         /// <list type="table">
1966         /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1967         /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1968         /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1969         /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1970         /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1971         /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1972         /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1973         /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1974         /// </list>
1975         /// </summary>
1976         /// <example>
1977         /// The following example demonstrates how to set the placeholder property.
1978         /// <code>
1979         /// PropertyMap propertyMap = new PropertyMap();
1980         /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1981         /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1982         /// propertyMap.Add("color", new PropertyValue(Color.Red));
1983         /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1984         /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1985         ///
1986         /// PropertyMap fontStyleMap = new PropertyMap();
1987         /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1988         /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1989         /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1990         /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1991         ///
1992         /// TextEditor editor = new TextEditor();
1993         /// editor.Placeholder = propertyMap;
1994         /// </code>
1995         /// </example>
1996         /// <since_tizen> 3 </since_tizen>
1997         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1998         public Tizen.NUI.PropertyMap Placeholder
1999         {
2000             get
2001             {
2002                 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2003                 string defalutText = "";
2004
2005                 if (TextMapHelper.IsValue(map, 0))
2006                     map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2007
2008                 if (TextMapHelper.IsValue(map, 1))
2009                     map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2010
2011                 if (TextMapHelper.IsValue(map, 2))
2012                 {
2013                     using (var color = TextMapHelper.GetColorFromMap(map, 2))
2014                     {
2015                         map.Add("color", color);
2016                     }
2017                 }
2018
2019                 if (TextMapHelper.IsValue(map, 3))
2020                     map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2021
2022                 if (TextMapHelper.IsValue(map, 4))
2023                 {
2024                     using (var properyValue = map.Find(4))
2025                     using (var fontStyle = new PropertyMap())
2026                     {
2027                         properyValue.Get(fontStyle);
2028                         using (var fontStyleValue = new PropertyValue(fontStyle))
2029                         {
2030                             map.Add("fontStyle", fontStyleValue);
2031                         }
2032                     }
2033                 }
2034
2035                 if (TextMapHelper.IsValue(map, 5))
2036                     map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2037
2038                 if (TextMapHelper.IsValue(map, 6))
2039                     map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2040
2041                 if (TextMapHelper.IsValue(map, 7))
2042                     map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2043
2044                 return map;
2045             }
2046             set
2047             {
2048                 SetValue(PlaceholderProperty, value);
2049                 NotifyPropertyChanged();
2050             }
2051         }
2052
2053         /// <summary>
2054         /// Set Placeholder to TextEditor. <br />
2055         /// </summary>
2056         /// <param name="placeholder">The Placeholder</param>
2057         /// <remarks>
2058         /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2059         /// </remarks>
2060         /// <example>
2061         /// The following example demonstrates how to use the SetPlaceholder method.
2062         /// <code>
2063         /// var placeholder = new Tizen.NUI.Text.Placeholder();
2064         /// placeholder.Text = "placeholder text";
2065         /// placeholder.TextFocused = "placeholder textFocused";
2066         /// placeholder.Color = new Color("#45B39D");
2067         /// placeholder.FontFamily = "BreezeSans";
2068         /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2069         /// {
2070         ///     Width = FontWidthType.Expanded,
2071         ///     Weight = FontWeightType.ExtraLight,
2072         ///     Slant = FontSlantType.Italic,
2073         /// };
2074         /// placeholder.PointSize = 25.0f;
2075         /// //placeholder.PixelSize = 50.0f;
2076         /// placeholder.Ellipsis = true;
2077         /// editor.SetPlaceholder(placeholder);
2078         /// </code>
2079         /// </example>
2080         [EditorBrowsable(EditorBrowsableState.Never)]
2081         public void SetPlaceholder(Placeholder placeholder)
2082         {
2083             using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2084             {
2085                 SetValue(PlaceholderProperty, placeholderMap);
2086             }
2087         }
2088
2089         /// <summary>
2090         /// Get Placeholder from TextEditor. <br />
2091         /// </summary>
2092         /// <returns>The Placeholder</returns>
2093         /// <remarks>
2094         /// <see cref="Tizen.NUI.Text.Placeholder"/>
2095         /// </remarks>
2096         [EditorBrowsable(EditorBrowsableState.Never)]
2097         public Placeholder GetPlaceholder()
2098         {
2099             Placeholder placeholder;
2100             using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2101             {
2102                 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2103             }
2104             return placeholder;
2105         }
2106
2107         /// <summary>
2108         /// The Ellipsis property.<br />
2109         /// Enable or disable the ellipsis.<br />
2110         /// </summary>
2111         /// <since_tizen> 9 </since_tizen>
2112         public bool Ellipsis
2113         {
2114             get
2115             {
2116                 return (bool)GetValue(EllipsisProperty);
2117             }
2118             set
2119             {
2120                 SetValue(EllipsisProperty, value);
2121                 NotifyPropertyChanged();
2122             }
2123         }
2124
2125
2126         /// <summary>
2127         /// The ellipsis position of the text.
2128         /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2129         /// </summary>
2130         /// <since_tizen> 9 </since_tizen>
2131         public EllipsisPosition EllipsisPosition
2132         {
2133             get
2134             {
2135                 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2136             }
2137             set
2138             {
2139                 SetValue(EllipsisPositionProperty, value);
2140                 NotifyPropertyChanged();
2141             }
2142         }
2143
2144         /// <summary>
2145         /// The LineWrapMode property.<br />
2146         /// The line wrap mode when the text lines over the layout width.<br />
2147         /// </summary>
2148         /// <since_tizen> 4 </since_tizen>
2149         public LineWrapMode LineWrapMode
2150         {
2151             get
2152             {
2153                 return (LineWrapMode)GetValue(LineWrapModeProperty);
2154             }
2155             set
2156             {
2157                 SetValue(LineWrapModeProperty, value);
2158                 NotifyPropertyChanged();
2159             }
2160         }
2161
2162         /// <summary>
2163         /// Enables Text selection using Shift key.
2164         /// </summary>
2165         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2166         [EditorBrowsable(EditorBrowsableState.Never)]
2167         public bool EnableShiftSelection
2168         {
2169             get
2170             {
2171                 return (bool)GetValue(EnableShiftSelectionProperty);
2172             }
2173             set
2174             {
2175                 SetValue(EnableShiftSelectionProperty, value);
2176                 NotifyPropertyChanged();
2177             }
2178         }
2179
2180         /// <summary>
2181         /// The text alignment to match the direction of the system language.
2182         /// </summary>
2183         /// <since_tizen> 6 </since_tizen>
2184         public bool MatchSystemLanguageDirection
2185         {
2186             get
2187             {
2188                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2189             }
2190             set
2191             {
2192                 SetValue(MatchSystemLanguageDirectionProperty, value);
2193                 NotifyPropertyChanged();
2194             }
2195         }
2196
2197         /// <summary>
2198         /// The MaxLength property.<br />
2199         /// The maximum number of characters that can be inserted.<br />
2200         /// </summary>
2201         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2202         [EditorBrowsable(EditorBrowsableState.Never)]
2203         public int MaxLength
2204         {
2205             get
2206             {
2207                 return (int)GetValue(MaxLengthProperty);
2208             }
2209             set
2210             {
2211                 SetValue(MaxLengthProperty, value);
2212                 NotifyPropertyChanged();
2213             }
2214         }
2215
2216         /// <summary>
2217         /// The FontSizeScale property. <br />
2218         /// The default value is 1.0. <br />
2219         /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2220         /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2221         /// </summary>
2222         /// <since_tizen> 9 </since_tizen>
2223         public float FontSizeScale
2224         {
2225             get
2226             {
2227                 return (float)GetValue(FontSizeScaleProperty);
2228             }
2229             set
2230             {
2231                 SetValue(FontSizeScaleProperty, value);
2232                 NotifyPropertyChanged();
2233             }
2234         }
2235
2236         private float InternalFontSizeScale
2237         {
2238             get
2239             {
2240                 return fontSizeScale;
2241             }
2242             set
2243             {
2244                 float newFontSizeScale;
2245
2246                 if (fontSizeScale == value) return;
2247
2248                 fontSizeScale = value;
2249                 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2250                 {
2251                     SystemSettingsFontSize systemSettingsFontSize;
2252
2253                     try
2254                     {
2255                         systemSettingsFontSize = SystemSettings.FontSize;
2256                     }
2257                     catch (Exception e)
2258                     {
2259                         Console.WriteLine("{0} Exception caught.", e);
2260                         systemSettingsFontSize = SystemSettingsFontSize.Normal;
2261                     }
2262                     newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2263                     AddSystemSettingsFontSizeChanged();
2264                 }
2265                 else
2266                 {
2267                     newFontSizeScale = fontSizeScale;
2268                     RemoveSystemSettingsFontSizeChanged();
2269                 }
2270
2271                 SetInternalFontSizeScale(newFontSizeScale);
2272             }
2273         }
2274
2275         private void SetInternalFontSizeScale(float fontSizeScale)
2276         {
2277
2278             Object.InternalSetPropertyFloat(this.SwigCPtr, TextEditor.Property.FontSizeScale, (float)fontSizeScale);
2279         }
2280
2281         /// <summary>
2282         /// The EnableFontSizeScale property.<br />
2283         /// Whether the font size scale is enabled. (The default value is true)
2284         /// </summary>
2285         [EditorBrowsable(EditorBrowsableState.Never)]
2286         public bool EnableFontSizeScale
2287         {
2288             get
2289             {
2290                 return (bool)GetValue(EnableFontSizeScaleProperty);
2291             }
2292             set
2293             {
2294                 SetValue(EnableFontSizeScaleProperty, value);
2295                 NotifyPropertyChanged();
2296             }
2297         }
2298
2299         /// <summary>
2300         /// The InputMethodSettings property.<br />
2301         /// The settings to relating to the System's Input Method, Key and Value.<br />
2302         /// </summary>
2303         /// <remarks>
2304         /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
2305         /// </remarks>
2306         /// <example>
2307         /// The following example demonstrates how to set the InputMethodSettings property.
2308         /// <code>
2309         /// InputMethod method = new InputMethod();
2310         /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
2311         /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
2312         /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
2313         /// method.Variation = 1;
2314         /// textEditor.InputMethodSettings = method.OutputMap;
2315         /// </code>
2316         /// </example>
2317         [EditorBrowsable(EditorBrowsableState.Never)]
2318         public PropertyMap InputMethodSettings
2319         {
2320             get
2321             {
2322                 return (PropertyMap)GetValue(InputMethodSettingsProperty);
2323             }
2324             set
2325             {
2326                 SetValue(InputMethodSettingsProperty, value);
2327                 NotifyPropertyChanged();
2328             }
2329         }
2330
2331         /// <summary>
2332         /// Scroll the text control by specific amount..
2333         /// </summary>
2334         /// <param name="scroll">The amount (in pixels) of scrolling in horizontal &amp; vertical directions.</param>
2335         [EditorBrowsable(EditorBrowsableState.Never)]
2336         public void ScrollBy(Vector2 scroll)
2337         {
2338             Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
2339             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2340         }
2341
2342         /// <summary>
2343         /// Get the InputMethodContext instance.
2344         /// </summary>
2345         /// <returns>The InputMethodContext instance.</returns>
2346         /// <since_tizen> 5 </since_tizen>
2347         public InputMethodContext GetInputMethodContext()
2348         {
2349             if (inputMethodContext == null)
2350             {
2351                 /*Avoid raising InputMethodContext reference count.*/
2352                 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
2353                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2354             }
2355             return inputMethodContext;
2356         }
2357
2358         /// <summary>
2359         /// Select the whole text.
2360         /// </summary>
2361         /// <since_tizen> 9 </since_tizen>
2362         public void SelectWholeText()
2363         {
2364             Interop.TextEditor.SelectWholeText(SwigCPtr);
2365             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2366         }
2367
2368         /// <summary>
2369         /// Select text from start to end index. <br />
2370         /// The index is valid when 0 or positive.
2371         /// </summary>
2372         /// <param name="start">The start index for selection.</param>
2373         /// <param name="end">The end index for selection.</param>
2374         /// <remarks>
2375         /// If the end index exceeds the maximum value, it is set to the length of the text.
2376         /// </remarks>
2377         /// <since_tizen> 9 </since_tizen>
2378         public void SelectText(int start, int end)
2379         {
2380             if (start < 0)
2381                 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2382             if (end < 0)
2383                 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2384
2385             Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
2386             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2387         }
2388
2389         /// <summary>
2390         /// Clear selection of the text. <br />
2391         /// Valid when selection is activate.
2392         /// </summary>
2393         /// <since_tizen> 9 </since_tizen>
2394         public void SelectNone()
2395         {
2396             _ = Interop.TextEditor.SelectNone(SwigCPtr);
2397             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2398         }
2399
2400         /// <summary>
2401         /// The Enable grab handle property.<br />
2402         /// Enables the grab handles for text selection.<br />
2403         /// The default value is true, which means the grab handles are enabled by default.<br />
2404         /// </summary>
2405         [EditorBrowsable(EditorBrowsableState.Never)]
2406         public bool EnableGrabHandle
2407         {
2408             get
2409             {
2410                 return (bool)GetValue(EnableGrabHandleProperty);
2411             }
2412             set
2413             {
2414                 SetValue(EnableGrabHandleProperty, value);
2415                 NotifyPropertyChanged();
2416             }
2417         }
2418
2419         /// <summary>
2420         /// The Enable grab handle popup property.<br />
2421         /// Enables the grab handle popup for text selection.<br />
2422         /// The default value is true, which means the grab handle popup is enabled by default.<br />
2423         /// </summary>
2424         [EditorBrowsable(EditorBrowsableState.Never)]
2425         public bool EnableGrabHandlePopup
2426         {
2427             get
2428             {
2429                 return (bool)GetValue(EnableGrabHandlePopupProperty);
2430             }
2431             set
2432             {
2433                 SetValue(EnableGrabHandlePopupProperty, value);
2434                 NotifyPropertyChanged();
2435             }
2436         }
2437
2438         /// <summary>
2439         /// Minimum line size to be used.<br />
2440         /// The height of the line in points. <br />
2441         /// If the font size is larger than the line size, it works with the font size. <br />
2442         /// </summary>
2443         [EditorBrowsable(EditorBrowsableState.Never)]
2444         public float MinLineSize
2445         {
2446             get
2447             {
2448                 return (float)GetValue(MinLineSizeProperty);
2449             }
2450             set
2451             {
2452                 SetValue(MinLineSizeProperty, value);
2453                 NotifyPropertyChanged();
2454             }
2455         }
2456
2457         internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2458         {
2459             SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t(Interop.TextEditor.InputStyleChangedSignal(SwigCPtr));
2460             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2461             return ret;
2462         }
2463
2464         /// <summary>
2465         /// The spaces between characters in Pixels.
2466         /// <remarks>
2467         /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2468         /// The default value is 0.f which does nothing.
2469         ///</remarks>
2470         /// </summary>
2471         [EditorBrowsable(EditorBrowsableState.Never)]
2472         public float CharacterSpacing
2473         {
2474             get
2475             {
2476                 return (float)GetValue(CharacterSpacingProperty);
2477             }
2478             set
2479             {
2480                 SetValue(CharacterSpacingProperty, value);
2481                 NotifyPropertyChanged();
2482             }
2483         }
2484
2485         /// <summary>
2486         /// Dispose.
2487         /// </summary>
2488         /// <since_tizen> 3 </since_tizen>
2489         protected override void Dispose(DisposeTypes type)
2490         {
2491             if (disposed)
2492             {
2493                 return;
2494             }
2495
2496             internalPlaceholderTextColor?.Dispose();
2497             internalPrimaryCursorColor?.Dispose();
2498             internalSecondaryCursorColor?.Dispose();
2499             internalSelectionHighlightColor?.Dispose();
2500             internalInputColor?.Dispose();
2501             internalTextColor?.Dispose();
2502             internalGrabHandleColor?.Dispose();
2503
2504             if (hasSystemLanguageChanged)
2505             {
2506                 systemLocaleLanguageChanged.Remove(SystemSettings_LocaleLanguageChanged);
2507             }
2508
2509             RemoveSystemSettingsFontTypeChanged();
2510             RemoveSystemSettingsFontSizeChanged();
2511
2512             //Release your own unmanaged resources here.
2513             //You should not access any managed member here except static instance.
2514             //because the execution order of Finalizes is non-deterministic.
2515
2516             if (this.HasBody())
2517             {
2518                 if (textEditorTextChangedCallbackDelegate != null)
2519                 {
2520                     TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2521                 }
2522
2523                 if (textEditorMaxLengthReachedCallbackDelegate != null)
2524                 {
2525                     this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2526                 }
2527
2528                 if (textEditorSelectionStartedCallbackDelegate != null)
2529                 {
2530                     this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
2531                 }
2532
2533                 if (textEditorSelectionClearedCallbackDelegate != null)
2534                 {
2535                     this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2536                 }
2537
2538                 if (textEditorCursorPositionChangedCallbackDelegate != null)
2539                 {
2540                     this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2541                 }
2542
2543                 if (textEditorSelectionChangedCallbackDelegate != null)
2544                 {
2545                     this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2546                 }
2547             }
2548
2549             TextChanged -= TextEditorTextChanged;
2550             GetInputMethodContext()?.DestroyContext();
2551
2552             base.Dispose(type);
2553         }
2554
2555         /// This will not be public opened.
2556         [EditorBrowsable(EditorBrowsableState.Never)]
2557         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2558         {
2559             Interop.TextEditor.DeleteTextEditor(swigCPtr);
2560         }
2561
2562         internal override LayoutItem CreateDefaultLayout()
2563         {
2564             return new TextEditorLayout();
2565         }
2566
2567         internal void SetTextWithoutTextChanged(string text)
2568         {
2569             invokeTextChanged = false;
2570             Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2571             invokeTextChanged = true;
2572         }
2573
2574         private string SetTranslatable(string textEditorSid)
2575         {
2576             string translatableText = null;
2577             translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2578             if (translatableText != null)
2579             {
2580                 if (hasSystemLanguageChanged == false)
2581                 {
2582                     systemLocaleLanguageChanged.Add(SystemSettings_LocaleLanguageChanged);
2583                     hasSystemLanguageChanged = true;
2584                 }
2585                 return translatableText;
2586             }
2587             else
2588             {
2589                 translatableText = "";
2590                 return translatableText;
2591             }
2592         }
2593
2594         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2595         {
2596             if (textEditorTextSid != null)
2597             {
2598                 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2599             }
2600             if (textEditorPlaceHolderTextSid != null)
2601             {
2602                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2603             }
2604         }
2605
2606         private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2607         {
2608             float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2609             SetInternalFontSizeScale(newFontSizeScale);
2610         }
2611
2612         private void AddSystemSettingsFontSizeChanged()
2613         {
2614             if (hasSystemFontSizeChanged != true)
2615             {
2616                 try
2617                 {
2618                     systemFontSizeChanged.Add(SystemSettingsFontSizeChanged);
2619                     hasSystemFontSizeChanged = true;
2620                 }
2621                 catch (Exception e)
2622                 {
2623                     Console.WriteLine("{0} Exception caught.", e);
2624                     hasSystemFontSizeChanged = false;
2625                 }
2626             }
2627         }
2628
2629         private void RemoveSystemSettingsFontSizeChanged()
2630         {
2631             if (hasSystemFontSizeChanged == true)
2632             {
2633                 try
2634                 {
2635                     systemFontSizeChanged.Remove(SystemSettingsFontSizeChanged);
2636                     hasSystemFontSizeChanged = false;
2637                 }
2638                 catch (Exception e)
2639                 {
2640                     Console.WriteLine("{0} Exception caught.", e);
2641                     hasSystemFontSizeChanged = true;
2642                 }
2643             }
2644         }
2645
2646         private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2647         {
2648             SetInternalFontFamily(e.Value);
2649         }
2650
2651         private void AddSystemSettingsFontTypeChanged()
2652         {
2653             if (HasStyle() && !hasSystemFontTypeChanged)
2654             {
2655                 try
2656                 {
2657                     systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2658                     hasSystemFontTypeChanged = true;
2659                 }
2660                 catch (Exception e)
2661                 {
2662                     Console.WriteLine("{0} Exception caught.", e);
2663                     hasSystemFontTypeChanged = false;
2664                 }
2665             }
2666         }
2667         
2668         private void RemoveSystemSettingsFontTypeChanged()
2669         {
2670             if (hasSystemFontTypeChanged)
2671             {
2672                 try
2673                 {
2674                     systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2675                     hasSystemFontTypeChanged = false;
2676                 }
2677                 catch (Exception e)
2678                 {
2679                     Console.WriteLine("{0} Exception caught.", e);
2680                     hasSystemFontTypeChanged = true;
2681                 }
2682             }
2683         }
2684
2685         private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
2686         {
2687             if (!isSettingTextInCSharp)
2688             {
2689                 EnforceNotifyBindedInstance(TextProperty);
2690             }
2691         }
2692
2693         internal new class Property
2694         {
2695             internal static readonly int TEXT = Interop.TextEditor.TextGet();
2696             internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2697             internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2698             internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2699             internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2700             internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2701             internal static readonly int VerticalAlignment = Interop.TextEditor.VerticalAlignmentGet();
2702             internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2703             internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2704             internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2705             internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2706             internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2707             internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2708             internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2709             internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2710             internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2711             internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2712             internal static readonly int SelectionPopupStyle = Interop.TextEditor.SelectionPopupStyleGet();
2713             internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2714             internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2715             internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2716             internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2717             internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2718             internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2719             internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2720             internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2721             internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2722             internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2723             internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2724             internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2725             internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2726             internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2727             internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2728             internal static readonly int RelativeLineHeight = Interop.TextEditor.RelativeLineHeightGet();
2729             internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2730             internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2731             internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2732             internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2733             internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2734             internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2735             internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2736             internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2737             internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2738             internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2739             internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2740             internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2741             internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2742             internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2743             internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2744             internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2745             internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2746             internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2747             internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2748             internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2749             internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2750             internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2751             internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2752             internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2753             internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2754             internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2755             internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2756             internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2757             internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2758             internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2759             internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2760             internal static readonly int EnableFontSizeScale = Interop.TextEditor.EnableFontSizeScaleGet();
2761             internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2762             internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2763             internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2764             internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2765             internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2766             internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2767             internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2768             internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2769             internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
2770             internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
2771         }
2772
2773         internal class InputStyle
2774         {
2775             internal enum Mask
2776             {
2777                 None = 0x0000,
2778                 Color = 0x0001,
2779                 FontFamily = 0x0002,
2780                 PointSize = 0x0004,
2781                 FontStyle = 0x0008,
2782                 LineSpacing = 0x0010,
2783                 Underline = 0x0020,
2784                 Shadow = 0x0040,
2785                 Emboss = 0x0080,
2786                 Outline = 0x0100
2787             }
2788         }
2789
2790         private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2791         {
2792             DecorationBoundingBox = new Rectangle(x, y, width, height);
2793         }
2794         private void OnInputColorChanged(float x, float y, float z, float w)
2795         {
2796             InputColor = new Vector4(x, y, z, w);
2797         }
2798         private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2799         {
2800             PlaceholderTextColor = new Color(r, g, b, a);
2801         }
2802         private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2803         {
2804             PrimaryCursorColor = new Vector4(x, y, z, w);
2805         }
2806         private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2807         {
2808             SecondaryCursorColor = new Vector4(x, y, z, w);
2809         }
2810         private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2811         {
2812             SelectionHighlightColor = new Vector4(x, y, z, w);
2813         }
2814         private void OnTextColorChanged(float x, float y, float z, float w)
2815         {
2816             TextColor = new Vector4(x, y, z, w);
2817         }
2818         private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2819         {
2820             GrabHandleColor = new Color(r, g, b, a);
2821         }
2822
2823         private class TextEditorLayout : LayoutItem
2824         {
2825             protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2826             {
2827                 // Padding will be automatically applied by DALi TextEditor.
2828                 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2829                 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2830                 var minSize = Owner.MinimumSize;
2831                 var maxSize = Owner.MaximumSize;
2832                 var naturalSize = Owner.GetNaturalSize();
2833
2834                 if (((TextEditor)Owner).Text.Length == 0)
2835                 {
2836                     // Calculate height of TextEditor by setting Text with " ".
2837                     // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2838                     ((TextEditor)Owner).SetTextWithoutTextChanged(" ");
2839
2840                     // Store original WidthSpecification to restore it after setting ResizePolicy.
2841                     var widthSpecification = Owner.WidthSpecification;
2842
2843                     // In DALi's Size logic, if Width or Height is set to be 0, then
2844                     // ResizePolicy is not changed to Fixed.
2845                     // This causes Size changes after NUI Layout's OnMeasure is finished.
2846                     // e.g. TextEditor's Width fills to its parent although Text is null and
2847                     //      WidthSpecification is WrapContent.
2848                     // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2849                     // in advance if Text is null.
2850                     Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2851
2852                     // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2853                     Owner.WidthSpecification = widthSpecification;
2854
2855                     naturalSize = Owner.GetNaturalSize();
2856
2857                     // Restore TextEditor's Text after calculating height of TextEditor.
2858                     // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2859                     ((TextEditor)Owner).SetTextWithoutTextChanged("");
2860                 }
2861
2862                 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2863                 {
2864                     float width = naturalSize != null ? naturalSize.Width : 0;
2865                     totalWidth = Math.Min(Math.Max(width, minSize.Width), maxSize.Width);
2866                 }
2867
2868                 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2869                 {
2870                     float height = naturalSize != null ? naturalSize.Height : 0;
2871                     totalHeight = Math.Min(Math.Max(height, minSize.Height), maxSize.Height);
2872                 }
2873
2874                 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2875                 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2876
2877                 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2878                 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2879
2880                 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2881                                       ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
2882             }
2883         }
2884     }
2885 }