e935960729630496ea282cc0837362b2e6b47d02
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
1 /*
2  * Copyright(c) 2023 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 using Tizen.NUI.Binding;
26
27 namespace Tizen.NUI.BaseComponents
28 {
29     /// <summary>
30     /// A control which renders a short text string.<br />
31     /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
32     /// </summary>
33     /// <since_tizen> 3 </since_tizen>
34     public partial class TextLabel : View
35     {
36         private class TextLayout : LayoutItem
37         {
38             protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
39             {
40                 // Padding will be automatically applied by DALi TextLabel.
41                 float totalWidth = widthMeasureSpec.Size.AsDecimal();
42                 float totalHeight = heightMeasureSpec.Size.AsDecimal();
43
44                 if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
45                 {
46                     if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
47                     {
48                         totalHeight = Owner.GetHeightForWidth(totalWidth);
49                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
50                     }
51                 }
52                 else
53                 {
54                     var minSize = Owner.MinimumSize;
55                     var maxSize = Owner.MaximumSize;
56                     var naturalSize = Owner.GetNaturalSize();
57
58                     if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
59                     {
60                         // GetWidthForHeight is not implemented.
61                         float width = naturalSize != null ? naturalSize.Width : 0;
62                         totalWidth = Math.Min(Math.Max(width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
63                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
64                     }
65                     else
66                     {
67                         float width = naturalSize != null ? naturalSize.Width : 0;
68                         float height = naturalSize != null ? naturalSize.Height : 0;
69                         totalWidth = Math.Min(Math.Max(width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
70                         totalHeight = Math.Min(Math.Max(height, minSize.Height), (maxSize.Height < 0 ? Int32.MaxValue : maxSize.Height));
71
72                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
73                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
74                     }
75                 }
76
77                 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
78                 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
79
80                 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
81                                        ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
82             }
83         }
84
85         static TextLabel() { }
86
87         private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
88         private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
89         static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextLabel";
90         static private string defaultFontFamily = "BreezeSans";
91         private string textLabelSid = null;
92         private TextLabelSelectorData selectorData;
93         private string fontFamily = defaultFontFamily;
94         private float fontSizeScale = 1.0f;
95         private bool hasSystemLanguageChanged = false;
96         private bool hasSystemFontSizeChanged = false;
97         private bool hasSystemFontTypeChanged = false;
98
99         private Color internalTextColor;
100
101         /// <summary>
102         /// Creates the TextLabel control.
103         /// </summary>
104         /// <since_tizen> 3 </since_tizen>
105         public TextLabel() : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
106         {
107             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108         }
109
110         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111         [EditorBrowsable(EditorBrowsableState.Never)]
112         public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, viewStyle)
113         {
114         }
115
116         /// <summary>
117         /// Creates the TextLabel with setting the status of shown or hidden.
118         /// </summary>
119         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
120         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
121         [EditorBrowsable(EditorBrowsableState.Never)]
122         public TextLabel(bool shown) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
123         {
124             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125             SetVisible(shown);
126         }
127
128         /// <summary>
129         /// Creates the TextLabel control.
130         /// </summary>
131         /// <param name="text">The text to display</param>
132         /// <since_tizen> 3 </since_tizen>
133         public TextLabel(string text) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
134         {
135             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136         }
137
138         /// <summary>
139         /// Creates the TextLabel with setting the status of shown or hidden.
140         /// </summary>
141         /// <param name="text">The text to display</param>
142         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
143         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
144         [EditorBrowsable(EditorBrowsableState.Never)]
145         public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
146         {
147             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148             SetVisible(shown);
149         }
150
151         internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.NewTextLabel(TextLabel.getCPtr(handle)), true)
152         {
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154
155             if (!shown)
156             {
157                 SetVisible(false);
158             }
159         }
160
161         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
162         {
163             if (!shown)
164             {
165                 SetVisible(false);
166             }
167         }
168
169         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
170         {
171             if (!shown)
172             {
173                 SetVisible(false);
174             }
175         }
176
177         private bool HasStyle()
178         {
179             return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
180         }
181
182         /// <summary>
183         /// The TranslatableText property.<br />
184         /// The text can set the SID value.<br />
185         /// </summary>
186         /// <exception cref='ArgumentNullException'>
187         /// ResourceManager about multilingual is null.
188         /// </exception>
189         /// <since_tizen> 4 </since_tizen>
190         public string TranslatableText
191         {
192             get
193             {
194                 return (string)GetValue(TranslatableTextProperty);
195             }
196             set
197             {
198                 SetValue(TranslatableTextProperty, value);
199             }
200         }
201         private string translatableText
202         {
203             get
204             {
205                 return textLabelSid;
206             }
207             set
208             {
209                 if (NUIApplication.MultilingualResourceManager == null)
210                 {
211                     throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
212                 }
213                 string translatableText = null;
214                 textLabelSid = value;
215                 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
216                 if (translatableText != null)
217                 {
218                     Text = translatableText;
219                     if (hasSystemLanguageChanged == false)
220                     {
221                         systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
222                         hasSystemLanguageChanged = true;
223                     }
224                 }
225                 else
226                 {
227                     Text = "";
228                 }
229                 NotifyPropertyChanged();
230             }
231         }
232
233         /// <summary>
234         /// The Text property.<br />
235         /// The text to display in the UTF-8 format.<br />
236         /// </summary>
237         /// <since_tizen> 3 </since_tizen>
238         public string Text
239         {
240             get
241             {
242                 return (string)GetValue(TextProperty);
243             }
244             set
245             {
246                 SetValue(TextProperty, value);
247                 NotifyPropertyChanged();
248             }
249         }
250
251         /// <summary>
252         /// The FontFamily property.<br />
253         /// The requested font family to use.<br />
254         /// </summary>
255         /// <since_tizen> 3 </since_tizen>
256         public string FontFamily
257         {
258             get
259             {
260                 return (string)GetValue(FontFamilyProperty);
261             }
262             set
263             {
264                 SetValue(FontFamilyProperty, value);
265                 NotifyPropertyChanged();
266             }
267         }
268
269         private string InternalFontFamily
270         {
271             get
272             {
273                 if (HasStyle())
274                     return fontFamily;
275                 else
276                     return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
277             }
278             set
279             {
280                 string newFontFamily;
281
282                 if (string.Equals(fontFamily, value)) return;
283
284                 fontFamily = value;
285                 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
286                 {
287                     try
288                     {
289                         newFontFamily = SystemSettings.FontType;
290                     }
291                     catch (Exception e)
292                     {
293                         Console.WriteLine("{0} Exception caught.", e);
294                         newFontFamily = defaultFontFamily;
295                     }
296                     AddSystemSettingsFontTypeChanged();
297                 }
298                 else
299                 {
300                     newFontFamily = fontFamily;
301                     RemoveSystemSettingsFontTypeChanged();
302                 }
303
304                 SetInternalFontFamily(newFontFamily);
305             }
306         }
307
308         private void SetInternalFontFamily(string fontFamily)
309         {
310             Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
311             RequestLayout();
312         }
313
314         /// <summary>
315         /// The FontStyle property.<br />
316         /// The requested font style to use.<br />
317         /// The fontStyle map contains the following keys :<br />
318         /// <list type="table">
319         /// <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>
320         /// <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>
321         /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
322         /// </list>
323         /// </summary>
324         /// <since_tizen> 3 </since_tizen>
325         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
326         public PropertyMap FontStyle
327         {
328             get
329             {
330                 return (PropertyMap)GetValue(FontStyleProperty);
331             }
332             set
333             {
334                 SetValue(FontStyleProperty, value);
335                 NotifyPropertyChanged();
336             }
337         }
338
339         /// <summary>
340         /// Set FontStyle to TextLabel. <br />
341         /// </summary>
342         /// <param name="fontStyle">The FontStyle</param>
343         /// <remarks>
344         /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
345         /// </remarks>
346         /// <example>
347         /// The following example demonstrates how to use the SetFontStyle method.
348         /// <code>
349         /// var fontStyle = new Tizen.NUI.Text.FontStyle();
350         /// fontStyle.Width = FontWidthType.Expanded;
351         /// fontStyle.Weight = FontWeightType.Bold;
352         /// fontStyle.Slant = FontSlantType.Italic;
353         /// label.SetFontStyle(fontStyle);
354         /// </code>
355         /// </example>
356         [EditorBrowsable(EditorBrowsableState.Never)]
357         public void SetFontStyle(FontStyle fontStyle)
358         {
359             using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
360             {
361                 SetValue(FontStyleProperty, fontStyleMap);
362             }
363         }
364
365         /// <summary>
366         /// Get FontStyle from TextLabel. <br />
367         /// </summary>
368         /// <returns>The FontStyle</returns>
369         /// <remarks>
370         /// <see cref="Tizen.NUI.Text.FontStyle"/>
371         /// </remarks>
372         [EditorBrowsable(EditorBrowsableState.Never)]
373         public FontStyle GetFontStyle()
374         {
375             FontStyle fontStyle;
376             using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
377             {
378                 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
379             }
380             return fontStyle;
381         }
382
383         /// <summary>
384         /// The PointSize property.<br />
385         /// The size of font in points.<br />
386         /// </summary>
387         /// <since_tizen> 3 </since_tizen>
388         [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
389         public float PointSize
390         {
391             get
392             {
393                 return (float)GetValue(PointSizeProperty);
394             }
395             set
396             {
397                 SetValue(PointSizeProperty, value);
398                 NotifyPropertyChanged();
399             }
400         }
401
402         /// <summary>
403         /// The MultiLine property.<br />
404         /// The single-line or multi-line layout option.<br />
405         /// </summary>
406         /// <since_tizen> 3 </since_tizen>
407         public bool MultiLine
408         {
409             get
410             {
411                 return (bool)GetValue(MultiLineProperty);
412             }
413             set
414             {
415                 SetValue(MultiLineProperty, value);
416                 NotifyPropertyChanged();
417             }
418         }
419
420         /// <summary>
421         /// The HorizontalAlignment property.<br />
422         /// The line horizontal alignment.<br />
423         /// </summary>
424         /// <since_tizen> 3 </since_tizen>
425         public HorizontalAlignment HorizontalAlignment
426         {
427             get
428             {
429                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
430             }
431             set
432             {
433                 SetValue(HorizontalAlignmentProperty, value);
434                 NotifyPropertyChanged();
435             }
436         }
437
438         /// <summary>
439         /// The VerticalAlignment property.<br />
440         /// The line vertical alignment.<br />
441         /// </summary>
442         /// <since_tizen> 3 </since_tizen>
443         public VerticalAlignment VerticalAlignment
444         {
445             get
446             {
447                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
448             }
449             set
450             {
451                 SetValue(VerticalAlignmentProperty, value);
452                 NotifyPropertyChanged();
453             }
454         }
455
456         /// <summary>
457         /// The TextColor property.<br />
458         /// The color of the text.<br />
459         /// Animation framework can be used to change the color of the text when not using mark up.<br />
460         /// Cannot animate the color when text is auto scrolling.<br />
461         /// </summary>
462         /// <remarks>
463         /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
464         /// </remarks>
465         /// <since_tizen> 3 </since_tizen>
466         public Color TextColor
467         {
468             get
469             {
470                 Color temp = (Color)GetValue(TextColorProperty);
471                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
472             }
473             set
474             {
475                 SetValue(TextColorProperty, value);
476                 NotifyPropertyChanged();
477             }
478         }
479
480         /// <summary>
481         /// The ShadowOffset property.<br />
482         /// The drop shadow offset 0 indicates no shadow.<br />
483         /// </summary>
484         /// <since_tizen> 3 </since_tizen>
485         /// <remarks>
486         /// Deprecated.(API Level 6) Use Shadow instead.
487         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
488         /// </remarks>
489         [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
490         public Vector2 ShadowOffset
491         {
492             get
493             {
494                 return GetValue(ShadowOffsetProperty) as Vector2;
495             }
496             set
497             {
498                 SetValue(ShadowOffsetProperty, value);
499             }
500         }
501
502         private Vector2 InternalShadowOffset
503         {
504             get
505             {
506                 float x = 0.0f, y = 0.0f;
507                 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "offset"))
508                 using (var shadowOffset = new Vector2())
509                 {
510                     if (null != propertyValue)
511                     {
512                         propertyValue.Get(shadowOffset);
513                         x = shadowOffset.X;
514                         y = shadowOffset.Y;
515                     }
516                 }
517                 return new Vector2(OnShadowOffsetChanged, x, y);
518             }
519             set
520             {
521                 using (var map = new PropertyMap())
522                 {
523                     map.Add("offset", value);
524
525                     var shadowMap = Shadow;
526                     shadowMap.Merge(map);
527
528                     SetValue(ShadowProperty, shadowMap);
529                     NotifyPropertyChanged();
530                 }
531             }
532         }
533
534         /// <summary>
535         /// The ShadowColor property.<br />
536         /// The color of a drop shadow.<br />
537         /// </summary>
538         /// <since_tizen> 3 </since_tizen>
539         /// <remarks>
540         /// Deprecated.(API Level 6) Use Shadow instead.
541         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
542         /// </remarks>
543         [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
544         public Vector4 ShadowColor
545         {
546             get
547             {
548                 return GetValue(ShadowColorProperty) as Vector4;
549             }
550             set
551             {
552                 SetValue(ShadowColorProperty, value);
553             }
554         }
555
556         private Vector4 InternalShadowColor
557         {
558             get
559             {
560                 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
561                 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "color"))
562                 using (var shadowColor = new Vector4())
563                 {
564                     if (null != propertyValue)
565                     {
566                         propertyValue.Get(shadowColor);
567                         x = shadowColor.X;
568                         y = shadowColor.Y;
569                         z = shadowColor.Z;
570                         w = shadowColor.W;
571                     }
572                 }
573                 return new Vector4(OnShadowColorChanged, x, y, z, w);
574             }
575             set
576             {
577                 using (var map = new PropertyMap())
578                 {
579                     map.Add("color", value);
580                     var shadowMap = Shadow;
581                     shadowMap.Merge(map);
582                     SetValue(ShadowProperty, shadowMap);
583                     NotifyPropertyChanged();
584                 }
585             }
586         }
587
588         /// <summary>
589         /// The UnderlineEnabled property.<br />
590         /// The underline enabled flag.<br />
591         /// </summary>
592         /// <since_tizen> 3 </since_tizen>
593         /// <remarks>
594         /// Deprecated.(API Level 6) Use Underline instead.
595         /// </remarks>
596         [Obsolete("Do not use this UnderlineEnabled(Deprecated). Use Underline instead.")]
597         public bool UnderlineEnabled
598         {
599             get
600             {
601                 return (bool)GetValue(UnderlineEnabledProperty);
602             }
603             set
604             {
605                 SetValue(UnderlineEnabledProperty, value);
606             }
607         }
608
609         private bool InternalUnderlineEnabled
610         {
611             get
612             {
613                 bool underlineEnabled = false;
614                 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "enable"))
615                 {
616                     if (propertyValue != null)
617                     {
618                         propertyValue.Get(out underlineEnabled);
619                     }
620                 }
621                 return underlineEnabled;
622             }
623             set
624             {
625                 using (var map = new PropertyMap())
626                 {
627                     map.Add("enable", value);
628                     var undelineMap = Underline;
629                     undelineMap.Merge(map);
630                     SetValue(UnderlineProperty, undelineMap);
631                     NotifyPropertyChanged();
632                 }
633             }
634         }
635
636         /// <summary>
637         /// The UnderlineColor property.<br />
638         /// Overrides the underline height from font metrics.<br />
639         /// </summary>
640         /// <since_tizen> 3 </since_tizen>
641         /// <remarks>
642         /// Deprecated.(API Level 6) Use Underline instead.
643         /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
644         /// </remarks>
645         [Obsolete("Do not use this UnderlineColor(Deprecated). Use Underline instead.")]
646         public Vector4 UnderlineColor
647         {
648             get
649             {
650                 return GetValue(UnderlineColorProperty) as Vector4;
651             }
652             set
653             {
654                 SetValue(UnderlineColorProperty, value);
655             }
656         }
657
658         private Vector4 InternalUnderlineColor
659         {
660             get
661             {
662                 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
663                 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "color"))
664                 using (var underlineColor = new Vector4())
665                 {
666                     if (null != propertyValue)
667                     {
668                         propertyValue.Get(underlineColor);
669                         x = underlineColor.X;
670                         y = underlineColor.Y;
671                         z = underlineColor.Z;
672                         w = underlineColor.W;
673                     }
674                 }
675                 return new Vector4(OnUnderlineColorChanged, x, y, z, w);
676             }
677             set
678             {
679                 using (var map = new PropertyMap())
680                 {
681                     map.Add("color", value);
682                     var undelineMap = Underline;
683                     undelineMap.Merge(map);
684                     SetValue(UnderlineProperty, undelineMap);
685                     NotifyPropertyChanged();
686                 }
687             }
688         }
689
690         /// <summary>
691         /// The UnderlineHeight property.<br />
692         /// Overrides the underline height from font metrics.<br />
693         /// </summary>
694         /// <since_tizen> 3 </since_tizen>
695         /// <remarks>
696         /// Deprecated.(API Level 6) Use Underline instead.
697         /// </remarks>
698         [Obsolete("Do not use this UnderlineHeight(Deprecated). Use Underline instead.")]
699         public float UnderlineHeight
700         {
701             get
702             {
703                 return (float)GetValue(UnderlineHeightProperty);
704             }
705             set
706             {
707                 SetValue(UnderlineHeightProperty, value);
708             }
709         }
710
711         private float InternalUnderlineHeight
712         {
713             get
714             {
715                 float underlineHeight = 0.0f;
716                 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "height"))
717                 {
718                     if (null != propertyValue)
719                     {
720                         propertyValue.Get(out underlineHeight);
721                     }
722                 }
723                 return underlineHeight;
724             }
725             set
726             {
727                 using (var map = new PropertyMap())
728                 {
729                     map.Add("height", value);
730                     var undelineMap = Underline;
731                     undelineMap.Merge(map);
732                     SetValue(UnderlineProperty, undelineMap);
733                     NotifyPropertyChanged();
734                 }
735             }
736         }
737
738         /// <summary>
739         /// The EnableMarkup property.<br />
740         /// Whether the mark-up processing is enabled.<br />
741         /// </summary>
742         /// <since_tizen> 3 </since_tizen>
743         public bool EnableMarkup
744         {
745             get
746             {
747                 return (bool)GetValue(EnableMarkupProperty);
748             }
749             set
750             {
751                 SetValue(EnableMarkupProperty, value);
752                 NotifyPropertyChanged();
753             }
754         }
755
756         /// <summary>
757         /// The EnableAutoScroll property.<br />
758         /// Starts or stops auto scrolling.<br />
759         /// </summary>
760         /// <since_tizen> 3 </since_tizen>
761         public bool EnableAutoScroll
762         {
763             get
764             {
765                 return (bool)GetValue(EnableAutoScrollProperty);
766             }
767             set
768             {
769                 SetValue(EnableAutoScrollProperty, value);
770                 NotifyPropertyChanged();
771             }
772         }
773
774         /// <summary>
775         /// The AutoScrollSpeed property.<br />
776         /// Sets the speed of scrolling in pixels per second.<br />
777         /// </summary>
778         /// <since_tizen> 3 </since_tizen>
779         public int AutoScrollSpeed
780         {
781             get
782             {
783                 return (int)GetValue(AutoScrollSpeedProperty);
784             }
785             set
786             {
787                 SetValue(AutoScrollSpeedProperty, value);
788                 NotifyPropertyChanged();
789             }
790         }
791
792         /// <summary>
793         /// The AutoScrollLoopCount property.<br />
794         /// Number of complete loops when scrolling enabled.<br />
795         /// </summary>
796         /// <since_tizen> 3 </since_tizen>
797         public int AutoScrollLoopCount
798         {
799             get
800             {
801                 return (int)GetValue(AutoScrollLoopCountProperty);
802             }
803             set
804             {
805                 SetValue(AutoScrollLoopCountProperty, value);
806                 NotifyPropertyChanged();
807             }
808         }
809
810         /// <summary>
811         /// The AutoScrollGap property.<br />
812         /// Gap before scrolling wraps.<br />
813         /// </summary>
814         /// <since_tizen> 3 </since_tizen>
815         public float AutoScrollGap
816         {
817             get
818             {
819                 return (float)GetValue(AutoScrollGapProperty);
820             }
821             set
822             {
823                 SetValue(AutoScrollGapProperty, value);
824                 NotifyPropertyChanged();
825             }
826         }
827
828         /// <summary>
829         /// The LineSpacing property.<br />
830         /// The default extra space between lines in points.<br />
831         /// </summary>
832         /// <since_tizen> 3 </since_tizen>
833         public float LineSpacing
834         {
835             get
836             {
837                 return (float)GetValue(LineSpacingProperty);
838             }
839             set
840             {
841                 SetValue(LineSpacingProperty, value);
842                 NotifyPropertyChanged();
843             }
844         }
845
846         /// <summary>
847         /// The relative height of the line (a factor that will be multiplied by text height). <br />
848         /// If the value is less than 1, the lines could to be overlapped.
849         /// </summary>
850         [EditorBrowsable(EditorBrowsableState.Never)]
851         public float RelativeLineHeight
852         {
853             get
854             {
855                 return (float)GetValue(RelativeLineHeightProperty);
856             }
857             set
858             {
859                 SetValue(RelativeLineHeightProperty, value);
860                 NotifyPropertyChanged();
861             }
862         }
863
864         /// <summary>
865         /// The Underline property.<br />
866         /// The default underline parameters.<br />
867         /// The underline map contains the following keys :<br />
868         /// <list type="table">
869         /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
870         /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
871         /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
872         /// </list>
873         /// </summary>
874         /// <since_tizen> 3 </since_tizen>
875         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
876         public PropertyMap Underline
877         {
878             get
879             {
880                 return (PropertyMap)GetValue(UnderlineProperty);
881             }
882             set
883             {
884                 SetValue(UnderlineProperty, value);
885                 NotifyPropertyChanged();
886             }
887         }
888
889         /// <summary>
890         /// Set Underline to TextLabel. <br />
891         /// </summary>
892         /// <param name="underline">The Underline</param>
893         /// <remarks>
894         /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
895         /// </remarks>
896         /// <example>
897         /// The following example demonstrates how to use the SetUnderline method.
898         /// <code>
899         /// var underline = new Tizen.NUI.Text.Underline();
900         /// underline.Enable = true;
901         /// underline.Color = new Color("#3498DB");
902         /// underline.Height = 2.0f;
903         /// label.SetUnderline(underline);
904         /// </code>
905         /// </example>
906         [EditorBrowsable(EditorBrowsableState.Never)]
907         public void SetUnderline(Underline underline)
908         {
909             using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
910             {
911                 SetValue(UnderlineProperty, underlineMap);
912             }
913         }
914
915         /// <summary>
916         /// Get Underline from TextLabel. <br />
917         /// </summary>
918         /// <returns>The Underline</returns>
919         /// <remarks>
920         /// <see cref="Tizen.NUI.Text.Underline"/>
921         /// </remarks>
922         [EditorBrowsable(EditorBrowsableState.Never)]
923         public Underline GetUnderline()
924         {
925             Underline underline;
926             using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
927             {
928                 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
929             }
930             return underline;
931         }
932
933         /// <summary>
934         /// The Shadow property.<br />
935         /// The default shadow parameters.<br />
936         /// The shadow map contains the following keys :<br />
937         /// <list type="table">
938         /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
939         /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
940         /// <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>
941         /// </list>
942         /// </summary>
943         /// <since_tizen> 3 </since_tizen>
944         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
945         public PropertyMap Shadow
946         {
947             get
948             {
949                 return (PropertyMap)GetValue(ShadowProperty);
950             }
951             set
952             {
953                 SetValue(ShadowProperty, value);
954                 NotifyPropertyChanged();
955             }
956         }
957
958         /// <summary>
959         /// Set Shadow to TextLabel. <br />
960         /// </summary>
961         /// <param name="shadow">The Shadow</param>
962         /// <remarks>
963         /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
964         /// </remarks>
965         /// <example>
966         /// The following example demonstrates how to use the SetShadow method.
967         /// <code>
968         /// var shadow = new Tizen.NUI.Text.Shadow();
969         /// shadow.Offset = new Vector2(3, 3);
970         /// shadow.Color = new Color("#F1C40F");
971         /// shadow.BlurRadius = 4.0f;
972         /// label.SetShadow(shadow);
973         /// </code>
974         /// </example>
975         [EditorBrowsable(EditorBrowsableState.Never)]
976         public void SetShadow(Tizen.NUI.Text.Shadow shadow)
977         {
978             using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
979             {
980                 SetValue(ShadowProperty, shadowMap);
981             }
982         }
983
984         /// <summary>
985         /// Get Shadow from TextLabel. <br />
986         /// </summary>
987         /// <returns>The Shadow</returns>
988         /// <remarks>
989         /// <see cref="Tizen.NUI.Text.Shadow"/>
990         /// </remarks>
991         [EditorBrowsable(EditorBrowsableState.Never)]
992         public Tizen.NUI.Text.Shadow GetShadow()
993         {
994             Tizen.NUI.Text.Shadow shadow;
995             using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
996             {
997                 shadow = TextMapHelper.GetShadowStruct(shadowMap);
998             }
999             return shadow;
1000         }
1001
1002         /// <summary>
1003         /// Describes a text shadow for a TextLabel.
1004         /// It is null by default.
1005         /// </summary>
1006         [EditorBrowsable(EditorBrowsableState.Never)]
1007         public TextShadow TextShadow
1008         {
1009             get
1010             {
1011                 return (TextShadow)GetValue(TextShadowProperty);
1012             }
1013             set
1014             {
1015                 SetValue(TextShadowProperty, value);
1016                 NotifyPropertyChanged();
1017             }
1018         }
1019
1020         /// <summary>
1021         /// The Emboss property.<br />
1022         /// The default emboss parameters.<br />
1023         /// </summary>
1024         /// <since_tizen> 3 </since_tizen>
1025         public string Emboss
1026         {
1027             get
1028             {
1029                 return (string)GetValue(EmbossProperty);
1030             }
1031             set
1032             {
1033                 SetValue(EmbossProperty, value);
1034                 NotifyPropertyChanged();
1035             }
1036         }
1037
1038         /// <summary>
1039         /// The Outline property.<br />
1040         /// The default outline parameters.<br />
1041         /// The outline map contains the following keys :<br />
1042         /// <list type="table">
1043         /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1044         /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1045         /// </list>
1046         /// </summary>
1047         /// <since_tizen> 3 </since_tizen>
1048         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1049         public PropertyMap Outline
1050         {
1051             get
1052             {
1053                 return (PropertyMap)GetValue(OutlineProperty);
1054             }
1055             set
1056             {
1057                 SetValue(OutlineProperty, value);
1058                 NotifyPropertyChanged();
1059             }
1060         }
1061
1062         /// <summary>
1063         /// Set Outline to TextLabel. <br />
1064         /// </summary>
1065         /// <param name="outline">The Outline</param>
1066         /// <remarks>
1067         /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1068         /// </remarks>
1069         /// <example>
1070         /// The following example demonstrates how to use the SetOutline method.
1071         /// <code>
1072         /// var outline = new Tizen.NUI.Text.Outline();
1073         /// outline.Width = 2.0f;
1074         /// outline.Color = new Color("#45B39D");
1075         /// label.SetOutline(outline);
1076         /// </code>
1077         /// </example>
1078         [EditorBrowsable(EditorBrowsableState.Never)]
1079         public void SetOutline(Outline outline)
1080         {
1081             using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1082             {
1083                 SetValue(OutlineProperty, outlineMap);
1084             }
1085         }
1086
1087         /// <summary>
1088         /// Get Outline from TextLabel. <br />
1089         /// </summary>
1090         /// <returns>The Outline</returns>
1091         /// <remarks>
1092         /// <see cref="Tizen.NUI.Text.Outline"/>
1093         /// </remarks>
1094         [EditorBrowsable(EditorBrowsableState.Never)]
1095         public Outline GetOutline()
1096         {
1097             Outline outline;
1098             using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1099             {
1100                 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1101             }
1102             return outline;
1103         }
1104
1105         /// <summary>
1106         /// Set Strikethrough to TextLabel. <br />
1107         /// </summary>
1108         /// <param name="strikethrough">The Strikethrough</param>
1109         /// <remarks>
1110         /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1111         /// </remarks>
1112         /// <example>
1113         /// The following example demonstrates how to use the SetStrikethrough method.
1114         /// <code>
1115         /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1116         /// strikethrough.Enable = true;
1117         /// strikethrough.Color = new Color("#3498DB");
1118         /// strikethrough.Height = 2.0f;
1119         /// label.SetStrikethrough(strikethrough);
1120         /// </code>
1121         /// </example>
1122         [EditorBrowsable(EditorBrowsableState.Never)]
1123         public void SetStrikethrough(Strikethrough strikethrough)
1124         {
1125             using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1126             using (var propertyValue = new PropertyValue(map))
1127             {
1128                 SetProperty(TextLabel.Property.Strikethrough, propertyValue);
1129             }
1130         }
1131
1132         /// <summary>
1133         /// Get Strikethrough from TextLabel. <br />
1134         /// </summary>
1135         /// <returns>The Strikethrough</returns>
1136         /// <remarks>
1137         /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1138         /// </remarks>
1139         [EditorBrowsable(EditorBrowsableState.Never)]
1140         public Strikethrough GetStrikethrough()
1141         {
1142             Strikethrough strikethrough;
1143             using (var propertyValue = GetProperty(TextLabel.Property.Strikethrough))
1144             using (var map = new PropertyMap())
1145             {
1146                 propertyValue.Get(map);
1147                 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1148             }
1149             return strikethrough;
1150         }
1151
1152         /// <summary>
1153         /// The PixelSize property.<br />
1154         /// The size of font in pixels.<br />
1155         /// </summary>
1156         /// <since_tizen> 3 </since_tizen>
1157         [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1158         public float PixelSize
1159         {
1160             get
1161             {
1162                 return (float)GetValue(PixelSizeProperty);
1163             }
1164             set
1165             {
1166                 SetValue(PixelSizeProperty, value);
1167                 NotifyPropertyChanged();
1168             }
1169         }
1170
1171         /// <summary>
1172         /// The Ellipsis property.<br />
1173         /// Enable or disable the ellipsis.<br />
1174         /// </summary>
1175         /// <since_tizen> 3 </since_tizen>
1176         public bool Ellipsis
1177         {
1178             get
1179             {
1180                 return (bool)GetValue(EllipsisProperty);
1181             }
1182             set
1183             {
1184                 SetValue(EllipsisProperty, value);
1185                 NotifyPropertyChanged();
1186             }
1187         }
1188
1189         /// <summary>
1190         /// The ellipsis position of the text.
1191         /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1192         /// </summary>
1193         /// <since_tizen> 9 </since_tizen>
1194         public EllipsisPosition EllipsisPosition
1195         {
1196             get
1197             {
1198                 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1199             }
1200             set
1201             {
1202                 SetValue(EllipsisPositionProperty, value);
1203                 NotifyPropertyChanged();
1204             }
1205         }
1206
1207         /// <summary>
1208         /// The AutoScrollLoopDelay property.<br />
1209         /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
1210         /// </summary>
1211         /// <since_tizen> 3 </since_tizen>
1212         public float AutoScrollLoopDelay
1213         {
1214             get
1215             {
1216                 return (float)GetValue(AutoScrollLoopDelayProperty);
1217             }
1218             set
1219             {
1220                 SetValue(AutoScrollLoopDelayProperty, value);
1221                 NotifyPropertyChanged();
1222             }
1223         }
1224
1225         /// <summary>
1226         /// The AutoScrollStopMode property.<br />
1227         /// The auto scrolling stop behaviour.<br />
1228         /// The default value is AutoScrollStopMode.FinishLoop. <br />
1229         /// </summary>
1230         /// <since_tizen> 3 </since_tizen>
1231         public AutoScrollStopMode AutoScrollStopMode
1232         {
1233             get
1234             {
1235                 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
1236             }
1237             set
1238             {
1239                 SetValue(AutoScrollStopModeProperty, value);
1240                 NotifyPropertyChanged();
1241             }
1242         }
1243
1244         /// <summary>
1245         /// The line count of the text.
1246         /// </summary>
1247         /// <since_tizen> 3 </since_tizen>
1248         public int LineCount
1249         {
1250             get
1251             {
1252                 int lineCount = 0;
1253                 using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
1254                 {
1255                     propertyValue.Get(out lineCount);
1256                 }
1257                 return lineCount;
1258             }
1259         }
1260
1261         /// <summary>
1262         /// The LineWrapMode property.<br />
1263         /// line wrap mode when the text lines over layout width.<br />
1264         /// </summary>
1265         /// <since_tizen> 4 </since_tizen>
1266         public LineWrapMode LineWrapMode
1267         {
1268             get
1269             {
1270                 return (LineWrapMode)GetValue(LineWrapModeProperty);
1271             }
1272             set
1273             {
1274                 SetValue(LineWrapModeProperty, value);
1275                 NotifyPropertyChanged();
1276             }
1277         }
1278
1279         /// <summary>
1280         /// The direction of the text such as left to right or right to left.
1281         /// </summary>
1282         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1283         [EditorBrowsable(EditorBrowsableState.Never)]
1284         public TextDirection TextDirection
1285         {
1286             get
1287             {
1288                 int textDirection = 0;
1289                 using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
1290                 {
1291                     propertyValue.Get(out textDirection);
1292                 }
1293                 return (TextDirection)textDirection;
1294             }
1295         }
1296
1297         /// <summary>
1298         /// The vertical line alignment of the text.
1299         /// </summary>
1300         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1301         [EditorBrowsable(EditorBrowsableState.Never)]
1302         public VerticalLineAlignment VerticalLineAlignment
1303         {
1304             get
1305             {
1306                 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
1307             }
1308             set
1309             {
1310                 SetValue(VerticalLineAlignmentProperty, value);
1311                 NotifyPropertyChanged();
1312             }
1313         }
1314
1315         /// <summary>
1316         /// The text alignment to match the direction of the system language.
1317         /// </summary>
1318         /// <since_tizen> 6 </since_tizen>
1319         public bool MatchSystemLanguageDirection
1320         {
1321             get
1322             {
1323                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1324             }
1325             set
1326             {
1327                 SetValue(MatchSystemLanguageDirectionProperty, value);
1328                 NotifyPropertyChanged();
1329             }
1330         }
1331
1332         /// <summary>
1333         /// The text fit parameters.<br />
1334         /// The textFit map contains the following keys :<br />
1335         /// <list type="table">
1336         /// <item><term>enable (bool)</term><description>True to enable the text fit or false to disable (the default value is false)</description></item>
1337         /// <item><term>minSize (float)</term><description>Minimum Size for text fit (the default value is 10.f)</description></item>
1338         /// <item><term>maxSize (float)</term><description>Maximum Size for text fit (the default value is 100.f)</description></item>
1339         /// <item><term>stepSize (float)</term><description>Step Size for font increase (the default value is 1.f)</description></item>
1340         /// <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>
1341         /// </list>
1342         /// </summary>
1343         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1344         [EditorBrowsable(EditorBrowsableState.Never)]
1345         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1346         public PropertyMap TextFit
1347         {
1348             get
1349             {
1350                 return (PropertyMap)GetValue(TextFitProperty);
1351             }
1352             set
1353             {
1354                 SetValue(TextFitProperty, value);
1355                 NotifyPropertyChanged();
1356             }
1357         }
1358
1359         /// <summary>
1360         /// Set TextFit to TextLabel. <br />
1361         /// </summary>
1362         /// <param name="textFit">The TextFit</param>
1363         /// <remarks>
1364         /// SetTextFit specifies the textFit of the text through <see cref="Tizen.NUI.Text.TextFit"/>. <br />
1365         /// </remarks>
1366         /// <example>
1367         /// The following example demonstrates how to use the SetTextFit method.
1368         /// <code>
1369         /// var textFit = new Tizen.NUI.Text.TextFit();
1370         /// textFit.Enable = true;
1371         /// textFit.MinSize = 10.0f;
1372         /// textFit.MaxSize = 100.0f;
1373         /// textFit.StepSize = 5.0f;
1374         /// textFit.FontSizeType = FontSizeType.PointSize;
1375         /// label.SetTextFit(textFit);
1376         /// </code>
1377         /// </example>
1378         [EditorBrowsable(EditorBrowsableState.Never)]
1379         public void SetTextFit(TextFit textFit)
1380         {
1381             using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
1382             {
1383                 SetValue(TextFitProperty, textFitMap);
1384             }
1385         }
1386
1387         /// <summary>
1388         /// Get TextFit from TextLabel. <br />
1389         /// </summary>
1390         /// <returns>The TextFit</returns>
1391         /// <remarks>
1392         /// TextFit is always returned based on PointSize. <br />
1393         /// If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned. <br />
1394         /// <see cref="Tizen.NUI.Text.TextFit"/>
1395         /// </remarks>
1396         [EditorBrowsable(EditorBrowsableState.Never)]
1397         public TextFit GetTextFit()
1398         {
1399             TextFit textFit;
1400             using (var textFitMap = (PropertyMap)GetValue(TextFitProperty))
1401             {
1402                 textFit = TextMapHelper.GetTextFitStruct(textFitMap);
1403             }
1404             return textFit;
1405         }
1406
1407         /// <summary>
1408         /// Set TextFitArray to TextLabel. <br />
1409         /// TextFitArray finds and applies the largest PointSize that fits among OptionList.
1410         /// </summary>
1411         /// <param name="textFitArray">The TextFitArray</param>
1412         /// <remarks>
1413         /// TextFitArray tries binary search by default. <br />
1414         /// The precondition for TextFitArray to perform binary search is sorting in ascending order of MinLineSize. <br />
1415         /// Because if MinLineSize is not sorted in ascending order, <br />
1416         /// binary search cannot guarantee that it will always find the best value. <br />
1417         /// In this case, the search sequentially starts from the largest PointSize. <br />
1418         /// If TextFitArrayOption's MinLineSize is set to null or 0, <br />
1419         /// TextFitArray is calculated without applying MinLineSize. <br />
1420         /// If TextFitArray is enabled, TextLabel's MinLineSize property is ignored. <br />
1421         /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1422         /// </remarks>
1423         /// <example>
1424         /// The following example demonstrates how to use the SetTextFitArray method. <br />
1425         /// <code>
1426         /// var textFitArray = new Tizen.NUI.Text.TextFitArray();
1427         /// textFitArray.Enable = true;
1428         /// textFitArray.OptionList = new List<Tizen.NUI.Text.TextFitArrayOption>()
1429         /// {
1430         ///     new Tizen.NUI.Text.TextFitArrayOption(12, 18),
1431         ///     new Tizen.NUI.Text.TextFitArrayOption(24, 40),
1432         ///     new Tizen.NUI.Text.TextFitArrayOption(28, 48),
1433         ///     new Tizen.NUI.Text.TextFitArrayOption(32, 56),
1434         ///     new Tizen.NUI.Text.TextFitArrayOption(50, 72),
1435         /// };
1436         /// label.SetTextFitArray(textFitArray);
1437         /// </code>
1438         /// <br />
1439         /// The table below shows cases where binary search is possible and where it is not possible. <br />
1440         /// <code>
1441         /// [Binary search possible]
1442         /// |            | List index  |  0 |  1 |  2 |  3 |
1443         /// | OptionList | PointSize   | 24 | 28 | 32 | 48 |
1444         /// |            | MinLineSize | 40 | 48 | 48 | 62 | << MinLineSize sorted in ascending order
1445         ///                                    ^    ^
1446         ///                                    same values â€‹are not a problem
1447         ///
1448         /// [Binary search not possible]
1449         /// |            | List index  |  0 |  1 |  2 |  3 |
1450         /// | OptionList | PointSize   | 24 | 28 | 32 | 48 |
1451         /// |            | MinLineSize | 40 | 48 | 38 | 62 | << MinLineSize is not sorted in ascending order
1452         ///                                         ^
1453         /// </code>
1454         /// </example>
1455         [EditorBrowsable(EditorBrowsableState.Never)]
1456         public void SetTextFitArray(TextFitArray textFitArray)
1457         {
1458             bool enable = textFitArray.Enable;
1459             int optionListSize = textFitArray.OptionList?.Count ?? 0;
1460
1461             float[] pointSizeArray = new float[optionListSize];
1462             float[] minLineSizeArray = new float[optionListSize];
1463
1464             for (int i = 0 ; i < optionListSize ; i ++)
1465             {
1466                 TextFitArrayOption option = textFitArray.OptionList[i];
1467                 pointSizeArray[i] = option.PointSize;
1468                 minLineSizeArray[i] = option.MinLineSize ?? 0;
1469             }
1470
1471             Interop.TextLabel.SetTextFitArray(SwigCPtr, enable, (uint)optionListSize, pointSizeArray, minLineSizeArray);
1472             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1473         }
1474
1475         /// <summary>
1476         /// Get TextFitArray from TextLabel.
1477         /// </summary>
1478         /// <returns>The TextFitArray</returns>
1479         /// <remarks>
1480         /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1481         /// </remarks>
1482         /// <example>
1483         /// The following example demonstrates how to use the GetTextFitArray method. <br />
1484         /// <code>
1485         /// Tizen.NUI.Text.TextFitArray textFitArray = label.GetTextFitArray();
1486         /// bool enable = textFitArray.Enable;
1487         /// var optionList = textFitArray.OptionList;
1488         /// foreach(Tizen.NUI.Text.TextFitArrayOption option in optionList)
1489         /// {
1490         ///     float pointSize = option.PointSize;
1491         ///     float minLinesize = option.MinLineSize;
1492         /// }
1493         /// </code>
1494         /// </example>
1495         [EditorBrowsable(EditorBrowsableState.Never)]
1496         public TextFitArray GetTextFitArray()
1497         {
1498             using PropertyMap textFitArrayMap = new PropertyMap(Interop.TextLabel.GetTextFitArray(SwigCPtr), true);
1499             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1500
1501             TextFitArray textFitArray;
1502             textFitArray = TextUtils.GetMapToTextFitArray(textFitArrayMap);
1503             return textFitArray;
1504         }
1505
1506         /// <summary>
1507         /// The MinLineSize property.<br />
1508         /// The height of the line in points. <br />
1509         /// If the font size is larger than the line size, it works with the font size. <br />
1510         /// </summary>
1511         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1512         [EditorBrowsable(EditorBrowsableState.Never)]
1513         public float MinLineSize
1514         {
1515             get
1516             {
1517                 return (float)GetValue(MinLineSizeProperty);
1518             }
1519             set
1520             {
1521                 SetValue(MinLineSizeProperty, value);
1522                 NotifyPropertyChanged();
1523             }
1524         }
1525
1526         /// <summary>
1527         /// The spaces between characters in Pixels.
1528         /// <remarks>
1529         /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1530         /// The default value is 0.f which does nothing.
1531         ///</remarks>
1532         /// </summary>
1533         [EditorBrowsable(EditorBrowsableState.Never)]
1534         public float CharacterSpacing
1535         {
1536             get
1537             {
1538                 return (float)GetValue(CharacterSpacingProperty);
1539             }
1540             set
1541             {
1542                 SetValue(CharacterSpacingProperty, value);
1543                 NotifyPropertyChanged();
1544             }
1545         }
1546
1547         /// <summary>
1548         /// The FontSizeScale property for scaling the specified font size up or down. <br />
1549         /// The default value is 1.0. <br />
1550         /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
1551         /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1552         /// </summary>
1553         /// <since_tizen> 9 </since_tizen>
1554         public float FontSizeScale
1555         {
1556             get
1557             {
1558                 return (float)GetValue(FontSizeScaleProperty);
1559             }
1560             set
1561             {
1562                 SetValue(FontSizeScaleProperty, value);
1563                 NotifyPropertyChanged();
1564             }
1565         }
1566
1567         private float InternalFontSizeScale
1568         {
1569             get
1570             {
1571                 return fontSizeScale;
1572             }
1573             set
1574             {
1575                 float newFontSizeScale;
1576
1577                 if (fontSizeScale == value) return;
1578
1579                 fontSizeScale = value;
1580                 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1581                 {
1582                     SystemSettingsFontSize systemSettingsFontSize;
1583
1584                     try
1585                     {
1586                         systemSettingsFontSize = SystemSettings.FontSize;
1587                     }
1588                     catch (Exception e)
1589                     {
1590                         Console.WriteLine("{0} Exception caught.", e);
1591                         systemSettingsFontSize = SystemSettingsFontSize.Normal;
1592                     }
1593                     newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1594                     AddSystemSettingsFontSizeChanged();
1595                 }
1596                 else
1597                 {
1598                     newFontSizeScale = fontSizeScale;
1599                     RemoveSystemSettingsFontSizeChanged();
1600                 }
1601
1602                 SetInternalFontSizeScale(newFontSizeScale);
1603             }
1604         }
1605
1606         private void SetInternalFontSizeScale(float fontSizeScale)
1607         {
1608
1609             Object.InternalSetPropertyFloat(this.SwigCPtr, TextLabel.Property.FontSizeScale, (float)fontSizeScale);
1610             RequestLayout();
1611         }
1612
1613         /// <summary>
1614         /// The EnableFontSizeScale property.<br />
1615         /// Whether the font size scale is enabled. (The default value is true)
1616         /// </summary>
1617         [EditorBrowsable(EditorBrowsableState.Never)]
1618         public bool EnableFontSizeScale
1619         {
1620             get
1621             {
1622                 return (bool)GetValue(EnableFontSizeScaleProperty);
1623             }
1624             set
1625             {
1626                 SetValue(EnableFontSizeScaleProperty, value);
1627                 NotifyPropertyChanged();
1628             }
1629         }
1630
1631         private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData());
1632
1633         /// <summary>
1634         /// Downcasts a handle to textLabel handle
1635         /// </summary>
1636         /// <param name="handle"></param>
1637         /// <returns></returns>
1638         /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
1639         /// <since_tizen> 3 </since_tizen>
1640         /// Do not use this, that will be deprecated. Use as keyword instead.
1641         [Obsolete("Do not use this, that will be deprecated. Use as keyword instead. " +
1642             "Like: " +
1643             "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
1644             "TextLabel label = handle as TextLabel")]
1645         [EditorBrowsable(EditorBrowsableState.Never)]
1646         public static TextLabel DownCast(BaseHandle handle)
1647         {
1648             if (null == handle)
1649             {
1650                 throw new ArgumentNullException(nameof(handle));
1651             }
1652             TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
1653             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1654             return ret;
1655         }
1656
1657         /// <inheritdoc/>
1658         [EditorBrowsable(EditorBrowsableState.Never)]
1659         protected override void Dispose(DisposeTypes type)
1660         {
1661             if (disposed)
1662             {
1663                 return;
1664             }
1665
1666             internalTextColor?.Dispose();
1667
1668             if (hasSystemLanguageChanged)
1669             {
1670                 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
1671             }
1672
1673             RemoveSystemSettingsFontTypeChanged();
1674             RemoveSystemSettingsFontSizeChanged();
1675
1676             if (type == DisposeTypes.Explicit)
1677             {
1678                 //Called by User
1679                 //Release your own managed resources here.
1680                 //You should release all of your own disposable objects here.
1681                 selectorData?.Reset(this);
1682             }
1683
1684             if (this.HasBody())
1685             {
1686                 if (textLabelTextFitChangedCallbackDelegate != null)
1687                 {
1688                     TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
1689                 }
1690             }
1691
1692             base.Dispose(type);
1693         }
1694
1695         /// This will not be public opened.
1696         [EditorBrowsable(EditorBrowsableState.Never)]
1697         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1698         {
1699             Interop.TextLabel.DeleteTextLabel(swigCPtr);
1700         }
1701
1702         /// <summary>
1703         /// Get attribues, it is abstract function and must be override.
1704         /// </summary>
1705         [EditorBrowsable(EditorBrowsableState.Never)]
1706         protected override ViewStyle CreateViewStyle()
1707         {
1708             return new TextLabelStyle();
1709         }
1710
1711         internal override LayoutItem CreateDefaultLayout()
1712         {
1713             return new TextLayout();
1714         }
1715
1716         /// <summary>
1717         /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1718         /// </summary>
1719         protected override void OnBindingContextChanged()
1720         {
1721             base.OnBindingContextChanged();
1722         }
1723
1724         private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1725         {
1726             Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1727         }
1728
1729         private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1730         {
1731             float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1732             SetInternalFontSizeScale(newFontSizeScale);
1733         }
1734
1735         private void AddSystemSettingsFontSizeChanged()
1736         {
1737             if (hasSystemFontSizeChanged != true)
1738             {
1739                 try
1740                 {
1741                     SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
1742                     hasSystemFontSizeChanged = true;
1743                 }
1744                 catch (Exception e)
1745                 {
1746                     Console.WriteLine("{0} Exception caught.", e);
1747                     hasSystemFontSizeChanged = false;
1748                 }
1749             }
1750         }
1751
1752         private void RemoveSystemSettingsFontSizeChanged()
1753         {
1754             if (hasSystemFontSizeChanged == true)
1755             {
1756                 try
1757                 {
1758                     SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
1759                     hasSystemFontSizeChanged = false;
1760                 }
1761                 catch (Exception e)
1762                 {
1763                     Console.WriteLine("{0} Exception caught.", e);
1764                     hasSystemFontSizeChanged = true;
1765                 }
1766             }
1767         }
1768
1769         private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
1770         {
1771             SetInternalFontFamily(e.Value);
1772         }
1773
1774         private void AddSystemSettingsFontTypeChanged()
1775         {
1776             if (HasStyle() && !hasSystemFontTypeChanged)
1777             {
1778                 try
1779                 {
1780                     systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
1781                     hasSystemFontTypeChanged = true;
1782                 }
1783                 catch (Exception e)
1784                 {
1785                     Console.WriteLine("{0} Exception caught.", e);
1786                     hasSystemFontTypeChanged = false;
1787                 }
1788             }
1789         }
1790         
1791         private void RemoveSystemSettingsFontTypeChanged()
1792         {
1793             if (hasSystemFontTypeChanged)
1794             {
1795                 try
1796                 {
1797                     systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
1798                     hasSystemFontTypeChanged = false;
1799                 }
1800                 catch (Exception e)
1801                 {
1802                     Console.WriteLine("{0} Exception caught.", e);
1803                     hasSystemFontTypeChanged = true;
1804                 }
1805             }
1806         }
1807
1808         private void RequestLayout()
1809         {
1810             Layout?.RequestLayout();
1811         }
1812
1813         internal new class Property
1814         {
1815             internal static readonly int TEXT = Interop.TextLabel.TextGet();
1816             internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
1817             internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
1818             internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
1819             internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
1820             internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
1821             internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
1822             internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
1823             internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
1824             internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
1825             internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
1826             internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
1827             internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
1828             internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
1829             internal static readonly int RelativeLineHeight = Interop.TextLabel.RelativeLineHeightGet();
1830             internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
1831             internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
1832             internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
1833             internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
1834             internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
1835             internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
1836             internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
1837             internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
1838             internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
1839             internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
1840             internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
1841             internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
1842             internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
1843             internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
1844             internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
1845             internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet();
1846             internal static readonly int EnableFontSizeScale = Interop.TextLabel.EnableFontSizeScaleGet();
1847             internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
1848             internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
1849             internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
1850         }
1851
1852         private void OnShadowColorChanged(float x, float y, float z, float w)
1853         {
1854             ShadowColor = new Vector4(x, y, z, w);
1855         }
1856         private void OnShadowOffsetChanged(float x, float y)
1857         {
1858             ShadowOffset = new Vector2(x, y);
1859         }
1860         private void OnTextColorChanged(float r, float g, float b, float a)
1861         {
1862             TextColor = new Color(r, g, b, a);
1863         }
1864         private void OnUnderlineColorChanged(float x, float y, float z, float w)
1865         {
1866             UnderlineColor = new Vector4(x, y, z, w);
1867         }
1868     }
1869 }