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;
111 private Color internalAnchorColor;
112 private Color internalAnchorClickedColor;
115 /// Creates the TextLabel control.
117 /// <since_tizen> 3 </since_tizen>
118 public TextLabel() : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, viewStyle)
130 /// Creates the TextLabel with setting the status of shown or hidden.
132 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
133 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public TextLabel(bool shown) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142 /// Creates the TextLabel control.
144 /// <param name="text">The text to display</param>
145 /// <since_tizen> 3 </since_tizen>
146 public TextLabel(string text) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149 textIsEmpty = string.IsNullOrEmpty(text);
153 /// Creates the TextLabel with setting the status of shown or hidden.
155 /// <param name="text">The text to display</param>
156 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
157 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 textIsEmpty = string.IsNullOrEmpty(text);
166 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
174 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
182 private bool HasStyle()
184 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
188 /// The TranslatableText property.<br />
189 /// The text can set the SID value.<br />
191 /// <exception cref='ArgumentNullException'>
192 /// ResourceManager about multilingual is null.
194 /// <since_tizen> 4 </since_tizen>
195 public string TranslatableText
199 return (string)GetValue(TranslatableTextProperty);
203 SetValue(TranslatableTextProperty, value);
206 private string translatableText
214 if (NUIApplication.MultilingualResourceManager == null)
216 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
218 string translatableText = null;
219 textLabelSid = value;
220 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
221 if (translatableText != null)
223 Text = translatableText;
224 if (hasSystemLanguageChanged == false)
226 systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
227 hasSystemLanguageChanged = true;
234 NotifyPropertyChanged();
239 /// The Text property.<br />
240 /// The text to display in the UTF-8 format.<br />
242 /// <since_tizen> 3 </since_tizen>
247 return (string)GetValue(TextProperty);
251 SetValue(TextProperty, value);
252 NotifyPropertyChanged();
257 /// The FontFamily property.<br />
258 /// The requested font family to use.<br />
260 /// <since_tizen> 3 </since_tizen>
261 public string FontFamily
265 return (string)GetValue(FontFamilyProperty);
269 SetValue(FontFamilyProperty, value);
270 NotifyPropertyChanged();
274 private string InternalFontFamily
281 return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
285 string newFontFamily;
287 if (string.Equals(fontFamily, value)) return;
290 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
294 newFontFamily = SystemSettings.FontType;
298 Console.WriteLine("{0} Exception caught.", e);
299 newFontFamily = defaultFontFamily;
301 AddSystemSettingsFontTypeChanged();
305 newFontFamily = fontFamily;
306 RemoveSystemSettingsFontTypeChanged();
309 SetInternalFontFamily(newFontFamily);
313 private void SetInternalFontFamily(string fontFamily)
315 Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
320 /// The FontStyle property.<br />
321 /// The requested font style to use.<br />
322 /// The fontStyle map contains the following keys :<br />
323 /// <list type="table">
324 /// <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>
325 /// <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>
326 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
329 /// <since_tizen> 3 </since_tizen>
330 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
331 public PropertyMap FontStyle
335 return (PropertyMap)GetValue(FontStyleProperty);
339 SetValue(FontStyleProperty, value);
340 NotifyPropertyChanged();
345 /// Set FontStyle to TextLabel. <br />
347 /// <param name="fontStyle">The FontStyle</param>
349 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
352 /// The following example demonstrates how to use the SetFontStyle method.
354 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
355 /// fontStyle.Width = FontWidthType.Expanded;
356 /// fontStyle.Weight = FontWeightType.Bold;
357 /// fontStyle.Slant = FontSlantType.Italic;
358 /// label.SetFontStyle(fontStyle);
361 [EditorBrowsable(EditorBrowsableState.Never)]
362 public void SetFontStyle(FontStyle fontStyle)
364 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
366 SetValue(FontStyleProperty, fontStyleMap);
371 /// Get FontStyle from TextLabel. <br />
373 /// <returns>The FontStyle</returns>
375 /// <see cref="Tizen.NUI.Text.FontStyle"/>
377 [EditorBrowsable(EditorBrowsableState.Never)]
378 public FontStyle GetFontStyle()
381 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
383 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
389 /// The PointSize property.<br />
390 /// The size of font in points.<br />
392 /// <since_tizen> 3 </since_tizen>
393 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
394 public float PointSize
398 return (float)GetValue(PointSizeProperty);
402 SetValue(PointSizeProperty, value);
403 NotifyPropertyChanged();
408 /// The MultiLine property.<br />
409 /// The single-line or multi-line layout option.<br />
411 /// <since_tizen> 3 </since_tizen>
412 public bool MultiLine
416 return (bool)GetValue(MultiLineProperty);
420 SetValue(MultiLineProperty, value);
421 NotifyPropertyChanged();
426 /// The HorizontalAlignment property.<br />
427 /// The line horizontal alignment.<br />
429 /// <since_tizen> 3 </since_tizen>
430 public HorizontalAlignment HorizontalAlignment
434 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
438 SetValue(HorizontalAlignmentProperty, value);
439 NotifyPropertyChanged();
444 /// The VerticalAlignment property.<br />
445 /// The line vertical alignment.<br />
447 /// <since_tizen> 3 </since_tizen>
448 public VerticalAlignment VerticalAlignment
452 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
456 SetValue(VerticalAlignmentProperty, value);
457 NotifyPropertyChanged();
462 /// The TextColor property.<br />
463 /// The color of the text.<br />
464 /// Animation framework can be used to change the color of the text when not using mark up.<br />
465 /// Cannot animate the color when text is auto scrolling.<br />
468 /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
470 /// <since_tizen> 3 </since_tizen>
471 public Color TextColor
475 Color temp = (Color)GetValue(TextColorProperty);
476 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
480 SetValue(TextColorProperty, value);
481 NotifyPropertyChanged();
486 /// The ShadowOffset property.<br />
487 /// The drop shadow offset 0 indicates no shadow.<br />
489 /// <since_tizen> 3 </since_tizen>
491 /// Deprecated.(API Level 6) Use Shadow instead.
492 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
494 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
495 public Vector2 ShadowOffset
499 return GetValue(ShadowOffsetProperty) as Vector2;
503 SetValue(ShadowOffsetProperty, value);
507 private Vector2 InternalShadowOffset
511 float x = 0.0f, y = 0.0f;
512 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "offset"))
513 using (var shadowOffset = new Vector2())
515 if (null != propertyValue)
517 propertyValue.Get(shadowOffset);
522 return new Vector2(OnShadowOffsetChanged, x, y);
526 using (var map = new PropertyMap())
528 map.Add("offset", value);
530 var shadowMap = Shadow;
531 shadowMap.Merge(map);
533 SetValue(ShadowProperty, shadowMap);
534 NotifyPropertyChanged();
540 /// The ShadowColor property.<br />
541 /// The color of a drop shadow.<br />
543 /// <since_tizen> 3 </since_tizen>
545 /// Deprecated.(API Level 6) Use Shadow instead.
546 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
548 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
549 public Vector4 ShadowColor
553 return GetValue(ShadowColorProperty) as Vector4;
557 SetValue(ShadowColorProperty, value);
561 private Vector4 InternalShadowColor
565 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
566 using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "color"))
567 using (var shadowColor = new Vector4())
569 if (null != propertyValue)
571 propertyValue.Get(shadowColor);
578 return new Vector4(OnShadowColorChanged, x, y, z, w);
582 using (var map = new PropertyMap())
584 map.Add("color", value);
585 var shadowMap = Shadow;
586 shadowMap.Merge(map);
587 SetValue(ShadowProperty, shadowMap);
588 NotifyPropertyChanged();
594 /// The UnderlineEnabled property.<br />
595 /// The underline enabled flag.<br />
597 /// <since_tizen> 3 </since_tizen>
599 /// Deprecated.(API Level 6) Use Underline instead.
601 [Obsolete("Do not use this UnderlineEnabled(Deprecated). Use Underline instead.")]
602 public bool UnderlineEnabled
606 return (bool)GetValue(UnderlineEnabledProperty);
610 SetValue(UnderlineEnabledProperty, value);
614 private bool InternalUnderlineEnabled
618 bool underlineEnabled = false;
619 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "enable"))
621 if (propertyValue != null)
623 propertyValue.Get(out underlineEnabled);
626 return underlineEnabled;
630 using (var map = new PropertyMap())
632 map.Add("enable", value);
633 var undelineMap = Underline;
634 undelineMap.Merge(map);
635 SetValue(UnderlineProperty, undelineMap);
636 NotifyPropertyChanged();
642 /// The UnderlineColor property.<br />
643 /// Overrides the underline height from font metrics.<br />
645 /// <since_tizen> 3 </since_tizen>
647 /// Deprecated.(API Level 6) Use Underline instead.
648 /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
650 [Obsolete("Do not use this UnderlineColor(Deprecated). Use Underline instead.")]
651 public Vector4 UnderlineColor
655 return GetValue(UnderlineColorProperty) as Vector4;
659 SetValue(UnderlineColorProperty, value);
663 private Vector4 InternalUnderlineColor
667 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
668 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "color"))
669 using (var underlineColor = new Vector4())
671 if (null != propertyValue)
673 propertyValue.Get(underlineColor);
674 x = underlineColor.X;
675 y = underlineColor.Y;
676 z = underlineColor.Z;
677 w = underlineColor.W;
680 return new Vector4(OnUnderlineColorChanged, x, y, z, w);
684 using (var map = new PropertyMap())
686 map.Add("color", value);
687 var undelineMap = Underline;
688 undelineMap.Merge(map);
689 SetValue(UnderlineProperty, undelineMap);
690 NotifyPropertyChanged();
696 /// The UnderlineHeight property.<br />
697 /// Overrides the underline height from font metrics.<br />
699 /// <since_tizen> 3 </since_tizen>
701 /// Deprecated.(API Level 6) Use Underline instead.
703 [Obsolete("Do not use this UnderlineHeight(Deprecated). Use Underline instead.")]
704 public float UnderlineHeight
708 return (float)GetValue(UnderlineHeightProperty);
712 SetValue(UnderlineHeightProperty, value);
716 private float InternalUnderlineHeight
720 float underlineHeight = 0.0f;
721 using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "height"))
723 if (null != propertyValue)
725 propertyValue.Get(out underlineHeight);
728 return underlineHeight;
732 using (var map = new PropertyMap())
734 map.Add("height", value);
735 var undelineMap = Underline;
736 undelineMap.Merge(map);
737 SetValue(UnderlineProperty, undelineMap);
738 NotifyPropertyChanged();
744 /// The EnableMarkup property.<br />
745 /// Whether the mark-up processing is enabled.<br />
747 /// <since_tizen> 3 </since_tizen>
748 public bool EnableMarkup
752 return (bool)GetValue(EnableMarkupProperty);
756 SetValue(EnableMarkupProperty, value);
757 NotifyPropertyChanged();
762 /// The EnableAutoScroll property.<br />
763 /// Starts or stops auto scrolling.<br />
765 /// <since_tizen> 3 </since_tizen>
766 public bool EnableAutoScroll
770 return (bool)GetValue(EnableAutoScrollProperty);
774 SetValue(EnableAutoScrollProperty, value);
775 NotifyPropertyChanged();
780 /// The AutoScrollSpeed property.<br />
781 /// Sets the speed of scrolling in pixels per second.<br />
783 /// <since_tizen> 3 </since_tizen>
784 public int AutoScrollSpeed
788 return (int)GetValue(AutoScrollSpeedProperty);
792 SetValue(AutoScrollSpeedProperty, value);
793 NotifyPropertyChanged();
798 /// The AutoScrollLoopCount property.<br />
799 /// Number of complete loops when scrolling enabled.<br />
801 /// <since_tizen> 3 </since_tizen>
802 public int AutoScrollLoopCount
806 return (int)GetValue(AutoScrollLoopCountProperty);
810 SetValue(AutoScrollLoopCountProperty, value);
811 NotifyPropertyChanged();
816 /// The AutoScrollGap property.<br />
817 /// Gap before scrolling wraps.<br />
819 /// <since_tizen> 3 </since_tizen>
820 public float AutoScrollGap
824 return (float)GetValue(AutoScrollGapProperty);
828 SetValue(AutoScrollGapProperty, value);
829 NotifyPropertyChanged();
834 /// The LineSpacing property.<br />
835 /// The default extra space between lines in points.<br />
837 /// <since_tizen> 3 </since_tizen>
838 public float LineSpacing
842 return (float)GetValue(LineSpacingProperty);
846 SetValue(LineSpacingProperty, value);
847 NotifyPropertyChanged();
852 /// The relative height of the line (a factor that will be multiplied by text height). <br />
853 /// If the value is less than 1, the lines could to be overlapped.
855 [EditorBrowsable(EditorBrowsableState.Never)]
856 public float RelativeLineHeight
860 return (float)GetValue(RelativeLineHeightProperty);
864 SetValue(RelativeLineHeightProperty, value);
865 NotifyPropertyChanged();
870 /// The Underline property.<br />
871 /// The default underline parameters.<br />
872 /// The underline map contains the following keys :<br />
873 /// <list type="table">
874 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
875 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
876 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
879 /// <since_tizen> 3 </since_tizen>
880 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
881 public PropertyMap Underline
885 return (PropertyMap)GetValue(UnderlineProperty);
889 SetValue(UnderlineProperty, value);
890 NotifyPropertyChanged();
895 /// Set Underline to TextLabel. <br />
897 /// <param name="underline">The Underline</param>
899 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
902 /// The following example demonstrates how to use the SetUnderline method.
904 /// var underline = new Tizen.NUI.Text.Underline();
905 /// underline.Enable = true;
906 /// underline.Color = new Color("#3498DB");
907 /// underline.Height = 2.0f;
908 /// label.SetUnderline(underline);
911 [EditorBrowsable(EditorBrowsableState.Never)]
912 public void SetUnderline(Underline underline)
914 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
916 SetValue(UnderlineProperty, underlineMap);
921 /// Get Underline from TextLabel. <br />
923 /// <returns>The Underline</returns>
925 /// <see cref="Tizen.NUI.Text.Underline"/>
927 [EditorBrowsable(EditorBrowsableState.Never)]
928 public Underline GetUnderline()
931 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
933 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
939 /// The Shadow property.<br />
940 /// The default shadow parameters.<br />
941 /// The shadow map contains the following keys :<br />
942 /// <list type="table">
943 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
944 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
945 /// <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>
948 /// <since_tizen> 3 </since_tizen>
949 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
950 public PropertyMap Shadow
954 return (PropertyMap)GetValue(ShadowProperty);
958 SetValue(ShadowProperty, value);
959 NotifyPropertyChanged();
964 /// Set Shadow to TextLabel. <br />
966 /// <param name="shadow">The Shadow</param>
968 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
971 /// The following example demonstrates how to use the SetShadow method.
973 /// var shadow = new Tizen.NUI.Text.Shadow();
974 /// shadow.Offset = new Vector2(3, 3);
975 /// shadow.Color = new Color("#F1C40F");
976 /// shadow.BlurRadius = 4.0f;
977 /// label.SetShadow(shadow);
980 [EditorBrowsable(EditorBrowsableState.Never)]
981 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
983 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
985 SetValue(ShadowProperty, shadowMap);
990 /// Get Shadow from TextLabel. <br />
992 /// <returns>The Shadow</returns>
994 /// <see cref="Tizen.NUI.Text.Shadow"/>
996 [EditorBrowsable(EditorBrowsableState.Never)]
997 public Tizen.NUI.Text.Shadow GetShadow()
999 Tizen.NUI.Text.Shadow shadow;
1000 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1002 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1008 /// Describes a text shadow for a TextLabel.
1009 /// It is null by default.
1011 [EditorBrowsable(EditorBrowsableState.Never)]
1012 public TextShadow TextShadow
1016 return (TextShadow)GetValue(TextShadowProperty);
1020 SetValue(TextShadowProperty, value);
1021 NotifyPropertyChanged();
1026 /// The Emboss property.<br />
1027 /// The default emboss parameters.<br />
1029 /// <since_tizen> 3 </since_tizen>
1030 public string Emboss
1034 return (string)GetValue(EmbossProperty);
1038 SetValue(EmbossProperty, value);
1039 NotifyPropertyChanged();
1044 /// The Outline property.<br />
1045 /// The default outline parameters.<br />
1046 /// The outline map contains the following keys :<br />
1047 /// <list type="table">
1048 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1049 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1052 /// <since_tizen> 3 </since_tizen>
1053 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1054 public PropertyMap Outline
1058 return (PropertyMap)GetValue(OutlineProperty);
1062 SetValue(OutlineProperty, value);
1063 NotifyPropertyChanged();
1068 /// Set Outline to TextLabel. <br />
1070 /// <param name="outline">The Outline</param>
1072 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1075 /// The following example demonstrates how to use the SetOutline method.
1077 /// var outline = new Tizen.NUI.Text.Outline();
1078 /// outline.Width = 2.0f;
1079 /// outline.Color = new Color("#45B39D");
1080 /// label.SetOutline(outline);
1083 [EditorBrowsable(EditorBrowsableState.Never)]
1084 public void SetOutline(Outline outline)
1086 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1088 SetValue(OutlineProperty, outlineMap);
1093 /// Get Outline from TextLabel. <br />
1095 /// <returns>The Outline</returns>
1097 /// <see cref="Tizen.NUI.Text.Outline"/>
1099 [EditorBrowsable(EditorBrowsableState.Never)]
1100 public Outline GetOutline()
1103 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1105 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1111 /// Set Strikethrough to TextLabel. <br />
1113 /// <param name="strikethrough">The Strikethrough</param>
1115 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1118 /// The following example demonstrates how to use the SetStrikethrough method.
1120 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1121 /// strikethrough.Enable = true;
1122 /// strikethrough.Color = new Color("#3498DB");
1123 /// strikethrough.Height = 2.0f;
1124 /// label.SetStrikethrough(strikethrough);
1127 [EditorBrowsable(EditorBrowsableState.Never)]
1128 public void SetStrikethrough(Strikethrough strikethrough)
1130 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1131 using (var propertyValue = new PropertyValue(map))
1133 SetProperty(TextLabel.Property.Strikethrough, propertyValue);
1138 /// Get Strikethrough from TextLabel. <br />
1140 /// <returns>The Strikethrough</returns>
1142 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1144 [EditorBrowsable(EditorBrowsableState.Never)]
1145 public Strikethrough GetStrikethrough()
1147 Strikethrough strikethrough;
1148 using (var propertyValue = GetProperty(TextLabel.Property.Strikethrough))
1149 using (var map = new PropertyMap())
1151 propertyValue.Get(map);
1152 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1154 return strikethrough;
1158 /// The PixelSize property.<br />
1159 /// The size of font in pixels.<br />
1161 /// <since_tizen> 3 </since_tizen>
1162 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1163 public float PixelSize
1167 return (float)GetValue(PixelSizeProperty);
1171 SetValue(PixelSizeProperty, value);
1172 NotifyPropertyChanged();
1177 /// The Ellipsis property.<br />
1178 /// Enable or disable the ellipsis.<br />
1180 /// <since_tizen> 3 </since_tizen>
1181 public bool Ellipsis
1185 return (bool)GetValue(EllipsisProperty);
1189 SetValue(EllipsisProperty, value);
1190 NotifyPropertyChanged();
1195 /// The ellipsis position of the text.
1196 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1198 /// <since_tizen> 9 </since_tizen>
1199 public EllipsisPosition EllipsisPosition
1203 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1207 SetValue(EllipsisPositionProperty, value);
1208 NotifyPropertyChanged();
1213 /// The AutoScrollLoopDelay property.<br />
1214 /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
1216 /// <since_tizen> 3 </since_tizen>
1217 public float AutoScrollLoopDelay
1221 return (float)GetValue(AutoScrollLoopDelayProperty);
1225 SetValue(AutoScrollLoopDelayProperty, value);
1226 NotifyPropertyChanged();
1231 /// The AutoScrollStopMode property.<br />
1232 /// The auto scrolling stop behaviour.<br />
1233 /// The default value is AutoScrollStopMode.FinishLoop. <br />
1235 /// <since_tizen> 3 </since_tizen>
1236 public AutoScrollStopMode AutoScrollStopMode
1240 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
1244 SetValue(AutoScrollStopModeProperty, value);
1245 NotifyPropertyChanged();
1250 /// The line count of the text.
1252 /// <since_tizen> 3 </since_tizen>
1253 public int LineCount
1258 using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
1260 propertyValue.Get(out lineCount);
1267 /// The LineWrapMode property.<br />
1268 /// line wrap mode when the text lines over layout width.<br />
1270 /// <since_tizen> 4 </since_tizen>
1271 public LineWrapMode LineWrapMode
1275 return (LineWrapMode)GetValue(LineWrapModeProperty);
1279 SetValue(LineWrapModeProperty, value);
1280 NotifyPropertyChanged();
1285 /// The direction of the text such as left to right or right to left.
1287 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1288 [EditorBrowsable(EditorBrowsableState.Never)]
1289 public TextDirection TextDirection
1293 int textDirection = 0;
1294 using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
1296 propertyValue.Get(out textDirection);
1298 return (TextDirection)textDirection;
1303 /// The vertical line alignment of the text.
1305 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1306 [EditorBrowsable(EditorBrowsableState.Never)]
1307 public VerticalLineAlignment VerticalLineAlignment
1311 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
1315 SetValue(VerticalLineAlignmentProperty, value);
1316 NotifyPropertyChanged();
1321 /// The text alignment to match the direction of the system language.
1323 /// <since_tizen> 6 </since_tizen>
1324 public bool MatchSystemLanguageDirection
1328 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1332 SetValue(MatchSystemLanguageDirectionProperty, value);
1333 NotifyPropertyChanged();
1338 /// The text fit parameters.<br />
1339 /// The textFit map contains the following keys :<br />
1340 /// <list type="table">
1341 /// <item><term>enable (bool)</term><description>True to enable the text fit or false to disable (the default value is false)</description></item>
1342 /// <item><term>minSize (float)</term><description>Minimum Size for text fit (the default value is 10.f)</description></item>
1343 /// <item><term>maxSize (float)</term><description>Maximum Size for text fit (the default value is 100.f)</description></item>
1344 /// <item><term>stepSize (float)</term><description>Step Size for font increase (the default value is 1.f)</description></item>
1345 /// <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>
1348 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1349 [EditorBrowsable(EditorBrowsableState.Never)]
1350 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1351 public PropertyMap TextFit
1355 return (PropertyMap)GetValue(TextFitProperty);
1359 SetValue(TextFitProperty, value);
1360 NotifyPropertyChanged();
1365 /// Set TextFit to TextLabel. <br />
1367 /// <param name="textFit">The TextFit</param>
1369 /// SetTextFit specifies the textFit of the text through <see cref="Tizen.NUI.Text.TextFit"/>. <br />
1372 /// The following example demonstrates how to use the SetTextFit method.
1374 /// var textFit = new Tizen.NUI.Text.TextFit();
1375 /// textFit.Enable = true;
1376 /// textFit.MinSize = 10.0f;
1377 /// textFit.MaxSize = 100.0f;
1378 /// textFit.StepSize = 5.0f;
1379 /// textFit.FontSizeType = FontSizeType.PointSize;
1380 /// label.SetTextFit(textFit);
1383 [EditorBrowsable(EditorBrowsableState.Never)]
1384 public void SetTextFit(TextFit textFit)
1386 using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
1388 SetValue(TextFitProperty, textFitMap);
1393 /// Get TextFit from TextLabel. <br />
1395 /// <returns>The TextFit</returns>
1397 /// TextFit is always returned based on PointSize. <br />
1398 /// If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned. <br />
1399 /// <see cref="Tizen.NUI.Text.TextFit"/>
1401 [EditorBrowsable(EditorBrowsableState.Never)]
1402 public TextFit GetTextFit()
1405 using (var textFitMap = (PropertyMap)GetValue(TextFitProperty))
1407 textFit = TextMapHelper.GetTextFitStruct(textFitMap);
1413 /// Set TextFitArray to TextLabel. <br />
1414 /// TextFitArray finds and applies the largest PointSize that fits among OptionList.
1416 /// <param name="textFitArray">The TextFitArray</param>
1418 /// TextFitArray tries binary search by default. <br />
1419 /// The precondition for TextFitArray to perform binary search is sorting in ascending order of MinLineSize. <br />
1420 /// Because if MinLineSize is not sorted in ascending order, <br />
1421 /// binary search cannot guarantee that it will always find the best value. <br />
1422 /// In this case, the search sequentially starts from the largest PointSize. <br />
1423 /// If TextFitArrayOption's MinLineSize is set to null or 0, <br />
1424 /// TextFitArray is calculated without applying MinLineSize. <br />
1425 /// If TextFitArray is enabled, TextLabel's MinLineSize property is ignored. <br />
1426 /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1429 /// The following example demonstrates how to use the SetTextFitArray method. <br />
1431 /// var textFitArray = new Tizen.NUI.Text.TextFitArray();
1432 /// textFitArray.Enable = true;
1433 /// textFitArray.OptionList = new List<Tizen.NUI.Text.TextFitArrayOption>()
1435 /// new Tizen.NUI.Text.TextFitArrayOption(12, 18),
1436 /// new Tizen.NUI.Text.TextFitArrayOption(24, 40),
1437 /// new Tizen.NUI.Text.TextFitArrayOption(28, 48),
1438 /// new Tizen.NUI.Text.TextFitArrayOption(32, 56),
1439 /// new Tizen.NUI.Text.TextFitArrayOption(50, 72),
1441 /// label.SetTextFitArray(textFitArray);
1444 /// The table below shows cases where binary search is possible and where it is not possible. <br />
1446 /// [Binary search possible]
1447 /// | | List index | 0 | 1 | 2 | 3 |
1448 /// | OptionList | PointSize | 24 | 28 | 32 | 48 |
1449 /// | | MinLineSize | 40 | 48 | 48 | 62 | << MinLineSize sorted in ascending order
1451 /// same values ​are not a problem
1453 /// [Binary search not possible]
1454 /// | | List index | 0 | 1 | 2 | 3 |
1455 /// | OptionList | PointSize | 24 | 28 | 32 | 48 |
1456 /// | | MinLineSize | 40 | 48 | 38 | 62 | << MinLineSize is not sorted in ascending order
1460 [EditorBrowsable(EditorBrowsableState.Never)]
1461 public void SetTextFitArray(TextFitArray textFitArray)
1463 bool enable = textFitArray.Enable;
1464 int optionListSize = textFitArray.OptionList?.Count ?? 0;
1466 float[] pointSizeArray = new float[optionListSize];
1467 float[] minLineSizeArray = new float[optionListSize];
1469 for (int i = 0 ; i < optionListSize ; i ++)
1471 TextFitArrayOption option = textFitArray.OptionList[i];
1472 pointSizeArray[i] = option.PointSize;
1473 minLineSizeArray[i] = option.MinLineSize ?? 0;
1476 Interop.TextLabel.SetTextFitArray(SwigCPtr, enable, (uint)optionListSize, pointSizeArray, minLineSizeArray);
1477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1481 /// Get TextFitArray from TextLabel.
1483 /// <returns>The TextFitArray</returns>
1485 /// See <see cref="Tizen.NUI.Text.TextFitArray"/> and <see cref="Tizen.NUI.Text.TextFitArrayOption"/>.
1488 /// The following example demonstrates how to use the GetTextFitArray method. <br />
1490 /// Tizen.NUI.Text.TextFitArray textFitArray = label.GetTextFitArray();
1491 /// bool enable = textFitArray.Enable;
1492 /// var optionList = textFitArray.OptionList;
1493 /// foreach(Tizen.NUI.Text.TextFitArrayOption option in optionList)
1495 /// float pointSize = option.PointSize;
1496 /// float minLinesize = option.MinLineSize;
1500 [EditorBrowsable(EditorBrowsableState.Never)]
1501 public TextFitArray GetTextFitArray()
1503 using PropertyMap textFitArrayMap = new PropertyMap(Interop.TextLabel.GetTextFitArray(SwigCPtr), true);
1504 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1506 TextFitArray textFitArray;
1507 textFitArray = TextUtils.GetMapToTextFitArray(textFitArrayMap);
1508 return textFitArray;
1512 /// The MinLineSize property.<br />
1513 /// The height of the line in points. <br />
1514 /// If the font size is larger than the line size, it works with the font size. <br />
1516 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1517 [EditorBrowsable(EditorBrowsableState.Never)]
1518 public float MinLineSize
1522 return (float)GetValue(MinLineSizeProperty);
1526 SetValue(MinLineSizeProperty, value);
1527 NotifyPropertyChanged();
1532 /// The spaces between characters in Pixels.
1534 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1535 /// The default value is 0.f which does nothing.
1538 [EditorBrowsable(EditorBrowsableState.Never)]
1539 public float CharacterSpacing
1543 return (float)GetValue(CharacterSpacingProperty);
1547 SetValue(CharacterSpacingProperty, value);
1548 NotifyPropertyChanged();
1553 /// The AnchorColor property.<br />
1554 /// The color of the anchor.<br />
1555 /// This property is used as the default color of the markup anchor tag.<br />
1556 /// If there is a color attribute in the markup anchor tag, the markup attribute takes precedence.
1559 /// The property cascade chaining set is possible. For example, this (textLabel.AnchorColor.X = 0.1f;) is possible.
1561 [EditorBrowsable(EditorBrowsableState.Never)]
1562 public Color AnchorColor
1566 Color color = (Color)GetValue(AnchorColorProperty);
1567 return new Color(OnAnchorColorChanged, color.R, color.G, color.B, color.A);
1571 SetValue(AnchorColorProperty, value);
1572 NotifyPropertyChanged();
1577 /// The AnchorClickedColor property.<br />
1578 /// The color of the clicked anchor.<br />
1579 /// This property is used as the default clicked color of the markup anchor tag.<br />
1580 /// If there is a color attribute in the markup anchor tag, the markup attribute takes precedence.
1583 /// The property cascade chaining set is possible. For example, this (textLabel.AnchorClickedColor.X = 0.1f;) is possible.
1585 [EditorBrowsable(EditorBrowsableState.Never)]
1586 public Color AnchorClickedColor
1590 Color color = (Color)GetValue(AnchorClickedColorProperty);
1591 return new Color(OnAnchorClickedColorChanged, color.R, color.G, color.B, color.A);
1595 SetValue(AnchorClickedColorProperty, value);
1596 NotifyPropertyChanged();
1601 /// The FontSizeScale property for scaling the specified font size up or down. <br />
1602 /// The default value is 1.0. <br />
1603 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
1604 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1606 /// <since_tizen> 9 </since_tizen>
1607 public float FontSizeScale
1611 return (float)GetValue(FontSizeScaleProperty);
1615 SetValue(FontSizeScaleProperty, value);
1616 NotifyPropertyChanged();
1620 private float InternalFontSizeScale
1624 return fontSizeScale;
1628 float newFontSizeScale;
1630 if (fontSizeScale == value) return;
1632 fontSizeScale = value;
1633 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1635 SystemSettingsFontSize systemSettingsFontSize;
1639 systemSettingsFontSize = SystemSettings.FontSize;
1643 Console.WriteLine("{0} Exception caught.", e);
1644 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1646 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1647 AddSystemSettingsFontSizeChanged();
1651 newFontSizeScale = fontSizeScale;
1652 RemoveSystemSettingsFontSizeChanged();
1655 SetInternalFontSizeScale(newFontSizeScale);
1659 private void SetInternalFontSizeScale(float fontSizeScale)
1662 Object.InternalSetPropertyFloat(this.SwigCPtr, TextLabel.Property.FontSizeScale, (float)fontSizeScale);
1667 /// The EnableFontSizeScale property.<br />
1668 /// Whether the font size scale is enabled. (The default value is true)
1670 [EditorBrowsable(EditorBrowsableState.Never)]
1671 public bool EnableFontSizeScale
1675 return (bool)GetValue(EnableFontSizeScaleProperty);
1679 SetValue(EnableFontSizeScaleProperty, value);
1680 NotifyPropertyChanged();
1684 private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData());
1687 /// Downcasts a handle to textLabel handle
1689 /// <param name="handle"></param>
1690 /// <returns></returns>
1691 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
1692 /// <since_tizen> 3 </since_tizen>
1693 /// Do not use this, that will be deprecated. Use as keyword instead.
1694 [Obsolete("Do not use this, that will be deprecated. Use as keyword instead. " +
1696 "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
1697 "TextLabel label = handle as TextLabel")]
1698 [EditorBrowsable(EditorBrowsableState.Never)]
1699 public static TextLabel DownCast(BaseHandle handle)
1703 throw new ArgumentNullException(nameof(handle));
1705 TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
1706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1711 [EditorBrowsable(EditorBrowsableState.Never)]
1712 protected override void Dispose(DisposeTypes type)
1719 internalTextColor?.Dispose();
1720 internalAnchorColor?.Dispose();
1721 internalAnchorClickedColor?.Dispose();
1723 if (hasSystemLanguageChanged)
1725 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
1728 RemoveSystemSettingsFontTypeChanged();
1729 RemoveSystemSettingsFontSizeChanged();
1731 if (type == DisposeTypes.Explicit)
1734 //Release your own managed resources here.
1735 //You should release all of your own disposable objects here.
1736 selectorData?.Reset(this);
1741 if (textLabelTextFitChangedCallbackDelegate != null)
1743 TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
1750 /// This will not be public opened.
1751 [EditorBrowsable(EditorBrowsableState.Never)]
1752 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1754 Interop.TextLabel.DeleteTextLabel(swigCPtr);
1758 /// Get attribues, it is abstract function and must be override.
1760 [EditorBrowsable(EditorBrowsableState.Never)]
1761 protected override ViewStyle CreateViewStyle()
1763 return new TextLabelStyle();
1766 internal override LayoutItem CreateDefaultLayout()
1768 return new TextLayout();
1772 /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1774 protected override void OnBindingContextChanged()
1776 base.OnBindingContextChanged();
1779 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1781 Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1784 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1786 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1787 SetInternalFontSizeScale(newFontSizeScale);
1790 private void AddSystemSettingsFontSizeChanged()
1792 if (hasSystemFontSizeChanged != true)
1796 SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
1797 hasSystemFontSizeChanged = true;
1801 Console.WriteLine("{0} Exception caught.", e);
1802 hasSystemFontSizeChanged = false;
1807 private void RemoveSystemSettingsFontSizeChanged()
1809 if (hasSystemFontSizeChanged == true)
1813 SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
1814 hasSystemFontSizeChanged = false;
1818 Console.WriteLine("{0} Exception caught.", e);
1819 hasSystemFontSizeChanged = true;
1824 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
1826 SetInternalFontFamily(e.Value);
1829 private void AddSystemSettingsFontTypeChanged()
1831 if (HasStyle() && !hasSystemFontTypeChanged)
1835 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
1836 hasSystemFontTypeChanged = true;
1840 Console.WriteLine("{0} Exception caught.", e);
1841 hasSystemFontTypeChanged = false;
1846 private void RemoveSystemSettingsFontTypeChanged()
1848 if (hasSystemFontTypeChanged)
1852 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
1853 hasSystemFontTypeChanged = false;
1857 Console.WriteLine("{0} Exception caught.", e);
1858 hasSystemFontTypeChanged = true;
1863 private void RequestLayout()
1865 Layout?.RequestLayout();
1868 internal new class Property
1870 internal static readonly int TEXT = Interop.TextLabel.TextGet();
1871 internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
1872 internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
1873 internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
1874 internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
1875 internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
1876 internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
1877 internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
1878 internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
1879 internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
1880 internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
1881 internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
1882 internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
1883 internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
1884 internal static readonly int RelativeLineHeight = Interop.TextLabel.RelativeLineHeightGet();
1885 internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
1886 internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
1887 internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
1888 internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
1889 internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
1890 internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
1891 internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
1892 internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
1893 internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
1894 internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
1895 internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
1896 internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
1897 internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
1898 internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
1899 internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
1900 internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet();
1901 internal static readonly int EnableFontSizeScale = Interop.TextLabel.EnableFontSizeScaleGet();
1902 internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
1903 internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
1904 internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
1905 internal static readonly int AnchorColor = Interop.TextLabel.AnchorColorGet();
1906 internal static readonly int AnchorClickedColor = Interop.TextLabel.AnchorClickedColorGet();
1909 internal static void Preload()
1911 // Do nothing. Just call for load static values.
1915 private void OnShadowColorChanged(float x, float y, float z, float w)
1917 ShadowColor = new Vector4(x, y, z, w);
1919 private void OnShadowOffsetChanged(float x, float y)
1921 ShadowOffset = new Vector2(x, y);
1923 private void OnTextColorChanged(float r, float g, float b, float a)
1925 TextColor = new Color(r, g, b, a);
1927 private void OnUnderlineColorChanged(float x, float y, float z, float w)
1929 UnderlineColor = new Vector4(x, y, z, w);
1931 private void OnAnchorColorChanged(float r, float g, float b, float a)
1933 AnchorColor = new Color(r, g, b, a);
1935 private void OnAnchorClickedColorChanged(float r, float g, float b, float a)
1937 AnchorClickedColor = new Color(r, g, b, a);