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 /// Return a copied Style instance of the TextLabel.
87 /// It returns copied style instance so that changing it does not effect to the view.
88 /// Style setting is possible by using constructor or the function of <see cref="View.ApplyStyle"/>.
90 [EditorBrowsable(EditorBrowsableState.Never)]
91 public TextLabelStyle Style => new TextLabelStyle(this);
94 /// Creates the TextLabel control.
96 /// <since_tizen> 3 </since_tizen>
97 public TextLabel() : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true)
99 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 Layout = new TextLayout();
103 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true, viewStyle)
107 Layout = new TextLayout();
111 /// Creates the TextLabel with setting the status of shown or hidden.
113 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
114 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
115 [EditorBrowsable(EditorBrowsableState.Never)]
116 public TextLabel(bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true)
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 Layout = new TextLayout();
124 /// Creates the TextLabel control.
126 /// <param name="text">The text to display</param>
127 /// <since_tizen> 3 </since_tizen>
128 public TextLabel(string text) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true)
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 Layout = new TextLayout();
135 /// Creates the TextLabel with setting the status of shown or hidden.
137 /// <param name="text">The text to display</param>
138 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
139 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 public TextLabel(string text, bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true)
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 Layout = new TextLayout();
148 internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true)
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
166 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn)
168 ApplyStyle(ThemeManager.GetStyle(nameof(TextLabel)));
177 /// The TranslatableText property.<br />
178 /// The text can set the SID value.<br />
180 /// <exception cref='ArgumentNullException'>
181 /// ResourceManager about multilingual is null.
183 /// <since_tizen> 4 </since_tizen>
184 public string TranslatableText
188 return (string)GetValue(TranslatableTextProperty);
192 SetValue(TranslatableTextProperty, value);
193 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
196 private string translatableText
204 if (NUIApplication.MultilingualResourceManager == null)
206 throw new ArgumentNullException("ResourceManager about multilingual is null");
208 string translatableText = null;
209 textLabelSid = value;
210 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
211 if (translatableText != null)
213 Text = translatableText;
214 if (systemlangTextFlag == false)
216 SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
217 systemlangTextFlag = true;
224 NotifyPropertyChanged();
229 /// The Text property.<br />
230 /// The text to display in the UTF-8 format.<br />
232 /// <since_tizen> 3 </since_tizen>
237 return (string)GetValue(TextProperty);
241 SetValue(TextProperty, value);
242 selectorData?.Text.UpdateIfNeeds(this, value);
243 NotifyPropertyChangedAndRequestLayout();
248 /// The FontFamily property.<br />
249 /// The requested font family to use.<br />
251 /// <since_tizen> 3 </since_tizen>
252 public string FontFamily
256 return (string)GetValue(FontFamilyProperty);
260 SetValue(FontFamilyProperty, value);
261 selectorData?.FontFamily.UpdateIfNeeds(this, value);
262 NotifyPropertyChangedAndRequestLayout();
267 /// The FontStyle property.<br />
268 /// The requested font style to use.<br />
270 /// <since_tizen> 3 </since_tizen>
271 public PropertyMap FontStyle
275 return (PropertyMap)GetValue(FontStyleProperty);
279 SetValue(FontStyleProperty, value);
280 NotifyPropertyChangedAndRequestLayout();
285 /// The PointSize property.<br />
286 /// The size of font in points.<br />
288 /// <since_tizen> 3 </since_tizen>
289 public float PointSize
293 return (float)GetValue(PointSizeProperty);
297 SetValue(PointSizeProperty, value);
298 selectorData?.PointSize.UpdateIfNeeds(this, value);
299 NotifyPropertyChangedAndRequestLayout();
304 /// The MultiLine property.<br />
305 /// The single-line or multi-line layout option.<br />
307 /// <since_tizen> 3 </since_tizen>
308 public bool MultiLine
312 return (bool)GetValue(MultiLineProperty);
316 SetValue(MultiLineProperty, value);
317 NotifyPropertyChangedAndRequestLayout();
322 /// The HorizontalAlignment property.<br />
323 /// The line horizontal alignment.<br />
325 /// <since_tizen> 3 </since_tizen>
326 public HorizontalAlignment HorizontalAlignment
330 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
334 SetValue(HorizontalAlignmentProperty, value);
335 NotifyPropertyChanged();
340 /// The VerticalAlignment property.<br />
341 /// The line vertical alignment.<br />
343 /// <since_tizen> 3 </since_tizen>
344 public VerticalAlignment VerticalAlignment
348 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
352 SetValue(VerticalAlignmentProperty, value);
353 NotifyPropertyChanged();
358 /// The TextColor property.<br />
359 /// The color of the text.<br />
360 /// Animation framework can be used to change the color of the text when not using mark up.<br />
361 /// Cannot animate the color when text is auto scrolling.<br />
364 /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
366 /// <since_tizen> 3 </since_tizen>
367 public Color TextColor
371 Color temp = (Color)GetValue(TextColorProperty);
372 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
376 SetValue(TextColorProperty, value);
377 selectorData?.TextColor.UpdateIfNeeds(this, value);
378 NotifyPropertyChanged();
383 /// The ShadowOffset property.<br />
384 /// The drop shadow offset 0 indicates no shadow.<br />
386 /// <since_tizen> 3 </since_tizen>
388 /// Deprecated.(API Level 6) Use Shadow instead.
389 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
391 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
392 public Vector2 ShadowOffset
396 Vector2 shadowOffset = new Vector2();
397 Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
398 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
402 PropertyMap temp = new PropertyMap();
403 temp.Insert("offset", new PropertyValue(value));
405 PropertyMap shadowMap = Shadow;
406 shadowMap.Merge(temp);
408 SetValue(ShadowProperty, shadowMap);
409 NotifyPropertyChanged();
414 /// The ShadowColor property.<br />
415 /// The color of a drop shadow.<br />
417 /// <since_tizen> 3 </since_tizen>
419 /// Deprecated.(API Level 6) Use Shadow instead.
420 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
422 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
423 public Vector4 ShadowColor
427 Vector4 shadowColor = new Vector4();
428 Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
429 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
433 PropertyMap temp = new PropertyMap();
434 temp.Insert("color", new PropertyValue(value));
436 PropertyMap shadowMap = Shadow;
437 shadowMap.Merge(temp);
439 SetValue(ShadowProperty, shadowMap);
440 NotifyPropertyChanged();
445 /// The UnderlineEnabled property.<br />
446 /// The underline enabled flag.<br />
448 /// <since_tizen> 3 </since_tizen>
450 /// Deprecated.(API Level 6) Use Underline instead.
452 [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
453 public bool UnderlineEnabled
457 bool underlineEnabled = false;
458 Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
459 return underlineEnabled;
463 PropertyMap temp = new PropertyMap();
464 temp.Add("enable", new PropertyValue(value));
466 PropertyMap undelineMap = Underline;
467 undelineMap.Merge(temp);
469 SetValue(UnderlineProperty, undelineMap);
470 NotifyPropertyChanged();
476 /// The UnderlineColor property.<br />
477 /// Overrides the underline height from font metrics.<br />
479 /// <since_tizen> 3 </since_tizen>
481 /// Deprecated.(API Level 6) Use Underline instead.
482 /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
484 [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
485 public Vector4 UnderlineColor
489 Vector4 underlineColor = new Vector4();
490 Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
491 return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
495 PropertyMap temp = new PropertyMap();
496 temp.Insert("color", new PropertyValue(value));
498 PropertyMap undelineMap = Underline;
499 undelineMap.Merge(temp);
501 SetValue(UnderlineProperty, undelineMap);
502 NotifyPropertyChanged();
507 /// The UnderlineHeight property.<br />
508 /// Overrides the underline height from font metrics.<br />
510 /// <since_tizen> 3 </since_tizen>
512 /// Deprecated.(API Level 6) Use Underline instead.
514 [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
515 public float UnderlineHeight
519 float underlineHeight = 0.0f;
520 Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
521 return underlineHeight;
525 PropertyMap temp = new PropertyMap();
526 temp.Insert("height", new PropertyValue(value));
528 PropertyMap undelineMap = Underline;
529 undelineMap.Merge(temp);
531 SetValue(UnderlineProperty, undelineMap);
532 NotifyPropertyChanged();
537 /// The EnableMarkup property.<br />
538 /// Whether the mark-up processing is enabled.<br />
540 /// <since_tizen> 3 </since_tizen>
541 public bool EnableMarkup
545 return (bool)GetValue(EnableMarkupProperty);
549 SetValue(EnableMarkupProperty, value);
550 NotifyPropertyChanged();
555 /// The EnableAutoScroll property.<br />
556 /// Starts or stops auto scrolling.<br />
558 /// <since_tizen> 3 </since_tizen>
559 public bool EnableAutoScroll
563 return (bool)GetValue(EnableAutoScrollProperty);
567 SetValue(EnableAutoScrollProperty, value);
568 NotifyPropertyChanged();
573 /// The AutoScrollSpeed property.<br />
574 /// Sets the speed of scrolling in pixels per second.<br />
576 /// <since_tizen> 3 </since_tizen>
577 public int AutoScrollSpeed
581 return (int)GetValue(AutoScrollSpeedProperty);
585 SetValue(AutoScrollSpeedProperty, value);
586 NotifyPropertyChanged();
591 /// The AutoScrollLoopCount property.<br />
592 /// Number of complete loops when scrolling enabled.<br />
594 /// <since_tizen> 3 </since_tizen>
595 public int AutoScrollLoopCount
599 return (int)GetValue(AutoScrollLoopCountProperty);
603 SetValue(AutoScrollLoopCountProperty, value);
604 NotifyPropertyChanged();
609 /// The AutoScrollGap property.<br />
610 /// Gap before scrolling wraps.<br />
612 /// <since_tizen> 3 </since_tizen>
613 public float AutoScrollGap
617 return (float)GetValue(AutoScrollGapProperty);
621 SetValue(AutoScrollGapProperty, value);
622 NotifyPropertyChanged();
627 /// The LineSpacing property.<br />
628 /// The default extra space between lines in points.<br />
630 /// <since_tizen> 3 </since_tizen>
631 public float LineSpacing
635 return (float)GetValue(LineSpacingProperty);
639 SetValue(LineSpacingProperty, value);
640 NotifyPropertyChangedAndRequestLayout();
645 /// The Underline property.<br />
646 /// The default underline parameters.<br />
648 /// <since_tizen> 3 </since_tizen>
649 public PropertyMap Underline
653 return (PropertyMap)GetValue(UnderlineProperty);
657 SetValue(UnderlineProperty, value);
658 NotifyPropertyChanged();
663 /// The Shadow property.<br />
664 /// The default shadow parameters.<br />
666 /// <since_tizen> 3 </since_tizen>
667 public PropertyMap Shadow
671 return (PropertyMap)GetValue(ShadowProperty);
675 SetValue(ShadowProperty, value);
676 NotifyPropertyChanged();
681 /// Describes a text shadow for a TextLabel.
682 /// It is null by default.
684 [EditorBrowsable(EditorBrowsableState.Never)]
685 public TextShadow TextShadow
689 return (TextShadow)GetValue(TextShadowProperty);
693 SetValue(TextShadowProperty, value);
694 selectorData?.TextShadow.UpdateIfNeeds(this, value);
695 NotifyPropertyChanged();
700 /// The Emboss property.<br />
701 /// The default emboss parameters.<br />
703 /// <since_tizen> 3 </since_tizen>
708 return (string)GetValue(EmbossProperty);
712 SetValue(EmbossProperty, value);
713 NotifyPropertyChanged();
718 /// The Outline property.<br />
719 /// The default outline parameters.<br />
721 /// <since_tizen> 3 </since_tizen>
722 public PropertyMap Outline
726 return (PropertyMap)GetValue(OutlineProperty);
730 SetValue(OutlineProperty, value);
731 NotifyPropertyChanged();
736 /// The PixelSize property.<br />
737 /// The size of font in pixels.<br />
739 /// <since_tizen> 3 </since_tizen>
740 public float PixelSize
744 return (float)GetValue(PixelSizeProperty);
748 SetValue(PixelSizeProperty, value);
749 NotifyPropertyChangedAndRequestLayout();
754 /// The Ellipsis property.<br />
755 /// Enable or disable the ellipsis.<br />
757 /// <since_tizen> 3 </since_tizen>
762 return (bool)GetValue(EllipsisProperty);
766 SetValue(EllipsisProperty, value);
767 NotifyPropertyChanged();
772 /// The AutoScrollLoopDelay property.<br />
773 /// Do something.<br />
775 /// <since_tizen> 3 </since_tizen>
776 public float AutoScrollLoopDelay
780 return (float)GetValue(AutoScrollLoopDelayProperty);
784 SetValue(AutoScrollLoopDelayProperty, value);
785 NotifyPropertyChanged();
790 /// The AutoScrollStopMode property.<br />
791 /// Do something.<br />
793 /// <since_tizen> 3 </since_tizen>
794 public AutoScrollStopMode AutoScrollStopMode
798 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
802 SetValue(AutoScrollStopModeProperty, value);
803 NotifyPropertyChanged();
808 /// The line count of the text.
810 /// <since_tizen> 3 </since_tizen>
816 GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp);
822 /// The LineWrapMode property.<br />
823 /// line wrap mode when the text lines over layout width.<br />
825 /// <since_tizen> 4 </since_tizen>
826 public LineWrapMode LineWrapMode
830 return (LineWrapMode)GetValue(LineWrapModeProperty);
834 SetValue(LineWrapModeProperty, value);
835 NotifyPropertyChanged();
840 /// The direction of the text such as left to right or right to left.
842 /// <since_tizen> 5 </since_tizen>
843 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
844 [EditorBrowsable(EditorBrowsableState.Never)]
845 public TextDirection TextDirection
850 GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp);
851 return (TextDirection)temp;
856 /// The vertical line alignment of the text.
858 /// <since_tizen> 5 </since_tizen>
859 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
860 [EditorBrowsable(EditorBrowsableState.Never)]
861 public VerticalLineAlignment VerticalLineAlignment
865 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
869 SetValue(VerticalLineAlignmentProperty, value);
870 NotifyPropertyChanged();
875 /// The text alignment to match the direction of the system language.
877 /// <since_tizen> 6 </since_tizen>
878 public bool MatchSystemLanguageDirection
882 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
886 SetValue(MatchSystemLanguageDirectionProperty, value);
887 NotifyPropertyChanged();
892 /// The text fit parameters.<br />
893 /// The textFit map contains the following keys :<br />
894 /// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)<br />
895 /// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)<br />
896 /// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)<br />
897 /// - stepSize (float type) : Step Size for font increase(the default value is 1.f)<br />
898 /// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")<br />
900 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
901 [EditorBrowsable(EditorBrowsableState.Never)]
902 public PropertyMap TextFit
906 return (PropertyMap)GetValue(TextFitProperty);
910 SetValue(TextFitProperty, value);
911 NotifyPropertyChanged();
916 /// The MinLineSize property.<br />
918 /// <since_tizen> 8 </since_tizen>
919 [EditorBrowsable(EditorBrowsableState.Never)]
920 public float MinLineSize
924 return (float)GetValue(MinLineSizeProperty);
928 SetValue(MinLineSizeProperty, value);
929 NotifyPropertyChangedAndRequestLayout();
933 private TextLabelSelectorData SelectorData
937 if (selectorData == null)
939 selectorData = new TextLabelSelectorData();
946 /// Downcasts a handle to textLabel handle
948 /// <param name="handle"></param>
949 /// <returns></returns>
950 /// <since_tizen> 3 </since_tizen>
951 /// Please do not use! this will be deprecated!
952 /// Instead please use as keyword.
953 [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
955 "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
956 "TextLabel label = handle as TextLabel")]
957 [EditorBrowsable(EditorBrowsableState.Never)]
958 public static TextLabel DownCast(BaseHandle handle)
960 TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
967 [EditorBrowsable(EditorBrowsableState.Never)]
968 protected override void Dispose(DisposeTypes type)
975 if (type == DisposeTypes.Explicit)
978 //Release your own managed resources here.
979 //You should release all of your own disposable objects here.
980 selectorData?.Reset(this);
986 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
988 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
991 /// This will not be public opened.
992 [EditorBrowsable(EditorBrowsableState.Never)]
993 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
995 Interop.TextLabel.delete_TextLabel(swigCPtr);
999 /// Get attribues, it is abstract function and must be override.
1001 /// <since_tizen> 6 </since_tizen>
1002 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1003 [EditorBrowsable(EditorBrowsableState.Never)]
1004 protected override ViewStyle GetViewStyle()
1006 return new TextLabelStyle();
1010 /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1012 protected override void OnBindingContextChanged()
1014 base.OnBindingContextChanged();
1017 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1019 Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1022 private void NotifyPropertyChangedAndRequestLayout()
1024 NotifyPropertyChanged();
1025 Layout?.RequestLayout();
1028 internal new class Property
1030 internal static readonly int TEXT = Interop.TextLabel.TextLabel_Property_TEXT_get();
1031 internal static readonly int FONT_FAMILY = Interop.TextLabel.TextLabel_Property_FONT_FAMILY_get();
1032 internal static readonly int FONT_STYLE = Interop.TextLabel.TextLabel_Property_FONT_STYLE_get();
1033 internal static readonly int POINT_SIZE = Interop.TextLabel.TextLabel_Property_POINT_SIZE_get();
1034 internal static readonly int MULTI_LINE = Interop.TextLabel.TextLabel_Property_MULTI_LINE_get();
1035 internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
1036 internal static readonly int VERTICAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_ALIGNMENT_get();
1037 internal static readonly int TEXT_COLOR = Interop.TextLabel.TextLabel_Property_TEXT_COLOR_get();
1038 internal static readonly int ENABLE_MARKUP = Interop.TextLabel.TextLabel_Property_ENABLE_MARKUP_get();
1039 internal static readonly int ENABLE_AUTO_SCROLL = Interop.TextLabel.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
1040 internal static readonly int AUTO_SCROLL_SPEED = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_SPEED_get();
1041 internal static readonly int AUTO_SCROLL_LOOP_COUNT = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
1042 internal static readonly int AUTO_SCROLL_GAP = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_GAP_get();
1043 internal static readonly int LINE_SPACING = Interop.TextLabel.TextLabel_Property_LINE_SPACING_get();
1044 internal static readonly int UNDERLINE = Interop.TextLabel.TextLabel_Property_UNDERLINE_get();
1045 internal static readonly int SHADOW = Interop.TextLabel.TextLabel_Property_SHADOW_get();
1046 internal static readonly int EMBOSS = Interop.TextLabel.TextLabel_Property_EMBOSS_get();
1047 internal static readonly int OUTLINE = Interop.TextLabel.TextLabel_Property_OUTLINE_get();
1048 internal static readonly int PIXEL_SIZE = Interop.TextLabel.TextLabel_Property_PIXEL_SIZE_get();
1049 internal static readonly int ELLIPSIS = Interop.TextLabel.TextLabel_Property_ELLIPSIS_get();
1050 internal static readonly int AUTO_SCROLL_STOP_MODE = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
1051 internal static readonly int AUTO_SCROLL_LOOP_DELAY = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
1052 internal static readonly int LINE_COUNT = Interop.TextLabel.TextLabel_Property_LINE_COUNT_get();
1053 internal static readonly int LINE_WRAP_MODE = Interop.TextLabel.TextLabel_Property_LINE_WRAP_MODE_get();
1054 internal static readonly int TEXT_DIRECTION = Interop.TextLabel.TextLabel_Property_TEXT_DIRECTION_get();
1055 internal static readonly int VERTICAL_LINE_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
1056 internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextLabel.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1057 internal static readonly int TEXT_FIT = Interop.TextLabel.TextLabel_Property_TEXT_FIT_get();
1058 internal static readonly int MIN_LINE_SIZE = Interop.TextLabel.TextLabel_Property_MIN_LINE_SIZE_get();
1061 private void OnShadowColorChanged(float x, float y, float z, float w)
1063 ShadowColor = new Vector4(x, y, z, w);
1065 private void OnShadowOffsetChanged(float x, float y)
1067 ShadowOffset = new Vector2(x, y);
1069 private void OnTextColorChanged(float r, float g, float b, float a)
1071 TextColor = new Color(r, g, b, a);
1073 private void OnUnderlineColorChanged(float x, float y, float z, float w)
1075 UnderlineColor = new Vector4(x, y, z, w);