Release 8.0.0.15408
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
1 /*
2  * Copyright(c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
20 using System;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
24
25 namespace Tizen.NUI.BaseComponents
26 {
27
28     /// <summary>
29     /// A control which renders a short text string.<br />
30     /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
31     /// </summary>
32     /// <since_tizen> 3 </since_tizen>
33     public partial class TextLabel : View
34     {
35         static TextLabel() { }
36
37         private string textLabelSid = null;
38         private bool systemlangTextFlag = false;
39         private TextLabelSelectorData selectorData;
40
41         /// <summary>
42         /// Return a copied Style instance of the TextLabel.
43         /// </summary>
44         /// <remarks>
45         /// It returns copied style instance so that changing it does not effect to the view.
46         /// Style setting is possible by using constructor or the function of <see cref="View.ApplyStyle"/>.
47         /// </remarks>
48         [EditorBrowsable(EditorBrowsableState.Never)]
49         public TextLabelStyle Style => new TextLabelStyle(this);
50
51         /// <summary>
52         /// Creates the TextLabel control.
53         /// </summary>
54         /// <since_tizen> 3 </since_tizen>
55         public TextLabel() : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true)
56         {
57             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
58         }
59
60         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
61         [EditorBrowsable(EditorBrowsableState.Never)]
62         public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true, viewStyle)
63         {
64         }
65
66         /// <summary>
67         /// Creates the TextLabel with setting the status of shown or hidden.
68         /// </summary>
69         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
70         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
71         [EditorBrowsable(EditorBrowsableState.Never)]
72         public TextLabel(bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true)
73         {
74             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
75             SetVisible(shown);
76         }
77
78         /// <summary>
79         /// Creates the TextLabel control.
80         /// </summary>
81         /// <param name="text">The text to display</param>
82         /// <since_tizen> 3 </since_tizen>
83         public TextLabel(string text) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true)
84         {
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86         }
87
88         /// <summary>
89         /// Creates the TextLabel with setting the status of shown or hidden.
90         /// </summary>
91         /// <param name="text">The text to display</param>
92         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
93         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
94         [EditorBrowsable(EditorBrowsableState.Never)]
95         public TextLabel(string text, bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true)
96         {
97             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98             SetVisible(shown);
99         }
100
101         internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true)
102         {
103             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104
105             if (!shown)
106             {
107                 SetVisible(false);
108             }
109         }
110
111         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
112         {
113             if (!shown)
114             {
115                 SetVisible(false);
116             }
117         }
118
119         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn)
120         {
121             if (!shown)
122             {
123                 SetVisible(false);
124             }
125         }
126
127         /// <summary>
128         /// The TranslatableText property.<br />
129         /// The text can set the SID value.<br />
130         /// </summary>
131         /// <exception cref='ArgumentNullException'>
132         /// ResourceManager about multilingual is null.
133         /// </exception>
134         /// <since_tizen> 4 </since_tizen>
135         public string TranslatableText
136         {
137             get
138             {
139                 return (string)GetValue(TranslatableTextProperty);
140             }
141             set
142             {
143                 SetValue(TranslatableTextProperty, value);
144                 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
145             }
146         }
147         private string translatableText
148         {
149             get
150             {
151                 return textLabelSid;
152             }
153             set
154             {
155                 if (NUIApplication.MultilingualResourceManager == null)
156                 {
157                     throw new ArgumentNullException("ResourceManager about multilingual is null");
158                 }
159                 string translatableText = null;
160                 textLabelSid = value;
161                 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
162                 if (translatableText != null)
163                 {
164                     Text = translatableText;
165                     if (systemlangTextFlag == false)
166                     {
167                         SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
168                         systemlangTextFlag = true;
169                     }
170                 }
171                 else
172                 {
173                     Text = "";
174                 }
175                 NotifyPropertyChanged();
176             }
177         }
178
179         /// <summary>
180         /// The Text property.<br />
181         /// The text to display in the UTF-8 format.<br />
182         /// </summary>
183         /// <since_tizen> 3 </since_tizen>
184         public string Text
185         {
186             get
187             {
188                 return (string)GetValue(TextProperty);
189             }
190             set
191             {
192                 SetValue(TextProperty, value);
193                 selectorData?.Text.UpdateIfNeeds(this, value);
194                 NotifyPropertyChangedAndRequestLayout();
195             }
196         }
197
198         /// <summary>
199         /// The FontFamily property.<br />
200         /// The requested font family to use.<br />
201         /// </summary>
202         /// <since_tizen> 3 </since_tizen>
203         public string FontFamily
204         {
205             get
206             {
207                 return (string)GetValue(FontFamilyProperty);
208             }
209             set
210             {
211                 SetValue(FontFamilyProperty, value);
212                 selectorData?.FontFamily.UpdateIfNeeds(this, value);
213                 NotifyPropertyChangedAndRequestLayout();
214             }
215         }
216
217         /// <summary>
218         /// The FontStyle property.<br />
219         /// The requested font style to use.<br />
220         /// </summary>
221         /// <since_tizen> 3 </since_tizen>
222         public PropertyMap FontStyle
223         {
224             get
225             {
226                 return (PropertyMap)GetValue(FontStyleProperty);
227             }
228             set
229             {
230                 SetValue(FontStyleProperty, value);
231                 NotifyPropertyChangedAndRequestLayout();
232             }
233         }
234
235         /// <summary>
236         /// The PointSize property.<br />
237         /// The size of font in points.<br />
238         /// </summary>
239         /// <since_tizen> 3 </since_tizen>
240         public float PointSize
241         {
242             get
243             {
244                 return (float)GetValue(PointSizeProperty);
245             }
246             set
247             {
248                 SetValue(PointSizeProperty, value);
249                 selectorData?.PointSize.UpdateIfNeeds(this, value);
250                 NotifyPropertyChangedAndRequestLayout();
251             }
252         }
253
254         /// <summary>
255         /// The MultiLine property.<br />
256         /// The single-line or multi-line layout option.<br />
257         /// </summary>
258         /// <since_tizen> 3 </since_tizen>
259         public bool MultiLine
260         {
261             get
262             {
263                 return (bool)GetValue(MultiLineProperty);
264             }
265             set
266             {
267                 SetValue(MultiLineProperty, value);
268                 NotifyPropertyChangedAndRequestLayout();
269             }
270         }
271
272         /// <summary>
273         /// The HorizontalAlignment property.<br />
274         /// The line horizontal alignment.<br />
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.<br />
292         /// The line vertical alignment.<br />
293         /// </summary>
294         /// <since_tizen> 3 </since_tizen>
295         public VerticalAlignment VerticalAlignment
296         {
297             get
298             {
299                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
300             }
301             set
302             {
303                 SetValue(VerticalAlignmentProperty, value);
304                 NotifyPropertyChanged();
305             }
306         }
307
308         /// <summary>
309         /// The TextColor property.<br />
310         /// The color of the text.<br />
311         /// Animation framework can be used to change the color of the text when not using mark up.<br />
312         /// Cannot animate the color when text is auto scrolling.<br />
313         /// </summary>
314         /// <remarks>
315         /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
316         /// </remarks>
317         /// <since_tizen> 3 </since_tizen>
318         public Color TextColor
319         {
320             get
321             {
322                 Color temp = (Color)GetValue(TextColorProperty);
323                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
324             }
325             set
326             {
327                 SetValue(TextColorProperty, value);
328                 selectorData?.TextColor.UpdateIfNeeds(this, value);
329                 NotifyPropertyChanged();
330             }
331         }
332
333         /// <summary>
334         /// The ShadowOffset property.<br />
335         /// The drop shadow offset 0 indicates no shadow.<br />
336         /// </summary>
337         /// <since_tizen> 3 </since_tizen>
338         /// <remarks>
339         /// Deprecated.(API Level 6) Use Shadow instead.
340         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
341         /// </remarks>
342         [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
343         public Vector2 ShadowOffset
344         {
345             get
346             {
347                 Vector2 shadowOffset = new Vector2();
348                 Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
349                 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
350             }
351             set
352             {
353                 PropertyMap temp = new PropertyMap();
354                 temp.Insert("offset", new PropertyValue(value));
355
356                 PropertyMap shadowMap = Shadow;
357                 shadowMap.Merge(temp);
358
359                 SetValue(ShadowProperty, shadowMap);
360                 NotifyPropertyChanged();
361             }
362         }
363
364         /// <summary>
365         /// The ShadowColor property.<br />
366         /// The color of a drop shadow.<br />
367         /// </summary>
368         /// <since_tizen> 3 </since_tizen>
369         /// <remarks>
370         /// Deprecated.(API Level 6) Use Shadow instead.
371         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
372         /// </remarks>
373         [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
374         public Vector4 ShadowColor
375         {
376             get
377             {
378                 Vector4 shadowColor = new Vector4();
379                 Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
380                 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
381             }
382             set
383             {
384                 PropertyMap temp = new PropertyMap();
385                 temp.Insert("color", new PropertyValue(value));
386
387                 PropertyMap shadowMap = Shadow;
388                 shadowMap.Merge(temp);
389
390                 SetValue(ShadowProperty, shadowMap);
391                 NotifyPropertyChanged();
392             }
393         }
394
395         /// <summary>
396         /// The UnderlineEnabled property.<br />
397         /// The underline enabled flag.<br />
398         /// </summary>
399         /// <since_tizen> 3 </since_tizen>
400         /// <remarks>
401         /// Deprecated.(API Level 6) Use Underline instead.
402         /// </remarks>
403         [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
404         public bool UnderlineEnabled
405         {
406             get
407             {
408                 bool underlineEnabled = false;
409                 Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
410                 return underlineEnabled;
411             }
412             set
413             {
414                 PropertyMap temp = new PropertyMap();
415                 temp.Add("enable", new PropertyValue(value));
416
417                 PropertyMap undelineMap = Underline;
418                 undelineMap.Merge(temp);
419
420                 SetValue(UnderlineProperty, undelineMap);
421                 NotifyPropertyChanged();
422
423             }
424         }
425
426         /// <summary>
427         /// The UnderlineColor property.<br />
428         /// Overrides the underline height from font metrics.<br />
429         /// </summary>
430         /// <since_tizen> 3 </since_tizen>
431         /// <remarks>
432         /// Deprecated.(API Level 6) Use Underline instead.
433         /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
434         /// </remarks>
435         [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
436         public Vector4 UnderlineColor
437         {
438             get
439             {
440                 Vector4 underlineColor = new Vector4();
441                 Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
442                 return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
443             }
444             set
445             {
446                 PropertyMap temp = new PropertyMap();
447                 temp.Insert("color", new PropertyValue(value));
448
449                 PropertyMap undelineMap = Underline;
450                 undelineMap.Merge(temp);
451
452                 SetValue(UnderlineProperty, undelineMap);
453                 NotifyPropertyChanged();
454             }
455         }
456
457         /// <summary>
458         /// The UnderlineHeight property.<br />
459         /// Overrides the underline height from font metrics.<br />
460         /// </summary>
461         /// <since_tizen> 3 </since_tizen>
462         /// <remarks>
463         /// Deprecated.(API Level 6) Use Underline instead.
464         /// </remarks>
465         [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
466         public float UnderlineHeight
467         {
468             get
469             {
470                 float underlineHeight = 0.0f;
471                 Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
472                 return underlineHeight;
473             }
474             set
475             {
476                 PropertyMap temp = new PropertyMap();
477                 temp.Insert("height", new PropertyValue(value));
478
479                 PropertyMap undelineMap = Underline;
480                 undelineMap.Merge(temp);
481
482                 SetValue(UnderlineProperty, undelineMap);
483                 NotifyPropertyChanged();
484             }
485         }
486
487         /// <summary>
488         /// The EnableMarkup property.<br />
489         /// Whether the mark-up processing is enabled.<br />
490         /// </summary>
491         /// <since_tizen> 3 </since_tizen>
492         public bool EnableMarkup
493         {
494             get
495             {
496                 return (bool)GetValue(EnableMarkupProperty);
497             }
498             set
499             {
500                 SetValue(EnableMarkupProperty, value);
501                 NotifyPropertyChanged();
502             }
503         }
504
505         /// <summary>
506         /// The EnableAutoScroll property.<br />
507         /// Starts or stops auto scrolling.<br />
508         /// </summary>
509         /// <since_tizen> 3 </since_tizen>
510         public bool EnableAutoScroll
511         {
512             get
513             {
514                 return (bool)GetValue(EnableAutoScrollProperty);
515             }
516             set
517             {
518                 SetValue(EnableAutoScrollProperty, value);
519                 NotifyPropertyChanged();
520             }
521         }
522
523         /// <summary>
524         /// The AutoScrollSpeed property.<br />
525         /// Sets the speed of scrolling in pixels per second.<br />
526         /// </summary>
527         /// <since_tizen> 3 </since_tizen>
528         public int AutoScrollSpeed
529         {
530             get
531             {
532                 return (int)GetValue(AutoScrollSpeedProperty);
533             }
534             set
535             {
536                 SetValue(AutoScrollSpeedProperty, value);
537                 NotifyPropertyChanged();
538             }
539         }
540
541         /// <summary>
542         /// The AutoScrollLoopCount property.<br />
543         /// Number of complete loops when scrolling enabled.<br />
544         /// </summary>
545         /// <since_tizen> 3 </since_tizen>
546         public int AutoScrollLoopCount
547         {
548             get
549             {
550                 return (int)GetValue(AutoScrollLoopCountProperty);
551             }
552             set
553             {
554                 SetValue(AutoScrollLoopCountProperty, value);
555                 NotifyPropertyChanged();
556             }
557         }
558
559         /// <summary>
560         /// The AutoScrollGap property.<br />
561         /// Gap before scrolling wraps.<br />
562         /// </summary>
563         /// <since_tizen> 3 </since_tizen>
564         public float AutoScrollGap
565         {
566             get
567             {
568                 return (float)GetValue(AutoScrollGapProperty);
569             }
570             set
571             {
572                 SetValue(AutoScrollGapProperty, value);
573                 NotifyPropertyChanged();
574             }
575         }
576
577         /// <summary>
578         /// The LineSpacing property.<br />
579         /// The default extra space between lines in points.<br />
580         /// </summary>
581         /// <since_tizen> 3 </since_tizen>
582         public float LineSpacing
583         {
584             get
585             {
586                 return (float)GetValue(LineSpacingProperty);
587             }
588             set
589             {
590                 SetValue(LineSpacingProperty, value);
591                 NotifyPropertyChangedAndRequestLayout();
592             }
593         }
594
595         /// <summary>
596         /// The Underline property.<br />
597         /// The default underline parameters.<br />
598         /// </summary>
599         /// <since_tizen> 3 </since_tizen>
600         public PropertyMap Underline
601         {
602             get
603             {
604                 return (PropertyMap)GetValue(UnderlineProperty);
605             }
606             set
607             {
608                 SetValue(UnderlineProperty, value);
609                 NotifyPropertyChanged();
610             }
611         }
612
613         /// <summary>
614         /// The Shadow property.<br />
615         /// The default shadow parameters.<br />
616         /// </summary>
617         /// <since_tizen> 3 </since_tizen>
618         public PropertyMap Shadow
619         {
620             get
621             {
622                 return (PropertyMap)GetValue(ShadowProperty);
623             }
624             set
625             {
626                 SetValue(ShadowProperty, value);
627                 NotifyPropertyChanged();
628             }
629         }
630
631         /// <summary>
632         /// Describes a text shadow for a TextLabel.
633         /// It is null by default.
634         /// </summary>
635         [EditorBrowsable(EditorBrowsableState.Never)]
636         public TextShadow TextShadow
637         {
638             get
639             {
640                 return (TextShadow)GetValue(TextShadowProperty);
641             }
642             set
643             {
644                 SetValue(TextShadowProperty, value);
645                 selectorData?.TextShadow.UpdateIfNeeds(this, value);
646                 NotifyPropertyChanged();
647             }
648         }
649
650         /// <summary>
651         /// The Emboss property.<br />
652         /// The default emboss parameters.<br />
653         /// </summary>
654         /// <since_tizen> 3 </since_tizen>
655         public string Emboss
656         {
657             get
658             {
659                 return (string)GetValue(EmbossProperty);
660             }
661             set
662             {
663                 SetValue(EmbossProperty, value);
664                 NotifyPropertyChanged();
665             }
666         }
667
668         /// <summary>
669         /// The Outline property.<br />
670         /// The default outline parameters.<br />
671         /// </summary>
672         /// <since_tizen> 3 </since_tizen>
673         public PropertyMap Outline
674         {
675             get
676             {
677                 return (PropertyMap)GetValue(OutlineProperty);
678             }
679             set
680             {
681                 SetValue(OutlineProperty, value);
682                 NotifyPropertyChanged();
683             }
684         }
685
686         /// <summary>
687         /// The PixelSize property.<br />
688         /// The size of font in pixels.<br />
689         /// </summary>
690         /// <since_tizen> 3 </since_tizen>
691         public float PixelSize
692         {
693             get
694             {
695                 return (float)GetValue(PixelSizeProperty);
696             }
697             set
698             {
699                 SetValue(PixelSizeProperty, value);
700                 NotifyPropertyChangedAndRequestLayout();
701             }
702         }
703
704         /// <summary>
705         /// The Ellipsis property.<br />
706         /// Enable or disable the ellipsis.<br />
707         /// </summary>
708         /// <since_tizen> 3 </since_tizen>
709         public bool Ellipsis
710         {
711             get
712             {
713                 return (bool)GetValue(EllipsisProperty);
714             }
715             set
716             {
717                 SetValue(EllipsisProperty, value);
718                 NotifyPropertyChanged();
719             }
720         }
721
722         /// <summary>
723         /// The AutoScrollLoopDelay property.<br />
724         /// Do something.<br />
725         /// </summary>
726         /// <since_tizen> 3 </since_tizen>
727         public float AutoScrollLoopDelay
728         {
729             get
730             {
731                 return (float)GetValue(AutoScrollLoopDelayProperty);
732             }
733             set
734             {
735                 SetValue(AutoScrollLoopDelayProperty, value);
736                 NotifyPropertyChanged();
737             }
738         }
739
740         /// <summary>
741         /// The AutoScrollStopMode property.<br />
742         /// Do something.<br />
743         /// </summary>
744         /// <since_tizen> 3 </since_tizen>
745         public AutoScrollStopMode AutoScrollStopMode
746         {
747             get
748             {
749                 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
750             }
751             set
752             {
753                 SetValue(AutoScrollStopModeProperty, value);
754                 NotifyPropertyChanged();
755             }
756         }
757
758         /// <summary>
759         /// The line count of the text.
760         /// </summary>
761         /// <since_tizen> 3 </since_tizen>
762         public int LineCount
763         {
764             get
765             {
766                 int temp = 0;
767                 GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp);
768                 return temp;
769             }
770         }
771
772         /// <summary>
773         /// The LineWrapMode property.<br />
774         /// line wrap mode when the text lines over layout width.<br />
775         /// </summary>
776         /// <since_tizen> 4 </since_tizen>
777         public LineWrapMode LineWrapMode
778         {
779             get
780             {
781                 return (LineWrapMode)GetValue(LineWrapModeProperty);
782             }
783             set
784             {
785                 SetValue(LineWrapModeProperty, value);
786                 NotifyPropertyChanged();
787             }
788         }
789
790         /// <summary>
791         /// The direction of the text such as left to right or right to left.
792         /// </summary>
793         /// <since_tizen> 5 </since_tizen>
794         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
795         [EditorBrowsable(EditorBrowsableState.Never)]
796         public TextDirection TextDirection
797         {
798             get
799             {
800                 int temp = 0;
801                 GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp);
802                 return (TextDirection)temp;
803             }
804         }
805
806         /// <summary>
807         /// The vertical line alignment of the text.
808         /// </summary>
809         /// <since_tizen> 5 </since_tizen>
810         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
811         [EditorBrowsable(EditorBrowsableState.Never)]
812         public VerticalLineAlignment VerticalLineAlignment
813         {
814             get
815             {
816                 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
817             }
818             set
819             {
820                 SetValue(VerticalLineAlignmentProperty, value);
821                 NotifyPropertyChanged();
822             }
823         }
824
825         /// <summary>
826         /// The text alignment to match the direction of the system language.
827         /// </summary>
828         /// <since_tizen> 6 </since_tizen>
829         public bool MatchSystemLanguageDirection
830         {
831             get
832             {
833                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
834             }
835             set
836             {
837                 SetValue(MatchSystemLanguageDirectionProperty, value);
838                 NotifyPropertyChanged();
839             }
840         }
841
842         /// <summary>
843         /// The text fit parameters.<br />
844         /// The textFit map contains the following keys :<br />
845         /// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)<br />
846         /// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)<br />
847         /// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)<br />
848         /// - stepSize (float type) : Step Size for font increase(the default value is 1.f)<br />
849         /// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")<br />
850         /// </summary>
851         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
852         [EditorBrowsable(EditorBrowsableState.Never)]
853         public PropertyMap TextFit
854         {
855             get
856             {
857                 return (PropertyMap)GetValue(TextFitProperty);
858             }
859             set
860             {
861                 SetValue(TextFitProperty, value);
862                 NotifyPropertyChanged();
863             }
864         }
865
866         /// <summary>
867         /// The MinLineSize property.<br />
868         /// </summary>
869         /// <since_tizen> 8 </since_tizen>
870         [EditorBrowsable(EditorBrowsableState.Never)]
871         public float MinLineSize
872         {
873             get
874             {
875                 return (float)GetValue(MinLineSizeProperty);
876             }
877             set
878             {
879                 SetValue(MinLineSizeProperty, value);
880                 NotifyPropertyChangedAndRequestLayout();
881             }
882         }
883
884         private TextLabelSelectorData SelectorData
885         {
886             get
887             {
888                 if (selectorData == null)
889                 {
890                     selectorData = new TextLabelSelectorData();
891                 }
892                 return selectorData;
893             }
894         }
895
896         /// <summary>
897         /// Downcasts a handle to textLabel handle
898         /// </summary>
899         /// <param name="handle"></param>
900         /// <returns></returns>
901         /// <since_tizen> 3 </since_tizen>
902         /// Please do not use! this will be deprecated!
903         /// Instead please use as keyword.
904         [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
905             "Like: " +
906             "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
907             "TextLabel label = handle as TextLabel")]
908         [EditorBrowsable(EditorBrowsableState.Never)]
909         public static TextLabel DownCast(BaseHandle handle)
910         {
911             TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
912
913             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
914             return ret;
915         }
916
917         /// <inheritdoc/>
918         [EditorBrowsable(EditorBrowsableState.Never)]
919         protected override void Dispose(DisposeTypes type)
920         {
921             if (disposed)
922             {
923                 return;
924             }
925
926             if (type == DisposeTypes.Explicit)
927             {
928                 //Called by User
929                 //Release your own managed resources here.
930                 //You should release all of your own disposable objects here.
931                 selectorData?.Reset(this);
932             }
933
934             base.Dispose(type);
935         }
936
937         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
938         {
939             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
940         }
941
942         /// This will not be public opened.
943         [EditorBrowsable(EditorBrowsableState.Never)]
944         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
945         {
946             Interop.TextLabel.delete_TextLabel(swigCPtr);
947         }
948
949         /// <summary>
950         /// Get attribues, it is abstract function and must be override.
951         /// </summary>
952         /// <since_tizen> 6 </since_tizen>
953         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
954         [EditorBrowsable(EditorBrowsableState.Never)]
955         protected override ViewStyle GetViewStyle()
956         {
957             return new TextLabelStyle();
958         }
959
960         /// <summary>
961         /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
962         /// </summary>
963         protected override void OnBindingContextChanged()
964         {
965             base.OnBindingContextChanged();
966         }
967
968         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
969         {
970             Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
971         }
972
973         private void  NotifyPropertyChangedAndRequestLayout()
974         {
975             NotifyPropertyChanged();
976             Layout?.RequestLayout();
977         }
978
979         internal new class Property
980         {
981             internal static readonly int TEXT = Interop.TextLabel.TextLabel_Property_TEXT_get();
982             internal static readonly int FONT_FAMILY = Interop.TextLabel.TextLabel_Property_FONT_FAMILY_get();
983             internal static readonly int FONT_STYLE = Interop.TextLabel.TextLabel_Property_FONT_STYLE_get();
984             internal static readonly int POINT_SIZE = Interop.TextLabel.TextLabel_Property_POINT_SIZE_get();
985             internal static readonly int MULTI_LINE = Interop.TextLabel.TextLabel_Property_MULTI_LINE_get();
986             internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
987             internal static readonly int VERTICAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_ALIGNMENT_get();
988             internal static readonly int TEXT_COLOR = Interop.TextLabel.TextLabel_Property_TEXT_COLOR_get();
989             internal static readonly int ENABLE_MARKUP = Interop.TextLabel.TextLabel_Property_ENABLE_MARKUP_get();
990             internal static readonly int ENABLE_AUTO_SCROLL = Interop.TextLabel.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
991             internal static readonly int AUTO_SCROLL_SPEED = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_SPEED_get();
992             internal static readonly int AUTO_SCROLL_LOOP_COUNT = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
993             internal static readonly int AUTO_SCROLL_GAP = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_GAP_get();
994             internal static readonly int LINE_SPACING = Interop.TextLabel.TextLabel_Property_LINE_SPACING_get();
995             internal static readonly int UNDERLINE = Interop.TextLabel.TextLabel_Property_UNDERLINE_get();
996             internal static readonly int SHADOW = Interop.TextLabel.TextLabel_Property_SHADOW_get();
997             internal static readonly int EMBOSS = Interop.TextLabel.TextLabel_Property_EMBOSS_get();
998             internal static readonly int OUTLINE = Interop.TextLabel.TextLabel_Property_OUTLINE_get();
999             internal static readonly int PIXEL_SIZE = Interop.TextLabel.TextLabel_Property_PIXEL_SIZE_get();
1000             internal static readonly int ELLIPSIS = Interop.TextLabel.TextLabel_Property_ELLIPSIS_get();
1001             internal static readonly int AUTO_SCROLL_STOP_MODE = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
1002             internal static readonly int AUTO_SCROLL_LOOP_DELAY = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
1003             internal static readonly int LINE_COUNT = Interop.TextLabel.TextLabel_Property_LINE_COUNT_get();
1004             internal static readonly int LINE_WRAP_MODE = Interop.TextLabel.TextLabel_Property_LINE_WRAP_MODE_get();
1005             internal static readonly int TEXT_DIRECTION = Interop.TextLabel.TextLabel_Property_TEXT_DIRECTION_get();
1006             internal static readonly int VERTICAL_LINE_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
1007             internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextLabel.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1008             internal static readonly int TEXT_FIT = Interop.TextLabel.TextLabel_Property_TEXT_FIT_get();
1009             internal static readonly int MIN_LINE_SIZE = Interop.TextLabel.TextLabel_Property_MIN_LINE_SIZE_get();
1010         }
1011
1012         private void OnShadowColorChanged(float x, float y, float z, float w)
1013         {
1014             ShadowColor = new Vector4(x, y, z, w);
1015         }
1016         private void OnShadowOffsetChanged(float x, float y)
1017         {
1018             ShadowOffset = new Vector2(x, y);
1019         }
1020         private void OnTextColorChanged(float r, float g, float b, float a)
1021         {
1022             TextColor = new Color(r, g, b, a);
1023         }
1024         private void OnUnderlineColorChanged(float x, float y, float z, float w)
1025         {
1026             UnderlineColor = new Vector4(x, y, z, w);
1027         }
1028     }
1029 }