[NUI] Property setter is changed (#1097)
[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
24 namespace Tizen.NUI.BaseComponents
25 {
26     /// <summary>
27     /// A control which provides a single line editable text field.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public partial class TextField : View
31     {
32         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33         private string textFieldTextSid = null;
34         private string textFieldPlaceHolderTextSid = null;
35         private bool systemlangTextFlag = false;
36         private InputMethodContext inputMethodCotext = null;
37
38         /// <summary>
39         /// Creates the TextField control.
40         /// </summary>
41         /// <since_tizen> 3 </since_tizen>
42         public TextField() : this(Interop.TextField.TextField_New(), true)
43         {
44             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
45         }
46
47         /// <summary>
48         /// Creates the TextField with setting the status of shown or hidden.
49         /// </summary>
50         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
51         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
52         [EditorBrowsable(EditorBrowsableState.Never)]
53         public TextField(bool shown) : this(Interop.TextField.TextField_New(), true)
54         {
55             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
56             SetVisible(shown);
57         }
58
59         internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn)
60         {
61             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
62
63             if (!shown)
64             {
65                 SetVisible(false);
66             }
67         }
68
69         internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
70         {
71             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72
73             if (!shown)
74             {
75                 SetVisible(false);
76             }
77         }
78
79         internal enum ExceedPolicyType
80         {
81             ExceedPolicyOriginal,
82             ExceedPolicyClip
83         }
84
85         /// <summary>
86         /// The TranslatableText property.<br />
87         /// The text can set the SID value.<br />
88         /// </summary>
89         /// <exception cref='ArgumentNullException'>
90         /// ResourceManager about multilingual is null.
91         /// </exception>
92         /// <since_tizen> 4 </since_tizen>
93         public string TranslatableText
94         {
95             get
96             {
97                 return textFieldTextSid;
98             }
99             set
100             {
101                 if (NUIApplication.MultilingualResourceManager == null)
102                 {
103                     throw new ArgumentNullException("ResourceManager about multilingual is null");
104                 }
105                 textFieldTextSid = value;
106                 Text = SetTranslatable(textFieldTextSid);
107                 NotifyPropertyChanged();
108             }
109         }
110
111         /// <summary>
112         /// The TranslatablePlaceholderText property.<br />
113         /// The text can set the SID value.<br />
114         /// </summary>
115         /// <exception cref='ArgumentNullException'>
116         /// ResourceManager about multilingual is null.
117         /// </exception>
118         /// <since_tizen> 4 </since_tizen>
119         public string TranslatablePlaceholderText
120         {
121             get
122             {
123                 return textFieldPlaceHolderTextSid;
124             }
125             set
126             {
127                 if (NUIApplication.MultilingualResourceManager == null)
128                 {
129                     throw new ArgumentNullException("ResourceManager about multilingual is null");
130                 }
131                 textFieldPlaceHolderTextSid = value;
132                 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
133                 NotifyPropertyChanged();
134             }
135         }
136
137         /// <summary>
138         /// The Text property.
139         /// </summary>
140         /// <since_tizen> 3 </since_tizen>
141         public string Text
142         {
143             get
144             {
145                 return (string)GetValue(TextProperty);
146             }
147             set
148             {
149                 SetValueAndForceSendChangeSignal(TextProperty, value);
150                 NotifyPropertyChanged();
151             }
152         }
153
154         /// <summary>
155         /// The PlaceholderText property.
156         /// </summary>
157         /// <since_tizen> 3 </since_tizen>
158         public string PlaceholderText
159         {
160             get
161             {
162                 return (string)GetValue(PlaceholderTextProperty);
163             }
164             set
165             {
166                 SetValue(PlaceholderTextProperty, value);
167                 NotifyPropertyChanged();
168             }
169         }
170
171         /// <summary>
172         /// The PlaceholderTextFocused property.
173         /// </summary>
174         /// <since_tizen> 3 </since_tizen>
175         public string PlaceholderTextFocused
176         {
177             get
178             {
179                 return (string)GetValue(PlaceholderTextFocusedProperty);
180             }
181             set
182             {
183                 SetValue(PlaceholderTextFocusedProperty, value);
184                 NotifyPropertyChanged();
185             }
186         }
187
188         /// <summary>
189         /// The FontFamily property.
190         /// </summary>
191         /// <since_tizen> 3 </since_tizen>
192         public string FontFamily
193         {
194             get
195             {
196                 return (string)GetValue(FontFamilyProperty);
197             }
198             set
199             {
200                 SetValue(FontFamilyProperty, value);
201                 NotifyPropertyChanged();
202             }
203         }
204
205         /// <summary>
206         /// The FontStyle property.
207         /// </summary>
208         /// <since_tizen> 3 </since_tizen>
209         public PropertyMap FontStyle
210         {
211             get
212             {
213                 return (PropertyMap)GetValue(FontStyleProperty);
214             }
215             set
216             {
217                 SetValue(FontStyleProperty, value);
218                 NotifyPropertyChanged();
219             }
220         }
221
222         /// <summary>
223         /// The PointSize property.
224         /// </summary>
225         /// <since_tizen> 3 </since_tizen>
226         public float PointSize
227         {
228             get
229             {
230                 return (float)GetValue(PointSizeProperty);
231             }
232             set
233             {
234                 SetValue(PointSizeProperty, value);
235                 NotifyPropertyChanged();
236             }
237         }
238
239         /// <summary>
240         /// The MaxLength property.
241         /// </summary>
242         /// <since_tizen> 3 </since_tizen>
243         public int MaxLength
244         {
245             get
246             {
247                 return (int)GetValue(MaxLengthProperty);
248             }
249             set
250             {
251                 SetValue(MaxLengthProperty, value);
252                 NotifyPropertyChanged();
253             }
254         }
255
256         /// <summary>
257         /// The ExceedPolicy property.
258         /// </summary>
259         /// <since_tizen> 3 </since_tizen>
260         public int ExceedPolicy
261         {
262             get
263             {
264                 return (int)GetValue(ExceedPolicyProperty);
265             }
266             set
267             {
268                 SetValue(ExceedPolicyProperty, value);
269                 NotifyPropertyChanged();
270             }
271         }
272
273         /// <summary>
274         /// The HorizontalAlignment property.
275         /// </summary>
276         /// <since_tizen> 3 </since_tizen>
277         public HorizontalAlignment HorizontalAlignment
278         {
279             get
280             {
281                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
282             }
283             set
284             {
285                 SetValue(HorizontalAlignmentProperty, value);
286                 NotifyPropertyChanged();
287             }
288         }
289
290         /// <summary>
291         /// The VerticalAlignment property.
292         /// </summary>
293         /// <since_tizen> 3 </since_tizen>
294         public VerticalAlignment VerticalAlignment
295         {
296             get
297             {
298                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
299             }
300             set
301             {
302                 SetValue(VerticalAlignmentProperty, value);
303                 NotifyPropertyChanged();
304                 NotifyPropertyChanged();
305             }
306         }
307
308         /// <summary>
309         /// The TextColor property.
310         /// </summary>
311         /// <remarks>
312         /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
313         /// </remarks>
314         /// <since_tizen> 3 </since_tizen>
315         public Color TextColor
316         {
317             get
318             {
319                 Color temp = (Color)GetValue(TextColorProperty);
320                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
321             }
322             set
323             {
324                 SetValue(TextColorProperty, value);
325                 NotifyPropertyChanged();
326             }
327         }
328
329         /// <summary>
330         /// The PlaceholderTextColor property.
331         /// </summary>
332         /// <remarks>
333         /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
334         /// </remarks>
335         /// <since_tizen> 3 </since_tizen>
336         public Vector4 PlaceholderTextColor
337         {
338             get
339             {
340                 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
341                 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
342             }
343             set
344             {
345                 SetValue(PlaceholderTextColorProperty, value);
346                 NotifyPropertyChanged();
347             }
348         }
349
350         /// <summary>
351         /// The ShadowOffset property.
352         /// </summary>
353         /// <since_tizen> 3 </since_tizen>
354         /// <remarks>
355         /// Deprecated.(API Level 6) Use Shadow instead.
356         /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
357         /// </remarks>
358         [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
359         public Vector2 ShadowOffset
360         {
361             get
362             {
363                 PropertyMap map = new PropertyMap();
364                 GetProperty(TextField.Property.SHADOW).Get(map);
365                 Vector2 shadowOffset = new Vector2();
366                 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
367                 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
368             }
369             set
370             {
371                 PropertyMap temp = new PropertyMap();
372                 temp.Insert("offset", new PropertyValue(value));
373                 SetValue(ShadowProperty, temp);
374                 NotifyPropertyChanged();
375             }
376         }
377
378         /// <summary>
379         /// The ShadowColor property.
380         /// </summary>
381         /// <since_tizen> 3 </since_tizen>
382         /// <remarks>
383         /// Deprecated.(API Level 6) Use Shadow instead.
384         /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
385         /// </remarks>
386         [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
387         public Vector4 ShadowColor
388         {
389             get
390             {
391                 PropertyMap map = new PropertyMap();
392                 GetProperty(TextField.Property.SHADOW).Get(map);
393                 Vector4 shadowColor = new Vector4();
394                 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
395                 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
396             }
397             set
398             {
399                 PropertyMap temp = new PropertyMap();
400                 temp.Insert("color", new PropertyValue(value));
401                 SetValue(ShadowProperty, temp);
402                 NotifyPropertyChanged();
403             }
404         }
405
406         /// <summary>
407         /// The PrimaryCursorColor property.
408         /// </summary>
409         /// <remarks>
410         /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
411         /// </remarks>
412         /// <since_tizen> 3 </since_tizen>
413         public Vector4 PrimaryCursorColor
414         {
415             get
416             {
417                 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
418                 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
419             }
420             set
421             {
422                 SetValue(PrimaryCursorColorProperty, value);
423                 NotifyPropertyChanged();
424             }
425         }
426
427         /// <summary>
428         /// The SecondaryCursorColor property.
429         /// </summary>
430         /// <remarks>
431         /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
432         /// </remarks>
433         /// <since_tizen> 3 </since_tizen>
434         public Vector4 SecondaryCursorColor
435         {
436             get
437             {
438                 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
439                 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
440             }
441             set
442             {
443                 SetValue(SecondaryCursorColorProperty, value);
444                 NotifyPropertyChanged();
445             }
446         }
447
448         /// <summary>
449         /// The EnableCursorBlink property.
450         /// </summary>
451         /// <since_tizen> 3 </since_tizen>
452         public bool EnableCursorBlink
453         {
454             get
455             {
456                 return (bool)GetValue(EnableCursorBlinkProperty);
457             }
458             set
459             {
460                 SetValue(EnableCursorBlinkProperty, value);
461                 NotifyPropertyChanged();
462             }
463         }
464
465         /// <summary>
466         /// The CursorBlinkInterval property.
467         /// </summary>
468         /// <since_tizen> 3 </since_tizen>
469         public float CursorBlinkInterval
470         {
471             get
472             {
473                 return (float)GetValue(CursorBlinkIntervalProperty);
474             }
475             set
476             {
477                 SetValue(CursorBlinkIntervalProperty, value);
478                 NotifyPropertyChanged();
479             }
480         }
481
482         /// <summary>
483         /// The CursorBlinkDuration property.
484         /// </summary>
485         /// <since_tizen> 3 </since_tizen>
486         public float CursorBlinkDuration
487         {
488             get
489             {
490                 return (float)GetValue(CursorBlinkDurationProperty);
491             }
492             set
493             {
494                 SetValue(CursorBlinkDurationProperty, value);
495                 NotifyPropertyChanged();
496             }
497         }
498
499         /// <summary>
500         /// The CursorWidth property.
501         /// </summary>
502         /// <since_tizen> 3 </since_tizen>
503         public int CursorWidth
504         {
505             get
506             {
507                 return (int)GetValue(CursorWidthProperty);
508             }
509             set
510             {
511                 SetValue(CursorWidthProperty, value);
512                 NotifyPropertyChanged();
513             }
514         }
515
516         /// <summary>
517         /// The GrabHandleImage property.
518         /// </summary>
519         /// <since_tizen> 3 </since_tizen>
520         public string GrabHandleImage
521         {
522             get
523             {
524                 return (string)GetValue(GrabHandleImageProperty);
525             }
526             set
527             {
528                 SetValue(GrabHandleImageProperty, value);
529                 NotifyPropertyChanged();
530             }
531         }
532
533         /// <summary>
534         /// The GrabHandlePressedImage property.
535         /// </summary>
536         /// <since_tizen> 3 </since_tizen>
537         public string GrabHandlePressedImage
538         {
539             get
540             {
541                 return (string)GetValue(GrabHandlePressedImageProperty);
542             }
543             set
544             {
545                 SetValue(GrabHandlePressedImageProperty, value);
546                 NotifyPropertyChanged();
547             }
548         }
549
550         /// <summary>
551         /// The ScrollThreshold property.
552         /// </summary>
553         /// <since_tizen> 3 </since_tizen>
554         public float ScrollThreshold
555         {
556             get
557             {
558                 return (float)GetValue(ScrollThresholdProperty);
559             }
560             set
561             {
562                 SetValue(ScrollThresholdProperty, value);
563                 NotifyPropertyChanged();
564             }
565         }
566
567         /// <summary>
568         /// The ScrollSpeed property.
569         /// </summary>
570         /// <since_tizen> 3 </since_tizen>
571         public float ScrollSpeed
572         {
573             get
574             {
575                 return (float)GetValue(ScrollSpeedProperty);
576             }
577             set
578             {
579                 SetValue(ScrollSpeedProperty, value);
580                 NotifyPropertyChanged();
581             }
582         }
583
584         /// <summary>
585         /// The SelectionHandleImageLeft property.
586         /// </summary>
587         /// <since_tizen> 3 </since_tizen>
588         public PropertyMap SelectionHandleImageLeft
589         {
590             get
591             {
592                 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
593             }
594             set
595             {
596                 SetValue(SelectionHandleImageLeftProperty, value);
597                 NotifyPropertyChanged();
598             }
599         }
600
601         /// <summary>
602         /// The SelectionHandleImageRight property.
603         /// </summary>
604         /// <since_tizen> 3 </since_tizen>
605         public PropertyMap SelectionHandleImageRight
606         {
607             get
608             {
609                 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
610             }
611             set
612             {
613                 SetValue(SelectionHandleImageRightProperty, value);
614                 NotifyPropertyChanged();
615             }
616         }
617
618         /// <summary>
619         /// The SelectionHandlePressedImageLeft property.
620         /// </summary>
621         /// <since_tizen> 3 </since_tizen>
622         public PropertyMap SelectionHandlePressedImageLeft
623         {
624             get
625             {
626                 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
627             }
628             set
629             {
630                 SetValue(SelectionHandlePressedImageLeftProperty, value);
631                 NotifyPropertyChanged();
632             }
633         }
634
635         /// <summary>
636         /// The SelectionHandlePressedImageRight property.
637         /// </summary>
638         /// <since_tizen> 3 </since_tizen>
639         public PropertyMap SelectionHandlePressedImageRight
640         {
641             get
642             {
643                 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
644             }
645             set
646             {
647                 SetValue(SelectionHandlePressedImageRightProperty, value);
648                 NotifyPropertyChanged();
649             }
650         }
651
652         /// <summary>
653         /// The SelectionHandleMarkerImageLeft property.
654         /// </summary>
655         /// <since_tizen> 3 </since_tizen>
656         public PropertyMap SelectionHandleMarkerImageLeft
657         {
658             get
659             {
660                 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
661             }
662             set
663             {
664                 SetValue(SelectionHandleMarkerImageLeftProperty, value);
665                 NotifyPropertyChanged();
666             }
667         }
668
669         /// <summary>
670         /// The SelectionHandleMarkerImageRight property.
671         /// </summary>
672         /// <since_tizen> 3 </since_tizen>
673         public PropertyMap SelectionHandleMarkerImageRight
674         {
675             get
676             {
677                 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
678             }
679             set
680             {
681                 SetValue(SelectionHandleMarkerImageRightProperty, value);
682                 NotifyPropertyChanged();
683             }
684         }
685
686         /// <summary>
687         /// The SelectionHighlightColor property.
688         /// </summary>
689         /// <remarks>
690         /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
691         /// </remarks>
692         /// <since_tizen> 3 </since_tizen>
693         public Vector4 SelectionHighlightColor
694         {
695             get
696             {
697                 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
698                 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
699             }
700             set
701             {
702                 SetValue(SelectionHighlightColorProperty, value);
703                 NotifyPropertyChanged();
704             }
705         }
706
707         /// <summary>
708         /// The DecorationBoundingBox property.
709         /// </summary>
710         /// <remarks>
711         /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
712         /// </remarks>
713         /// <since_tizen> 3 </since_tizen>
714         public Rectangle DecorationBoundingBox
715         {
716             get
717             {
718                 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
719                 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
720             }
721             set
722             {
723                 SetValue(DecorationBoundingBoxProperty, value);
724                 NotifyPropertyChanged();
725             }
726         }
727
728         /// <summary>
729         /// The InputMethodSettings property.
730         /// </summary>
731         /// <since_tizen> 3 </since_tizen>
732         public PropertyMap InputMethodSettings
733         {
734             get
735             {
736                 return (PropertyMap)GetValue(InputMethodSettingsProperty);
737             }
738             set
739             {
740                 SetValue(InputMethodSettingsProperty, value);
741                 NotifyPropertyChanged();
742             }
743         }
744
745         /// <summary>
746         /// The InputColor property.
747         /// </summary>
748         /// <remarks>
749         /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
750         /// </remarks>
751         /// <since_tizen> 3 </since_tizen>
752         public Vector4 InputColor
753         {
754             get
755             {
756                 Vector4 temp = (Vector4)GetValue(InputColorProperty);
757                 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
758             }
759             set
760             {
761                 SetValue(InputColorProperty, value);
762                 NotifyPropertyChanged();
763             }
764         }
765
766         /// <summary>
767         /// The EnableMarkup property.
768         /// </summary>
769         /// <since_tizen> 3 </since_tizen>
770         public bool EnableMarkup
771         {
772             get
773             {
774                 return (bool)GetValue(EnableMarkupProperty);
775             }
776             set
777             {
778                 SetValue(EnableMarkupProperty, value);
779                 NotifyPropertyChanged();
780             }
781         }
782
783         /// <summary>
784         /// The InputFontFamily property.
785         /// </summary>
786         /// <since_tizen> 3 </since_tizen>
787         public string InputFontFamily
788         {
789             get
790             {
791                 return (string)GetValue(InputFontFamilyProperty);
792             }
793             set
794             {
795                 SetValue(InputFontFamilyProperty, value);
796                 NotifyPropertyChanged();
797             }
798         }
799
800         /// <summary>
801         /// The InputFontStyle property.
802         /// </summary>
803         /// <since_tizen> 3 </since_tizen>
804         public PropertyMap InputFontStyle
805         {
806             get
807             {
808                 return (PropertyMap)GetValue(InputFontStyleProperty);
809             }
810             set
811             {
812                 SetValue(InputFontStyleProperty, value);
813                 NotifyPropertyChanged();
814             }
815         }
816
817         /// <summary>
818         /// The InputPointSize property.
819         /// </summary>
820         /// <since_tizen> 3 </since_tizen>
821         public float InputPointSize
822         {
823             get
824             {
825                 return (float)GetValue(InputPointSizeProperty);
826             }
827             set
828             {
829                 SetValue(InputPointSizeProperty, value);
830                 NotifyPropertyChanged();
831             }
832         }
833
834         /// <summary>
835         /// The Underline property.
836         /// </summary>
837         /// <since_tizen> 3 </since_tizen>
838         public PropertyMap Underline
839         {
840             get
841             {
842                 return (PropertyMap)GetValue(UnderlineProperty);
843             }
844             set
845             {
846                 SetValue(UnderlineProperty, value);
847                 NotifyPropertyChanged();
848             }
849         }
850
851         /// <summary>
852         /// The InputUnderline property.
853         /// </summary>
854         /// <since_tizen> 3 </since_tizen>
855         public string InputUnderline
856         {
857             get
858             {
859                 return (string)GetValue(InputUnderlineProperty);
860             }
861             set
862             {
863                 SetValue(InputUnderlineProperty, value);
864                 NotifyPropertyChanged();
865             }
866         }
867
868         /// <summary>
869         /// The Shadow property.
870         /// </summary>
871         /// <since_tizen> 3 </since_tizen>
872         public PropertyMap Shadow
873         {
874             get
875             {
876                 return (PropertyMap)GetValue(ShadowProperty);
877             }
878             set
879             {
880                 SetValue(ShadowProperty, value);
881                 NotifyPropertyChanged();
882             }
883         }
884
885         /// <summary>
886         /// The InputShadow property.
887         /// </summary>
888         /// <since_tizen> 3 </since_tizen>
889         public string InputShadow
890         {
891             get
892             {
893                 return (string)GetValue(InputShadowProperty);
894             }
895             set
896             {
897                 SetValue(InputShadowProperty, value);
898                 NotifyPropertyChanged();
899             }
900         }
901
902         /// <summary>
903         /// The Emboss property.
904         /// </summary>
905         /// <since_tizen> 3 </since_tizen>
906         public string Emboss
907         {
908             get
909             {
910                 return (string)GetValue(EmbossProperty);
911             }
912             set
913             {
914                 SetValue(EmbossProperty, value);
915                 NotifyPropertyChanged();
916             }
917         }
918
919         /// <summary>
920         /// The InputEmboss property.
921         /// </summary>
922         /// <since_tizen> 3 </since_tizen>
923         public string InputEmboss
924         {
925             get
926             {
927                 return (string)GetValue(InputEmbossProperty);
928             }
929             set
930             {
931                 SetValue(InputEmbossProperty, value);
932                 NotifyPropertyChanged();
933             }
934         }
935
936         /// <summary>
937         /// The Outline property.
938         /// </summary>
939         /// <since_tizen> 3 </since_tizen>
940         public PropertyMap Outline
941         {
942             get
943             {
944                 return (PropertyMap)GetValue(OutlineProperty);
945             }
946             set
947             {
948                 SetValue(OutlineProperty, value);
949                 NotifyPropertyChanged();
950             }
951         }
952
953         /// <summary>
954         /// The InputOutline property.
955         /// </summary>
956         /// <since_tizen> 3 </since_tizen>
957         public string InputOutline
958         {
959             get
960             {
961                 return (string)GetValue(InputOutlineProperty);
962             }
963             set
964             {
965                 SetValue(InputOutlineProperty, value);
966                 NotifyPropertyChanged();
967             }
968         }
969
970         /// <summary>
971         /// The HiddenInputSettings property.
972         /// </summary>
973         /// <since_tizen> 3 </since_tizen>
974         public Tizen.NUI.PropertyMap HiddenInputSettings
975         {
976             get
977             {
978                 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
979             }
980             set
981             {
982                 SetValue(HiddenInputSettingsProperty, value);
983                 NotifyPropertyChanged();
984             }
985         }
986
987         /// <summary>
988         /// The PixelSize property.
989         /// </summary>
990         /// <since_tizen> 3 </since_tizen>
991         public float PixelSize
992         {
993             get
994             {
995                 return (float)GetValue(PixelSizeProperty);
996             }
997             set
998             {
999                 SetValue(PixelSizeProperty, value);
1000                 NotifyPropertyChanged();
1001             }
1002         }
1003
1004         /// <summary>
1005         /// The Enable selection property.
1006         /// </summary>
1007         /// <since_tizen> 3 </since_tizen>
1008         public bool EnableSelection
1009         {
1010             get
1011             {
1012                 return (bool)GetValue(EnableSelectionProperty);
1013             }
1014             set
1015             {
1016                 SetValue(EnableSelectionProperty, value);
1017                 NotifyPropertyChanged();
1018             }
1019         }
1020
1021         /// <summary>
1022         /// The Enable selection property.
1023         /// </summary>
1024         /// <since_tizen> 6 </since_tizen>
1025         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1026         [EditorBrowsable(EditorBrowsableState.Never)]
1027         public bool EnableGrabHandle
1028         {
1029             get
1030             {
1031                 return (bool)GetValue(EnableGrabHandleProperty);
1032             }
1033             set
1034             {
1035                 SetValue(EnableGrabHandleProperty, value);
1036                 NotifyPropertyChanged();
1037             }
1038         }
1039
1040         /// <summary>
1041         /// The Enable selection property.
1042         /// </summary>
1043         /// <since_tizen> 6 </since_tizen>
1044         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1045         [EditorBrowsable(EditorBrowsableState.Never)]
1046         public bool EnableGrabHandlePopup
1047         {
1048             get
1049             {
1050                 return (bool)GetValue(EnableGrabHandlePopupProperty);
1051             }
1052             set
1053             {
1054                 SetValue(EnableGrabHandlePopupProperty, value);
1055                 NotifyPropertyChanged();
1056             }
1057         }
1058
1059         /// <summary>
1060         /// The Placeholder property.
1061         /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1062         /// </summary>
1063         /// <example>
1064         /// The following example demonstrates how to set the Placeholder property.
1065         /// <code>
1066         /// PropertyMap propertyMap = new PropertyMap();
1067         /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1068         /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1069         /// propertyMap.Add("color", new PropertyValue(Color.Red));
1070         /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1071         /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1072         ///
1073         /// PropertyMap fontStyleMap = new PropertyMap();
1074         /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1075         /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1076         /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1077         /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1078         ///
1079         /// TextField field = new TextField();
1080         /// field.Placeholder = propertyMap;
1081         /// </code>
1082         /// </example>
1083         /// <since_tizen> 3 </since_tizen>
1084         public Tizen.NUI.PropertyMap Placeholder
1085         {
1086             get
1087             {
1088                 return (PropertyMap)GetValue(PlaceholderProperty);
1089             }
1090             set
1091             {
1092                 SetValue(PlaceholderProperty, value);
1093                 NotifyPropertyChanged();
1094             }
1095         }
1096
1097         /// <summary>
1098         /// The Ellipsis property.<br />
1099         /// Enable or disable the ellipsis.<br />
1100         /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1101         /// </summary>
1102         /// <since_tizen> 4 </since_tizen>
1103         public bool Ellipsis
1104         {
1105             get
1106             {
1107                 return (bool)GetValue(EllipsisProperty);
1108             }
1109             set
1110             {
1111                 SetValue(EllipsisProperty, value);
1112                 NotifyPropertyChanged();
1113             }
1114         }
1115
1116         /// <summary>
1117         /// Enables selection of the text using the Shift key.
1118         /// </summary>
1119         /// <since_tizen> 5 </since_tizen>
1120         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1121         [EditorBrowsable(EditorBrowsableState.Never)]
1122         public bool EnableShiftSelection
1123         {
1124             get
1125             {
1126                 return (bool)GetValue(EnableShiftSelectionProperty);
1127             }
1128             set
1129             {
1130                 SetValue(EnableShiftSelectionProperty, value);
1131                 NotifyPropertyChanged();
1132             }
1133         }
1134
1135         /// <summary>
1136         /// The text alignment to match the direction of the system language.
1137         /// </summary>
1138         /// <since_tizen> 6 </since_tizen>
1139         public bool MatchSystemLanguageDirection
1140         {
1141             get
1142             {
1143                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1144             }
1145             set
1146             {
1147                 SetValue(MatchSystemLanguageDirectionProperty, value);
1148                 NotifyPropertyChanged();
1149             }
1150         }
1151
1152         /// Only used by the IL of xaml, will never changed to not hidden.
1153         [EditorBrowsable(EditorBrowsableState.Never)]
1154         public override bool IsCreateByXaml
1155         {
1156             get
1157             {
1158                 return base.IsCreateByXaml;
1159             }
1160             set
1161             {
1162                 base.IsCreateByXaml = value;
1163
1164                 if (value == true)
1165                 {
1166                     this.TextChanged += (obj, e) =>
1167                     {
1168                         this.Text = this.Text;
1169                     };
1170                 }
1171             }
1172         }
1173
1174         /// <summary>
1175         /// Get the InputMethodContext instance.
1176         /// </summary>
1177         /// <returns>The InputMethodContext instance.</returns>
1178         /// <since_tizen> 5 </since_tizen>
1179         public InputMethodContext GetInputMethodContext()
1180         {
1181             if (inputMethodCotext == null)
1182             {
1183                 /*Avoid raising InputMethodContext reference count.*/
1184                 inputMethodCotext = new InputMethodContext(Interop.TextField.TextField_GetInputMethodContext(swigCPtr), true);
1185                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1186             }
1187             return inputMethodCotext;
1188         }
1189
1190         /// <summary>
1191         /// Select the whole text.
1192         /// </summary>
1193         /// <since_tizen> 6 </since_tizen>
1194         /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1195         [EditorBrowsable(EditorBrowsableState.Never)]
1196         public void SelectWholeText()
1197         {
1198             Interop.TextField.TextField_SelectWholeText(swigCPtr);
1199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1200         }
1201
1202         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1203         {
1204             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1205         }
1206
1207         internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1208         {
1209             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.TextField_InputStyleChangedSignal(swigCPtr), false);
1210             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1211             return ret;
1212         }
1213
1214         /// <summary>
1215         /// Dispose.
1216         /// </summary>
1217         /// <since_tizen> 3 </since_tizen>
1218         protected override void Dispose(DisposeTypes type)
1219         {
1220             if (disposed)
1221             {
1222                 DisposeQueue.Instance.Add(this);
1223                 return;
1224             }
1225
1226             //Release your own unmanaged resources here.
1227             //You should not access any managed member here except static instance.
1228             //because the execution order of Finalizes is non-deterministic.
1229             if (this.HasBody())
1230             {
1231                 if (_textFieldMaxLengthReachedCallbackDelegate != null)
1232                 {
1233                     this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
1234                 }
1235
1236                 if (_textFieldTextChangedCallbackDelegate != null)
1237                 {
1238                     TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
1239                 }
1240             }
1241
1242             if (swigCPtr.Handle != global::System.IntPtr.Zero)
1243             {
1244                 if (swigCMemOwn)
1245                 {
1246                     swigCMemOwn = false;
1247                     // In order to speed up IME hide, temporarily add
1248                     GetInputMethodContext()?.DestroyContext();
1249                     Interop.TextField.delete_TextField(swigCPtr);
1250                 }
1251                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1252             }
1253
1254             base.Dispose(type);
1255         }
1256
1257         private string SetTranslatable(string textFieldSid)
1258         {
1259             string translatableText = null;
1260             translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1261             if (translatableText != null)
1262             {
1263                 if (systemlangTextFlag == false)
1264                 {
1265                     SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
1266                     systemlangTextFlag = true;
1267                 }
1268                 return translatableText;
1269             }
1270             else
1271             {
1272                 translatableText = "";
1273                 return translatableText;
1274             }
1275         }
1276
1277         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1278         {
1279             if (textFieldTextSid != null)
1280             {
1281                 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1282             }
1283             if (textFieldPlaceHolderTextSid != null)
1284             {
1285                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1286             }
1287         }
1288
1289         internal new class Property
1290         {
1291             internal static readonly int RENDERING_BACKEND = Interop.TextField.TextField_Property_RENDERING_BACKEND_get();
1292             internal static readonly int TEXT = Interop.TextField.TextField_Property_TEXT_get();
1293             internal static readonly int PLACEHOLDER_TEXT = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_get();
1294             internal static readonly int PLACEHOLDER_TEXT_FOCUSED = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
1295             internal static readonly int FONT_FAMILY = Interop.TextField.TextField_Property_FONT_FAMILY_get();
1296             internal static readonly int FONT_STYLE = Interop.TextField.TextField_Property_FONT_STYLE_get();
1297             internal static readonly int POINT_SIZE = Interop.TextField.TextField_Property_POINT_SIZE_get();
1298             internal static readonly int MAX_LENGTH = Interop.TextField.TextField_Property_MAX_LENGTH_get();
1299             internal static readonly int EXCEED_POLICY = Interop.TextField.TextField_Property_EXCEED_POLICY_get();
1300             internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextField.TextField_Property_HORIZONTAL_ALIGNMENT_get();
1301             internal static readonly int VERTICAL_ALIGNMENT = Interop.TextField.TextField_Property_VERTICAL_ALIGNMENT_get();
1302             internal static readonly int TEXT_COLOR = Interop.TextField.TextField_Property_TEXT_COLOR_get();
1303             internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
1304             internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextField.TextField_Property_PRIMARY_CURSOR_COLOR_get();
1305             internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextField.TextField_Property_SECONDARY_CURSOR_COLOR_get();
1306             internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextField.TextField_Property_ENABLE_CURSOR_BLINK_get();
1307             internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextField.TextField_Property_CURSOR_BLINK_INTERVAL_get();
1308             internal static readonly int CURSOR_BLINK_DURATION = Interop.TextField.TextField_Property_CURSOR_BLINK_DURATION_get();
1309             internal static readonly int CURSOR_WIDTH = Interop.TextField.TextField_Property_CURSOR_WIDTH_get();
1310             internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_IMAGE_get();
1311             internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
1312             internal static readonly int SCROLL_THRESHOLD = Interop.TextField.TextField_Property_SCROLL_THRESHOLD_get();
1313             internal static readonly int SCROLL_SPEED = Interop.TextField.TextField_Property_SCROLL_SPEED_get();
1314             internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
1315             internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
1316             internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
1317             internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
1318             internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
1319             internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
1320             internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextField.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
1321             internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextField.TextField_Property_DECORATION_BOUNDING_BOX_get();
1322             internal static readonly int INPUT_METHOD_SETTINGS = Interop.TextField.TextField_Property_INPUT_METHOD_SETTINGS_get();
1323             internal static readonly int INPUT_COLOR = Interop.TextField.TextField_Property_INPUT_COLOR_get();
1324             internal static readonly int ENABLE_MARKUP = Interop.TextField.TextField_Property_ENABLE_MARKUP_get();
1325             internal static readonly int INPUT_FONT_FAMILY = Interop.TextField.TextField_Property_INPUT_FONT_FAMILY_get();
1326             internal static readonly int INPUT_FONT_STYLE = Interop.TextField.TextField_Property_INPUT_FONT_STYLE_get();
1327             internal static readonly int INPUT_POINT_SIZE = Interop.TextField.TextField_Property_INPUT_POINT_SIZE_get();
1328             internal static readonly int UNDERLINE = Interop.TextField.TextField_Property_UNDERLINE_get();
1329             internal static readonly int INPUT_UNDERLINE = Interop.TextField.TextField_Property_INPUT_UNDERLINE_get();
1330             internal static readonly int SHADOW = Interop.TextField.TextField_Property_SHADOW_get();
1331             internal static readonly int INPUT_SHADOW = Interop.TextField.TextField_Property_INPUT_SHADOW_get();
1332             internal static readonly int EMBOSS = Interop.TextField.TextField_Property_EMBOSS_get();
1333             internal static readonly int INPUT_EMBOSS = Interop.TextField.TextField_Property_INPUT_EMBOSS_get();
1334             internal static readonly int OUTLINE = Interop.TextField.TextField_Property_OUTLINE_get();
1335             internal static readonly int INPUT_OUTLINE = Interop.TextField.TextField_Property_INPUT_OUTLINE_get();
1336             internal static readonly int HIDDEN_INPUT_SETTINGS = Interop.TextField.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
1337             internal static readonly int PIXEL_SIZE = Interop.TextField.TextField_Property_PIXEL_SIZE_get();
1338             internal static readonly int ENABLE_SELECTION = Interop.TextField.TextField_Property_ENABLE_SELECTION_get();
1339             internal static readonly int PLACEHOLDER = Interop.TextField.TextField_Property_PLACEHOLDER_get();
1340             internal static readonly int ELLIPSIS = Interop.TextField.TextField_Property_ELLIPSIS_get();
1341             internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextField.TextField_Property_ENABLE_SHIFT_SELECTION_get();
1342             internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextField.TextField_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1343             internal static readonly int ENABLE_GRAB_HANDLE = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_get();
1344             internal static readonly int ENABLE_GRAB_HANDLE_POPUP = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_POPUP_get();
1345         }
1346
1347         internal class InputStyle
1348         {
1349             internal enum Mask
1350             {
1351                 None = 0x0000,
1352                 Color = 0x0001,
1353                 FontFamily = 0x0002,
1354                 PointSize = 0x0004,
1355                 FontStyle = 0x0008,
1356                 Underline = 0x0010,
1357                 Shadow = 0x0020,
1358                 Emboss = 0x0040,
1359                 Outline = 0x0080
1360             }
1361         }
1362
1363         private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1364         {
1365             DecorationBoundingBox = new Rectangle(x, y, width, height);
1366         }
1367         private void OnInputColorChanged(float x, float y, float z, float w)
1368         {
1369             InputColor = new Vector4(x, y, z, w);
1370         }
1371         private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1372         {
1373             PlaceholderTextColor = new Vector4(r, g, b, a);
1374         }
1375         private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1376         {
1377             PrimaryCursorColor = new Vector4(x, y, z, w);
1378         }
1379         private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1380         {
1381             SecondaryCursorColor = new Vector4(x, y, z, w);
1382         }
1383         private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1384         {
1385             SelectionHighlightColor = new Vector4(x, y, z, w);
1386         }
1387         private void OnShadowColorChanged(float x, float y, float z, float w)
1388         {
1389             ShadowColor = new Vector4(x, y, z, w);
1390         }
1391         private void OnShadowOffsetChanged(float x, float y)
1392         {
1393             ShadowOffset = new Vector2(x, y);
1394         }
1395         private void OnTextColorChanged(float r, float g, float b, float a)
1396         {
1397             TextColor = new Color(r, g, b, a);
1398         }
1399     }
1400 }