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