2 * Copyright(c) 2023 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
22 using System.Globalization;
23 using System.ComponentModel;
25 using Tizen.NUI.Binding;
27 namespace Tizen.NUI.BaseComponents
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 />
33 /// <since_tizen> 3 </since_tizen>
34 public partial class TextLabel : View
36 private class TextLayout : LayoutItem
38 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
40 // Padding will be automatically applied by DALi TextLabel.
41 float totalWidth = widthMeasureSpec.Size.AsDecimal();
42 float totalHeight = heightMeasureSpec.Size.AsDecimal();
44 if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
46 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
48 totalHeight = Owner.GetHeightForWidth(totalWidth);
49 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
54 var minSize = Owner.MinimumSize;
55 var maxSize = Owner.MaximumSize;
56 var naturalSize = Owner.GetNaturalSize();
58 if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
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);
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));
72 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
73 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
77 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
78 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
80 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
81 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
85 static TextLabel() { }
87 static internal new void Preload()
89 // Do not call View.Preload(), since we already call it
92 // Do nothing. Just call for load static values.
95 private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
96 private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
97 static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextLabel";
98 static private string defaultFontFamily = "BreezeSans";
99 private string textLabelSid = null;
100 private TextLabelSelectorData selectorData;
101 private string fontFamily = defaultFontFamily;
102 private float fontSizeScale = 1.0f;
104 private bool textIsEmpty = true;
106 private bool hasSystemLanguageChanged = false;
107 private bool hasSystemFontSizeChanged = false;
108 private bool hasSystemFontTypeChanged = false;
110 private Color internalTextColor;
113 /// Creates the TextLabel control.
115 /// <since_tizen> 3 </since_tizen>
116 public TextLabel() : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, viewStyle)
128 /// Creates the TextLabel with setting the status of shown or hidden.
130 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
131 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
132 [EditorBrowsable(EditorBrowsableState.Never)]
133 public TextLabel(bool shown) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 /// Creates the TextLabel control.
142 /// <param name="text">The text to display</param>
143 /// <since_tizen> 3 </since_tizen>
144 public TextLabel(string text) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 textIsEmpty = string.IsNullOrEmpty(text);
151 /// Creates the TextLabel with setting the status of shown or hidden.
153 /// <param name="text">The text to display</param>
154 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
155 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160 textIsEmpty = string.IsNullOrEmpty(text);
164 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
172 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
180 private bool HasStyle()
182 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
186 /// The TranslatableText property.<br />
187 /// The text can set the SID value.<br />
189 /// <exception cref='ArgumentNullException'>
190 /// ResourceManager about multilingual is null.
192 /// <since_tizen> 4 </since_tizen>
193 public string TranslatableText
197 return (string)GetValue(TranslatableTextProperty);
201 SetValue(TranslatableTextProperty, value);
204 private string translatableText
212 if (NUIApplication.MultilingualResourceManager == null)
214 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
216 string translatableText = null;
217 textLabelSid = value;
218 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
219 if (translatableText != null)
221 Text = translatableText;
222 if (hasSystemLanguageChanged == false)
224 systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
225 hasSystemLanguageChanged = true;
232 NotifyPropertyChanged();
237 /// The Text property.<br />
238 /// The text to display in the UTF-8 format.<br />
240 /// <since_tizen> 3 </since_tizen>
245 return (string)GetValue(TextProperty);
249 SetValue(TextProperty, value);
250 NotifyPropertyChanged();
255 /// The FontFamily property.<br />
256 /// The requested font family to use.<br />
258 /// <since_tizen> 3 </since_tizen>
259 public string FontFamily
263 return (string)GetValue(FontFamilyProperty);
267 SetValue(FontFamilyProperty, value);
268 NotifyPropertyChanged();
272 private string InternalFontFamily
279 return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
283 string newFontFamily;
285 if (string.Equals(fontFamily, value)) return;
288 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
292 newFontFamily = SystemSettings.FontType;
296 Console.WriteLine("{0} Exception caught.", e);
297 newFontFamily = defaultFontFamily;
299 AddSystemSettingsFontTypeChanged();
303 newFontFamily = fontFamily;
304 RemoveSystemSettingsFontTypeChanged();
307 SetInternalFontFamily(newFontFamily);
311 private void SetInternalFontFamily(string fontFamily)
313 Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
318 /// The FontStyle property.<br />
319 /// The requested font style to use.<br />
320 /// The fontStyle map contains the following keys :<br />
321 /// <list type="table">
322 /// <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>
323 /// <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>
324 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
327 /// <since_tizen> 3 </since_tizen>
328 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
329 public PropertyMap FontStyle
333 return (PropertyMap)GetValue(FontStyleProperty);
337 SetValue(FontStyleProperty, value);
338 NotifyPropertyChanged();
343 /// Set FontStyle to TextLabel. <br />
345 /// <param name="fontStyle">The FontStyle</param>
347 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
350 /// The following example demonstrates how to use the SetFontStyle method.
352 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
353 /// fontStyle.Width = FontWidthType.Expanded;
354 /// fontStyle.Weight = FontWeightType.Bold;
355 /// fontStyle.Slant = FontSlantType.Italic;
356 /// label.SetFontStyle(fontStyle);
359 [EditorBrowsable(EditorBrowsableState.Never)]
360 public void SetFontStyle(FontStyle fontStyle)
362 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
364 SetValue(FontStyleProperty, fontStyleMap);
369 /// Get FontStyle from TextLabel. <br />
371 /// <returns>The FontStyle</returns>
373 /// <see cref="Tizen.NUI.Text.FontStyle"/>
375 [EditorBrowsable(EditorBrowsableState.Never)]
376 public FontStyle GetFontStyle()
379 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
381 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
387 /// The PointSize property.<br />
388 /// The size of font in points.<br />
390 /// <since_tizen> 3 </since_tizen>
391 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
392 public float PointSize
396 return (float)GetValue(PointSizeProperty);
400 SetValue(PointSizeProperty, value);
401 NotifyPropertyChanged();
406 /// The MultiLine property.<br />
407 /// The single-line or multi-line layout option.<br />
409 /// <since_tizen> 3 </since_tizen>
410 public bool MultiLine
414 return (bool)GetValue(MultiLineProperty);
418 SetValue(MultiLineProperty, value);
419 NotifyPropertyChanged();
424 /// The HorizontalAlignment property.<br />
425 /// The line horizontal alignment.<br />
427 /// <since_tizen> 3 </since_tizen>
428 public HorizontalAlignment HorizontalAlignment
432 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
436 SetValue(HorizontalAlignmentProperty, value);
437 NotifyPropertyChanged();
442 /// The VerticalAlignment property.<br />
443 /// The line vertical alignment.<br />
445 /// <since_tizen> 3 </since_tizen>
446 public VerticalAlignment VerticalAlignment
450 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
454 SetValue(VerticalAlignmentProperty, value);
455 NotifyPropertyChanged();
460 /// The TextColor property.<br />
461 /// The color of the text.<br />
462 /// Animation framework can be used to change the color of the text when not using mark up.<br />
463 /// Cannot animate the color when text is auto scrolling.<br />
466 /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
468 /// <since_tizen> 3 </since_tizen>
469 public Color TextColor
473 Color temp = (Color)GetValue(TextColorProperty);
474 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
478 SetValue(TextColorProperty, value);
479 NotifyPropertyChanged();
484 /// The ShadowOffset property.<br />
485 /// The drop shadow offset 0 indicates no shadow.<br />
487 /// <since_tizen> 3 </since_tizen>
489 /// Deprecated.(API Level 6) Use Shadow instead.
490 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
492 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
493 public Vector2 ShadowOffset
497 return GetValue(ShadowOffsetProperty) as Vector2;
501 SetValue(ShadowOffsetProperty, value);
505 private Vector2 InternalShadowOffset
509 float x = 0.0f, y = 0.0f;
510 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "offset"))
511 using (var shadowOffset = new Vector2())
513 if (null != propertyValue)
515 propertyValue.Get(shadowOffset);
520 return new Vector2(OnShadowOffsetChanged, x, y);
524 using (var map = new PropertyMap())
526 map.Add("offset", value);
528 var shadowMap = Shadow;
529 shadowMap.Merge(map);
531 SetValue(ShadowProperty, shadowMap);
532 NotifyPropertyChanged();
538 /// The ShadowColor property.<br />
539 /// The color of a drop shadow.<br />
541 /// <since_tizen> 3 </since_tizen>
543 /// Deprecated.(API Level 6) Use Shadow instead.
544 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
546 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
547 public Vector4 ShadowColor
551 return GetValue(ShadowColorProperty) as Vector4;
555 SetValue(ShadowColorProperty, value);
559 private Vector4 InternalShadowColor
563 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
564 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "color"))
565 using (var shadowColor = new Vector4())
567 if (null != propertyValue)
569 propertyValue.Get(shadowColor);
576 return new Vector4(OnShadowColorChanged, x, y, z, w);
580 using (var map = new PropertyMap())
582 map.Add("color", value);
583 var shadowMap = Shadow;
584 shadowMap.Merge(map);
585 SetValue(ShadowProperty, shadowMap);
586 NotifyPropertyChanged();
592 /// The UnderlineEnabled property.<br />
593 /// The underline enabled flag.<br />
595 /// <since_tizen> 3 </since_tizen>
597 /// Deprecated.(API Level 6) Use Underline instead.
599 [Obsolete("Do not use this UnderlineEnabled(Deprecated). Use Underline instead.")]
600 public bool UnderlineEnabled
604 return (bool)GetValue(UnderlineEnabledProperty);
608 SetValue(UnderlineEnabledProperty, value);
612 private bool InternalUnderlineEnabled
616 bool underlineEnabled = false;
617 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "enable"))
619 if (propertyValue != null)
621 propertyValue.Get(out underlineEnabled);
624 return underlineEnabled;
628 using (var map = new PropertyMap())
630 map.Add("enable", value);
631 var undelineMap = Underline;
632 undelineMap.Merge(map);
633 SetValue(UnderlineProperty, undelineMap);
634 NotifyPropertyChanged();
640 /// The UnderlineColor property.<br />
641 /// Overrides the underline height from font metrics.<br />
643 /// <since_tizen> 3 </since_tizen>
645 /// Deprecated.(API Level 6) Use Underline instead.
646 /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
648 [Obsolete("Do not use this UnderlineColor(Deprecated). Use Underline instead.")]
649 public Vector4 UnderlineColor
653 return GetValue(UnderlineColorProperty) as Vector4;
657 SetValue(UnderlineColorProperty, value);
661 private Vector4 InternalUnderlineColor
665 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
666 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "color"))
667 using (var underlineColor = new Vector4())
669 if (null != propertyValue)
671 propertyValue.Get(underlineColor);
672 x = underlineColor.X;
673 y = underlineColor.Y;
674 z = underlineColor.Z;
675 w = underlineColor.W;
678 return new Vector4(OnUnderlineColorChanged, x, y, z, w);
682 using (var map = new PropertyMap())
684 map.Add("color", value);
685 var undelineMap = Underline;
686 undelineMap.Merge(map);
687 SetValue(UnderlineProperty, undelineMap);
688 NotifyPropertyChanged();
694 /// The UnderlineHeight property.<br />
695 /// Overrides the underline height from font metrics.<br />
697 /// <since_tizen> 3 </since_tizen>
699 /// Deprecated.(API Level 6) Use Underline instead.
701 [Obsolete("Do not use this UnderlineHeight(Deprecated). Use Underline instead.")]
702 public float UnderlineHeight
706 return (float)GetValue(UnderlineHeightProperty);
710 SetValue(UnderlineHeightProperty, value);
714 private float InternalUnderlineHeight
718 float underlineHeight = 0.0f;
719 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "height"))
721 if (null != propertyValue)
723 propertyValue.Get(out underlineHeight);
726 return underlineHeight;
730 using (var map = new PropertyMap())
732 map.Add("height", value);
733 var undelineMap = Underline;
734 undelineMap.Merge(map);
735 SetValue(UnderlineProperty, undelineMap);
736 NotifyPropertyChanged();
742 /// The EnableMarkup property.<br />
743 /// Whether the mark-up processing is enabled.<br />
745 /// <since_tizen> 3 </since_tizen>
746 public bool EnableMarkup
750 return (bool)GetValue(EnableMarkupProperty);
754 SetValue(EnableMarkupProperty, value);
755 NotifyPropertyChanged();
760 /// The EnableAutoScroll property.<br />
761 /// Starts or stops auto scrolling.<br />
763 /// <since_tizen> 3 </since_tizen>
764 public bool EnableAutoScroll
768 return (bool)GetValue(EnableAutoScrollProperty);
772 SetValue(EnableAutoScrollProperty, value);
773 NotifyPropertyChanged();
778 /// The AutoScrollSpeed property.<br />
779 /// Sets the speed of scrolling in pixels per second.<br />
781 /// <since_tizen> 3 </since_tizen>
782 public int AutoScrollSpeed
786 return (int)GetValue(AutoScrollSpeedProperty);
790 SetValue(AutoScrollSpeedProperty, value);
791 NotifyPropertyChanged();
796 /// The AutoScrollLoopCount property.<br />
797 /// Number of complete loops when scrolling enabled.<br />
799 /// <since_tizen> 3 </since_tizen>
800 public int AutoScrollLoopCount
804 return (int)GetValue(AutoScrollLoopCountProperty);
808 SetValue(AutoScrollLoopCountProperty, value);
809 NotifyPropertyChanged();
814 /// The AutoScrollGap property.<br />
815 /// Gap before scrolling wraps.<br />
817 /// <since_tizen> 3 </since_tizen>
818 public float AutoScrollGap
822 return (float)GetValue(AutoScrollGapProperty);
826 SetValue(AutoScrollGapProperty, value);
827 NotifyPropertyChanged();
832 /// The LineSpacing property.<br />
833 /// The default extra space between lines in points.<br />
835 /// <since_tizen> 3 </since_tizen>
836 public float LineSpacing
840 return (float)GetValue(LineSpacingProperty);
844 SetValue(LineSpacingProperty, value);
845 NotifyPropertyChanged();
850 /// The relative height of the line (a factor that will be multiplied by text height). <br />
851 /// If the value is less than 1, the lines could to be overlapped.
853 [EditorBrowsable(EditorBrowsableState.Never)]
854 public float RelativeLineHeight
858 return (float)GetValue(RelativeLineHeightProperty);
862 SetValue(RelativeLineHeightProperty, value);
863 NotifyPropertyChanged();
868 /// The Underline property.<br />
869 /// The default underline parameters.<br />
870 /// The underline map contains the following keys :<br />
871 /// <list type="table">
872 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
873 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
874 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
877 /// <since_tizen> 3 </since_tizen>
878 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
879 public PropertyMap Underline
883 return (PropertyMap)GetValue(UnderlineProperty);
887 SetValue(UnderlineProperty, value);
888 NotifyPropertyChanged();
893 /// Set Underline to TextLabel. <br />
895 /// <param name="underline">The Underline</param>
897 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
900 /// The following example demonstrates how to use the SetUnderline method.
902 /// var underline = new Tizen.NUI.Text.Underline();
903 /// underline.Enable = true;
904 /// underline.Color = new Color("#3498DB");
905 /// underline.Height = 2.0f;
906 /// label.SetUnderline(underline);
909 [EditorBrowsable(EditorBrowsableState.Never)]
910 public void SetUnderline(Underline underline)
912 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
914 SetValue(UnderlineProperty, underlineMap);
919 /// Get Underline from TextLabel. <br />
921 /// <returns>The Underline</returns>
923 /// <see cref="Tizen.NUI.Text.Underline"/>
925 [EditorBrowsable(EditorBrowsableState.Never)]
926 public Underline GetUnderline()
929 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
931 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
937 /// The Shadow property.<br />
938 /// The default shadow parameters.<br />
939 /// The shadow map contains the following keys :<br />
940 /// <list type="table">
941 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
942 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
943 /// <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>
946 /// <since_tizen> 3 </since_tizen>
947 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
948 public PropertyMap Shadow
952 return (PropertyMap)GetValue(ShadowProperty);
956 SetValue(ShadowProperty, value);
957 NotifyPropertyChanged();
962 /// Set Shadow to TextLabel. <br />
964 /// <param name="shadow">The Shadow</param>
966 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
969 /// The following example demonstrates how to use the SetShadow method.
971 /// var shadow = new Tizen.NUI.Text.Shadow();
972 /// shadow.Offset = new Vector2(3, 3);
973 /// shadow.Color = new Color("#F1C40F");
974 /// shadow.BlurRadius = 4.0f;
975 /// label.SetShadow(shadow);
978 [EditorBrowsable(EditorBrowsableState.Never)]
979 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
981 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
983 SetValue(ShadowProperty, shadowMap);
988 /// Get Shadow from TextLabel. <br />
990 /// <returns>The Shadow</returns>
992 /// <see cref="Tizen.NUI.Text.Shadow"/>
994 [EditorBrowsable(EditorBrowsableState.Never)]
995 public Tizen.NUI.Text.Shadow GetShadow()
997 Tizen.NUI.Text.Shadow shadow;
998 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1000 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1006 /// Describes a text shadow for a TextLabel.
1007 /// It is null by default.
1009 [EditorBrowsable(EditorBrowsableState.Never)]
1010 public TextShadow TextShadow
1014 return (TextShadow)GetValue(TextShadowProperty);
1018 SetValue(TextShadowProperty, value);
1019 NotifyPropertyChanged();
1024 /// The Emboss property.<br />
1025 /// The default emboss parameters.<br />
1027 /// <since_tizen> 3 </since_tizen>
1028 public string Emboss
1032 return (string)GetValue(EmbossProperty);
1036 SetValue(EmbossProperty, value);
1037 NotifyPropertyChanged();
1042 /// The Outline property.<br />
1043 /// The default outline parameters.<br />
1044 /// The outline map contains the following keys :<br />
1045 /// <list type="table">
1046 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1047 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1050 /// <since_tizen> 3 </since_tizen>
1051 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1052 public PropertyMap Outline
1056 return (PropertyMap)GetValue(OutlineProperty);
1060 SetValue(OutlineProperty, value);
1061 NotifyPropertyChanged();
1066 /// Set Outline to TextLabel. <br />
1068 /// <param name="outline">The Outline</param>
1070 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1073 /// The following example demonstrates how to use the SetOutline method.
1075 /// var outline = new Tizen.NUI.Text.Outline();
1076 /// outline.Width = 2.0f;
1077 /// outline.Color = new Color("#45B39D");
1078 /// label.SetOutline(outline);
1081 [EditorBrowsable(EditorBrowsableState.Never)]
1082 public void SetOutline(Outline outline)
1084 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1086 SetValue(OutlineProperty, outlineMap);
1091 /// Get Outline from TextLabel. <br />
1093 /// <returns>The Outline</returns>
1095 /// <see cref="Tizen.NUI.Text.Outline"/>
1097 [EditorBrowsable(EditorBrowsableState.Never)]
1098 public Outline GetOutline()
1101 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1103 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1109 /// Set Strikethrough to TextLabel. <br />
1111 /// <param name="strikethrough">The Strikethrough</param>
1113 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1116 /// The following example demonstrates how to use the SetStrikethrough method.
1118 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1119 /// strikethrough.Enable = true;
1120 /// strikethrough.Color = new Color("#3498DB");
1121 /// strikethrough.Height = 2.0f;
1122 /// label.SetStrikethrough(strikethrough);
1125 [EditorBrowsable(EditorBrowsableState.Never)]
1126 public void SetStrikethrough(Strikethrough strikethrough)
1128 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1129 using (var propertyValue = new PropertyValue(map))
1131 SetProperty(TextLabel.Property.Strikethrough, propertyValue);
1136 /// Get Strikethrough from TextLabel. <br />
1138 /// <returns>The Strikethrough</returns>
1140 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1142 [EditorBrowsable(EditorBrowsableState.Never)]
1143 public Strikethrough GetStrikethrough()
1145 Strikethrough strikethrough;
1146 using (var propertyValue = GetProperty(TextLabel.Property.Strikethrough))
1147 using (var map = new PropertyMap())
1149 propertyValue.Get(map);
1150 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1152 return strikethrough;
1156 /// The PixelSize property.<br />
1157 /// The size of font in pixels.<br />
1159 /// <since_tizen> 3 </since_tizen>
1160 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1161 public float PixelSize
1165 return (float)GetValue(PixelSizeProperty);
1169 SetValue(PixelSizeProperty, value);
1170 NotifyPropertyChanged();
1175 /// The Ellipsis property.<br />
1176 /// Enable or disable the ellipsis.<br />
1178 /// <since_tizen> 3 </since_tizen>
1179 public bool Ellipsis
1183 return (bool)GetValue(EllipsisProperty);
1187 SetValue(EllipsisProperty, value);
1188 NotifyPropertyChanged();
1193 /// The ellipsis position of the text.
1194 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1196 /// <since_tizen> 9 </since_tizen>
1197 public EllipsisPosition EllipsisPosition
1201 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1205 SetValue(EllipsisPositionProperty, value);
1206 NotifyPropertyChanged();
1211 /// The AutoScrollLoopDelay property.<br />
1212 /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
1214 /// <since_tizen> 3 </since_tizen>
1215 public float AutoScrollLoopDelay
1219 return (float)GetValue(AutoScrollLoopDelayProperty);
1223 SetValue(AutoScrollLoopDelayProperty, value);
1224 NotifyPropertyChanged();
1229 /// The AutoScrollStopMode property.<br />
1230 /// The auto scrolling stop behaviour.<br />
1231 /// The default value is AutoScrollStopMode.FinishLoop. <br />
1233 /// <since_tizen> 3 </since_tizen>
1234 public AutoScrollStopMode AutoScrollStopMode
1238 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
1242 SetValue(AutoScrollStopModeProperty, value);
1243 NotifyPropertyChanged();
1248 /// The line count of the text.
1250 /// <since_tizen> 3 </since_tizen>
1251 public int LineCount
1256 using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
1258 propertyValue.Get(out lineCount);
1265 /// The LineWrapMode property.<br />
1266 /// line wrap mode when the text lines over layout width.<br />
1268 /// <since_tizen> 4 </since_tizen>
1269 public LineWrapMode LineWrapMode
1273 return (LineWrapMode)GetValue(LineWrapModeProperty);
1277 SetValue(LineWrapModeProperty, value);
1278 NotifyPropertyChanged();
1283 /// The direction of the text such as left to right or right to left.
1285 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1286 [EditorBrowsable(EditorBrowsableState.Never)]
1287 public TextDirection TextDirection
1291 int textDirection = 0;
1292 using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
1294 propertyValue.Get(out textDirection);
1296 return (TextDirection)textDirection;
1301 /// The vertical line alignment of the text.
1303 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1304 [EditorBrowsable(EditorBrowsableState.Never)]
1305 public VerticalLineAlignment VerticalLineAlignment
1309 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
1313 SetValue(VerticalLineAlignmentProperty, value);
1314 NotifyPropertyChanged();
1319 /// The text alignment to match the direction of the system language.
1321 /// <since_tizen> 6 </since_tizen>
1322 public bool MatchSystemLanguageDirection
1326 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1330 SetValue(MatchSystemLanguageDirectionProperty, value);
1331 NotifyPropertyChanged();
1336 /// The text fit parameters.<br />
1337 /// The textFit map contains the following keys :<br />
1338 /// <list type="table">
1339 /// <item><term>enable (bool)</term><description>True to enable the text fit or false to disable (the default value is false)</description></item>
1340 /// <item><term>minSize (float)</term><description>Minimum Size for text fit (the default value is 10.f)</description></item>
1341 /// <item><term>maxSize (float)</term><description>Maximum Size for text fit (the default value is 100.f)</description></item>
1342 /// <item><term>stepSize (float)</term><description>Step Size for font increase (the default value is 1.f)</description></item>
1343 /// <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>
1346 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1347 [EditorBrowsable(EditorBrowsableState.Never)]
1348 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1349 public PropertyMap TextFit
1353 return (PropertyMap)GetValue(TextFitProperty);
1357 SetValue(TextFitProperty, value);
1358 NotifyPropertyChanged();
1363 /// Set TextFit to TextLabel. <br />
1365 /// <param name="textFit">The TextFit</param>
1367 /// SetTextFit specifies the textFit of the text through <see cref="Tizen.NUI.Text.TextFit"/>. <br />
1370 /// The following example demonstrates how to use the SetTextFit method.
1372 /// var textFit = new Tizen.NUI.Text.TextFit();
1373 /// textFit.Enable = true;
1374 /// textFit.MinSize = 10.0f;
1375 /// textFit.MaxSize = 100.0f;
1376 /// textFit.StepSize = 5.0f;
1377 /// textFit.FontSizeType = FontSizeType.PointSize;
1378 /// label.SetTextFit(textFit);
1381 [EditorBrowsable(EditorBrowsableState.Never)]
1382 public void SetTextFit(TextFit textFit)
1384 using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
1386 SetValue(TextFitProperty, textFitMap);
1391 /// Get TextFit from TextLabel. <br />
1393 /// <returns>The TextFit</returns>
1395 /// TextFit is always returned based on PointSize. <br />
1396 /// If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned. <br />
1397 /// <see cref="Tizen.NUI.Text.TextFit"/>
1399 [EditorBrowsable(EditorBrowsableState.Never)]
1400 public TextFit GetTextFit()
1403 using (var textFitMap = (PropertyMap)GetValue(TextFitProperty))
1405 textFit = TextMapHelper.GetTextFitStruct(textFitMap);
1411 /// Set TextFitArray to TextLabel. <br />
1412 /// TextFitArray finds and applies the largest PointSize that fits among OptionList.
1414 /// <param name="textFitArray">The TextFitArray</param>
1416 /// TextFitArray tries binary search by default. <br />
1417 /// The precondition for TextFitArray to perform binary search is sorting in ascending order of MinLineSize. <br />
1418 /// Because if MinLineSize is not sorted in ascending order, <br />
1419 /// binary search cannot guarantee that it will always find the best value. <br />
1420 /// In this case, the search sequentially starts from the largest PointSize. <br />
1421 /// If TextFitArrayOption's MinLineSize is set to null or 0, <br />
1422 /// TextFitArray is calculated without applying MinLineSize. <br />
1423 /// If TextFitArray is enabled, TextLabel's MinLineSize property is ignored. <br />
1424 /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1427 /// The following example demonstrates how to use the SetTextFitArray method. <br />
1429 /// var textFitArray = new Tizen.NUI.Text.TextFitArray();
1430 /// textFitArray.Enable = true;
1431 /// textFitArray.OptionList = new List<Tizen.NUI.Text.TextFitArrayOption>()
1433 /// new Tizen.NUI.Text.TextFitArrayOption(12, 18),
1434 /// new Tizen.NUI.Text.TextFitArrayOption(24, 40),
1435 /// new Tizen.NUI.Text.TextFitArrayOption(28, 48),
1436 /// new Tizen.NUI.Text.TextFitArrayOption(32, 56),
1437 /// new Tizen.NUI.Text.TextFitArrayOption(50, 72),
1439 /// label.SetTextFitArray(textFitArray);
1442 /// The table below shows cases where binary search is possible and where it is not possible. <br />
1444 /// [Binary search possible]
1445 /// | | List index | 0 | 1 | 2 | 3 |
1446 /// | OptionList | PointSize | 24 | 28 | 32 | 48 |
1447 /// | | MinLineSize | 40 | 48 | 48 | 62 | << MinLineSize sorted in ascending order
1449 /// same values ​are not a problem
1451 /// [Binary search not possible]
1452 /// | | List index | 0 | 1 | 2 | 3 |
1453 /// | OptionList | PointSize | 24 | 28 | 32 | 48 |
1454 /// | | MinLineSize | 40 | 48 | 38 | 62 | << MinLineSize is not sorted in ascending order
1458 [EditorBrowsable(EditorBrowsableState.Never)]
1459 public void SetTextFitArray(TextFitArray textFitArray)
1461 bool enable = textFitArray.Enable;
1462 int optionListSize = textFitArray.OptionList?.Count ?? 0;
1464 float[] pointSizeArray = new float[optionListSize];
1465 float[] minLineSizeArray = new float[optionListSize];
1467 for (int i = 0 ; i < optionListSize ; i ++)
1469 TextFitArrayOption option = textFitArray.OptionList[i];
1470 pointSizeArray[i] = option.PointSize;
1471 minLineSizeArray[i] = option.MinLineSize ?? 0;
1474 Interop.TextLabel.SetTextFitArray(SwigCPtr, enable, (uint)optionListSize, pointSizeArray, minLineSizeArray);
1475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1479 /// Get TextFitArray from TextLabel.
1481 /// <returns>The TextFitArray</returns>
1483 /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1486 /// The following example demonstrates how to use the GetTextFitArray method. <br />
1488 /// Tizen.NUI.Text.TextFitArray textFitArray = label.GetTextFitArray();
1489 /// bool enable = textFitArray.Enable;
1490 /// var optionList = textFitArray.OptionList;
1491 /// foreach(Tizen.NUI.Text.TextFitArrayOption option in optionList)
1493 /// float pointSize = option.PointSize;
1494 /// float minLinesize = option.MinLineSize;
1498 [EditorBrowsable(EditorBrowsableState.Never)]
1499 public TextFitArray GetTextFitArray()
1501 using PropertyMap textFitArrayMap = new PropertyMap(Interop.TextLabel.GetTextFitArray(SwigCPtr), true);
1502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1504 TextFitArray textFitArray;
1505 textFitArray = TextUtils.GetMapToTextFitArray(textFitArrayMap);
1506 return textFitArray;
1510 /// The MinLineSize property.<br />
1511 /// The height of the line in points. <br />
1512 /// If the font size is larger than the line size, it works with the font size. <br />
1514 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1515 [EditorBrowsable(EditorBrowsableState.Never)]
1516 public float MinLineSize
1520 return (float)GetValue(MinLineSizeProperty);
1524 SetValue(MinLineSizeProperty, value);
1525 NotifyPropertyChanged();
1530 /// The spaces between characters in Pixels.
1532 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1533 /// The default value is 0.f which does nothing.
1536 [EditorBrowsable(EditorBrowsableState.Never)]
1537 public float CharacterSpacing
1541 return (float)GetValue(CharacterSpacingProperty);
1545 SetValue(CharacterSpacingProperty, value);
1546 NotifyPropertyChanged();
1551 /// The FontSizeScale property for scaling the specified font size up or down. <br />
1552 /// The default value is 1.0. <br />
1553 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
1554 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1556 /// <since_tizen> 9 </since_tizen>
1557 public float FontSizeScale
1561 return (float)GetValue(FontSizeScaleProperty);
1565 SetValue(FontSizeScaleProperty, value);
1566 NotifyPropertyChanged();
1570 private float InternalFontSizeScale
1574 return fontSizeScale;
1578 float newFontSizeScale;
1580 if (fontSizeScale == value) return;
1582 fontSizeScale = value;
1583 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1585 SystemSettingsFontSize systemSettingsFontSize;
1589 systemSettingsFontSize = SystemSettings.FontSize;
1593 Console.WriteLine("{0} Exception caught.", e);
1594 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1596 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1597 AddSystemSettingsFontSizeChanged();
1601 newFontSizeScale = fontSizeScale;
1602 RemoveSystemSettingsFontSizeChanged();
1605 SetInternalFontSizeScale(newFontSizeScale);
1609 private void SetInternalFontSizeScale(float fontSizeScale)
1612 Object.InternalSetPropertyFloat(this.SwigCPtr, TextLabel.Property.FontSizeScale, (float)fontSizeScale);
1617 /// The EnableFontSizeScale property.<br />
1618 /// Whether the font size scale is enabled. (The default value is true)
1620 [EditorBrowsable(EditorBrowsableState.Never)]
1621 public bool EnableFontSizeScale
1625 return (bool)GetValue(EnableFontSizeScaleProperty);
1629 SetValue(EnableFontSizeScaleProperty, value);
1630 NotifyPropertyChanged();
1634 private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData());
1637 /// Downcasts a handle to textLabel handle
1639 /// <param name="handle"></param>
1640 /// <returns></returns>
1641 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
1642 /// <since_tizen> 3 </since_tizen>
1643 /// Do not use this, that will be deprecated. Use as keyword instead.
1644 [Obsolete("Do not use this, that will be deprecated. Use as keyword instead. " +
1646 "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
1647 "TextLabel label = handle as TextLabel")]
1648 [EditorBrowsable(EditorBrowsableState.Never)]
1649 public static TextLabel DownCast(BaseHandle handle)
1653 throw new ArgumentNullException(nameof(handle));
1655 TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
1656 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1661 [EditorBrowsable(EditorBrowsableState.Never)]
1662 protected override void Dispose(DisposeTypes type)
1669 internalTextColor?.Dispose();
1671 if (hasSystemLanguageChanged)
1673 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
1676 RemoveSystemSettingsFontTypeChanged();
1677 RemoveSystemSettingsFontSizeChanged();
1679 if (type == DisposeTypes.Explicit)
1682 //Release your own managed resources here.
1683 //You should release all of your own disposable objects here.
1684 selectorData?.Reset(this);
1689 if (textLabelTextFitChangedCallbackDelegate != null)
1691 TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
1698 /// This will not be public opened.
1699 [EditorBrowsable(EditorBrowsableState.Never)]
1700 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1702 Interop.TextLabel.DeleteTextLabel(swigCPtr);
1706 /// Get attribues, it is abstract function and must be override.
1708 [EditorBrowsable(EditorBrowsableState.Never)]
1709 protected override ViewStyle CreateViewStyle()
1711 return new TextLabelStyle();
1714 internal override LayoutItem CreateDefaultLayout()
1716 return new TextLayout();
1720 /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1722 protected override void OnBindingContextChanged()
1724 base.OnBindingContextChanged();
1727 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1729 Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1732 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1734 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1735 SetInternalFontSizeScale(newFontSizeScale);
1738 private void AddSystemSettingsFontSizeChanged()
1740 if (hasSystemFontSizeChanged != true)
1744 SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
1745 hasSystemFontSizeChanged = true;
1749 Console.WriteLine("{0} Exception caught.", e);
1750 hasSystemFontSizeChanged = false;
1755 private void RemoveSystemSettingsFontSizeChanged()
1757 if (hasSystemFontSizeChanged == true)
1761 SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
1762 hasSystemFontSizeChanged = false;
1766 Console.WriteLine("{0} Exception caught.", e);
1767 hasSystemFontSizeChanged = true;
1772 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
1774 SetInternalFontFamily(e.Value);
1777 private void AddSystemSettingsFontTypeChanged()
1779 if (HasStyle() && !hasSystemFontTypeChanged)
1783 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
1784 hasSystemFontTypeChanged = true;
1788 Console.WriteLine("{0} Exception caught.", e);
1789 hasSystemFontTypeChanged = false;
1794 private void RemoveSystemSettingsFontTypeChanged()
1796 if (hasSystemFontTypeChanged)
1800 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
1801 hasSystemFontTypeChanged = false;
1805 Console.WriteLine("{0} Exception caught.", e);
1806 hasSystemFontTypeChanged = true;
1811 private void RequestLayout()
1813 Layout?.RequestLayout();
1816 internal new class Property
1818 internal static readonly int TEXT = Interop.TextLabel.TextGet();
1819 internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
1820 internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
1821 internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
1822 internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
1823 internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
1824 internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
1825 internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
1826 internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
1827 internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
1828 internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
1829 internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
1830 internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
1831 internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
1832 internal static readonly int RelativeLineHeight = Interop.TextLabel.RelativeLineHeightGet();
1833 internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
1834 internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
1835 internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
1836 internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
1837 internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
1838 internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
1839 internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
1840 internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
1841 internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
1842 internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
1843 internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
1844 internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
1845 internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
1846 internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
1847 internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
1848 internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet();
1849 internal static readonly int EnableFontSizeScale = Interop.TextLabel.EnableFontSizeScaleGet();
1850 internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
1851 internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
1852 internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
1854 internal static void Preload()
1856 // Do nothing. Just call for load static values.
1860 private void OnShadowColorChanged(float x, float y, float z, float w)
1862 ShadowColor = new Vector4(x, y, z, w);
1864 private void OnShadowOffsetChanged(float x, float y)
1866 ShadowOffset = new Vector2(x, y);
1868 private void OnTextColorChanged(float r, float g, float b, float a)
1870 TextColor = new Color(r, g, b, a);
1872 private void OnUnderlineColorChanged(float x, float y, float z, float w)
1874 UnderlineColor = new Vector4(x, y, z, w);