[NUI] Add SetFontStyle, GetFontStyle to Text Components
[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 using System.Text.RegularExpressions;
21
22 using System;
23 using System.Globalization;
24 using System.ComponentModel;
25 using Tizen.NUI.Text;
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         private string textEditorTextSid = null;
36         private string textEditorPlaceHolderTextSid = null;
37         private bool systemlangTextFlag = false;
38         private InputMethodContext inputMethodContext = null;
39         private float fontSizeScale = 1.0f;
40         private bool hasFontSizeChangedCallback = false;
41
42         static TextEditor() { }
43
44         /// <summary>
45         /// Creates the TextEditor control.
46         /// </summary>
47         /// <since_tizen> 3 </since_tizen>
48         public TextEditor() : this(Interop.TextEditor.New(), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         /// <summary>
54         /// Creates the TextEditor with specified style.
55         /// </summary>
56         [EditorBrowsable(EditorBrowsableState.Never)]
57         public TextEditor(TextEditorStyle style) : this(Interop.TextLabel.New(), true, style: style)
58         {
59         }
60
61         /// <summary>
62         /// Creates the TextEditor with setting the status of shown or hidden.
63         /// </summary>
64         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
65         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
66         [EditorBrowsable(EditorBrowsableState.Never)]
67         public TextEditor(bool shown) : this(Interop.TextEditor.New(), true)
68         {
69             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70             SetVisible(shown);
71         }
72
73         internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
74         {
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76
77             if (!shown)
78             {
79                 SetVisible(false);
80             }
81         }
82
83         internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
84         {
85             if (!shown)
86             {
87                 SetVisible(false);
88             }
89         }
90
91         /// <summary>
92         /// The TranslatableText property.<br />
93         /// The text can set the SID value.<br />
94         /// </summary>
95         /// <exception cref='ArgumentNullException'>
96         /// ResourceManager about multilingual is null.
97         /// </exception>
98         /// <since_tizen> 4 </since_tizen>
99         public string TranslatableText
100         {
101             get
102             {
103                 return textEditorTextSid;
104             }
105             set
106             {
107                 if (NUIApplication.MultilingualResourceManager == null)
108                 {
109                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
110                 }
111                 textEditorTextSid = value;
112                 Text = SetTranslatable(textEditorTextSid);
113                 NotifyPropertyChanged();
114             }
115         }
116         /// <summary>
117         /// The TranslatablePlaceholderText property.<br />
118         /// The text can set the SID value.<br />
119         /// </summary>
120         /// <exception cref='ArgumentNullException'>
121         /// ResourceManager about multilingual is null.
122         /// </exception>
123         /// <since_tizen> 4 </since_tizen>
124         public string TranslatablePlaceholderText
125         {
126             get
127             {
128                 return textEditorPlaceHolderTextSid;
129             }
130             set
131             {
132                 if (NUIApplication.MultilingualResourceManager == null)
133                 {
134                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
135                 }
136                 textEditorPlaceHolderTextSid = value;
137                 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
138                 NotifyPropertyChanged();
139             }
140         }
141
142         /// <summary>
143         /// The Text property.
144         /// </summary>
145         /// <since_tizen> 3 </since_tizen>
146         public string Text
147         {
148             get
149             {
150                 return (string)GetValue(TextProperty);
151             }
152             set
153             {
154                 SetValueAndForceSendChangeSignal(TextProperty, value);
155                 NotifyPropertyChanged();
156             }
157         }
158
159         /// <summary>
160         /// The TextColor property.
161         /// </summary>
162         /// <remarks>
163         /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
164         /// </remarks>
165         /// <since_tizen> 3 </since_tizen>
166         public Vector4 TextColor
167         {
168             get
169             {
170                 Vector4 temp = (Vector4)GetValue(TextColorProperty);
171                 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
172             }
173             set
174             {
175                 SetValue(TextColorProperty, value);
176                 NotifyPropertyChanged();
177             }
178         }
179
180         /// <summary>
181         /// The FontFamily property.
182         /// </summary>
183         /// <since_tizen> 3 </since_tizen>
184         public string FontFamily
185         {
186             get
187             {
188                 return (string)GetValue(FontFamilyProperty);
189             }
190             set
191             {
192                 SetValue(FontFamilyProperty, value);
193                 NotifyPropertyChanged();
194             }
195         }
196
197         /// <summary>
198         /// The FontStyle property.
199         /// The fontStyle map contains the following keys :<br />
200         /// <list type="table">
201         /// <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>
202         /// <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>
203         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
204         /// </list>
205         /// </summary>
206         /// <since_tizen> 3 </since_tizen>
207         public PropertyMap FontStyle
208         {
209             get
210             {
211                 return (PropertyMap)GetValue(FontStyleProperty);
212             }
213             set
214             {
215                 SetValue(FontStyleProperty, value);
216                 NotifyPropertyChanged();
217             }
218         }
219
220         /// <summary>
221         /// Set FontStyle to TextEditor. <br />
222         /// </summary>
223         /// <param name="fontStyle">The FontStyle</param>
224         /// <remarks>
225         /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
226         /// </remarks>
227         /// <example>
228         /// The following example demonstrates how to use the SetFontStyle method.
229         /// <code>
230         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
231         /// fontStyle.Width = FontWidthType.Expanded;
232         /// fontStyle.Weight = FontWeightType.Bold;
233         /// fontStyle.Slant = FontSlantType.Italic;
234         /// editor.SetFontStyle(fontStyle);
235         /// </code>
236         /// </example>
237         [EditorBrowsable(EditorBrowsableState.Never)]
238         public void SetFontStyle(FontStyle fontStyle)
239         {
240             SetProperty(TextEditor.Property.FontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
241         }
242
243         /// <summary>
244         /// Get FontStyle from TextEditor. <br />
245         /// </summary>
246         /// <returns>The FontStyle</returns>
247         /// <remarks>
248         /// <see cref="Tizen.NUI.Text.FontStyle"/>
249         /// </remarks>
250         [EditorBrowsable(EditorBrowsableState.Never)]
251         public FontStyle GetFontStyle()
252         {
253             var map = new PropertyMap();
254             GetProperty(TextEditor.Property.FontStyle).Get(map);
255             return TextUtils.GetFontStyleStruct(map);
256         }
257
258         /// <summary>
259         /// The PointSize property.
260         /// </summary>
261         /// <since_tizen> 3 </since_tizen>
262         public float PointSize
263         {
264             get
265             {
266                 return (float)GetValue(PointSizeProperty);
267             }
268             set
269             {
270                 SetValue(PointSizeProperty, value);
271                 NotifyPropertyChanged();
272             }
273         }
274
275         /// <summary>
276         /// The HorizontalAlignment property.
277         /// </summary>
278         /// <since_tizen> 3 </since_tizen>
279         public HorizontalAlignment HorizontalAlignment
280         {
281             get
282             {
283                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
284             }
285             set
286             {
287                 SetValue(HorizontalAlignmentProperty, value);
288                 NotifyPropertyChanged();
289             }
290         }
291
292         /// <summary>
293         /// The ScrollThreshold property.
294         /// </summary>
295         /// <since_tizen> 3 </since_tizen>
296         public float ScrollThreshold
297         {
298             get
299             {
300                 return (float)GetValue(ScrollThresholdProperty);
301             }
302             set
303             {
304                 SetValue(ScrollThresholdProperty, value);
305                 NotifyPropertyChanged();
306             }
307         }
308
309         /// <summary>
310         /// The ScrollSpeed property.
311         /// </summary>
312         /// <since_tizen> 3 </since_tizen>
313         public float ScrollSpeed
314         {
315             get
316             {
317                 return (float)GetValue(ScrollSpeedProperty);
318             }
319             set
320             {
321                 SetValue(ScrollSpeedProperty, value);
322                 NotifyPropertyChanged();
323             }
324         }
325
326         /// <summary>
327         /// The PrimaryCursorColor property.
328         /// </summary>
329         /// <remarks>
330         /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
331         /// </remarks>
332         /// <since_tizen> 3 </since_tizen>
333         public Vector4 PrimaryCursorColor
334         {
335             get
336             {
337                 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
338                 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
339             }
340             set
341             {
342                 SetValue(PrimaryCursorColorProperty, value);
343                 NotifyPropertyChanged();
344             }
345         }
346
347         /// <summary>
348         /// The SecondaryCursorColor property.
349         /// </summary>
350         /// <remarks>
351         /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
352         /// </remarks>
353         /// <since_tizen> 3 </since_tizen>
354         public Vector4 SecondaryCursorColor
355         {
356             get
357             {
358                 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
359                 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
360             }
361             set
362             {
363                 SetValue(SecondaryCursorColorProperty, value);
364                 NotifyPropertyChanged();
365             }
366         }
367
368         /// <summary>
369         /// The EnableCursorBlink property.
370         /// </summary>
371         /// <since_tizen> 3 </since_tizen>
372         public bool EnableCursorBlink
373         {
374             get
375             {
376                 return (bool)GetValue(EnableCursorBlinkProperty);
377             }
378             set
379             {
380                 SetValue(EnableCursorBlinkProperty, value);
381                 NotifyPropertyChanged();
382             }
383         }
384
385         /// <summary>
386         /// The CursorBlinkInterval property.
387         /// </summary>
388         /// <since_tizen> 3 </since_tizen>
389         public float CursorBlinkInterval
390         {
391             get
392             {
393                 return (float)GetValue(CursorBlinkIntervalProperty);
394             }
395             set
396             {
397                 SetValue(CursorBlinkIntervalProperty, value);
398                 NotifyPropertyChanged();
399             }
400         }
401
402         /// <summary>
403         /// The CursorBlinkDuration property.
404         /// </summary>
405         /// <since_tizen> 3 </since_tizen>
406         public float CursorBlinkDuration
407         {
408             get
409             {
410                 return (float)GetValue(CursorBlinkDurationProperty);
411             }
412             set
413             {
414                 SetValue(CursorBlinkDurationProperty, value);
415                 NotifyPropertyChanged();
416             }
417         }
418
419         /// <summary>
420         /// The CursorWidth property.
421         /// </summary>
422         /// <since_tizen> 3 </since_tizen>
423         public int CursorWidth
424         {
425             get
426             {
427                 return (int)GetValue(CursorWidthProperty);
428             }
429             set
430             {
431                 SetValue(CursorWidthProperty, value);
432                 NotifyPropertyChanged();
433             }
434         }
435
436         /// <summary>
437         /// The GrabHandleImage property.
438         /// </summary>
439         /// <since_tizen> 3 </since_tizen>
440         public string GrabHandleImage
441         {
442             get
443             {
444                 return (string)GetValue(GrabHandleImageProperty);
445             }
446             set
447             {
448                 SetValue(GrabHandleImageProperty, value);
449                 NotifyPropertyChanged();
450             }
451         }
452
453         /// <summary>
454         /// The GrabHandlePressedImage property.
455         /// </summary>
456         /// <since_tizen> 3 </since_tizen>
457         public string GrabHandlePressedImage
458         {
459             get
460             {
461                 return (string)GetValue(GrabHandlePressedImageProperty);
462             }
463             set
464             {
465                 SetValue(GrabHandlePressedImageProperty, value);
466                 NotifyPropertyChanged();
467             }
468         }
469
470         /// <summary>
471         /// The SelectionHandleImageLeft property.
472         /// The selectionHandleImageLeft map contains the following key :<br />
473         /// <list type="table">
474         /// <item><term>filename (string)</term><description>The path of image file</description></item>
475         /// </list>
476         /// </summary>
477         /// <since_tizen> 3 </since_tizen>
478         public PropertyMap SelectionHandleImageLeft
479         {
480             get
481             {
482                 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
483             }
484             set
485             {
486                 SetValue(SelectionHandleImageLeftProperty, value);
487                 NotifyPropertyChanged();
488             }
489         }
490
491         /// <summary>
492         /// The SelectionHandleImageRight property.
493         /// The selectionHandleImageRight map contains the following key :<br />
494         /// <list type="table">
495         /// <item><term>filename (string)</term><description>The path of image file</description></item>
496         /// </list>
497         /// </summary>
498         /// <since_tizen> 3 </since_tizen>
499         public PropertyMap SelectionHandleImageRight
500         {
501             get
502             {
503                 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
504             }
505             set
506             {
507                 SetValue(SelectionHandleImageRightProperty, value);
508                 NotifyPropertyChanged();
509             }
510         }
511
512         /// <summary>
513         /// The SelectionHandlePressedImageLeft property.
514         /// The selectionHandlePressedImageLeft map contains the following key :<br />
515         /// <list type="table">
516         /// <item><term>filename (string)</term><description>The path of image file</description></item>
517         /// </list>
518         /// </summary>
519         /// <since_tizen> 3 </since_tizen>
520         public PropertyMap SelectionHandlePressedImageLeft
521         {
522             get
523             {
524                 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
525             }
526             set
527             {
528                 SetValue(SelectionHandlePressedImageLeftProperty, value);
529                 NotifyPropertyChanged();
530             }
531         }
532
533         /// <summary>
534         /// The SelectionHandlePressedImageRight property.
535         /// The selectionHandlePressedImageRight map contains the following key :<br />
536         /// <list type="table">
537         /// <item><term>filename (string)</term><description>The path of image file</description></item>
538         /// </list>
539         /// </summary>
540         /// <since_tizen> 3 </since_tizen>
541         public PropertyMap SelectionHandlePressedImageRight
542         {
543             get
544             {
545                 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
546             }
547             set
548             {
549                 SetValue(SelectionHandlePressedImageRightProperty, value);
550                 NotifyPropertyChanged();
551             }
552         }
553
554         /// <summary>
555         /// The SelectionHandleMarkerImageLeft property.
556         /// The selectionHandleMarkerImageLeft map contains the following key :<br />
557         /// <list type="table">
558         /// <item><term>filename (string)</term><description>The path of image file</description></item>
559         /// </list>
560         /// </summary>
561         /// <since_tizen> 3 </since_tizen>
562         public PropertyMap SelectionHandleMarkerImageLeft
563         {
564             get
565             {
566                 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
567             }
568             set
569             {
570                 SetValue(SelectionHandleMarkerImageLeftProperty, value);
571                 NotifyPropertyChanged();
572             }
573         }
574
575         /// <summary>
576         /// The SelectionHandleMarkerImageRight property.
577         /// The selectionHandleMarkerImageRight map contains the following key :<br />
578         /// <list type="table">
579         /// <item><term>filename (string)</term><description>The path of image file</description></item>
580         /// </list>
581         /// </summary>
582         /// <since_tizen> 3 </since_tizen>
583         public PropertyMap SelectionHandleMarkerImageRight
584         {
585             get
586             {
587                 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
588             }
589             set
590             {
591                 SetValue(SelectionHandleMarkerImageRightProperty, value);
592                 NotifyPropertyChanged();
593             }
594         }
595
596         /// <summary>
597         /// The SelectionHighlightColor property.
598         /// </summary>
599         /// <remarks>
600         /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
601         /// </remarks>
602         /// <since_tizen> 3 </since_tizen>
603         public Vector4 SelectionHighlightColor
604         {
605             get
606             {
607                 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
608                 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
609             }
610             set
611             {
612                 SetValue(SelectionHighlightColorProperty, value);
613                 NotifyPropertyChanged();
614             }
615         }
616
617         /// <summary>
618         /// The DecorationBoundingBox property.
619         /// </summary>
620         /// <remarks>
621         /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
622         /// </remarks>
623         /// <since_tizen> 3 </since_tizen>
624         public Rectangle DecorationBoundingBox
625         {
626             get
627             {
628                 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
629                 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
630             }
631             set
632             {
633                 SetValue(DecorationBoundingBoxProperty, value);
634                 NotifyPropertyChanged();
635             }
636         }
637
638         /// <summary>
639         /// The EnableMarkup property.
640         /// </summary>
641         /// <since_tizen> 3 </since_tizen>
642         public bool EnableMarkup
643         {
644             get
645             {
646                 return (bool)GetValue(EnableMarkupProperty);
647             }
648             set
649             {
650                 SetValue(EnableMarkupProperty, value);
651                 NotifyPropertyChanged();
652             }
653         }
654
655         /// <summary>
656         /// The InputColor property.
657         /// </summary>
658         /// <remarks>
659         /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
660         /// </remarks>
661         /// <since_tizen> 3 </since_tizen>
662         public Vector4 InputColor
663         {
664             get
665             {
666                 Vector4 temp = (Vector4)GetValue(InputColorProperty);
667                 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
668             }
669             set
670             {
671                 SetValue(InputColorProperty, value);
672                 NotifyPropertyChanged();
673             }
674         }
675
676         /// <summary>
677         /// The InputFontFamily property.
678         /// </summary>
679         /// <since_tizen> 3 </since_tizen>
680         public string InputFontFamily
681         {
682             get
683             {
684                 return (string)GetValue(InputFontFamilyProperty);
685             }
686             set
687             {
688                 SetValue(InputFontFamilyProperty, value);
689                 NotifyPropertyChanged();
690             }
691         }
692
693         /// <summary>
694         /// The InputFontStyle property.
695         /// The inputFontStyle map contains the following keys :<br />
696         /// <list type="table">
697         /// <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>
698         /// <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>
699         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
700         /// </list>
701         /// </summary>
702         /// <since_tizen> 3 </since_tizen>
703         public PropertyMap InputFontStyle
704         {
705             get
706             {
707                 return (PropertyMap)GetValue(InputFontStyleProperty);
708             }
709             set
710             {
711                 SetValue(InputFontStyleProperty, value);
712                 NotifyPropertyChanged();
713             }
714         }
715
716         /// <summary>
717         /// Set InputFontStyle to TextEditor. <br />
718         /// </summary>
719         /// <param name="fontStyle">The FontStyle</param>
720         /// <remarks>
721         /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
722         /// </remarks>
723         /// <example>
724         /// The following example demonstrates how to use the SetInputFontStyle method.
725         /// <code>
726         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
727         /// fontStyle.Width = FontWidthType.Expanded;
728         /// fontStyle.Weight = FontWeightType.Bold;
729         /// fontStyle.Slant = FontSlantType.Italic;
730         /// editor.SetInputFontStyle(fontStyle);
731         /// </code>
732         /// </example>
733         [EditorBrowsable(EditorBrowsableState.Never)]
734         public void SetInputFontStyle(FontStyle fontStyle)
735         {
736             SetProperty(TextEditor.Property.InputFontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
737             NotifyPropertyChanged();
738         }
739
740         /// <summary>
741         /// Get InputFontStyle from TextEditor. <br />
742         /// </summary>
743         /// <returns>The FontStyle</returns>
744         /// <remarks>
745         /// <see cref="Tizen.NUI.Text.FontStyle"/>
746         /// </remarks>
747         [EditorBrowsable(EditorBrowsableState.Never)]
748         public FontStyle GetInputFontStyle()
749         {
750             var map = new PropertyMap();
751             GetProperty(TextEditor.Property.InputFontStyle).Get(map);
752             return TextUtils.GetFontStyleStruct(map);
753         }
754
755         /// <summary>
756         /// The InputPointSize property.
757         /// </summary>
758         /// <since_tizen> 3 </since_tizen>
759         public float InputPointSize
760         {
761             get
762             {
763                 return (float)GetValue(InputPointSizeProperty);
764             }
765             set
766             {
767                 SetValue(InputPointSizeProperty, value);
768                 NotifyPropertyChanged();
769             }
770         }
771
772         /// <summary>
773         /// The LineSpacing property.
774         /// </summary>
775         /// <since_tizen> 3 </since_tizen>
776         public float LineSpacing
777         {
778             get
779             {
780                 return (float)GetValue(LineSpacingProperty);
781             }
782             set
783             {
784                 SetValue(LineSpacingProperty, value);
785                 NotifyPropertyChanged();
786             }
787         }
788
789         /// <summary>
790         /// The InputLineSpacing property.
791         /// </summary>
792         /// <since_tizen> 3 </since_tizen>
793         public float InputLineSpacing
794         {
795             get
796             {
797                 return (float)GetValue(InputLineSpacingProperty);
798             }
799             set
800             {
801                 SetValue(InputLineSpacingProperty, value);
802                 NotifyPropertyChanged();
803             }
804         }
805
806         /// <summary>
807         /// The Underline property.
808         /// The underline map contains the following keys :<br />
809         /// <list type="table">
810         /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
811         /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
812         /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
813         /// </list>
814         /// </summary>
815         /// <since_tizen> 3 </since_tizen>
816         public PropertyMap Underline
817         {
818             get
819             {
820                 return (PropertyMap)GetValue(UnderlineProperty);
821             }
822             set
823             {
824                 SetValue(UnderlineProperty, value);
825                 NotifyPropertyChanged();
826             }
827         }
828
829         /// <summary>
830         /// The InputUnderline property.
831         /// </summary>
832         /// <since_tizen> 3 </since_tizen>
833         public string InputUnderline
834         {
835             get
836             {
837                 return (string)GetValue(InputUnderlineProperty);
838             }
839             set
840             {
841                 SetValue(InputUnderlineProperty, value);
842                 NotifyPropertyChanged();
843             }
844         }
845
846         /// <summary>
847         /// The Shadow property.
848         /// The shadow map contains the following keys :<br />
849         /// <list type="table">
850         /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
851         /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
852         /// <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>
853         /// </list>
854         /// </summary>
855         /// <since_tizen> 3 </since_tizen>
856         public PropertyMap Shadow
857         {
858             get
859             {
860                 return (PropertyMap)GetValue(ShadowProperty);
861             }
862             set
863             {
864                 SetValue(ShadowProperty, value);
865                 NotifyPropertyChanged();
866             }
867         }
868
869         /// <summary>
870         /// The InputShadow property.
871         /// </summary>
872         /// <since_tizen> 3 </since_tizen>
873         public string InputShadow
874         {
875             get
876             {
877                 return (string)GetValue(InputShadowProperty);
878             }
879             set
880             {
881                 SetValue(InputShadowProperty, value);
882                 NotifyPropertyChanged();
883             }
884         }
885
886         /// <summary>
887         /// The Emboss property.
888         /// </summary>
889         /// <since_tizen> 3 </since_tizen>
890         public string Emboss
891         {
892             get
893             {
894                 return (string)GetValue(EmbossProperty);
895             }
896             set
897             {
898                 SetValue(EmbossProperty, value);
899                 NotifyPropertyChanged();
900             }
901         }
902
903         /// <summary>
904         /// The InputEmboss property.
905         /// </summary>
906         /// <since_tizen> 3 </since_tizen>
907         public string InputEmboss
908         {
909             get
910             {
911                 return (string)GetValue(InputEmbossProperty);
912             }
913             set
914             {
915                 SetValue(InputEmbossProperty, value);
916                 NotifyPropertyChanged();
917             }
918         }
919
920         /// <summary>
921         /// The Outline property.
922         /// The outline map contains the following keys :<br />
923         /// <list type="table">
924         /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
925         /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
926         /// </list>
927         /// </summary>
928         /// <since_tizen> 3 </since_tizen>
929         public PropertyMap Outline
930         {
931             get
932             {
933                 return (PropertyMap)GetValue(OutlineProperty);
934             }
935             set
936             {
937                 SetValue(OutlineProperty, value);
938                 NotifyPropertyChanged();
939             }
940         }
941
942         /// <summary>
943         /// The InputOutline property.
944         /// </summary>
945         /// <since_tizen> 3 </since_tizen>
946         public string InputOutline
947         {
948             get
949             {
950                 return (string)GetValue(InputOutlineProperty);
951             }
952             set
953             {
954                 SetValue(InputOutlineProperty, value);
955                 NotifyPropertyChanged();
956             }
957         }
958
959         /// <summary>
960         /// The SmoothScroll property.
961         /// </summary>
962         /// <since_tizen> 3 </since_tizen>
963         public bool SmoothScroll
964         {
965             get
966             {
967                 return (bool)GetValue(SmoothScrollProperty);
968             }
969             set
970             {
971                 SetValue(SmoothScrollProperty, value);
972                 NotifyPropertyChanged();
973             }
974         }
975
976         /// <summary>
977         /// The SmoothScrollDuration property.
978         /// </summary>
979         /// <since_tizen> 3 </since_tizen>
980         public float SmoothScrollDuration
981         {
982             get
983             {
984                 return (float)GetValue(SmoothScrollDurationProperty);
985             }
986             set
987             {
988                 SetValue(SmoothScrollDurationProperty, value);
989                 NotifyPropertyChanged();
990             }
991         }
992
993         /// <summary>
994         /// The EnableScrollBar property.
995         /// </summary>
996         /// <since_tizen> 3 </since_tizen>
997         public bool EnableScrollBar
998         {
999             get
1000             {
1001                 return (bool)GetValue(EnableScrollBarProperty);
1002             }
1003             set
1004             {
1005                 SetValue(EnableScrollBarProperty, value);
1006                 NotifyPropertyChanged();
1007             }
1008         }
1009
1010         /// <summary>
1011         /// The ScrollBarShowDuration property.
1012         /// </summary>
1013         /// <since_tizen> 3 </since_tizen>
1014         public float ScrollBarShowDuration
1015         {
1016             get
1017             {
1018                 return (float)GetValue(ScrollBarShowDurationProperty);
1019             }
1020             set
1021             {
1022                 SetValue(ScrollBarShowDurationProperty, value);
1023                 NotifyPropertyChanged();
1024             }
1025         }
1026
1027         /// <summary>
1028         /// The ScrollBarFadeDuration property.
1029         /// </summary>
1030         /// <since_tizen> 3 </since_tizen>
1031         public float ScrollBarFadeDuration
1032         {
1033             get
1034             {
1035                 return (float)GetValue(ScrollBarFadeDurationProperty);
1036             }
1037             set
1038             {
1039                 SetValue(ScrollBarFadeDurationProperty, value);
1040                 NotifyPropertyChanged();
1041             }
1042         }
1043
1044         /// <summary>
1045         /// The PixelSize property.
1046         /// </summary>
1047         /// <since_tizen> 3 </since_tizen>
1048         public float PixelSize
1049         {
1050             get
1051             {
1052                 return (float)GetValue(PixelSizeProperty);
1053             }
1054             set
1055             {
1056                 SetValue(PixelSizeProperty, value);
1057                 NotifyPropertyChanged();
1058             }
1059         }
1060
1061         /// <summary>
1062         /// The line count of the text.
1063         /// </summary>
1064         /// <since_tizen> 3 </since_tizen>
1065         public int LineCount
1066         {
1067             get
1068             {
1069                 int temp = 0;
1070                 GetProperty(TextEditor.Property.LineCount).Get(out temp);
1071                 return temp;
1072             }
1073         }
1074
1075         /// <summary>
1076         /// The text to display when the TextEditor is empty and inactive.
1077         /// </summary>
1078         /// <since_tizen> 3 </since_tizen>
1079         public string PlaceholderText
1080         {
1081             get
1082             {
1083                 return (string)GetValue(PlaceholderTextProperty);
1084             }
1085             set
1086             {
1087                 SetValue(PlaceholderTextProperty, value);
1088                 NotifyPropertyChanged();
1089             }
1090         }
1091
1092         /// <summary>
1093         /// The Selected Text property (read-only).
1094         /// </summary>
1095         [EditorBrowsable(EditorBrowsableState.Never)]
1096         public string SelectedText
1097         {
1098             get
1099             {
1100                 string temp;
1101                 GetProperty(TextEditor.Property.SelectedText).Get(out temp);
1102                 return temp;
1103             }
1104         }
1105
1106         /// <summary>
1107         /// The Placeholder text color.
1108         /// </summary>
1109         /// <remarks>
1110         /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1111         /// </remarks>
1112         /// <since_tizen> 3 </since_tizen>
1113         public Color PlaceholderTextColor
1114         {
1115             get
1116             {
1117                 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1118                 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1119             }
1120             set
1121             {
1122                 SetValue(PlaceholderTextColorProperty, value);
1123                 NotifyPropertyChanged();
1124             }
1125         }
1126
1127         /// <summary>
1128         /// The EnableSelection property.
1129         /// </summary>
1130         /// <since_tizen> 3 </since_tizen>
1131         public bool EnableSelection
1132         {
1133             get
1134             {
1135                 return (bool)GetValue(EnableSelectionProperty);
1136             }
1137             set
1138             {
1139                 SetValue(EnableSelectionProperty, value);
1140                 NotifyPropertyChanged();
1141             }
1142         }
1143
1144         /// <summary>
1145         /// The start index for selection.
1146         /// </summary>
1147         /// <since_tizen> 8 </since_tizen>
1148         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1149         [EditorBrowsable(EditorBrowsableState.Never)]
1150         public int SelectedTextStart
1151         {
1152             get
1153             {
1154                 int temp;
1155                 GetProperty(TextEditor.Property.SelectedTextStart).Get(out temp);
1156                 return temp;
1157             }
1158             set
1159             {
1160                 SetProperty(TextEditor.Property.SelectedTextStart, new PropertyValue(value));
1161                 NotifyPropertyChanged();
1162             }
1163         }
1164
1165         /// <summary>
1166         /// The end index for selection.
1167         /// </summary>
1168         /// <since_tizen> 8 </since_tizen>
1169         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1170         [EditorBrowsable(EditorBrowsableState.Never)]
1171         public int SelectedTextEnd
1172         {
1173             get
1174             {
1175                 int temp;
1176                 GetProperty(TextEditor.Property.SelectedTextEnd).Get(out temp);
1177                 return temp;
1178             }
1179             set
1180             {
1181                 SetProperty(TextEditor.Property.SelectedTextEnd, new PropertyValue(value));
1182                 NotifyPropertyChanged();
1183             }
1184         }
1185
1186         /// <summary>
1187         /// Enable editing in text control.
1188         /// </summary>
1189         /// <since_tizen> 8 </since_tizen>
1190         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1191         [EditorBrowsable(EditorBrowsableState.Never)]
1192         public bool EnableEditing
1193         {
1194             get
1195             {
1196                 bool temp;
1197                 GetProperty(TextEditor.Property.EnableEditing).Get(out temp);
1198                 return temp;
1199             }
1200             set
1201             {
1202                 SetProperty(TextEditor.Property.EnableEditing, new PropertyValue(value));
1203                 NotifyPropertyChanged();
1204             }
1205         }
1206
1207         /// <summary>
1208         /// Specify horizontal scroll position in text control.
1209         /// </summary>
1210         [EditorBrowsable(EditorBrowsableState.Never)]
1211         public int HorizontalScrollPosition
1212         {
1213             get
1214             {
1215                 int temp;
1216                 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1217                 {
1218                     propertyValue.Get(out temp);
1219                 }
1220                 return temp;
1221             }
1222             set
1223             {
1224                 using (PropertyValue propertyValue = new PropertyValue(value))
1225                 {
1226                     SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1227                     NotifyPropertyChanged();
1228                 }
1229             }
1230         }
1231
1232         /// <summary>
1233         /// Specify vertical scroll position in text control.
1234         /// </summary>
1235         [EditorBrowsable(EditorBrowsableState.Never)]
1236         public int VerticalScrollPosition
1237         {
1238             get
1239             {
1240                 int temp;
1241                 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1242                 {
1243                     propertyValue.Get(out temp);
1244                 }
1245                 return temp;
1246             }
1247             set
1248             {
1249                 using (PropertyValue propertyValue = new PropertyValue(value))
1250                 {
1251                     SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1252                     NotifyPropertyChanged();
1253                 }
1254             }
1255         }
1256
1257         /// <summary>
1258         /// Specify primary cursor (caret) position in text control.
1259         /// </summary>
1260         [EditorBrowsable(EditorBrowsableState.Never)]
1261         public int PrimaryCursorPosition
1262         {
1263             get
1264             {
1265                 int temp;
1266                 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1267                 {
1268                     propertyValue.Get(out temp);
1269                 }
1270                 return temp;
1271             }
1272             set
1273             {
1274                 using (PropertyValue propertyValue = new PropertyValue(value))
1275                 {
1276                     SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1277                     NotifyPropertyChanged();
1278                 }
1279             }
1280         }
1281
1282         /// <summary>
1283         /// The GrabHandleColor property.
1284         /// </summary>
1285         /// <remarks>
1286         /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1287         /// </remarks>
1288         [EditorBrowsable(EditorBrowsableState.Never)]
1289         public Color GrabHandleColor
1290         {
1291             get
1292             {
1293                 Color temp = (Color)GetValue(GrabHandleColorProperty);
1294                 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1295             }
1296             set
1297             {
1298                 SetValue(GrabHandleColorProperty, value);
1299                 NotifyPropertyChanged();
1300             }
1301         }
1302
1303         /// <summary>
1304         /// Set InputFilter to TextEditor. <br />
1305         /// </summary>
1306         /// <param name="inputFilter">The InputFilter</param>
1307         /// <remarks>
1308         /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1309         /// Users can set the Accepted or Rejected regular expression set, or both. <br />
1310         /// If both are used, Rejected has higher priority. <br />
1311         /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1312         /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description. <br />
1313         /// </remarks>
1314         /// <example>
1315         /// The following example demonstrates how to use the SetInputFilter method.
1316         /// <code>
1317         /// Tizen.NUI.Text.InputFilter inputFilter;
1318         /// inputFilter.Accepted = new Regex(@"[\d]"); // accept whole digits
1319         /// inputFilter.Rejected = new Regex("[0-3]"); // reject 0, 1, 2, 3
1320         /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1321         /// </code>
1322         /// </example>
1323         [EditorBrowsable(EditorBrowsableState.Never)]
1324         public void SetInputFilter(InputFilter inputFilter)
1325         {
1326             var map = new PropertyMap();
1327             var accepted = inputFilter.Accepted != null ? new PropertyValue(inputFilter.Accepted.ToString()) : new PropertyValue("");
1328             var rejected = inputFilter.Rejected != null ? new PropertyValue(inputFilter.Rejected.ToString()) : new PropertyValue("");
1329             map.Add(0, accepted);
1330             map.Add(1, rejected);
1331             SetProperty(TextEditor.Property.InputFilter, new PropertyValue(map));
1332         }
1333
1334         /// <summary>
1335         /// Get InputFilter from TextEditor. <br />
1336         /// </summary>
1337         /// <returns>The InputFilter</returns>
1338         /// <remarks>
1339         /// <see cref="Tizen.NUI.Text.InputFilter"/>
1340         /// </remarks>
1341         [EditorBrowsable(EditorBrowsableState.Never)]
1342         public InputFilter GetInputFilter()
1343         {
1344             var map = new PropertyMap();
1345             GetProperty(TextEditor.Property.InputFilter).Get(map);
1346             string accepted = "";
1347             string rejected = "";
1348             map.Find(0)?.Get(out accepted);
1349             map.Find(1)?.Get(out rejected);
1350
1351             var inputFilter = new InputFilter();
1352             inputFilter.Accepted = new Regex(accepted);
1353             inputFilter.Rejected = new Regex(rejected);
1354
1355             return inputFilter;
1356         }
1357
1358         /// <summary>
1359         /// The Placeholder property.
1360         /// The placeholder map contains the following keys :<br />
1361         /// <list type="table">
1362         /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1363         /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1364         /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1365         /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1366         /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1367         /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1368         /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1369         /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1370         /// </list>
1371         /// </summary>
1372         /// <example>
1373         /// The following example demonstrates how to set the placeholder property.
1374         /// <code>
1375         /// PropertyMap propertyMap = new PropertyMap();
1376         /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1377         /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1378         /// propertyMap.Add("color", new PropertyValue(Color.Red));
1379         /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1380         /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1381         ///
1382         /// PropertyMap fontStyleMap = new PropertyMap();
1383         /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1384         /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1385         /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1386         /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1387         ///
1388         /// TextEditor editor = new TextEditor();
1389         /// editor.Placeholder = propertyMap;
1390         /// </code>
1391         /// </example>
1392         /// <since_tizen> 3 </since_tizen>
1393         public Tizen.NUI.PropertyMap Placeholder
1394         {
1395             get
1396             {
1397                 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1398                 PropertyValue value = null;
1399
1400                 // text
1401                 value = map.Find(0);
1402                 if (null != value)
1403                 {
1404                     value.Get(out string text);
1405                     map.Add("text", new PropertyValue(text));
1406                 }
1407
1408                 // textFocused
1409                 value = map.Find(1);
1410                 if (null != value)
1411                 {
1412                     value.Get(out string textFocused);
1413                     map.Add("textFocused", new PropertyValue(textFocused));
1414                 }
1415
1416                 // color
1417                 value = map.Find(2);
1418                 if (null != value)
1419                 {
1420                     Color color = new Color();
1421                     value.Get(color);
1422                     map.Add("color", new PropertyValue(color));
1423                 }
1424
1425                 // fontFamily
1426                 value = map.Find(3);
1427                 if (null != value)
1428                 {
1429                     value.Get(out string fontFamily);
1430                     map.Add("fontFamily", new PropertyValue(fontFamily));
1431                 }
1432
1433                 // fontStyle
1434                 value = map.Find(4);
1435                 if (null != value)
1436                 {
1437                     PropertyMap fontStyle = new PropertyMap();
1438                     value.Get(fontStyle);
1439                     map.Add("fontStyle", new PropertyValue(fontStyle));
1440                 }
1441
1442                 // pointSize
1443                 value = map.Find(5);
1444                 if (null != value)
1445                 {
1446                     value.Get(out float pointSize);
1447                     map.Add("pointSize", new PropertyValue(pointSize));
1448                 }
1449
1450                 // pixelSize
1451                 value = map.Find(6);
1452                 if (null != value)
1453                 {
1454                     value.Get(out float pixelSize);
1455                     map.Add("pixelSize", new PropertyValue(pixelSize));
1456                 }
1457
1458                 // ellipsis
1459                 value = map.Find(7);
1460                 if (null != value)
1461                 {
1462                     value.Get(out bool ellipsis);
1463                     map.Add("ellipsis", new PropertyValue(ellipsis));
1464                 }
1465
1466                 return map;
1467             }
1468             set
1469             {
1470                 SetValue(PlaceholderProperty, value);
1471                 NotifyPropertyChanged();
1472             }
1473         }
1474
1475         /// <summary>
1476         /// The Ellipsis property.<br />
1477         /// Enable or disable the ellipsis.<br />
1478         /// </summary>
1479         [EditorBrowsable(EditorBrowsableState.Never)]
1480         public bool Ellipsis
1481         {
1482             get
1483             {
1484                 return (bool)GetValue(EllipsisProperty);
1485             }
1486             set
1487             {
1488                 SetValue(EllipsisProperty, value);
1489                 NotifyPropertyChanged();
1490             }
1491         }
1492
1493
1494         /// <summary>
1495         /// The ellipsis position of the text.
1496         /// The ellipsis position type when the text size over the layout size.<br />
1497         /// The ellipsis position: End, Start or Middle.<br />
1498         /// </summary>
1499         [EditorBrowsable(EditorBrowsableState.Never)]
1500         public EllipsisPosition EllipsisPosition
1501         {
1502             get
1503             {
1504                 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1505             }
1506             set
1507             {
1508                 SetValue(EllipsisPositionProperty, value);
1509                 NotifyPropertyChanged();
1510             }
1511         }
1512
1513         /// <summary>
1514         /// The LineWrapMode property.<br />
1515         /// The line wrap mode when the text lines over the layout width.<br />
1516         /// </summary>
1517         /// <since_tizen> 4 </since_tizen>
1518         public LineWrapMode LineWrapMode
1519         {
1520             get
1521             {
1522                 return (LineWrapMode)GetValue(LineWrapModeProperty);
1523             }
1524             set
1525             {
1526                 SetValue(LineWrapModeProperty, value);
1527                 NotifyPropertyChanged();
1528             }
1529         }
1530
1531         /// <summary>
1532         /// Enables Text selection using Shift key.
1533         /// </summary>
1534         /// <since_tizen> 5 </since_tizen>
1535         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1536         [EditorBrowsable(EditorBrowsableState.Never)]
1537         public bool EnableShiftSelection
1538         {
1539             get
1540             {
1541                 return (bool)GetValue(EnableShiftSelectionProperty);
1542             }
1543             set
1544             {
1545                 SetValue(EnableShiftSelectionProperty, value);
1546                 NotifyPropertyChanged();
1547             }
1548         }
1549
1550         /// <summary>
1551         /// The text alignment to match the direction of the system language.
1552         /// </summary>
1553         /// <since_tizen> 6 </since_tizen>
1554         public bool MatchSystemLanguageDirection
1555         {
1556             get
1557             {
1558                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1559             }
1560             set
1561             {
1562                 SetValue(MatchSystemLanguageDirectionProperty, value);
1563                 NotifyPropertyChanged();
1564             }
1565         }
1566
1567         /// <summary>
1568         /// The MaxLength property.
1569         /// </summary>
1570         /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1571         [EditorBrowsable(EditorBrowsableState.Never)]
1572         public int MaxLength
1573         {
1574             get
1575             {
1576                 return (int)GetValue(MaxLengthProperty);
1577             }
1578             set
1579             {
1580                 SetValue(MaxLengthProperty, value);
1581                 NotifyPropertyChanged();
1582             }
1583         }
1584
1585         /// Only used by the IL of xaml, will never changed to not hidden.
1586         [EditorBrowsable(EditorBrowsableState.Never)]
1587         public override bool IsCreateByXaml
1588         {
1589             get
1590             {
1591                 return base.IsCreateByXaml;
1592             }
1593             set
1594             {
1595                 base.IsCreateByXaml = value;
1596
1597                 if (value == true)
1598                 {
1599                     this.TextChanged += (obj, e) =>
1600                     {
1601                         this.Text = e.TextEditor.Text;
1602                     };
1603                 }
1604             }
1605         }
1606
1607         /// <summary>
1608         /// The FontSizeScale property. <br />
1609         /// The default value is 1.0. <br />
1610         /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1611         /// </summary>
1612         /// <since_tizen> 9 </since_tizen>
1613         public float FontSizeScale
1614         {
1615             get
1616             {
1617                 return fontSizeScale;
1618             }
1619             set
1620             {
1621                 float newFontSizeScale;
1622
1623                 if (fontSizeScale == value) return;
1624
1625                 fontSizeScale = value;
1626                 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1627                 {
1628                     SystemSettingsFontSize systemSettingsFontSize;
1629
1630                     try
1631                     {
1632                         systemSettingsFontSize = SystemSettings.FontSize;
1633                     }
1634                     catch (Exception e)
1635                     {
1636                         Console.WriteLine("{0} Exception caught.", e);
1637                         systemSettingsFontSize = SystemSettingsFontSize.Normal;
1638                     }
1639                     newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1640                     addFontSizeChangedCallback();
1641                 }
1642                 else
1643                 {
1644                     newFontSizeScale = fontSizeScale;
1645                     removeFontSizeChangedCallback();
1646                 }
1647
1648                 SetValue(FontSizeScaleProperty, newFontSizeScale);
1649                 NotifyPropertyChanged();
1650             }
1651         }
1652
1653         /// <summary>
1654         /// The InputMethodSettings property.
1655         /// </summary>
1656         /// <remarks>
1657         /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1658         /// </remarks>
1659         /// <example>
1660         /// The following example demonstrates how to set the InputMethodSettings property.
1661         /// <code>
1662         /// InputMethod method = new InputMethod();
1663         /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1664         /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1665         /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1666         /// method.Variation = 1;
1667         /// textEditor.InputMethodSettings = method.OutputMap;
1668         /// </code>
1669         /// </example>
1670         [EditorBrowsable(EditorBrowsableState.Never)]
1671         public PropertyMap InputMethodSettings
1672         {
1673             get
1674             {
1675                 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1676             }
1677             set
1678             {
1679                 SetValue(InputMethodSettingsProperty, value);
1680                 NotifyPropertyChanged();
1681             }
1682         }
1683
1684         /// <summary>
1685         /// Scroll the text control by specific amount..
1686         /// </summary>
1687         /// <param name="scroll">The amount (in pixels) of scrolling in horizontal &amp; vertical directions.</param>
1688         [EditorBrowsable(EditorBrowsableState.Never)]
1689         public void ScrollBy(Vector2 scroll)
1690         {
1691             Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
1692             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1693         }
1694
1695         /// <summary>
1696         /// Get the InputMethodContext instance.
1697         /// </summary>
1698         /// <returns>The InputMethodContext instance.</returns>
1699         /// <since_tizen> 5 </since_tizen>
1700         public InputMethodContext GetInputMethodContext()
1701         {
1702             if (inputMethodContext == null)
1703             {
1704                 /*Avoid raising InputMethodContext reference count.*/
1705                 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
1706                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707             }
1708             return inputMethodContext;
1709         }
1710
1711         /// <summary>
1712         /// Select the whole text.
1713         /// </summary>
1714         [EditorBrowsable(EditorBrowsableState.Never)]
1715         public void SelectWholeText()
1716         {
1717             Interop.TextEditor.SelectWholeText(SwigCPtr);
1718             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1719         }
1720
1721         /// <summary>
1722         /// Select text from start to end index.
1723         /// </summary>
1724         /// <param name="start">The start index for selection.</param>
1725         /// <param name="end">The end index for selection.</param>
1726         [EditorBrowsable(EditorBrowsableState.Never)]
1727         public void SelectText(uint start, uint end)
1728         {
1729             Interop.TextEditor.SelectText(SwigCPtr, start, end);
1730             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1731         }
1732
1733         /// <summary>
1734         /// Clear selection of the text.
1735         /// </summary>
1736         [EditorBrowsable(EditorBrowsableState.Never)]
1737         public void SelectNone()
1738         {
1739             _ = Interop.TextEditor.SelectNone(SwigCPtr);
1740             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1741         }
1742
1743         /// <summary>
1744         /// Enable grab handle property.
1745         /// </summary>
1746         [EditorBrowsable(EditorBrowsableState.Never)]
1747         public bool EnableGrabHandle
1748         {
1749             get
1750             {
1751                 return (bool)GetValue(EnableGrabHandleProperty);
1752             }
1753             set
1754             {
1755                 SetValue(EnableGrabHandleProperty, value);
1756                 NotifyPropertyChanged();
1757             }
1758         }
1759
1760         /// <summary>
1761         /// Enable grab handle popup property.
1762         /// </summary>
1763         [EditorBrowsable(EditorBrowsableState.Never)]
1764         public bool EnableGrabHandlePopup
1765         {
1766             get
1767             {
1768                 return (bool)GetValue(EnableGrabHandlePopupProperty);
1769             }
1770             set
1771             {
1772                 SetValue(EnableGrabHandlePopupProperty, value);
1773                 NotifyPropertyChanged();
1774             }
1775         }
1776
1777         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditor obj)
1778         {
1779             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1780         }
1781
1782         internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
1783         {
1784             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));
1785             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1786             return ret;
1787         }
1788
1789         /// <summary>
1790         /// Dispose.
1791         /// </summary>
1792         /// <since_tizen> 3 </since_tizen>
1793         protected override void Dispose(DisposeTypes type)
1794         {
1795             if (disposed)
1796             {
1797                 return;
1798             }
1799
1800             if (systemlangTextFlag)
1801             {
1802                 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1803             }
1804
1805             removeFontSizeChangedCallback();
1806
1807             //Release your own unmanaged resources here.
1808             //You should not access any managed member here except static instance.
1809             //because the execution order of Finalizes is non-deterministic.
1810
1811             if (this.HasBody())
1812             {
1813                 if (textEditorTextChangedCallbackDelegate != null)
1814                 {
1815                     TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
1816                 }
1817
1818                 if (textEditorMaxLengthReachedCallbackDelegate != null)
1819                 {
1820                     this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
1821                 }
1822             }
1823
1824             base.Dispose(type);
1825         }
1826
1827         /// This will not be public opened.
1828         [EditorBrowsable(EditorBrowsableState.Never)]
1829         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1830         {
1831             // In order to speed up IME hide, temporarily add
1832             GetInputMethodContext()?.DestroyContext();
1833             Interop.TextEditor.DeleteTextEditor(swigCPtr);
1834         }
1835
1836         private string SetTranslatable(string textEditorSid)
1837         {
1838             string translatableText = null;
1839             translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1840             if (translatableText != null)
1841             {
1842                 if (systemlangTextFlag == false)
1843                 {
1844                     SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1845                     systemlangTextFlag = true;
1846                 }
1847                 return translatableText;
1848             }
1849             else
1850             {
1851                 translatableText = "";
1852                 return translatableText;
1853             }
1854         }
1855
1856         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1857         {
1858             if (textEditorTextSid != null)
1859             {
1860                 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1861             }
1862             if (textEditorPlaceHolderTextSid != null)
1863             {
1864                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1865             }
1866         }
1867
1868         private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1869         {
1870             float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1871             SetValue(FontSizeScaleProperty, newFontSizeScale);
1872             NotifyPropertyChanged();
1873         }
1874
1875         private void addFontSizeChangedCallback()
1876         {
1877             if (hasFontSizeChangedCallback != true)
1878             {
1879                 try
1880                 {
1881                     SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
1882                     hasFontSizeChangedCallback = true;
1883                 }
1884                 catch (Exception e)
1885                 {
1886                     Console.WriteLine("{0} Exception caught.", e);
1887                     hasFontSizeChangedCallback = false;
1888                 }
1889             }
1890         }
1891
1892         private void removeFontSizeChangedCallback()
1893         {
1894             if (hasFontSizeChangedCallback == true)
1895             {
1896                 try
1897                 {
1898                     SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
1899                     hasFontSizeChangedCallback = false;
1900                 }
1901                 catch (Exception e)
1902                 {
1903                     Console.WriteLine("{0} Exception caught.", e);
1904                     hasFontSizeChangedCallback = true;
1905                 }
1906             }
1907         }
1908
1909         internal new class Property
1910         {
1911             internal static readonly int TEXT = Interop.TextEditor.TextGet();
1912             internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
1913             internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
1914             internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
1915             internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
1916             internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
1917             internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
1918             internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
1919             internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
1920             internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
1921             internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
1922             internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
1923             internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
1924             internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
1925             internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
1926             internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
1927             internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
1928             internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
1929             internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
1930             internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
1931             internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
1932             internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
1933             internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
1934             internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
1935             internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
1936             internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
1937             internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
1938             internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
1939             internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
1940             internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
1941             internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
1942             internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
1943             internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
1944             internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
1945             internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
1946             internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
1947             internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
1948             internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
1949             internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
1950             internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
1951             internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
1952             internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
1953             internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
1954             internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
1955             internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
1956             internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
1957             internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
1958             internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
1959             internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
1960             internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
1961             internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
1962             internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
1963             internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
1964             internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
1965             internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
1966             internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
1967             internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
1968             internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
1969             internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
1970             internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
1971             internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
1972             internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
1973             internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
1974             internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
1975             internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
1976             internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
1977             internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
1978             internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
1979             internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
1980         }
1981
1982         internal class InputStyle
1983         {
1984             internal enum Mask
1985             {
1986                 None = 0x0000,
1987                 Color = 0x0001,
1988                 FontFamily = 0x0002,
1989                 PointSize = 0x0004,
1990                 FontStyle = 0x0008,
1991                 LineSpacing = 0x0010,
1992                 Underline = 0x0020,
1993                 Shadow = 0x0040,
1994                 Emboss = 0x0080,
1995                 Outline = 0x0100
1996             }
1997         }
1998
1999         private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2000         {
2001             DecorationBoundingBox = new Rectangle(x, y, width, height);
2002         }
2003         private void OnInputColorChanged(float x, float y, float z, float w)
2004         {
2005             InputColor = new Vector4(x, y, z, w);
2006         }
2007         private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2008         {
2009             PlaceholderTextColor = new Color(r, g, b, a);
2010         }
2011         private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2012         {
2013             PrimaryCursorColor = new Vector4(x, y, z, w);
2014         }
2015         private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2016         {
2017             SecondaryCursorColor = new Vector4(x, y, z, w);
2018         }
2019         private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2020         {
2021             SelectionHighlightColor = new Vector4(x, y, z, w);
2022         }
2023         private void OnTextColorChanged(float x, float y, float z, float w)
2024         {
2025             TextColor = new Vector4(x, y, z, w);
2026         }
2027         private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2028         {
2029             GrabHandleColor = new Color(r, g, b, a);
2030         }
2031     }
2032 }