[NUI] fix warning for text components
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
20
21 using System;
22 using System.Globalization;
23 using System.ComponentModel;
24 using Tizen.NUI.Text;
25
26 namespace Tizen.NUI.BaseComponents
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         private class TextLayout : LayoutItem
36         {
37             protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
38             {
39                 // Padding will be automatically applied by DALi TextLabel.
40                 float totalWidth = widthMeasureSpec.Size.AsDecimal();
41                 float totalHeight = heightMeasureSpec.Size.AsDecimal();
42
43                 if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
44                 {
45                     if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
46                     {
47                         totalHeight = Owner.GetHeightForWidth(totalWidth);
48                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
49                     }
50                 }
51                 else
52                 {
53                     var minSize = Owner.MinimumSize;
54                     var maxSize = Owner.MaximumSize;
55                     var naturalSize = Owner.GetNaturalSize();
56
57                     if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
58                     {
59                         // GetWidthForHeight is not implemented.
60                         totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
61                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
62                     }
63                     else
64                     {
65                         totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
66                         totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), (maxSize.Height < 0 ? Int32.MaxValue : maxSize.Height));
67
68                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
69                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
70                     }
71                 }
72
73                 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
74                 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
75
76                 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
77                                        ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
78             }
79         }
80
81         static TextLabel() { }
82
83         private string textLabelSid = null;
84         private bool systemlangTextFlag = false;
85         private TextLabelSelectorData selectorData;
86         private float fontSizeScale = 1.0f;
87         private bool hasFontSizeChangedCallback = false;
88
89         /// <summary>
90         /// Creates the TextLabel control.
91         /// </summary>
92         /// <since_tizen> 3 </since_tizen>
93         public TextLabel() : this(Interop.TextLabel.New(), true)
94         {
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96         }
97
98         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
99         [EditorBrowsable(EditorBrowsableState.Never)]
100         public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(), true, viewStyle)
101         {
102         }
103
104         /// <summary>
105         /// Creates the TextLabel with setting the status of shown or hidden.
106         /// </summary>
107         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
108         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
109         [EditorBrowsable(EditorBrowsableState.Never)]
110         public TextLabel(bool shown) : this(Interop.TextLabel.New(), true)
111         {
112             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113             SetVisible(shown);
114         }
115
116         /// <summary>
117         /// Creates the TextLabel control.
118         /// </summary>
119         /// <param name="text">The text to display</param>
120         /// <since_tizen> 3 </since_tizen>
121         public TextLabel(string text) : this(Interop.TextLabel.New(text), true)
122         {
123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124         }
125
126         /// <summary>
127         /// Creates the TextLabel with setting the status of shown or hidden.
128         /// </summary>
129         /// <param name="text">The text to display</param>
130         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
131         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
132         [EditorBrowsable(EditorBrowsableState.Never)]
133         public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text), true)
134         {
135             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136             SetVisible(shown);
137         }
138
139         internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.NewTextLabel(TextLabel.getCPtr(handle)), true)
140         {
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142
143             if (!shown)
144             {
145                 SetVisible(false);
146             }
147         }
148
149         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
150         {
151             if (!shown)
152             {
153                 SetVisible(false);
154             }
155         }
156
157         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
158         {
159             if (!shown)
160             {
161                 SetVisible(false);
162             }
163         }
164
165         /// <summary>
166         /// The TranslatableText property.<br />
167         /// The text can set the SID value.<br />
168         /// </summary>
169         /// <exception cref='ArgumentNullException'>
170         /// ResourceManager about multilingual is null.
171         /// </exception>
172         /// <since_tizen> 4 </since_tizen>
173         public string TranslatableText
174         {
175             get
176             {
177                 return (string)GetValue(TranslatableTextProperty);
178             }
179             set
180             {
181                 SetValue(TranslatableTextProperty, value);
182             }
183         }
184         private string translatableText
185         {
186             get
187             {
188                 return textLabelSid;
189             }
190             set
191             {
192                 if (NUIApplication.MultilingualResourceManager == null)
193                 {
194                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
195                 }
196                 string translatableText = null;
197                 textLabelSid = value;
198                 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
199                 if (translatableText != null)
200                 {
201                     Text = translatableText;
202                     if (systemlangTextFlag == false)
203                     {
204                         SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
205                         systemlangTextFlag = true;
206                     }
207                 }
208                 else
209                 {
210                     Text = "";
211                 }
212                 NotifyPropertyChanged();
213             }
214         }
215
216         /// <summary>
217         /// The Text property.<br />
218         /// The text to display in the UTF-8 format.<br />
219         /// </summary>
220         /// <since_tizen> 3 </since_tizen>
221         public string Text
222         {
223             get
224             {
225                 return (string)GetValue(TextProperty);
226             }
227             set
228             {
229                 SetValue(TextProperty, value);
230                 NotifyPropertyChanged();
231             }
232         }
233
234         /// <summary>
235         /// The FontFamily property.<br />
236         /// The requested font family to use.<br />
237         /// </summary>
238         /// <since_tizen> 3 </since_tizen>
239         public string FontFamily
240         {
241             get
242             {
243                 return (string)GetValue(FontFamilyProperty);
244             }
245             set
246             {
247                 SetValue(FontFamilyProperty, value);
248                 NotifyPropertyChanged();
249             }
250         }
251
252         /// <summary>
253         /// The FontStyle property.<br />
254         /// The requested font style to use.<br />
255         /// The fontStyle map contains the following keys :<br />
256         /// <list type="table">
257         /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
258         /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
259         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
260         /// </list>
261         /// </summary>
262         /// <since_tizen> 3 </since_tizen>
263         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
264         public PropertyMap FontStyle
265         {
266             get
267             {
268                 return (PropertyMap)GetValue(FontStyleProperty);
269             }
270             set
271             {
272                 SetValue(FontStyleProperty, value);
273                 NotifyPropertyChanged();
274             }
275         }
276
277         /// <summary>
278         /// Set FontStyle to TextLabel. <br />
279         /// </summary>
280         /// <param name="fontStyle">The FontStyle</param>
281         /// <remarks>
282         /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
283         /// </remarks>
284         /// <example>
285         /// The following example demonstrates how to use the SetFontStyle method.
286         /// <code>
287         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
288         /// fontStyle.Width = FontWidthType.Expanded;
289         /// fontStyle.Weight = FontWeightType.Bold;
290         /// fontStyle.Slant = FontSlantType.Italic;
291         /// label.SetFontStyle(fontStyle);
292         /// </code>
293         /// </example>
294         [EditorBrowsable(EditorBrowsableState.Never)]
295         public void SetFontStyle(FontStyle fontStyle)
296         {            
297             using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
298             {
299                 SetValue(FontStyleProperty, fontStyleMap);
300             }
301         }
302
303         /// <summary>
304         /// Get FontStyle from TextLabel. <br />
305         /// </summary>
306         /// <returns>The FontStyle</returns>
307         /// <remarks>
308         /// <see cref="Tizen.NUI.Text.FontStyle"/>
309         /// </remarks>
310         [EditorBrowsable(EditorBrowsableState.Never)]
311         public FontStyle GetFontStyle()
312         {
313             FontStyle fontStyle;
314             using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
315             {
316                 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
317             }
318             return fontStyle;
319         }
320
321         /// <summary>
322         /// The PointSize property.<br />
323         /// The size of font in points.<br />
324         /// </summary>
325         /// <since_tizen> 3 </since_tizen>
326         public float PointSize
327         {
328             get
329             {
330                 return (float)GetValue(PointSizeProperty);
331             }
332             set
333             {
334                 SetValue(PointSizeProperty, value);
335                 NotifyPropertyChanged();
336             }
337         }
338
339         /// <summary>
340         /// The MultiLine property.<br />
341         /// The single-line or multi-line layout option.<br />
342         /// </summary>
343         /// <since_tizen> 3 </since_tizen>
344         public bool MultiLine
345         {
346             get
347             {
348                 return (bool)GetValue(MultiLineProperty);
349             }
350             set
351             {
352                 SetValue(MultiLineProperty, value);
353                 NotifyPropertyChanged();
354             }
355         }
356
357         /// <summary>
358         /// The HorizontalAlignment property.<br />
359         /// The line horizontal alignment.<br />
360         /// </summary>
361         /// <since_tizen> 3 </since_tizen>
362         public HorizontalAlignment HorizontalAlignment
363         {
364             get
365             {
366                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
367             }
368             set
369             {
370                 SetValue(HorizontalAlignmentProperty, value);
371                 NotifyPropertyChanged();
372             }
373         }
374
375         /// <summary>
376         /// The VerticalAlignment property.<br />
377         /// The line vertical alignment.<br />
378         /// </summary>
379         /// <since_tizen> 3 </since_tizen>
380         public VerticalAlignment VerticalAlignment
381         {
382             get
383             {
384                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
385             }
386             set
387             {
388                 SetValue(VerticalAlignmentProperty, value);
389                 NotifyPropertyChanged();
390             }
391         }
392
393         /// <summary>
394         /// The TextColor property.<br />
395         /// The color of the text.<br />
396         /// Animation framework can be used to change the color of the text when not using mark up.<br />
397         /// Cannot animate the color when text is auto scrolling.<br />
398         /// </summary>
399         /// <remarks>
400         /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
401         /// </remarks>
402         /// <since_tizen> 3 </since_tizen>
403         public Color TextColor
404         {
405             get
406             {
407                 Color temp = (Color)GetValue(TextColorProperty);
408                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
409             }
410             set
411             {
412                 SetValue(TextColorProperty, value);
413                 NotifyPropertyChanged();
414             }
415         }
416
417         /// <summary>
418         /// The ShadowOffset property.<br />
419         /// The drop shadow offset 0 indicates no shadow.<br />
420         /// </summary>
421         /// <since_tizen> 3 </since_tizen>
422         /// <remarks>
423         /// Deprecated.(API Level 6) Use Shadow instead.
424         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
425         /// </remarks>
426         [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
427         public Vector2 ShadowOffset
428         {
429             get
430             {
431                 return GetValue(ShadowOffsetProperty) as Vector2;
432             }
433             set
434             {
435                 SetValue(ShadowOffsetProperty, value);
436             }
437         }
438
439         private Vector2 InternalShadowOffset
440         {
441             get
442             {
443                 Vector2 shadowOffset = new Vector2();
444                 Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
445                 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
446             }
447             set
448             {
449                 PropertyMap temp = new PropertyMap();
450                 temp.Insert("offset", new PropertyValue(value));
451
452                 PropertyMap shadowMap = Shadow;
453                 shadowMap.Merge(temp);
454
455                 SetValue(ShadowProperty, shadowMap);
456                 NotifyPropertyChanged();
457             }
458         }
459
460         /// <summary>
461         /// The ShadowColor property.<br />
462         /// The color of a drop shadow.<br />
463         /// </summary>
464         /// <since_tizen> 3 </since_tizen>
465         /// <remarks>
466         /// Deprecated.(API Level 6) Use Shadow instead.
467         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
468         /// </remarks>
469         [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
470         public Vector4 ShadowColor
471         {
472             get
473             {
474                 return GetValue(ShadowColorProperty) as Vector4;
475             }
476             set
477             {
478                 SetValue(ShadowColorProperty, value);
479             }
480         }
481
482         private Vector4 InternalShadowColor
483         {
484             get
485             {
486                 Vector4 shadowColor = new Vector4();
487                 Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
488                 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
489             }
490             set
491             {
492                 PropertyMap temp = new PropertyMap();
493                 temp.Insert("color", new PropertyValue(value));
494
495                 PropertyMap shadowMap = Shadow;
496                 shadowMap.Merge(temp);
497
498                 SetValue(ShadowProperty, shadowMap);
499                 NotifyPropertyChanged();
500             }
501         }
502
503         /// <summary>
504         /// The UnderlineEnabled property.<br />
505         /// The underline enabled flag.<br />
506         /// </summary>
507         /// <since_tizen> 3 </since_tizen>
508         /// <remarks>
509         /// Deprecated.(API Level 6) Use Underline instead.
510         /// </remarks>
511         [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
512         public bool UnderlineEnabled
513         {
514             get
515             {
516                 return (bool)GetValue(UnderlineEnabledProperty);
517             }
518             set
519             {
520                 SetValue(UnderlineEnabledProperty, value);
521             }
522         }
523
524         private bool InternalUnderlineEnabled
525         {
526             get
527             {
528                 bool underlineEnabled = false;
529                 Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
530                 return underlineEnabled;
531             }
532             set
533             {
534                 PropertyMap temp = new PropertyMap();
535                 temp.Add("enable", new PropertyValue(value));
536
537                 PropertyMap undelineMap = Underline;
538                 undelineMap.Merge(temp);
539
540                 SetValue(UnderlineProperty, undelineMap);
541                 NotifyPropertyChanged();
542
543             }
544         }
545
546         /// <summary>
547         /// The UnderlineColor property.<br />
548         /// Overrides the underline height from font metrics.<br />
549         /// </summary>
550         /// <since_tizen> 3 </since_tizen>
551         /// <remarks>
552         /// Deprecated.(API Level 6) Use Underline instead.
553         /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
554         /// </remarks>
555         [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
556         public Vector4 UnderlineColor
557         {
558             get
559             {
560                 return GetValue(UnderlineColorProperty) as Vector4;
561             }
562             set
563             {
564                 SetValue(UnderlineColorProperty, value);
565             }
566         }
567
568         private Vector4 InternalUnderlineColor
569         {
570             get
571             {
572                 Vector4 underlineColor = new Vector4();
573                 Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
574                 return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
575             }
576             set
577             {
578                 PropertyMap temp = new PropertyMap();
579                 temp.Insert("color", new PropertyValue(value));
580
581                 PropertyMap undelineMap = Underline;
582                 undelineMap.Merge(temp);
583
584                 SetValue(UnderlineProperty, undelineMap);
585                 NotifyPropertyChanged();
586             }
587         }
588
589         /// <summary>
590         /// The UnderlineHeight property.<br />
591         /// Overrides the underline height from font metrics.<br />
592         /// </summary>
593         /// <since_tizen> 3 </since_tizen>
594         /// <remarks>
595         /// Deprecated.(API Level 6) Use Underline instead.
596         /// </remarks>
597         [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
598         public float UnderlineHeight
599         {
600             get
601             {
602                 return (float)GetValue(UnderlineHeightProperty);
603             }
604             set
605             {
606                 SetValue(UnderlineHeightProperty, value);
607             }
608         }
609
610         private float InternalUnderlineHeight
611         {
612             get
613             {
614                 float underlineHeight = 0.0f;
615                 Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
616                 return underlineHeight;
617             }
618             set
619             {
620                 PropertyMap temp = new PropertyMap();
621                 temp.Insert("height", new PropertyValue(value));
622
623                 PropertyMap undelineMap = Underline;
624                 undelineMap.Merge(temp);
625
626                 SetValue(UnderlineProperty, undelineMap);
627                 NotifyPropertyChanged();
628             }
629         }
630
631         /// <summary>
632         /// The EnableMarkup property.<br />
633         /// Whether the mark-up processing is enabled.<br />
634         /// </summary>
635         /// <since_tizen> 3 </since_tizen>
636         public bool EnableMarkup
637         {
638             get
639             {
640                 return (bool)GetValue(EnableMarkupProperty);
641             }
642             set
643             {
644                 SetValue(EnableMarkupProperty, value);
645                 NotifyPropertyChanged();
646             }
647         }
648
649         /// <summary>
650         /// The EnableAutoScroll property.<br />
651         /// Starts or stops auto scrolling.<br />
652         /// </summary>
653         /// <since_tizen> 3 </since_tizen>
654         public bool EnableAutoScroll
655         {
656             get
657             {
658                 return (bool)GetValue(EnableAutoScrollProperty);
659             }
660             set
661             {
662                 SetValue(EnableAutoScrollProperty, value);
663                 NotifyPropertyChanged();
664             }
665         }
666
667         /// <summary>
668         /// The AutoScrollSpeed property.<br />
669         /// Sets the speed of scrolling in pixels per second.<br />
670         /// </summary>
671         /// <since_tizen> 3 </since_tizen>
672         public int AutoScrollSpeed
673         {
674             get
675             {
676                 return (int)GetValue(AutoScrollSpeedProperty);
677             }
678             set
679             {
680                 SetValue(AutoScrollSpeedProperty, value);
681                 NotifyPropertyChanged();
682             }
683         }
684
685         /// <summary>
686         /// The AutoScrollLoopCount property.<br />
687         /// Number of complete loops when scrolling enabled.<br />
688         /// </summary>
689         /// <since_tizen> 3 </since_tizen>
690         public int AutoScrollLoopCount
691         {
692             get
693             {
694                 return (int)GetValue(AutoScrollLoopCountProperty);
695             }
696             set
697             {
698                 SetValue(AutoScrollLoopCountProperty, value);
699                 NotifyPropertyChanged();
700             }
701         }
702
703         /// <summary>
704         /// The AutoScrollGap property.<br />
705         /// Gap before scrolling wraps.<br />
706         /// </summary>
707         /// <since_tizen> 3 </since_tizen>
708         public float AutoScrollGap
709         {
710             get
711             {
712                 return (float)GetValue(AutoScrollGapProperty);
713             }
714             set
715             {
716                 SetValue(AutoScrollGapProperty, value);
717                 NotifyPropertyChanged();
718             }
719         }
720
721         /// <summary>
722         /// The LineSpacing property.<br />
723         /// The default extra space between lines in points.<br />
724         /// </summary>
725         /// <since_tizen> 3 </since_tizen>
726         public float LineSpacing
727         {
728             get
729             {
730                 return (float)GetValue(LineSpacingProperty);
731             }
732             set
733             {
734                 SetValue(LineSpacingProperty, value);
735                 NotifyPropertyChanged();
736             }
737         }
738
739         /// <summary>
740         /// The Underline property.<br />
741         /// The default underline parameters.<br />
742         /// The underline map contains the following keys :<br />
743         /// <list type="table">
744         /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
745         /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
746         /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
747         /// </list>
748         /// </summary>
749         /// <since_tizen> 3 </since_tizen>
750         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
751         public PropertyMap Underline
752         {
753             get
754             {
755                 return (PropertyMap)GetValue(UnderlineProperty);
756             }
757             set
758             {
759                 SetValue(UnderlineProperty, value);
760                 NotifyPropertyChanged();
761             }
762         }
763
764         /// <summary>
765         /// Set Underline to TextLabel. <br />
766         /// </summary>
767         /// <param name="underline">The Underline</param>
768         /// <remarks>
769         /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
770         /// </remarks>
771         /// <example>
772         /// The following example demonstrates how to use the SetUnderline method.
773         /// <code>
774         /// var underline = new Tizen.NUI.Text.Underline();
775         /// underline.Enable = true;
776         /// underline.Color = new Color("#3498DB");
777         /// underline.Height = 2.0f;
778         /// label.SetUnderline(underline);
779         /// </code>
780         /// </example>
781         [EditorBrowsable(EditorBrowsableState.Never)]
782         public void SetUnderline(Underline underline)
783         {
784             using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
785             {
786                 SetValue(UnderlineProperty, underlineMap);
787             }
788         }
789
790         /// <summary>
791         /// Get Underline from TextLabel. <br />
792         /// </summary>
793         /// <returns>The Underline</returns>
794         /// <remarks>
795         /// <see cref="Tizen.NUI.Text.Underline"/>
796         /// </remarks>
797         [EditorBrowsable(EditorBrowsableState.Never)]
798         public Underline GetUnderline()
799         {
800             Underline underline;
801             using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
802             {
803                 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
804             }
805             return underline;
806         }
807
808         /// <summary>
809         /// The Shadow property.<br />
810         /// The default shadow parameters.<br />
811         /// The shadow map contains the following keys :<br />
812         /// <list type="table">
813         /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
814         /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
815         /// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
816         /// </list>
817         /// </summary>
818         /// <since_tizen> 3 </since_tizen>
819         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
820         public PropertyMap Shadow
821         {
822             get
823             {
824                 return (PropertyMap)GetValue(ShadowProperty);
825             }
826             set
827             {
828                 SetValue(ShadowProperty, value);
829                 NotifyPropertyChanged();
830             }
831         }
832
833         /// <summary>
834         /// Set Shadow to TextLabel. <br />
835         /// </summary>
836         /// <param name="shadow">The Shadow</param>
837         /// <remarks>
838         /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
839         /// </remarks>
840         /// <example>
841         /// The following example demonstrates how to use the SetShadow method.
842         /// <code>
843         /// var shadow = new Tizen.NUI.Text.Shadow();
844         /// shadow.Offset = new Vector2(3, 3);
845         /// shadow.Color = new Color("#F1C40F");
846         /// shadow.BlurRadius = 4.0f;
847         /// label.SetShadow(shadow);
848         /// </code>
849         /// </example>
850         [EditorBrowsable(EditorBrowsableState.Never)]
851         public void SetShadow(Tizen.NUI.Text.Shadow shadow)
852         {
853             using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
854             {
855                 SetValue(ShadowProperty, shadowMap);
856             }
857         }
858
859         /// <summary>
860         /// Get Shadow from TextLabel. <br />
861         /// </summary>
862         /// <returns>The Shadow</returns>
863         /// <remarks>
864         /// <see cref="Tizen.NUI.Text.Shadow"/>
865         /// </remarks>
866         [EditorBrowsable(EditorBrowsableState.Never)]
867         public Tizen.NUI.Text.Shadow GetShadow()
868         {
869             Tizen.NUI.Text.Shadow shadow;
870             using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
871             {
872                 shadow = TextMapHelper.GetShadowStruct(shadowMap);
873             }
874             return shadow;
875         }
876
877         /// <summary>
878         /// Describes a text shadow for a TextLabel.
879         /// It is null by default.
880         /// </summary>
881         [EditorBrowsable(EditorBrowsableState.Never)]
882         public TextShadow TextShadow
883         {
884             get
885             {
886                 return (TextShadow)GetValue(TextShadowProperty);
887             }
888             set
889             {
890                 SetValue(TextShadowProperty, value);
891                 NotifyPropertyChanged();
892             }
893         }
894
895         /// <summary>
896         /// The Emboss property.<br />
897         /// The default emboss parameters.<br />
898         /// </summary>
899         /// <since_tizen> 3 </since_tizen>
900         public string Emboss
901         {
902             get
903             {
904                 return (string)GetValue(EmbossProperty);
905             }
906             set
907             {
908                 SetValue(EmbossProperty, value);
909                 NotifyPropertyChanged();
910             }
911         }
912
913         /// <summary>
914         /// The Outline property.<br />
915         /// The default outline parameters.<br />
916         /// The outline map contains the following keys :<br />
917         /// <list type="table">
918         /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
919         /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
920         /// </list>
921         /// </summary>
922         /// <since_tizen> 3 </since_tizen>
923         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
924         public PropertyMap Outline
925         {
926             get
927             {
928                 return (PropertyMap)GetValue(OutlineProperty);
929             }
930             set
931             {
932                 SetValue(OutlineProperty, value);
933                 NotifyPropertyChanged();
934             }
935         }
936
937         /// <summary>
938         /// Set Outline to TextLabel. <br />
939         /// </summary>
940         /// <param name="outline">The Outline</param>
941         /// <remarks>
942         /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
943         /// </remarks>
944         /// <example>
945         /// The following example demonstrates how to use the SetOutline method.
946         /// <code>
947         /// var outline = new Tizen.NUI.Text.Outline();
948         /// outline.Width = 2.0f;
949         /// outline.Color = new Color("#45B39D");
950         /// label.SetOutline(outline);
951         /// </code>
952         /// </example>
953         [EditorBrowsable(EditorBrowsableState.Never)]
954         public void SetOutline(Outline outline)
955         {
956             using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
957             {
958                 SetValue(OutlineProperty, outlineMap);
959             }
960         }
961
962         /// <summary>
963         /// Get Outline from TextLabel. <br />
964         /// </summary>
965         /// <returns>The Outline</returns>
966         /// <remarks>
967         /// <see cref="Tizen.NUI.Text.Outline"/>
968         /// </remarks>
969         [EditorBrowsable(EditorBrowsableState.Never)]
970         public Outline GetOutline()
971         {
972             Outline outline;
973             using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
974             {
975                 outline = TextMapHelper.GetOutlineStruct(outlineMap);
976             }
977             return outline;
978         }
979
980         /// <summary>
981         /// The PixelSize property.<br />
982         /// The size of font in pixels.<br />
983         /// </summary>
984         /// <since_tizen> 3 </since_tizen>
985         public float PixelSize
986         {
987             get
988             {
989                 return (float)GetValue(PixelSizeProperty);
990             }
991             set
992             {
993                 SetValue(PixelSizeProperty, value);
994                 NotifyPropertyChanged();
995             }
996         }
997
998         /// <summary>
999         /// The Ellipsis property.<br />
1000         /// Enable or disable the ellipsis.<br />
1001         /// </summary>
1002         /// <since_tizen> 3 </since_tizen>
1003         public bool Ellipsis
1004         {
1005             get
1006             {
1007                 return (bool)GetValue(EllipsisProperty);
1008             }
1009             set
1010             {
1011                 SetValue(EllipsisProperty, value);
1012                 NotifyPropertyChanged();
1013             }
1014         }
1015
1016         /// <summary>
1017         /// The ellipsis position of the text.
1018         /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1019         /// </summary>
1020         /// <since_tizen> 9 </since_tizen>
1021         public EllipsisPosition EllipsisPosition
1022         {
1023             get
1024             {
1025                 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1026             }
1027             set
1028             {
1029                 SetValue(EllipsisPositionProperty, value);
1030                 NotifyPropertyChanged();
1031             }
1032         }
1033
1034         /// <summary>
1035         /// The AutoScrollLoopDelay property.<br />
1036         /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
1037         /// </summary>
1038         /// <since_tizen> 3 </since_tizen>
1039         public float AutoScrollLoopDelay
1040         {
1041             get
1042             {
1043                 return (float)GetValue(AutoScrollLoopDelayProperty);
1044             }
1045             set
1046             {
1047                 SetValue(AutoScrollLoopDelayProperty, value);
1048                 NotifyPropertyChanged();
1049             }
1050         }
1051
1052         /// <summary>
1053         /// The AutoScrollStopMode property.<br />
1054         /// The auto scrolling stop behaviour.<br />
1055         /// The default value is AutoScrollStopMode.FinishLoop. <br />
1056         /// </summary>
1057         /// <since_tizen> 3 </since_tizen>
1058         public AutoScrollStopMode AutoScrollStopMode
1059         {
1060             get
1061             {
1062                 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
1063             }
1064             set
1065             {
1066                 SetValue(AutoScrollStopModeProperty, value);
1067                 NotifyPropertyChanged();
1068             }
1069         }
1070
1071         /// <summary>
1072         /// The line count of the text.
1073         /// </summary>
1074         /// <since_tizen> 3 </since_tizen>
1075         public int LineCount
1076         {
1077             get
1078             {
1079                 int lineCount = 0;
1080                 using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
1081                 {
1082                     propertyValue.Get(out lineCount);
1083                 }
1084                 return lineCount;
1085             }
1086         }
1087
1088         /// <summary>
1089         /// The LineWrapMode property.<br />
1090         /// line wrap mode when the text lines over layout width.<br />
1091         /// </summary>
1092         /// <since_tizen> 4 </since_tizen>
1093         public LineWrapMode LineWrapMode
1094         {
1095             get
1096             {
1097                 return (LineWrapMode)GetValue(LineWrapModeProperty);
1098             }
1099             set
1100             {
1101                 SetValue(LineWrapModeProperty, value);
1102                 NotifyPropertyChanged();
1103             }
1104         }
1105
1106         /// <summary>
1107         /// The direction of the text such as left to right or right to left.
1108         /// </summary>
1109         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1110         [EditorBrowsable(EditorBrowsableState.Never)]
1111         public TextDirection TextDirection
1112         {
1113             get
1114             {
1115                 int textDirection = 0;
1116                 using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
1117                 {
1118                     propertyValue.Get(out textDirection);
1119                 }
1120                 return (TextDirection)textDirection;
1121             }
1122         }
1123
1124         /// <summary>
1125         /// The vertical line alignment of the text.
1126         /// </summary>
1127         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1128         [EditorBrowsable(EditorBrowsableState.Never)]
1129         public VerticalLineAlignment VerticalLineAlignment
1130         {
1131             get
1132             {
1133                 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
1134             }
1135             set
1136             {
1137                 SetValue(VerticalLineAlignmentProperty, value);
1138                 NotifyPropertyChanged();
1139             }
1140         }
1141
1142         /// <summary>
1143         /// The text alignment to match the direction of the system language.
1144         /// </summary>
1145         /// <since_tizen> 6 </since_tizen>
1146         public bool MatchSystemLanguageDirection
1147         {
1148             get
1149             {
1150                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1151             }
1152             set
1153             {
1154                 SetValue(MatchSystemLanguageDirectionProperty, value);
1155                 NotifyPropertyChanged();
1156             }
1157         }
1158
1159         /// <summary>
1160         /// The text fit parameters.<br />
1161         /// The textFit map contains the following keys :<br />
1162         /// <list type="table">
1163         /// <item><term>enable (bool)</term><description>True to enable the text fit or false to disable (the default value is false)</description></item>
1164         /// <item><term>minSize (float)</term><description>Minimum Size for text fit (the default value is 10.f)</description></item>
1165         /// <item><term>maxSize (float)</term><description>Maximum Size for text fit (the default value is 100.f)</description></item>
1166         /// <item><term>stepSize (float)</term><description>Step Size for font increase (the default value is 1.f)</description></item>
1167         /// <item><term>fontSize (string)</term><description>The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")</description></item>
1168         /// </list>
1169         /// </summary>
1170         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1171         [EditorBrowsable(EditorBrowsableState.Never)]
1172         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1173         public PropertyMap TextFit
1174         {
1175             get
1176             {
1177                 return (PropertyMap)GetValue(TextFitProperty);
1178             }
1179             set
1180             {
1181                 SetValue(TextFitProperty, value);
1182                 NotifyPropertyChanged();
1183             }
1184         }
1185
1186         /// <summary>
1187         /// Set TextFit to TextLabel. <br />
1188         /// </summary>
1189         /// <param name="textFit">The TextFit</param>
1190         /// <remarks>
1191         /// SetTextFit specifies the textFit of the text through <see cref="Tizen.NUI.Text.TextFit"/>. <br />
1192         /// </remarks>
1193         /// <example>
1194         /// The following example demonstrates how to use the SetTextFit method.
1195         /// <code>
1196         /// var textFit = new Tizen.NUI.Text.TextFit();
1197         /// textFit.Enable = true;
1198         /// textFit.MinSize = 10.0f;
1199         /// textFit.MaxSize = 100.0f;
1200         /// textFit.StepSize = 5.0f;
1201         /// textFit.FontSizeType = FontSizeType.PointSize;
1202         /// label.SetTextFit(textFit);
1203         /// </code>
1204         /// </example>
1205         [EditorBrowsable(EditorBrowsableState.Never)]
1206         public void SetTextFit(TextFit textFit)
1207         {
1208             using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
1209             {
1210                 SetValue(TextFitProperty, textFitMap);
1211             }
1212         }
1213
1214         /// <summary>
1215         /// Get TextFit from TextLabel. <br />
1216         /// </summary>
1217         /// <returns>The TextFit</returns>
1218         /// <remarks>
1219         /// TextFit is always returned based on PointSize. <br />
1220         /// If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned. <br />
1221         /// <see cref="Tizen.NUI.Text.TextFit"/>
1222         /// </remarks>
1223         [EditorBrowsable(EditorBrowsableState.Never)]
1224         public TextFit GetTextFit()
1225         {
1226             TextFit textFit;
1227             using (var textFitMap = (PropertyMap)GetValue(TextFitProperty))
1228             {
1229                 textFit = TextMapHelper.GetTextFitStruct(textFitMap);
1230             }
1231             return textFit;
1232         }
1233
1234         /// <summary>
1235         /// The MinLineSize property.<br />
1236         /// The height of the line in points. <br />
1237         /// If the font size is larger than the line size, it works with the font size. <br />
1238         /// </summary>
1239         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1240         [EditorBrowsable(EditorBrowsableState.Never)]
1241         public float MinLineSize
1242         {
1243             get
1244             {
1245                 return (float)GetValue(MinLineSizeProperty);
1246             }
1247             set
1248             {
1249                 SetValue(MinLineSizeProperty, value);
1250                 NotifyPropertyChanged();
1251             }
1252         }
1253
1254         /// <summary>
1255         /// The FontSizeScale property for scaling the specified font size up or down. <br />
1256         /// The default value is 1.0. <br />
1257         /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
1258         /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1259         /// </summary>
1260         /// <since_tizen> 9 </since_tizen>
1261         public float FontSizeScale
1262         {
1263             get
1264             {
1265                 return fontSizeScale;
1266             }
1267             set
1268             {
1269                 float newFontSizeScale;
1270
1271                 if (fontSizeScale == value) return;
1272
1273                 fontSizeScale = value;
1274                 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1275                 {
1276                     SystemSettingsFontSize systemSettingsFontSize;
1277
1278                     try
1279                     {
1280                         systemSettingsFontSize = SystemSettings.FontSize;
1281                     }
1282                     catch (Exception e)
1283                     {
1284                         Console.WriteLine("{0} Exception caught.", e);
1285                         systemSettingsFontSize = SystemSettingsFontSize.Normal;
1286                     }
1287                     newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1288                     addFontSizeChangedCallback();
1289                 }
1290                 else
1291                 {
1292                     newFontSizeScale = fontSizeScale;
1293                     removeFontSizeChangedCallback();
1294                 }
1295
1296                 SetValue(FontSizeScaleProperty, newFontSizeScale);
1297                 NotifyPropertyChanged();
1298             }
1299         }
1300
1301         private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData());
1302
1303         /// <summary>
1304         /// Downcasts a handle to textLabel handle
1305         /// </summary>
1306         /// <param name="handle"></param>
1307         /// <returns></returns>
1308         /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
1309         /// <since_tizen> 3 </since_tizen>
1310         /// Please do not use! this will be deprecated!
1311         /// Instead please use as keyword.
1312         [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
1313             "Like: " +
1314             "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
1315             "TextLabel label = handle as TextLabel")]
1316         [EditorBrowsable(EditorBrowsableState.Never)]
1317         public static TextLabel DownCast(BaseHandle handle)
1318         {
1319             if (null == handle)
1320             {
1321                 throw new ArgumentNullException(nameof(handle));
1322             }
1323             TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
1324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325             return ret;
1326         }
1327
1328         /// <inheritdoc/>
1329         [EditorBrowsable(EditorBrowsableState.Never)]
1330         protected override void Dispose(DisposeTypes type)
1331         {
1332             if (disposed)
1333             {
1334                 return;
1335             }
1336
1337             if (systemlangTextFlag)
1338             {
1339                 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1340             }
1341
1342             removeFontSizeChangedCallback();
1343
1344             if (type == DisposeTypes.Explicit)
1345             {
1346                 //Called by User
1347                 //Release your own managed resources here.
1348                 //You should release all of your own disposable objects here.
1349                 selectorData?.Reset(this);
1350             }
1351
1352             if (this.HasBody())
1353             {
1354                 if (textLabelTextFitChangedCallbackDelegate != null)
1355                 {
1356                     TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
1357                 }
1358             }
1359
1360             base.Dispose(type);
1361         }
1362
1363         /// This will not be public opened.
1364         [EditorBrowsable(EditorBrowsableState.Never)]
1365         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1366         {
1367             Interop.TextLabel.DeleteTextLabel(swigCPtr);
1368         }
1369
1370         /// <summary>
1371         /// Get attribues, it is abstract function and must be override.
1372         /// </summary>
1373         [EditorBrowsable(EditorBrowsableState.Never)]
1374         protected override ViewStyle CreateViewStyle()
1375         {
1376             return new TextLabelStyle();
1377         }
1378
1379         internal override LayoutItem CreateDefaultLayout()
1380         {
1381             return new TextLayout();
1382         }
1383
1384         /// <summary>
1385         /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1386         /// </summary>
1387         protected override void OnBindingContextChanged()
1388         {
1389             base.OnBindingContextChanged();
1390         }
1391
1392         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1393         {
1394             Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1395         }
1396
1397         private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1398         {
1399             float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1400             SetValue(FontSizeScaleProperty, newFontSizeScale);
1401         }
1402
1403         private void addFontSizeChangedCallback()
1404         {
1405             if (hasFontSizeChangedCallback != true)
1406             {
1407                 try
1408                 {
1409                     SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
1410                     hasFontSizeChangedCallback = true;
1411                 }
1412                 catch (Exception e)
1413                 {
1414                     Console.WriteLine("{0} Exception caught.", e);
1415                     hasFontSizeChangedCallback = false;
1416                 }
1417             }
1418         }
1419
1420         private void removeFontSizeChangedCallback()
1421         {
1422             if (hasFontSizeChangedCallback == true)
1423             {
1424                 try
1425                 {
1426                     SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
1427                     hasFontSizeChangedCallback = false;
1428                 }
1429                 catch (Exception e)
1430                 {
1431                     Console.WriteLine("{0} Exception caught.", e);
1432                     hasFontSizeChangedCallback = true;
1433                 }
1434             }
1435         }
1436
1437         private void RequestLayout()
1438         {
1439             Layout?.RequestLayout();
1440         }
1441
1442         internal new class Property
1443         {
1444             internal static readonly int TEXT = Interop.TextLabel.TextGet();
1445             internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
1446             internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
1447             internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
1448             internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
1449             internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
1450             internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
1451             internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
1452             internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
1453             internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
1454             internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
1455             internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
1456             internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
1457             internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
1458             internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
1459             internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
1460             internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
1461             internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
1462             internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
1463             internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
1464             internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
1465             internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
1466             internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
1467             internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
1468             internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
1469             internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
1470             internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
1471             internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
1472             internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
1473             internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet();
1474             internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
1475         }
1476
1477         private void OnShadowColorChanged(float x, float y, float z, float w)
1478         {
1479             ShadowColor = new Vector4(x, y, z, w);
1480         }
1481         private void OnShadowOffsetChanged(float x, float y)
1482         {
1483             ShadowOffset = new Vector2(x, y);
1484         }
1485         private void OnTextColorChanged(float r, float g, float b, float a)
1486         {
1487             TextColor = new Color(r, g, b, a);
1488         }
1489         private void OnUnderlineColorChanged(float x, float y, float z, float w)
1490         {
1491             UnderlineColor = new Vector4(x, y, z, w);
1492         }
1493     }
1494 }