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, null)
175 /// The TranslatableText property.<br />
176 /// The text can set the SID value.<br />
178 /// <exception cref='ArgumentNullException'>
179 /// ResourceManager about multilingual is null.
181 /// <since_tizen> 4 </since_tizen>
182 public string TranslatableText
186 return (string)GetValue(TranslatableTextProperty);
190 SetValue(TranslatableTextProperty, value);
191 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
194 private string translatableText
202 if (NUIApplication.MultilingualResourceManager == null)
204 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
206 string translatableText = null;
207 textLabelSid = value;
208 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
209 if (translatableText != null)
211 Text = translatableText;
212 if (systemlangTextFlag == false)
214 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
215 systemlangTextFlag = true;
222 NotifyPropertyChanged();
227 /// The Text property.<br />
228 /// The text to display in the UTF-8 format.<br />
230 /// <since_tizen> 3 </since_tizen>
235 return (string)GetValue(TextProperty);
239 SetValue(TextProperty, value);
240 selectorData?.Text.UpdateIfNeeds(this, value);
241 NotifyPropertyChangedAndRequestLayout();
246 /// The FontFamily property.<br />
247 /// The requested font family to use.<br />
249 /// <since_tizen> 3 </since_tizen>
250 public string FontFamily
254 return (string)GetValue(FontFamilyProperty);
258 SetValue(FontFamilyProperty, value);
259 selectorData?.FontFamily.UpdateIfNeeds(this, value);
260 NotifyPropertyChangedAndRequestLayout();
265 /// The FontStyle property.<br />
266 /// The requested font style to use.<br />
268 /// <since_tizen> 3 </since_tizen>
269 public PropertyMap FontStyle
273 return (PropertyMap)GetValue(FontStyleProperty);
277 SetValue(FontStyleProperty, value);
278 NotifyPropertyChangedAndRequestLayout();
283 /// The PointSize property.<br />
284 /// The size of font in points.<br />
286 /// <since_tizen> 3 </since_tizen>
287 public float PointSize
291 return (float)GetValue(PointSizeProperty);
295 SetValue(PointSizeProperty, value);
296 selectorData?.PointSize.UpdateIfNeeds(this, value);
297 NotifyPropertyChangedAndRequestLayout();
302 /// The MultiLine property.<br />
303 /// The single-line or multi-line layout option.<br />
305 /// <since_tizen> 3 </since_tizen>
306 public bool MultiLine
310 return (bool)GetValue(MultiLineProperty);
314 SetValue(MultiLineProperty, value);
315 NotifyPropertyChangedAndRequestLayout();
320 /// The HorizontalAlignment property.<br />
321 /// The line horizontal alignment.<br />
323 /// <since_tizen> 3 </since_tizen>
324 public HorizontalAlignment HorizontalAlignment
328 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
332 SetValue(HorizontalAlignmentProperty, value);
333 NotifyPropertyChanged();
338 /// The VerticalAlignment property.<br />
339 /// The line vertical alignment.<br />
341 /// <since_tizen> 3 </since_tizen>
342 public VerticalAlignment VerticalAlignment
346 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
350 SetValue(VerticalAlignmentProperty, value);
351 NotifyPropertyChanged();
356 /// The TextColor property.<br />
357 /// The color of the text.<br />
358 /// Animation framework can be used to change the color of the text when not using mark up.<br />
359 /// Cannot animate the color when text is auto scrolling.<br />
362 /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
364 /// <since_tizen> 3 </since_tizen>
365 public Color TextColor
369 Color temp = (Color)GetValue(TextColorProperty);
370 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
374 SetValue(TextColorProperty, value);
375 selectorData?.TextColor.UpdateIfNeeds(this, value);
376 NotifyPropertyChanged();
381 /// The ShadowOffset property.<br />
382 /// The drop shadow offset 0 indicates no shadow.<br />
384 /// <since_tizen> 3 </since_tizen>
386 /// Deprecated.(API Level 6) Use Shadow instead.
387 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
389 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
390 public Vector2 ShadowOffset
394 Vector2 shadowOffset = new Vector2();
395 Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
396 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
400 PropertyMap temp = new PropertyMap();
401 temp.Insert("offset", new PropertyValue(value));
403 PropertyMap shadowMap = Shadow;
404 shadowMap.Merge(temp);
406 SetValue(ShadowProperty, shadowMap);
407 NotifyPropertyChanged();
412 /// The ShadowColor property.<br />
413 /// The color of a drop shadow.<br />
415 /// <since_tizen> 3 </since_tizen>
417 /// Deprecated.(API Level 6) Use Shadow instead.
418 /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
420 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
421 public Vector4 ShadowColor
425 Vector4 shadowColor = new Vector4();
426 Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
427 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
431 PropertyMap temp = new PropertyMap();
432 temp.Insert("color", new PropertyValue(value));
434 PropertyMap shadowMap = Shadow;
435 shadowMap.Merge(temp);
437 SetValue(ShadowProperty, shadowMap);
438 NotifyPropertyChanged();
443 /// The UnderlineEnabled property.<br />
444 /// The underline enabled flag.<br />
446 /// <since_tizen> 3 </since_tizen>
448 /// Deprecated.(API Level 6) Use Underline instead.
450 [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
451 public bool UnderlineEnabled
455 bool underlineEnabled = false;
456 Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
457 return underlineEnabled;
461 PropertyMap temp = new PropertyMap();
462 temp.Add("enable", new PropertyValue(value));
464 PropertyMap undelineMap = Underline;
465 undelineMap.Merge(temp);
467 SetValue(UnderlineProperty, undelineMap);
468 NotifyPropertyChanged();
474 /// The UnderlineColor property.<br />
475 /// Overrides the underline height from font metrics.<br />
477 /// <since_tizen> 3 </since_tizen>
479 /// Deprecated.(API Level 6) Use Underline instead.
480 /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
482 [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
483 public Vector4 UnderlineColor
487 Vector4 underlineColor = new Vector4();
488 Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
489 return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
493 PropertyMap temp = new PropertyMap();
494 temp.Insert("color", new PropertyValue(value));
496 PropertyMap undelineMap = Underline;
497 undelineMap.Merge(temp);
499 SetValue(UnderlineProperty, undelineMap);
500 NotifyPropertyChanged();
505 /// The UnderlineHeight property.<br />
506 /// Overrides the underline height from font metrics.<br />
508 /// <since_tizen> 3 </since_tizen>
510 /// Deprecated.(API Level 6) Use Underline instead.
512 [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
513 public float UnderlineHeight
517 float underlineHeight = 0.0f;
518 Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
519 return underlineHeight;
523 PropertyMap temp = new PropertyMap();
524 temp.Insert("height", new PropertyValue(value));
526 PropertyMap undelineMap = Underline;
527 undelineMap.Merge(temp);
529 SetValue(UnderlineProperty, undelineMap);
530 NotifyPropertyChanged();
535 /// The EnableMarkup property.<br />
536 /// Whether the mark-up processing is enabled.<br />
538 /// <since_tizen> 3 </since_tizen>
539 public bool EnableMarkup
543 return (bool)GetValue(EnableMarkupProperty);
547 SetValue(EnableMarkupProperty, value);
548 NotifyPropertyChanged();
553 /// The EnableAutoScroll property.<br />
554 /// Starts or stops auto scrolling.<br />
556 /// <since_tizen> 3 </since_tizen>
557 public bool EnableAutoScroll
561 return (bool)GetValue(EnableAutoScrollProperty);
565 SetValue(EnableAutoScrollProperty, value);
566 NotifyPropertyChanged();
571 /// The AutoScrollSpeed property.<br />
572 /// Sets the speed of scrolling in pixels per second.<br />
574 /// <since_tizen> 3 </since_tizen>
575 public int AutoScrollSpeed
579 return (int)GetValue(AutoScrollSpeedProperty);
583 SetValue(AutoScrollSpeedProperty, value);
584 NotifyPropertyChanged();
589 /// The AutoScrollLoopCount property.<br />
590 /// Number of complete loops when scrolling enabled.<br />
592 /// <since_tizen> 3 </since_tizen>
593 public int AutoScrollLoopCount
597 return (int)GetValue(AutoScrollLoopCountProperty);
601 SetValue(AutoScrollLoopCountProperty, value);
602 NotifyPropertyChanged();
607 /// The AutoScrollGap property.<br />
608 /// Gap before scrolling wraps.<br />
610 /// <since_tizen> 3 </since_tizen>
611 public float AutoScrollGap
615 return (float)GetValue(AutoScrollGapProperty);
619 SetValue(AutoScrollGapProperty, value);
620 NotifyPropertyChanged();
625 /// The LineSpacing property.<br />
626 /// The default extra space between lines in points.<br />
628 /// <since_tizen> 3 </since_tizen>
629 public float LineSpacing
633 return (float)GetValue(LineSpacingProperty);
637 SetValue(LineSpacingProperty, value);
638 NotifyPropertyChangedAndRequestLayout();
643 /// The Underline property.<br />
644 /// The default underline parameters.<br />
646 /// <since_tizen> 3 </since_tizen>
647 public PropertyMap Underline
651 return (PropertyMap)GetValue(UnderlineProperty);
655 SetValue(UnderlineProperty, value);
656 NotifyPropertyChanged();
661 /// The Shadow property.<br />
662 /// The default shadow parameters.<br />
664 /// <since_tizen> 3 </since_tizen>
665 public PropertyMap Shadow
669 return (PropertyMap)GetValue(ShadowProperty);
673 SetValue(ShadowProperty, value);
674 NotifyPropertyChanged();
679 /// Describes a text shadow for a TextLabel.
680 /// It is null by default.
682 [EditorBrowsable(EditorBrowsableState.Never)]
683 public TextShadow TextShadow
687 return (TextShadow)GetValue(TextShadowProperty);
691 SetValue(TextShadowProperty, value);
692 selectorData?.TextShadow.UpdateIfNeeds(this, value);
693 NotifyPropertyChanged();
698 /// The Emboss property.<br />
699 /// The default emboss parameters.<br />
701 /// <since_tizen> 3 </since_tizen>
706 return (string)GetValue(EmbossProperty);
710 SetValue(EmbossProperty, value);
711 NotifyPropertyChanged();
716 /// The Outline property.<br />
717 /// The default outline parameters.<br />
719 /// <since_tizen> 3 </since_tizen>
720 public PropertyMap Outline
724 return (PropertyMap)GetValue(OutlineProperty);
728 SetValue(OutlineProperty, value);
729 NotifyPropertyChanged();
734 /// The PixelSize property.<br />
735 /// The size of font in pixels.<br />
737 /// <since_tizen> 3 </since_tizen>
738 public float PixelSize
742 return (float)GetValue(PixelSizeProperty);
746 SetValue(PixelSizeProperty, value);
747 NotifyPropertyChangedAndRequestLayout();
752 /// The Ellipsis property.<br />
753 /// Enable or disable the ellipsis.<br />
755 /// <since_tizen> 3 </since_tizen>
760 return (bool)GetValue(EllipsisProperty);
764 SetValue(EllipsisProperty, value);
765 NotifyPropertyChanged();
770 /// The AutoScrollLoopDelay property.<br />
771 /// Do something.<br />
773 /// <since_tizen> 3 </since_tizen>
774 public float AutoScrollLoopDelay
778 return (float)GetValue(AutoScrollLoopDelayProperty);
782 SetValue(AutoScrollLoopDelayProperty, value);
783 NotifyPropertyChanged();
788 /// The AutoScrollStopMode property.<br />
789 /// Do something.<br />
791 /// <since_tizen> 3 </since_tizen>
792 public AutoScrollStopMode AutoScrollStopMode
796 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
800 SetValue(AutoScrollStopModeProperty, value);
801 NotifyPropertyChanged();
806 /// The line count of the text.
808 /// <since_tizen> 3 </since_tizen>
814 GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp);
820 /// The LineWrapMode property.<br />
821 /// line wrap mode when the text lines over layout width.<br />
823 /// <since_tizen> 4 </since_tizen>
824 public LineWrapMode LineWrapMode
828 return (LineWrapMode)GetValue(LineWrapModeProperty);
832 SetValue(LineWrapModeProperty, value);
833 NotifyPropertyChanged();
838 /// The direction of the text such as left to right or right to left.
840 /// <since_tizen> 5 </since_tizen>
841 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
842 [EditorBrowsable(EditorBrowsableState.Never)]
843 public TextDirection TextDirection
848 GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp);
849 return (TextDirection)temp;
854 /// The vertical line alignment of the text.
856 /// <since_tizen> 5 </since_tizen>
857 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
858 [EditorBrowsable(EditorBrowsableState.Never)]
859 public VerticalLineAlignment VerticalLineAlignment
863 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
867 SetValue(VerticalLineAlignmentProperty, value);
868 NotifyPropertyChanged();
873 /// The text alignment to match the direction of the system language.
875 /// <since_tizen> 6 </since_tizen>
876 public bool MatchSystemLanguageDirection
880 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
884 SetValue(MatchSystemLanguageDirectionProperty, value);
885 NotifyPropertyChanged();
890 /// The text fit parameters.<br />
891 /// The textFit map contains the following keys :<br />
892 /// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)<br />
893 /// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)<br />
894 /// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)<br />
895 /// - stepSize (float type) : Step Size for font increase(the default value is 1.f)<br />
896 /// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")<br />
898 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
899 [EditorBrowsable(EditorBrowsableState.Never)]
900 public PropertyMap TextFit
904 return (PropertyMap)GetValue(TextFitProperty);
908 SetValue(TextFitProperty, value);
909 NotifyPropertyChanged();
914 /// The MinLineSize property.<br />
916 /// <since_tizen> 8 </since_tizen>
917 [EditorBrowsable(EditorBrowsableState.Never)]
918 public float MinLineSize
922 return (float)GetValue(MinLineSizeProperty);
926 SetValue(MinLineSizeProperty, value);
927 NotifyPropertyChangedAndRequestLayout();
931 private TextLabelSelectorData SelectorData
935 if (selectorData == null)
937 selectorData = new TextLabelSelectorData();
944 /// Downcasts a handle to textLabel handle
946 /// <param name="handle"></param>
947 /// <returns></returns>
948 /// <since_tizen> 3 </since_tizen>
949 /// Please do not use! this will be deprecated!
950 /// Instead please use as keyword.
951 [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
953 "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
954 "TextLabel label = handle as TextLabel")]
955 [EditorBrowsable(EditorBrowsableState.Never)]
956 public static TextLabel DownCast(BaseHandle handle)
958 TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
960 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
965 [EditorBrowsable(EditorBrowsableState.Never)]
966 protected override void Dispose(DisposeTypes type)
973 if (systemlangTextFlag)
975 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
978 if (type == DisposeTypes.Explicit)
981 //Release your own managed resources here.
982 //You should release all of your own disposable objects here.
983 selectorData?.Reset(this);
989 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
991 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
994 /// This will not be public opened.
995 [EditorBrowsable(EditorBrowsableState.Never)]
996 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
998 Interop.TextLabel.delete_TextLabel(swigCPtr);
1002 /// Get attribues, it is abstract function and must be override.
1004 /// <since_tizen> 6 </since_tizen>
1005 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1006 [EditorBrowsable(EditorBrowsableState.Never)]
1007 protected override ViewStyle GetViewStyle()
1009 return new TextLabelStyle();
1013 /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1015 protected override void OnBindingContextChanged()
1017 base.OnBindingContextChanged();
1020 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1022 Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1025 private void NotifyPropertyChangedAndRequestLayout()
1027 NotifyPropertyChanged();
1028 Layout?.RequestLayout();
1031 internal new class Property
1033 internal static readonly int TEXT = Interop.TextLabel.TextLabel_Property_TEXT_get();
1034 internal static readonly int FONT_FAMILY = Interop.TextLabel.TextLabel_Property_FONT_FAMILY_get();
1035 internal static readonly int FONT_STYLE = Interop.TextLabel.TextLabel_Property_FONT_STYLE_get();
1036 internal static readonly int POINT_SIZE = Interop.TextLabel.TextLabel_Property_POINT_SIZE_get();
1037 internal static readonly int MULTI_LINE = Interop.TextLabel.TextLabel_Property_MULTI_LINE_get();
1038 internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
1039 internal static readonly int VERTICAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_ALIGNMENT_get();
1040 internal static readonly int TEXT_COLOR = Interop.TextLabel.TextLabel_Property_TEXT_COLOR_get();
1041 internal static readonly int ENABLE_MARKUP = Interop.TextLabel.TextLabel_Property_ENABLE_MARKUP_get();
1042 internal static readonly int ENABLE_AUTO_SCROLL = Interop.TextLabel.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
1043 internal static readonly int AUTO_SCROLL_SPEED = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_SPEED_get();
1044 internal static readonly int AUTO_SCROLL_LOOP_COUNT = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
1045 internal static readonly int AUTO_SCROLL_GAP = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_GAP_get();
1046 internal static readonly int LINE_SPACING = Interop.TextLabel.TextLabel_Property_LINE_SPACING_get();
1047 internal static readonly int UNDERLINE = Interop.TextLabel.TextLabel_Property_UNDERLINE_get();
1048 internal static readonly int SHADOW = Interop.TextLabel.TextLabel_Property_SHADOW_get();
1049 internal static readonly int EMBOSS = Interop.TextLabel.TextLabel_Property_EMBOSS_get();
1050 internal static readonly int OUTLINE = Interop.TextLabel.TextLabel_Property_OUTLINE_get();
1051 internal static readonly int PIXEL_SIZE = Interop.TextLabel.TextLabel_Property_PIXEL_SIZE_get();
1052 internal static readonly int ELLIPSIS = Interop.TextLabel.TextLabel_Property_ELLIPSIS_get();
1053 internal static readonly int AUTO_SCROLL_STOP_MODE = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
1054 internal static readonly int AUTO_SCROLL_LOOP_DELAY = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
1055 internal static readonly int LINE_COUNT = Interop.TextLabel.TextLabel_Property_LINE_COUNT_get();
1056 internal static readonly int LINE_WRAP_MODE = Interop.TextLabel.TextLabel_Property_LINE_WRAP_MODE_get();
1057 internal static readonly int TEXT_DIRECTION = Interop.TextLabel.TextLabel_Property_TEXT_DIRECTION_get();
1058 internal static readonly int VERTICAL_LINE_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
1059 internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextLabel.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1060 internal static readonly int TEXT_FIT = Interop.TextLabel.TextLabel_Property_TEXT_FIT_get();
1061 internal static readonly int MIN_LINE_SIZE = Interop.TextLabel.TextLabel_Property_MIN_LINE_SIZE_get();
1064 private void OnShadowColorChanged(float x, float y, float z, float w)
1066 ShadowColor = new Vector4(x, y, z, w);
1068 private void OnShadowOffsetChanged(float x, float y)
1070 ShadowOffset = new Vector2(x, y);
1072 private void OnTextColorChanged(float r, float g, float b, float a)
1074 TextColor = new Color(r, g, b, a);
1076 private void OnUnderlineColorChanged(float x, float y, float z, float w)
1078 UnderlineColor = new Vector4(x, y, z, w);