Support TranslatablePlaceholderTextFocused to TextField
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextField.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 extern alias TizenSystemSettings;
18 using TizenSystemSettings.Tizen.System;
19
20 using System;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
24
25 namespace Tizen.NUI.BaseComponents
26 {
27     /// <summary>
28     /// A control which provides a single line editable text field.
29     /// </summary>
30     /// <since_tizen> 3 </since_tizen>
31     public partial class TextField : View
32     {
33         private string textFieldTextSid = null;
34         private string textFieldPlaceHolderTextSid = null;
35         private string textFieldPlaceHolderTextFocusedSid = null;
36         private bool systemlangTextFlag = false;
37         private InputMethodContext inputMethodCotext = null;
38         private TextFieldSelectorData selectorData;
39         private float fontSizeScale = 1.0f;
40         private bool hasFontSizeChangedCallback = false;
41
42         static TextField() { }
43
44         /// <summary>
45         /// Creates the TextField control.
46         /// </summary>
47         /// <since_tizen> 3 </since_tizen>
48         public TextField() : this(Interop.TextField.New(), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         /// <summary>
54         /// Creates the TextField with setting the status of shown or hidden.
55         /// </summary>
56         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
57         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
58         [EditorBrowsable(EditorBrowsableState.Never)]
59         public TextField(bool shown) : this(Interop.TextField.New(), true)
60         {
61             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62             SetVisible(shown);
63         }
64
65         /// <summary>
66         /// Get attribues, it is abstract function and must be override.
67         /// </summary>
68         [EditorBrowsable(EditorBrowsableState.Never)]
69         protected override ViewStyle CreateViewStyle()
70         {
71             return new TextFieldStyle();
72         }
73
74         internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
75         {
76             if (!shown)
77             {
78                 SetVisible(false);
79             }
80         }
81
82         internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
83         {
84             if (!shown)
85             {
86                 SetVisible(false);
87             }
88         }
89
90         internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
91         {
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93
94             if (!shown)
95             {
96                 SetVisible(false);
97             }
98         }
99
100         internal enum ExceedPolicyType
101         {
102             ExceedPolicyOriginal,
103             ExceedPolicyClip
104         }
105
106         /// <summary>
107         /// The TranslatableText property.<br />
108         /// The text can set the SID value.<br />
109         /// </summary>
110         /// <exception cref='ArgumentNullException'>
111         /// ResourceManager about multilingual is null.
112         /// </exception>
113         /// <since_tizen> 4 </since_tizen>
114         public string TranslatableText
115         {
116             get
117             {
118                 return (string)GetValue(TranslatableTextProperty);
119             }
120             set
121             {
122                 selectorData?.TranslatableText?.Reset(this);
123                 SetValue(TranslatableTextProperty, value);
124             }
125         }
126         private string translatableText
127         {
128             get
129             {
130                 return textFieldTextSid;
131             }
132             set
133             {
134                 if (NUIApplication.MultilingualResourceManager == null)
135                 {
136                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
137                 }
138                 textFieldTextSid = value;
139                 Text = SetTranslatable(textFieldTextSid);
140                 NotifyPropertyChanged();
141             }
142         }
143
144         /// <summary>
145         /// The TranslatablePlaceholderText property.<br />
146         /// The text can set the SID value.<br />
147         /// </summary>
148         /// <exception cref='ArgumentNullException'>
149         /// ResourceManager about multilingual is null.
150         /// </exception>
151         /// <since_tizen> 4 </since_tizen>
152         public string TranslatablePlaceholderText
153         {
154             get
155             {
156                 return (string)GetValue(TranslatablePlaceholderTextProperty);
157             }
158             set
159             {
160                 SetValue(TranslatablePlaceholderTextProperty, value);
161                 selectorData?.TranslatablePlaceholderText?.Reset(this);
162             }
163         }
164         private string translatablePlaceholderText
165         {
166             get
167             {
168                 return textFieldPlaceHolderTextSid;
169             }
170             set
171             {
172                 if (NUIApplication.MultilingualResourceManager == null)
173                 {
174                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
175                 }
176                 textFieldPlaceHolderTextSid = value;
177                 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
178                 NotifyPropertyChanged();
179             }
180         }
181
182         /// <summary>
183         /// The TranslatablePlaceholderTextFocused property.<br />
184         /// The text can set the SID value.<br />
185         /// </summary>
186         /// <exception cref='ArgumentNullException'>
187         /// ResourceManager about multilingual is null.
188         /// </exception>
189         /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
190         [EditorBrowsable(EditorBrowsableState.Never)]
191         public string TranslatablePlaceholderTextFocused
192         {
193             get
194             {
195                 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
196             }
197             set
198             {
199                 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
200                 selectorData?.TranslatablePlaceholderTextFocused?.Reset(this);
201             }
202         }
203         private string translatablePlaceholderTextFocused
204         {
205             get
206             {
207                 return textFieldPlaceHolderTextFocusedSid;
208             }
209             set
210             {
211                 if (NUIApplication.MultilingualResourceManager == null)
212                 {
213                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
214                 }
215                 textFieldPlaceHolderTextFocusedSid = value;
216                 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
217                 NotifyPropertyChanged();
218             }
219         }
220
221         /// <summary>
222         /// The Text property.
223         /// </summary>
224         /// <since_tizen> 3 </since_tizen>
225         public string Text
226         {
227             get
228             {
229                 return (string)GetValue(TextProperty);
230             }
231             set
232             {
233                 SetValueAndForceSendChangeSignal(TextProperty, value);
234                 selectorData?.Text?.Reset(this);
235                 NotifyPropertyChanged();
236             }
237         }
238
239         /// <summary>
240         /// The PlaceholderText property.
241         /// </summary>
242         /// <since_tizen> 3 </since_tizen>
243         public string PlaceholderText
244         {
245             get
246             {
247                 return (string)GetValue(PlaceholderTextProperty);
248             }
249             set
250             {
251                 SetValue(PlaceholderTextProperty, value);
252                 NotifyPropertyChanged();
253             }
254         }
255
256         /// <summary>
257         /// The PlaceholderTextFocused property.
258         /// </summary>
259         /// <since_tizen> 3 </since_tizen>
260         public string PlaceholderTextFocused
261         {
262             get
263             {
264                 return (string)GetValue(PlaceholderTextFocusedProperty);
265             }
266             set
267             {
268                 SetValue(PlaceholderTextFocusedProperty, value);
269                 NotifyPropertyChanged();
270             }
271         }
272
273         /// <summary>
274         /// The FontFamily property.
275         /// </summary>
276         /// <since_tizen> 3 </since_tizen>
277         public string FontFamily
278         {
279             get
280             {
281                 return (string)GetValue(FontFamilyProperty);
282             }
283             set
284             {
285                 SetValue(FontFamilyProperty, value);
286                 selectorData?.FontFamily?.Reset(this);
287                 NotifyPropertyChanged();
288             }
289         }
290
291         /// <summary>
292         /// The FontStyle property.
293         /// </summary>
294         /// <since_tizen> 3 </since_tizen>
295         public PropertyMap FontStyle
296         {
297             get
298             {
299                 return (PropertyMap)GetValue(FontStyleProperty);
300             }
301             set
302             {
303                 SetValue(FontStyleProperty, value);
304                 NotifyPropertyChanged();
305             }
306         }
307
308         /// <summary>
309         /// The PointSize property.
310         /// </summary>
311         /// <since_tizen> 3 </since_tizen>
312         public float PointSize
313         {
314             get
315             {
316                 return (float)GetValue(PointSizeProperty);
317             }
318             set
319             {
320                 SetValue(PointSizeProperty, value);
321                 selectorData?.PointSize?.Reset(this);
322                 NotifyPropertyChanged();
323             }
324         }
325
326         /// <summary>
327         /// The MaxLength property.
328         /// </summary>
329         /// <since_tizen> 3 </since_tizen>
330         public int MaxLength
331         {
332             get
333             {
334                 return (int)GetValue(MaxLengthProperty);
335             }
336             set
337             {
338                 SetValue(MaxLengthProperty, value);
339                 NotifyPropertyChanged();
340             }
341         }
342
343         /// <summary>
344         /// The ExceedPolicy property.
345         /// </summary>
346         /// <since_tizen> 3 </since_tizen>
347         public int ExceedPolicy
348         {
349             get
350             {
351                 return (int)GetValue(ExceedPolicyProperty);
352             }
353             set
354             {
355                 SetValue(ExceedPolicyProperty, value);
356                 NotifyPropertyChanged();
357             }
358         }
359
360         /// <summary>
361         /// The HorizontalAlignment property.
362         /// </summary>
363         /// <since_tizen> 3 </since_tizen>
364         public HorizontalAlignment HorizontalAlignment
365         {
366             get
367             {
368                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
369             }
370             set
371             {
372                 SetValue(HorizontalAlignmentProperty, value);
373                 NotifyPropertyChanged();
374             }
375         }
376
377         /// <summary>
378         /// The VerticalAlignment property.
379         /// </summary>
380         /// <since_tizen> 3 </since_tizen>
381         public VerticalAlignment VerticalAlignment
382         {
383             get
384             {
385                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
386             }
387             set
388             {
389                 SetValue(VerticalAlignmentProperty, value);
390                 NotifyPropertyChanged();
391                 NotifyPropertyChanged();
392             }
393         }
394
395         /// <summary>
396         /// The TextColor property.
397         /// </summary>
398         /// <remarks>
399         /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
400         /// </remarks>
401         /// <since_tizen> 3 </since_tizen>
402         public Color TextColor
403         {
404             get
405             {
406                 Color temp = (Color)GetValue(TextColorProperty);
407                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
408             }
409             set
410             {
411                 SetValue(TextColorProperty, value);
412                 selectorData?.TextColor?.Reset(this);
413                 NotifyPropertyChanged();
414             }
415         }
416
417         /// <summary>
418         /// The PlaceholderTextColor property.
419         /// </summary>
420         /// <remarks>
421         /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
422         /// </remarks>
423         /// <since_tizen> 3 </since_tizen>
424         public Vector4 PlaceholderTextColor
425         {
426             get
427             {
428                 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
429                 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
430             }
431             set
432             {
433                 SetValue(PlaceholderTextColorProperty, value);
434                 selectorData?.PlaceholderTextColor?.Reset(this);
435                 NotifyPropertyChanged();
436             }
437         }
438
439         /// <summary>
440         /// The ShadowOffset property.
441         /// </summary>
442         /// <since_tizen> 3 </since_tizen>
443         /// <remarks>
444         /// Deprecated.(API Level 6) Use Shadow instead.
445         /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
446         /// </remarks>
447         [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
448         public Vector2 ShadowOffset
449         {
450             get
451             {
452                 PropertyMap map = new PropertyMap();
453                 GetProperty(TextField.Property.SHADOW).Get(map);
454                 Vector2 shadowOffset = new Vector2();
455                 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
456                 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
457             }
458             set
459             {
460                 PropertyMap temp = new PropertyMap();
461                 temp.Insert("offset", new PropertyValue(value));
462                 SetValue(ShadowProperty, temp);
463                 NotifyPropertyChanged();
464             }
465         }
466
467         /// <summary>
468         /// The ShadowColor property.
469         /// </summary>
470         /// <since_tizen> 3 </since_tizen>
471         /// <remarks>
472         /// Deprecated.(API Level 6) Use Shadow instead.
473         /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
474         /// </remarks>
475         [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
476         public Vector4 ShadowColor
477         {
478             get
479             {
480                 PropertyMap map = new PropertyMap();
481                 GetProperty(TextField.Property.SHADOW).Get(map);
482                 Vector4 shadowColor = new Vector4();
483                 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
484                 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
485             }
486             set
487             {
488                 PropertyMap temp = new PropertyMap();
489                 temp.Insert("color", new PropertyValue(value));
490                 SetValue(ShadowProperty, temp);
491                 NotifyPropertyChanged();
492             }
493         }
494
495         /// <summary>
496         /// The PrimaryCursorColor property.
497         /// </summary>
498         /// <remarks>
499         /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
500         /// </remarks>
501         /// <since_tizen> 3 </since_tizen>
502         public Vector4 PrimaryCursorColor
503         {
504             get
505             {
506                 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
507                 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
508             }
509             set
510             {
511                 SetValue(PrimaryCursorColorProperty, value);
512                 selectorData?.PrimaryCursorColor?.Reset(this);
513                 NotifyPropertyChanged();
514             }
515         }
516
517         /// <summary>
518         /// The SecondaryCursorColor property.
519         /// </summary>
520         /// <remarks>
521         /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
522         /// </remarks>
523         /// <since_tizen> 3 </since_tizen>
524         public Vector4 SecondaryCursorColor
525         {
526             get
527             {
528                 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
529                 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
530             }
531             set
532             {
533                 SetValue(SecondaryCursorColorProperty, value);
534                 NotifyPropertyChanged();
535             }
536         }
537
538         /// <summary>
539         /// The EnableCursorBlink property.
540         /// </summary>
541         /// <since_tizen> 3 </since_tizen>
542         public bool EnableCursorBlink
543         {
544             get
545             {
546                 return (bool)GetValue(EnableCursorBlinkProperty);
547             }
548             set
549             {
550                 SetValue(EnableCursorBlinkProperty, value);
551                 NotifyPropertyChanged();
552             }
553         }
554
555         /// <summary>
556         /// The CursorBlinkInterval property.
557         /// </summary>
558         /// <since_tizen> 3 </since_tizen>
559         public float CursorBlinkInterval
560         {
561             get
562             {
563                 return (float)GetValue(CursorBlinkIntervalProperty);
564             }
565             set
566             {
567                 SetValue(CursorBlinkIntervalProperty, value);
568                 NotifyPropertyChanged();
569             }
570         }
571
572         /// <summary>
573         /// The CursorBlinkDuration property.
574         /// </summary>
575         /// <since_tizen> 3 </since_tizen>
576         public float CursorBlinkDuration
577         {
578             get
579             {
580                 return (float)GetValue(CursorBlinkDurationProperty);
581             }
582             set
583             {
584                 SetValue(CursorBlinkDurationProperty, value);
585                 NotifyPropertyChanged();
586             }
587         }
588
589         /// <summary>
590         /// The CursorWidth property.
591         /// </summary>
592         /// <since_tizen> 3 </since_tizen>
593         public int CursorWidth
594         {
595             get
596             {
597                 return (int)GetValue(CursorWidthProperty);
598             }
599             set
600             {
601                 SetValue(CursorWidthProperty, value);
602                 NotifyPropertyChanged();
603             }
604         }
605
606         /// <summary>
607         /// The GrabHandleImage property.
608         /// </summary>
609         /// <since_tizen> 3 </since_tizen>
610         public string GrabHandleImage
611         {
612             get
613             {
614                 return (string)GetValue(GrabHandleImageProperty);
615             }
616             set
617             {
618                 SetValue(GrabHandleImageProperty, value);
619                 NotifyPropertyChanged();
620             }
621         }
622
623         /// <summary>
624         /// The GrabHandlePressedImage property.
625         /// </summary>
626         /// <since_tizen> 3 </since_tizen>
627         public string GrabHandlePressedImage
628         {
629             get
630             {
631                 return (string)GetValue(GrabHandlePressedImageProperty);
632             }
633             set
634             {
635                 SetValue(GrabHandlePressedImageProperty, value);
636                 NotifyPropertyChanged();
637             }
638         }
639
640         /// <summary>
641         /// The ScrollThreshold property.
642         /// </summary>
643         /// <since_tizen> 3 </since_tizen>
644         public float ScrollThreshold
645         {
646             get
647             {
648                 return (float)GetValue(ScrollThresholdProperty);
649             }
650             set
651             {
652                 SetValue(ScrollThresholdProperty, value);
653                 NotifyPropertyChanged();
654             }
655         }
656
657         /// <summary>
658         /// The ScrollSpeed property.
659         /// </summary>
660         /// <since_tizen> 3 </since_tizen>
661         public float ScrollSpeed
662         {
663             get
664             {
665                 return (float)GetValue(ScrollSpeedProperty);
666             }
667             set
668             {
669                 SetValue(ScrollSpeedProperty, value);
670                 NotifyPropertyChanged();
671             }
672         }
673
674         /// <summary>
675         /// The SelectionHandleImageLeft property.
676         /// </summary>
677         /// <since_tizen> 3 </since_tizen>
678         public PropertyMap SelectionHandleImageLeft
679         {
680             get
681             {
682                 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
683             }
684             set
685             {
686                 SetValue(SelectionHandleImageLeftProperty, value);
687                 NotifyPropertyChanged();
688             }
689         }
690
691         /// <summary>
692         /// The SelectionHandleImageRight property.
693         /// </summary>
694         /// <since_tizen> 3 </since_tizen>
695         public PropertyMap SelectionHandleImageRight
696         {
697             get
698             {
699                 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
700             }
701             set
702             {
703                 SetValue(SelectionHandleImageRightProperty, value);
704                 NotifyPropertyChanged();
705             }
706         }
707
708         /// <summary>
709         /// The SelectionHandlePressedImageLeft property.
710         /// </summary>
711         /// <since_tizen> 3 </since_tizen>
712         public PropertyMap SelectionHandlePressedImageLeft
713         {
714             get
715             {
716                 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
717             }
718             set
719             {
720                 SetValue(SelectionHandlePressedImageLeftProperty, value);
721                 NotifyPropertyChanged();
722             }
723         }
724
725         /// <summary>
726         /// The SelectionHandlePressedImageRight property.
727         /// </summary>
728         /// <since_tizen> 3 </since_tizen>
729         public PropertyMap SelectionHandlePressedImageRight
730         {
731             get
732             {
733                 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
734             }
735             set
736             {
737                 SetValue(SelectionHandlePressedImageRightProperty, value);
738                 NotifyPropertyChanged();
739             }
740         }
741
742         /// <summary>
743         /// The SelectionHandleMarkerImageLeft property.
744         /// </summary>
745         /// <since_tizen> 3 </since_tizen>
746         public PropertyMap SelectionHandleMarkerImageLeft
747         {
748             get
749             {
750                 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
751             }
752             set
753             {
754                 SetValue(SelectionHandleMarkerImageLeftProperty, value);
755                 NotifyPropertyChanged();
756             }
757         }
758
759         /// <summary>
760         /// The SelectionHandleMarkerImageRight property.
761         /// </summary>
762         /// <since_tizen> 3 </since_tizen>
763         public PropertyMap SelectionHandleMarkerImageRight
764         {
765             get
766             {
767                 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
768             }
769             set
770             {
771                 SetValue(SelectionHandleMarkerImageRightProperty, value);
772                 NotifyPropertyChanged();
773             }
774         }
775
776         /// <summary>
777         /// The SelectionHighlightColor property.
778         /// </summary>
779         /// <remarks>
780         /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
781         /// </remarks>
782         /// <since_tizen> 3 </since_tizen>
783         public Vector4 SelectionHighlightColor
784         {
785             get
786             {
787                 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
788                 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
789             }
790             set
791             {
792                 SetValue(SelectionHighlightColorProperty, value);
793                 NotifyPropertyChanged();
794             }
795         }
796
797         /// <summary>
798         /// The DecorationBoundingBox property.
799         /// </summary>
800         /// <remarks>
801         /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
802         /// </remarks>
803         /// <since_tizen> 3 </since_tizen>
804         public Rectangle DecorationBoundingBox
805         {
806             get
807             {
808                 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
809                 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
810             }
811             set
812             {
813                 SetValue(DecorationBoundingBoxProperty, value);
814                 NotifyPropertyChanged();
815             }
816         }
817
818         /// <summary>
819         /// The InputMethodSettings property.
820         /// </summary>
821         /// <since_tizen> 3 </since_tizen>
822         public PropertyMap InputMethodSettings
823         {
824             get
825             {
826                 return (PropertyMap)GetValue(InputMethodSettingsProperty);
827             }
828             set
829             {
830                 SetValue(InputMethodSettingsProperty, value);
831                 NotifyPropertyChanged();
832             }
833         }
834
835         /// <summary>
836         /// The InputColor property.
837         /// </summary>
838         /// <remarks>
839         /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
840         /// </remarks>
841         /// <since_tizen> 3 </since_tizen>
842         public Vector4 InputColor
843         {
844             get
845             {
846                 Vector4 temp = (Vector4)GetValue(InputColorProperty);
847                 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
848             }
849             set
850             {
851                 SetValue(InputColorProperty, value);
852                 NotifyPropertyChanged();
853             }
854         }
855
856         /// <summary>
857         /// The EnableMarkup property.
858         /// </summary>
859         /// <since_tizen> 3 </since_tizen>
860         public bool EnableMarkup
861         {
862             get
863             {
864                 return (bool)GetValue(EnableMarkupProperty);
865             }
866             set
867             {
868                 SetValue(EnableMarkupProperty, value);
869                 NotifyPropertyChanged();
870             }
871         }
872
873         /// <summary>
874         /// The InputFontFamily property.
875         /// </summary>
876         /// <since_tizen> 3 </since_tizen>
877         public string InputFontFamily
878         {
879             get
880             {
881                 return (string)GetValue(InputFontFamilyProperty);
882             }
883             set
884             {
885                 SetValue(InputFontFamilyProperty, value);
886                 NotifyPropertyChanged();
887             }
888         }
889
890         /// <summary>
891         /// The InputFontStyle property.
892         /// </summary>
893         /// <since_tizen> 3 </since_tizen>
894         public PropertyMap InputFontStyle
895         {
896             get
897             {
898                 return (PropertyMap)GetValue(InputFontStyleProperty);
899             }
900             set
901             {
902                 SetValue(InputFontStyleProperty, value);
903                 NotifyPropertyChanged();
904             }
905         }
906
907         /// <summary>
908         /// The InputPointSize property.
909         /// </summary>
910         /// <since_tizen> 3 </since_tizen>
911         public float InputPointSize
912         {
913             get
914             {
915                 return (float)GetValue(InputPointSizeProperty);
916             }
917             set
918             {
919                 SetValue(InputPointSizeProperty, value);
920                 NotifyPropertyChanged();
921             }
922         }
923
924         /// <summary>
925         /// The Underline property.
926         /// </summary>
927         /// <since_tizen> 3 </since_tizen>
928         public PropertyMap Underline
929         {
930             get
931             {
932                 return (PropertyMap)GetValue(UnderlineProperty);
933             }
934             set
935             {
936                 SetValue(UnderlineProperty, value);
937                 NotifyPropertyChanged();
938             }
939         }
940
941         /// <summary>
942         /// The InputUnderline property.
943         /// </summary>
944         /// <since_tizen> 3 </since_tizen>
945         public string InputUnderline
946         {
947             get
948             {
949                 return (string)GetValue(InputUnderlineProperty);
950             }
951             set
952             {
953                 SetValue(InputUnderlineProperty, value);
954                 NotifyPropertyChanged();
955             }
956         }
957
958         /// <summary>
959         /// The Shadow property.
960         /// </summary>
961         /// <since_tizen> 3 </since_tizen>
962         public PropertyMap Shadow
963         {
964             get
965             {
966                 return (PropertyMap)GetValue(ShadowProperty);
967             }
968             set
969             {
970                 SetValue(ShadowProperty, value);
971                 NotifyPropertyChanged();
972             }
973         }
974
975         /// <summary>
976         /// The InputShadow property.
977         /// </summary>
978         /// <since_tizen> 3 </since_tizen>
979         public string InputShadow
980         {
981             get
982             {
983                 return (string)GetValue(InputShadowProperty);
984             }
985             set
986             {
987                 SetValue(InputShadowProperty, value);
988                 NotifyPropertyChanged();
989             }
990         }
991
992         /// <summary>
993         /// The Emboss property.
994         /// </summary>
995         /// <since_tizen> 3 </since_tizen>
996         public string Emboss
997         {
998             get
999             {
1000                 return (string)GetValue(EmbossProperty);
1001             }
1002             set
1003             {
1004                 SetValue(EmbossProperty, value);
1005                 NotifyPropertyChanged();
1006             }
1007         }
1008
1009         /// <summary>
1010         /// The InputEmboss property.
1011         /// </summary>
1012         /// <since_tizen> 3 </since_tizen>
1013         public string InputEmboss
1014         {
1015             get
1016             {
1017                 return (string)GetValue(InputEmbossProperty);
1018             }
1019             set
1020             {
1021                 SetValue(InputEmbossProperty, value);
1022                 NotifyPropertyChanged();
1023             }
1024         }
1025
1026         /// <summary>
1027         /// The Outline property.
1028         /// </summary>
1029         /// <since_tizen> 3 </since_tizen>
1030         public PropertyMap Outline
1031         {
1032             get
1033             {
1034                 return (PropertyMap)GetValue(OutlineProperty);
1035             }
1036             set
1037             {
1038                 SetValue(OutlineProperty, value);
1039                 NotifyPropertyChanged();
1040             }
1041         }
1042
1043         /// <summary>
1044         /// The InputOutline property.
1045         /// </summary>
1046         /// <since_tizen> 3 </since_tizen>
1047         public string InputOutline
1048         {
1049             get
1050             {
1051                 return (string)GetValue(InputOutlineProperty);
1052             }
1053             set
1054             {
1055                 SetValue(InputOutlineProperty, value);
1056                 NotifyPropertyChanged();
1057             }
1058         }
1059
1060         /// <summary>
1061         /// The HiddenInputSettings property.
1062         /// </summary>
1063         /// <since_tizen> 3 </since_tizen>
1064         public Tizen.NUI.PropertyMap HiddenInputSettings
1065         {
1066             get
1067             {
1068                 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1069             }
1070             set
1071             {
1072                 SetValue(HiddenInputSettingsProperty, value);
1073                 NotifyPropertyChanged();
1074             }
1075         }
1076
1077         /// <summary>
1078         /// The PixelSize property.
1079         /// </summary>
1080         /// <since_tizen> 3 </since_tizen>
1081         public float PixelSize
1082         {
1083             get
1084             {
1085                 return (float)GetValue(PixelSizeProperty);
1086             }
1087             set
1088             {
1089                 SetValue(PixelSizeProperty, value);
1090                 selectorData?.PixelSize?.Reset(this);
1091                 NotifyPropertyChanged();
1092             }
1093         }
1094
1095         /// <summary>
1096         /// The Enable selection property.
1097         /// </summary>
1098         /// <since_tizen> 3 </since_tizen>
1099         public bool EnableSelection
1100         {
1101             get
1102             {
1103                 return (bool)GetValue(EnableSelectionProperty);
1104             }
1105             set
1106             {
1107                 SetValue(EnableSelectionProperty, value);
1108                 NotifyPropertyChanged();
1109             }
1110         }
1111
1112         /// <summary>
1113         /// The Enable selection property.
1114         /// </summary>
1115         /// <since_tizen> 6 </since_tizen>
1116         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1117         [EditorBrowsable(EditorBrowsableState.Never)]
1118         public bool EnableGrabHandle
1119         {
1120             get
1121             {
1122                 return (bool)GetValue(EnableGrabHandleProperty);
1123             }
1124             set
1125             {
1126                 SetValue(EnableGrabHandleProperty, value);
1127                 NotifyPropertyChanged();
1128             }
1129         }
1130
1131         /// <summary>
1132         /// The Enable selection property.
1133         /// </summary>
1134         /// <since_tizen> 6 </since_tizen>
1135         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1136         [EditorBrowsable(EditorBrowsableState.Never)]
1137         public bool EnableGrabHandlePopup
1138         {
1139             get
1140             {
1141                 return (bool)GetValue(EnableGrabHandlePopupProperty);
1142             }
1143             set
1144             {
1145                 SetValue(EnableGrabHandlePopupProperty, value);
1146                 NotifyPropertyChanged();
1147             }
1148         }
1149
1150         /// <summary>
1151         /// The Selected Text property.
1152         /// </summary>
1153         /// <since_tizen> 8 </since_tizen>
1154         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1155         [EditorBrowsable(EditorBrowsableState.Never)]
1156         public string SelectedText
1157         {
1158             get
1159             {
1160                 string temp;
1161                 GetProperty(TextField.Property.SelectedText).Get(out temp);
1162                 return temp;
1163             }
1164         }
1165
1166         /// <summary>
1167         /// The start index for selection.
1168         /// </summary>
1169         /// <since_tizen> 8 </since_tizen>
1170         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1171         [EditorBrowsable(EditorBrowsableState.Never)]
1172         public int SelectedTextStart
1173         {
1174             get
1175             {
1176                 int temp;
1177                 GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
1178                 return temp;
1179             }
1180             set
1181             {
1182                 SetProperty(TextField.Property.SelectedTextStart, new PropertyValue(value));
1183                 NotifyPropertyChanged();
1184             }
1185         }
1186
1187         /// <summary>
1188         /// The end index for selection.
1189         /// </summary>
1190         /// <since_tizen> 8 </since_tizen>
1191         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1192         [EditorBrowsable(EditorBrowsableState.Never)]
1193         public int SelectedTextEnd
1194         {
1195             get
1196             {
1197                 int temp;
1198                 GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
1199                 return temp;
1200             }
1201             set
1202             {
1203                 SetProperty(TextField.Property.SelectedTextEnd, new PropertyValue(value));
1204                 NotifyPropertyChanged();
1205             }
1206         }
1207
1208         /// <summary>
1209         /// Enable editing in text control.
1210         /// </summary>
1211         /// <since_tizen> 8 </since_tizen>
1212         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1213         [EditorBrowsable(EditorBrowsableState.Never)]
1214         public bool EnableEditing
1215         {
1216             get
1217             {
1218                 bool temp;
1219                 GetProperty(TextField.Property.EnableEditing).Get(out temp);
1220                 return temp;
1221             }
1222             set
1223             {
1224                 SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
1225                 NotifyPropertyChanged();
1226             }
1227         }
1228
1229         /// <summary>
1230         /// Specify primary cursor (caret) position in text control.
1231         /// </summary>
1232         [EditorBrowsable(EditorBrowsableState.Never)]
1233         public int PrimaryCursorPosition
1234         {
1235             get
1236             {
1237                 int temp;
1238                 using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1239                 {
1240                     propertyValue.Get(out temp);
1241                 }
1242                 return temp;
1243             }
1244             set
1245             {
1246                 using (PropertyValue propertyValue = new PropertyValue(value))
1247                 {
1248                     SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1249                     NotifyPropertyChanged();
1250                 }
1251             }
1252         }
1253
1254         /// <summary>
1255         /// The Placeholder property.
1256         /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1257         /// </summary>
1258         /// <example>
1259         /// The following example demonstrates how to set the Placeholder property.
1260         /// <code>
1261         /// PropertyMap propertyMap = new PropertyMap();
1262         /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1263         /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1264         /// propertyMap.Add("color", new PropertyValue(Color.Red));
1265         /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1266         /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1267         ///
1268         /// PropertyMap fontStyleMap = new PropertyMap();
1269         /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1270         /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1271         /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1272         /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1273         ///
1274         /// TextField field = new TextField();
1275         /// field.Placeholder = propertyMap;
1276         /// </code>
1277         /// </example>
1278         /// <since_tizen> 3 </since_tizen>
1279         public Tizen.NUI.PropertyMap Placeholder
1280         {
1281             get
1282             {
1283                 return (PropertyMap)GetValue(PlaceholderProperty);
1284             }
1285             set
1286             {
1287                 SetValue(PlaceholderProperty, value);
1288                 NotifyPropertyChanged();
1289             }
1290         }
1291
1292         /// <summary>
1293         /// The Ellipsis property.<br />
1294         /// Enable or disable the ellipsis.<br />
1295         /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1296         /// </summary>
1297         /// <since_tizen> 4 </since_tizen>
1298         public bool Ellipsis
1299         {
1300             get
1301             {
1302                 return (bool)GetValue(EllipsisProperty);
1303             }
1304             set
1305             {
1306                 SetValue(EllipsisProperty, value);
1307                 NotifyPropertyChanged();
1308             }
1309         }
1310
1311         /// <summary>
1312         /// Enables selection of the text using the Shift key.
1313         /// </summary>
1314         /// <since_tizen> 5 </since_tizen>
1315         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1316         [EditorBrowsable(EditorBrowsableState.Never)]
1317         public bool EnableShiftSelection
1318         {
1319             get
1320             {
1321                 return (bool)GetValue(EnableShiftSelectionProperty);
1322             }
1323             set
1324             {
1325                 SetValue(EnableShiftSelectionProperty, value);
1326                 NotifyPropertyChanged();
1327             }
1328         }
1329
1330         /// <summary>
1331         /// The text alignment to match the direction of the system language.
1332         /// </summary>
1333         /// <since_tizen> 6 </since_tizen>
1334         public bool MatchSystemLanguageDirection
1335         {
1336             get
1337             {
1338                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1339             }
1340             set
1341             {
1342                 SetValue(MatchSystemLanguageDirectionProperty, value);
1343                 NotifyPropertyChanged();
1344             }
1345         }
1346
1347         /// <summary>
1348         /// The FontSizeScale property. <br />
1349         /// The default value is 1.0. <br />
1350         /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1351         /// </summary>
1352         /// <since_tizen> 9 </since_tizen>
1353         public float FontSizeScale
1354         {
1355             get
1356             {
1357                 return fontSizeScale;
1358             }
1359             set
1360             {
1361                 float newFontSizeScale;
1362
1363                 if (fontSizeScale == value) return;
1364
1365                 fontSizeScale = value;
1366                 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1367                 {
1368                     SystemSettingsFontSize systemSettingsFontSize;
1369
1370                     try
1371                     {
1372                         systemSettingsFontSize = SystemSettings.FontSize;
1373                     }
1374                     catch (Exception e)
1375                     {
1376                         Console.WriteLine("{0} Exception caught.", e);
1377                         systemSettingsFontSize = SystemSettingsFontSize.Normal;
1378                     }
1379                     newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1380                     addFontSizeChangedCallback();
1381                 }
1382                 else
1383                 {
1384                     newFontSizeScale = fontSizeScale;
1385                     removeFontSizeChangedCallback();
1386                 }
1387
1388                 SetValue(FontSizeScaleProperty, newFontSizeScale);
1389                 NotifyPropertyChanged();
1390             }
1391         }
1392
1393         /// Only used by the IL of xaml, will never changed to not hidden.
1394         [EditorBrowsable(EditorBrowsableState.Never)]
1395         public override bool IsCreateByXaml
1396         {
1397             get
1398             {
1399                 return base.IsCreateByXaml;
1400             }
1401             set
1402             {
1403                 base.IsCreateByXaml = value;
1404
1405                 if (value == true)
1406                 {
1407                     this.TextChanged += (obj, e) =>
1408                     {
1409                         this.Text = e.TextField.Text;
1410                     };
1411                 }
1412             }
1413         }
1414
1415         private TextFieldSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextFieldSelectorData());
1416
1417         /// <summary>
1418         /// Get the InputMethodContext instance.
1419         /// </summary>
1420         /// <returns>The InputMethodContext instance.</returns>
1421         /// <since_tizen> 5 </since_tizen>
1422         public InputMethodContext GetInputMethodContext()
1423         {
1424             if (inputMethodCotext == null)
1425             {
1426                 /*Avoid raising InputMethodContext reference count.*/
1427                 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
1428                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1429             }
1430             return inputMethodCotext;
1431         }
1432
1433         /// <summary>
1434         /// Select the whole text.
1435         /// </summary>
1436         /// <since_tizen> 6 </since_tizen>
1437         /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1438         [EditorBrowsable(EditorBrowsableState.Never)]
1439         public void SelectWholeText()
1440         {
1441             Interop.TextField.SelectWholeText(SwigCPtr);
1442             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1443         }
1444
1445         /// <summary>
1446         /// Clear selection of the text.
1447         /// </summary>
1448         /// <since_tizen> 8 </since_tizen>
1449         /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1450         [EditorBrowsable(EditorBrowsableState.Never)]
1451         public void SelectNone()
1452         {
1453             _ = Interop.TextField.SelectNone(SwigCPtr);
1454             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1455         }
1456
1457         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1458         {
1459             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1460         }
1461
1462         internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1463         {
1464             SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.InputStyleChangedSignal(SwigCPtr));
1465             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1466             return ret;
1467         }
1468
1469         /// <summary>
1470         /// Dispose.
1471         /// </summary>
1472         /// <since_tizen> 3 </since_tizen>
1473         protected override void Dispose(DisposeTypes type)
1474         {
1475             if (disposed)
1476             {
1477                 DisposeQueue.Instance.Add(this);
1478                 return;
1479             }
1480
1481             if (systemlangTextFlag)
1482             {
1483                 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1484             }
1485
1486             removeFontSizeChangedCallback();
1487
1488             if (type == DisposeTypes.Explicit)
1489             {
1490                 //Called by User
1491                 //Release your own managed resources here.
1492                 //You should release all of your own disposable objects here.
1493                 selectorData?.Reset(this);
1494             }
1495
1496             //Release your own unmanaged resources here.
1497             //You should not access any managed member here except static instance.
1498             //because the execution order of Finalizes is non-deterministic.
1499             if (this.HasBody())
1500             {
1501                 if (textFieldMaxLengthReachedCallbackDelegate != null)
1502                 {
1503                     this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
1504                 }
1505
1506                 if (textFieldTextChangedCallbackDelegate != null)
1507                 {
1508                     TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
1509                 }
1510             }
1511
1512             base.Dispose(type);
1513         }
1514
1515         /// This will not be public opened.
1516         [EditorBrowsable(EditorBrowsableState.Never)]
1517         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1518         {
1519             // In order to speed up IME hide, temporarily add
1520             GetInputMethodContext()?.DestroyContext();
1521             Interop.TextField.DeleteTextField(swigCPtr);
1522         }
1523
1524         private string SetTranslatable(string textFieldSid)
1525         {
1526             string translatableText = null;
1527             translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1528             if (translatableText != null)
1529             {
1530                 if (systemlangTextFlag == false)
1531                 {
1532                     SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1533                     systemlangTextFlag = true;
1534                 }
1535                 return translatableText;
1536             }
1537             else
1538             {
1539                 translatableText = "";
1540                 return translatableText;
1541             }
1542         }
1543
1544         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1545         {
1546             if (textFieldTextSid != null)
1547             {
1548                 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1549             }
1550             if (textFieldPlaceHolderTextSid != null)
1551             {
1552                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1553             }
1554             if (textFieldPlaceHolderTextFocusedSid != null)
1555             {
1556                 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
1557             }
1558         }
1559
1560         private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1561         {
1562             float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1563             SetValue(FontSizeScaleProperty, newFontSizeScale);
1564             NotifyPropertyChanged();
1565         }
1566
1567         private void addFontSizeChangedCallback()
1568         {
1569             if (hasFontSizeChangedCallback != true)
1570             {
1571                 try
1572                 {
1573                     SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
1574                     hasFontSizeChangedCallback = true;
1575                 }
1576                 catch (Exception e)
1577                 {
1578                     Console.WriteLine("{0} Exception caught.", e);
1579                     hasFontSizeChangedCallback = false;
1580                 }
1581             }
1582         }
1583
1584         private void removeFontSizeChangedCallback()
1585         {
1586             if (hasFontSizeChangedCallback == true)
1587             {
1588                 try
1589                 {
1590                     SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
1591                     hasFontSizeChangedCallback = false;
1592                 }
1593                 catch (Exception e)
1594                 {
1595                     Console.WriteLine("{0} Exception caught.", e);
1596                     hasFontSizeChangedCallback = true;
1597                 }
1598             }
1599         }
1600
1601         internal new class Property
1602         {
1603             internal static readonly int TEXT = Interop.TextField.TextGet();
1604             internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
1605             internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
1606             internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
1607             internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
1608             internal static readonly int PointSize = Interop.TextField.PointSizeGet();
1609             internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
1610             internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
1611             internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
1612             internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
1613             internal static readonly int TextColor = Interop.TextField.TextColorGet();
1614             internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
1615             internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
1616             internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
1617             internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
1618             internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
1619             internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
1620             internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
1621             internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
1622             internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
1623             internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
1624             internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
1625             internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
1626             internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
1627             internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
1628             internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
1629             internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
1630             internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
1631             internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
1632             internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
1633             internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
1634             internal static readonly int InputColor = Interop.TextField.InputColorGet();
1635             internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
1636             internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
1637             internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
1638             internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
1639             internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
1640             internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
1641             internal static readonly int SHADOW = Interop.TextField.ShadowGet();
1642             internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
1643             internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
1644             internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
1645             internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
1646             internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
1647             internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
1648             internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
1649             internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
1650             internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
1651             internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
1652             internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
1653             internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
1654             internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
1655             internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
1656             internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
1657             internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
1658             internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
1659             internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
1660             internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
1661             internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
1662         }
1663
1664         internal class InputStyle
1665         {
1666             internal enum Mask
1667             {
1668                 None = 0x0000,
1669                 Color = 0x0001,
1670                 FontFamily = 0x0002,
1671                 PointSize = 0x0004,
1672                 FontStyle = 0x0008,
1673                 Underline = 0x0010,
1674                 Shadow = 0x0020,
1675                 Emboss = 0x0040,
1676                 Outline = 0x0080
1677             }
1678         }
1679
1680         private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1681         {
1682             DecorationBoundingBox = new Rectangle(x, y, width, height);
1683         }
1684         private void OnInputColorChanged(float x, float y, float z, float w)
1685         {
1686             InputColor = new Vector4(x, y, z, w);
1687         }
1688         private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1689         {
1690             PlaceholderTextColor = new Vector4(r, g, b, a);
1691         }
1692         private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1693         {
1694             PrimaryCursorColor = new Vector4(x, y, z, w);
1695         }
1696         private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1697         {
1698             SecondaryCursorColor = new Vector4(x, y, z, w);
1699         }
1700         private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1701         {
1702             SelectionHighlightColor = new Vector4(x, y, z, w);
1703         }
1704         private void OnShadowColorChanged(float x, float y, float z, float w)
1705         {
1706             ShadowColor = new Vector4(x, y, z, w);
1707         }
1708         private void OnShadowOffsetChanged(float x, float y)
1709         {
1710             ShadowOffset = new Vector2(x, y);
1711         }
1712         private void OnTextColorChanged(float r, float g, float b, float a)
1713         {
1714             TextColor = new Color(r, g, b, a);
1715         }
1716     }
1717 }