2 * Copyright(c) 2020 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;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
25 namespace Tizen.NUI.BaseComponents
28 /// A control which renders a short text string.<br />
29 /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
31 /// <since_tizen> 3 </since_tizen>
32 public partial class TextLabel : View
34 private class TextLayout : LayoutItem
36 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
38 // Padding will be automatically applied by DALi TextLabel.
39 float totalWidth = widthMeasureSpec.Size.AsDecimal();
40 float totalHeight = heightMeasureSpec.Size.AsDecimal();
42 if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
44 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
46 totalHeight = Owner.GetHeightForWidth(totalWidth);
47 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
52 if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
54 // GetWidthForHeight is not implemented.
55 totalWidth = Owner.GetNaturalSize().Width;
56 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
60 Vector3 naturalSize = Owner.GetNaturalSize();
61 totalWidth = naturalSize.Width;
62 totalHeight = naturalSize.Height;
64 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
65 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
69 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
70 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
72 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
73 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
77 static TextLabel() { }
79 private string textLabelSid = null;
80 private bool systemlangTextFlag = false;
81 private TextLabelSelectorData selectorData;
84 /// Creates the TextLabel control.
86 /// <since_tizen> 3 </since_tizen>
87 public TextLabel() : this(Interop.TextLabel.New(), true)
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 Layout = new TextLayout();
93 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
94 [EditorBrowsable(EditorBrowsableState.Never)]
95 public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(), true, viewStyle)
97 Layout = new TextLayout();
101 /// Creates the TextLabel with setting the status of shown or hidden.
103 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
104 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
105 [EditorBrowsable(EditorBrowsableState.Never)]
106 public TextLabel(bool shown) : this(Interop.TextLabel.New(), true)
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 Layout = new TextLayout();
114 /// Creates the TextLabel control.
116 /// <param name="text">The text to display</param>
117 /// <since_tizen> 3 </since_tizen>
118 public TextLabel(string text) : this(Interop.TextLabel.New(text), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 Layout = new TextLayout();
125 /// Creates the TextLabel with setting the status of shown or hidden.
127 /// <param name="text">The text to display</param>
128 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
129 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
130 [EditorBrowsable(EditorBrowsableState.Never)]
131 public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text), true)
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 Layout = new TextLayout();
138 internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.NewTextLabel(TextLabel.getCPtr(handle)), true)
140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextLabel.Upcast(cPtr), cMemoryOwn, viewStyle)
156 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextLabel.Upcast(cPtr), cMemoryOwn, null)
165 /// The TranslatableText property.<br />
166 /// The text can set the SID value.<br />
168 /// <exception cref='ArgumentNullException'>
169 /// ResourceManager about multilingual is null.
171 /// <since_tizen> 4 </since_tizen>
172 public string TranslatableText
176 return (string)GetValue(TranslatableTextProperty);
180 SetValue(TranslatableTextProperty, value);
181 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
184 private string translatableText
192 if (NUIApplication.MultilingualResourceManager == null)
194 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
196 string translatableText = null;
197 textLabelSid = value;
198 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
199 if (translatableText != null)
201 Text = translatableText;
202 if (systemlangTextFlag == false)
204 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
205 systemlangTextFlag = true;
212 NotifyPropertyChanged();
217 /// The Text property.<br />
218 /// The text to display in the UTF-8 format.<br />
220 /// <since_tizen> 3 </since_tizen>
225 return (string)GetValue(TextProperty);
229 SetValue(TextProperty, value);
230 selectorData?.Text.UpdateIfNeeds(this, value);
231 NotifyPropertyChangedAndRequestLayout();
236 /// The FontFamily property.<br />
237 /// The requested font family to use.<br />
239 /// <since_tizen> 3 </since_tizen>
240 public string FontFamily
244 return (string)GetValue(FontFamilyProperty);
248 SetValue(FontFamilyProperty, value);
249 selectorData?.FontFamily.UpdateIfNeeds(this, value);
250 NotifyPropertyChangedAndRequestLayout();
255 /// The FontStyle property.<br />
256 /// The requested font style to use.<br />
258 /// <since_tizen> 3 </since_tizen>
259 public PropertyMap FontStyle
263 return (PropertyMap)GetValue(FontStyleProperty);
267 SetValue(FontStyleProperty, value);
268 NotifyPropertyChangedAndRequestLayout();
273 /// The PointSize property.<br />
274 /// The size of font in points.<br />
276 /// <since_tizen> 3 </since_tizen>
277 public float PointSize
281 return (float)GetValue(PointSizeProperty);
285 SetValue(PointSizeProperty, value);
286 selectorData?.PointSize.UpdateIfNeeds(this, value);
287 NotifyPropertyChangedAndRequestLayout();
292 /// The MultiLine property.<br />
293 /// The single-line or multi-line layout option.<br />
295 /// <since_tizen> 3 </since_tizen>
296 public bool MultiLine
300 return (bool)GetValue(MultiLineProperty);
304 SetValue(MultiLineProperty, value);
305 NotifyPropertyChangedAndRequestLayout();
310 /// The HorizontalAlignment property.<br />
311 /// The line horizontal alignment.<br />
313 /// <since_tizen> 3 </since_tizen>
314 public HorizontalAlignment HorizontalAlignment
318 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
322 SetValue(HorizontalAlignmentProperty, value);
323 NotifyPropertyChanged();
328 /// The VerticalAlignment property.<br />
329 /// The line vertical alignment.<br />
331 /// <since_tizen> 3 </since_tizen>
332 public VerticalAlignment VerticalAlignment
336 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
340 SetValue(VerticalAlignmentProperty, value);
341 NotifyPropertyChanged();
346 /// The TextColor property.<br />
347 /// The color of the text.<br />
348 /// Animation framework can be used to change the color of the text when not using mark up.<br />
349 /// Cannot animate the color when text is auto scrolling.<br />
352 /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
354 /// <since_tizen> 3 </since_tizen>
355 public Color TextColor
359 Color temp = (Color)GetValue(TextColorProperty);
360 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
364 SetValue(TextColorProperty, value);
365 selectorData?.TextColor.UpdateIfNeeds(this, value);
366 NotifyPropertyChanged();
371 /// The ShadowOffset property.<br />
372 /// The drop shadow offset 0 indicates no shadow.<br />
374 /// <since_tizen> 3 </since_tizen>
376 /// Deprecated.(API Level 6) Use Shadow instead.
377 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
379 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
380 public Vector2 ShadowOffset
384 Vector2 shadowOffset = new Vector2();
385 Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
386 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
390 PropertyMap temp = new PropertyMap();
391 temp.Insert("offset", new PropertyValue(value));
393 PropertyMap shadowMap = Shadow;
394 shadowMap.Merge(temp);
396 SetValue(ShadowProperty, shadowMap);
397 NotifyPropertyChanged();
402 /// The ShadowColor property.<br />
403 /// The color of a drop shadow.<br />
405 /// <since_tizen> 3 </since_tizen>
407 /// Deprecated.(API Level 6) Use Shadow instead.
408 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
410 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
411 public Vector4 ShadowColor
415 Vector4 shadowColor = new Vector4();
416 Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
417 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
421 PropertyMap temp = new PropertyMap();
422 temp.Insert("color", new PropertyValue(value));
424 PropertyMap shadowMap = Shadow;
425 shadowMap.Merge(temp);
427 SetValue(ShadowProperty, shadowMap);
428 NotifyPropertyChanged();
433 /// The UnderlineEnabled property.<br />
434 /// The underline enabled flag.<br />
436 /// <since_tizen> 3 </since_tizen>
438 /// Deprecated.(API Level 6) Use Underline instead.
440 [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
441 public bool UnderlineEnabled
445 bool underlineEnabled = false;
446 Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
447 return underlineEnabled;
451 PropertyMap temp = new PropertyMap();
452 temp.Add("enable", new PropertyValue(value));
454 PropertyMap undelineMap = Underline;
455 undelineMap.Merge(temp);
457 SetValue(UnderlineProperty, undelineMap);
458 NotifyPropertyChanged();
464 /// The UnderlineColor property.<br />
465 /// Overrides the underline height from font metrics.<br />
467 /// <since_tizen> 3 </since_tizen>
469 /// Deprecated.(API Level 6) Use Underline instead.
470 /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
472 [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
473 public Vector4 UnderlineColor
477 Vector4 underlineColor = new Vector4();
478 Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
479 return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
483 PropertyMap temp = new PropertyMap();
484 temp.Insert("color", new PropertyValue(value));
486 PropertyMap undelineMap = Underline;
487 undelineMap.Merge(temp);
489 SetValue(UnderlineProperty, undelineMap);
490 NotifyPropertyChanged();
495 /// The UnderlineHeight property.<br />
496 /// Overrides the underline height from font metrics.<br />
498 /// <since_tizen> 3 </since_tizen>
500 /// Deprecated.(API Level 6) Use Underline instead.
502 [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
503 public float UnderlineHeight
507 float underlineHeight = 0.0f;
508 Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
509 return underlineHeight;
513 PropertyMap temp = new PropertyMap();
514 temp.Insert("height", new PropertyValue(value));
516 PropertyMap undelineMap = Underline;
517 undelineMap.Merge(temp);
519 SetValue(UnderlineProperty, undelineMap);
520 NotifyPropertyChanged();
525 /// The EnableMarkup property.<br />
526 /// Whether the mark-up processing is enabled.<br />
528 /// <since_tizen> 3 </since_tizen>
529 public bool EnableMarkup
533 return (bool)GetValue(EnableMarkupProperty);
537 SetValue(EnableMarkupProperty, value);
538 NotifyPropertyChanged();
543 /// The EnableAutoScroll property.<br />
544 /// Starts or stops auto scrolling.<br />
546 /// <since_tizen> 3 </since_tizen>
547 public bool EnableAutoScroll
551 return (bool)GetValue(EnableAutoScrollProperty);
555 SetValue(EnableAutoScrollProperty, value);
556 NotifyPropertyChanged();
561 /// The AutoScrollSpeed property.<br />
562 /// Sets the speed of scrolling in pixels per second.<br />
564 /// <since_tizen> 3 </since_tizen>
565 public int AutoScrollSpeed
569 return (int)GetValue(AutoScrollSpeedProperty);
573 SetValue(AutoScrollSpeedProperty, value);
574 NotifyPropertyChanged();
579 /// The AutoScrollLoopCount property.<br />
580 /// Number of complete loops when scrolling enabled.<br />
582 /// <since_tizen> 3 </since_tizen>
583 public int AutoScrollLoopCount
587 return (int)GetValue(AutoScrollLoopCountProperty);
591 SetValue(AutoScrollLoopCountProperty, value);
592 NotifyPropertyChanged();
597 /// The AutoScrollGap property.<br />
598 /// Gap before scrolling wraps.<br />
600 /// <since_tizen> 3 </since_tizen>
601 public float AutoScrollGap
605 return (float)GetValue(AutoScrollGapProperty);
609 SetValue(AutoScrollGapProperty, value);
610 NotifyPropertyChanged();
615 /// The LineSpacing property.<br />
616 /// The default extra space between lines in points.<br />
618 /// <since_tizen> 3 </since_tizen>
619 public float LineSpacing
623 return (float)GetValue(LineSpacingProperty);
627 SetValue(LineSpacingProperty, value);
628 NotifyPropertyChangedAndRequestLayout();
633 /// The Underline property.<br />
634 /// The default underline parameters.<br />
636 /// <since_tizen> 3 </since_tizen>
637 public PropertyMap Underline
641 return (PropertyMap)GetValue(UnderlineProperty);
645 SetValue(UnderlineProperty, value);
646 NotifyPropertyChanged();
651 /// The Shadow property.<br />
652 /// The default shadow parameters.<br />
654 /// <since_tizen> 3 </since_tizen>
655 public PropertyMap Shadow
659 return (PropertyMap)GetValue(ShadowProperty);
663 SetValue(ShadowProperty, value);
664 NotifyPropertyChanged();
669 /// Describes a text shadow for a TextLabel.
670 /// It is null by default.
672 [EditorBrowsable(EditorBrowsableState.Never)]
673 public TextShadow TextShadow
677 return (TextShadow)GetValue(TextShadowProperty);
681 SetValue(TextShadowProperty, value);
682 selectorData?.TextShadow.UpdateIfNeeds(this, value);
683 NotifyPropertyChanged();
688 /// The Emboss property.<br />
689 /// The default emboss parameters.<br />
691 /// <since_tizen> 3 </since_tizen>
696 return (string)GetValue(EmbossProperty);
700 SetValue(EmbossProperty, value);
701 NotifyPropertyChanged();
706 /// The Outline property.<br />
707 /// The default outline parameters.<br />
709 /// <since_tizen> 3 </since_tizen>
710 public PropertyMap Outline
714 return (PropertyMap)GetValue(OutlineProperty);
718 SetValue(OutlineProperty, value);
719 NotifyPropertyChanged();
724 /// The PixelSize property.<br />
725 /// The size of font in pixels.<br />
727 /// <since_tizen> 3 </since_tizen>
728 public float PixelSize
732 return (float)GetValue(PixelSizeProperty);
736 SetValue(PixelSizeProperty, value);
737 selectorData?.PixelSize.UpdateIfNeeds(this, value);
738 NotifyPropertyChangedAndRequestLayout();
743 /// The Ellipsis property.<br />
744 /// Enable or disable the ellipsis.<br />
746 /// <since_tizen> 3 </since_tizen>
751 return (bool)GetValue(EllipsisProperty);
755 SetValue(EllipsisProperty, value);
756 NotifyPropertyChanged();
761 /// The AutoScrollLoopDelay property.<br />
762 /// Do something.<br />
764 /// <since_tizen> 3 </since_tizen>
765 public float AutoScrollLoopDelay
769 return (float)GetValue(AutoScrollLoopDelayProperty);
773 SetValue(AutoScrollLoopDelayProperty, value);
774 NotifyPropertyChanged();
779 /// The AutoScrollStopMode property.<br />
780 /// Do something.<br />
782 /// <since_tizen> 3 </since_tizen>
783 public AutoScrollStopMode AutoScrollStopMode
787 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
791 SetValue(AutoScrollStopModeProperty, value);
792 NotifyPropertyChanged();
797 /// The line count of the text.
799 /// <since_tizen> 3 </since_tizen>
805 GetProperty(TextLabel.Property.LineCount).Get(out temp);
811 /// The LineWrapMode property.<br />
812 /// line wrap mode when the text lines over layout width.<br />
814 /// <since_tizen> 4 </since_tizen>
815 public LineWrapMode LineWrapMode
819 return (LineWrapMode)GetValue(LineWrapModeProperty);
823 SetValue(LineWrapModeProperty, value);
824 NotifyPropertyChanged();
829 /// The direction of the text such as left to right or right to left.
831 /// <since_tizen> 5 </since_tizen>
832 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
833 [EditorBrowsable(EditorBrowsableState.Never)]
834 public TextDirection TextDirection
839 GetProperty(TextLabel.Property.TextDirection).Get(out temp);
840 return (TextDirection)temp;
845 /// The vertical line alignment of the text.
847 /// <since_tizen> 5 </since_tizen>
848 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
849 [EditorBrowsable(EditorBrowsableState.Never)]
850 public VerticalLineAlignment VerticalLineAlignment
854 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
858 SetValue(VerticalLineAlignmentProperty, value);
859 NotifyPropertyChanged();
864 /// The text alignment to match the direction of the system language.
866 /// <since_tizen> 6 </since_tizen>
867 public bool MatchSystemLanguageDirection
871 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
875 SetValue(MatchSystemLanguageDirectionProperty, value);
876 NotifyPropertyChanged();
881 /// The text fit parameters.<br />
882 /// The textFit map contains the following keys :<br />
883 /// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)<br />
884 /// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)<br />
885 /// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)<br />
886 /// - stepSize (float type) : Step Size for font increase(the default value is 1.f)<br />
887 /// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")<br />
889 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
890 [EditorBrowsable(EditorBrowsableState.Never)]
891 public PropertyMap TextFit
895 return (PropertyMap)GetValue(TextFitProperty);
899 SetValue(TextFitProperty, value);
900 NotifyPropertyChanged();
905 /// The MinLineSize property.<br />
907 /// <since_tizen> 8 </since_tizen>
908 [EditorBrowsable(EditorBrowsableState.Never)]
909 public float MinLineSize
913 return (float)GetValue(MinLineSizeProperty);
917 SetValue(MinLineSizeProperty, value);
918 NotifyPropertyChangedAndRequestLayout();
922 private TextLabelSelectorData SelectorData
926 if (selectorData == null)
928 selectorData = new TextLabelSelectorData();
935 /// Downcasts a handle to textLabel handle
937 /// <param name="handle"></param>
938 /// <returns></returns>
939 /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
940 /// <since_tizen> 3 </since_tizen>
941 /// Please do not use! this will be deprecated!
942 /// Instead please use as keyword.
943 [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
945 "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
946 "TextLabel label = handle as TextLabel")]
947 [EditorBrowsable(EditorBrowsableState.Never)]
948 public static TextLabel DownCast(BaseHandle handle)
952 throw new ArgumentNullException(nameof(handle));
954 TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
955 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
960 [EditorBrowsable(EditorBrowsableState.Never)]
961 protected override void Dispose(DisposeTypes type)
968 if (systemlangTextFlag)
970 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
973 if (type == DisposeTypes.Explicit)
976 //Release your own managed resources here.
977 //You should release all of your own disposable objects here.
978 selectorData?.Reset(this);
984 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
986 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
989 /// This will not be public opened.
990 [EditorBrowsable(EditorBrowsableState.Never)]
991 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
993 Interop.TextLabel.DeleteTextLabel(swigCPtr);
997 /// Get attribues, it is abstract function and must be override.
999 [EditorBrowsable(EditorBrowsableState.Never)]
1000 protected override ViewStyle CreateViewStyle()
1002 return new TextLabelStyle();
1006 /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1008 protected override void OnBindingContextChanged()
1010 base.OnBindingContextChanged();
1013 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1015 Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1018 private void NotifyPropertyChangedAndRequestLayout()
1020 NotifyPropertyChanged();
1021 Layout?.RequestLayout();
1024 internal new class Property
1026 internal static readonly int TEXT = Interop.TextLabel.TextGet();
1027 internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
1028 internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
1029 internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
1030 internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
1031 internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
1032 internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
1033 internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
1034 internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
1035 internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
1036 internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
1037 internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
1038 internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
1039 internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
1040 internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
1041 internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
1042 internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
1043 internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
1044 internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
1045 internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
1046 internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
1047 internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
1048 internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
1049 internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
1050 internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
1051 internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
1052 internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
1053 internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
1054 internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
1057 private void OnShadowColorChanged(float x, float y, float z, float w)
1059 ShadowColor = new Vector4(x, y, z, w);
1061 private void OnShadowOffsetChanged(float x, float y)
1063 ShadowOffset = new Vector2(x, y);
1065 private void OnTextColorChanged(float r, float g, float b, float a)
1067 TextColor = new Color(r, g, b, a);
1069 private void OnUnderlineColorChanged(float x, float y, float z, float w)
1071 UnderlineColor = new Vector4(x, y, z, w);