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