/* * Copyright(c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ extern alias TizenSystemSettings; using TizenSystemSettings.Tizen.System; using System; using System.Globalization; using System.ComponentModel; using Tizen.NUI.Binding; namespace Tizen.NUI.BaseComponents { /// /// A control which renders a short text string.
/// Text labels are lightweight, non-editable, and do not respond to the user input.
///
/// 3 public class TextLabel : View { /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT, new Tizen.NUI.PropertyValue((string)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; string temp; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue((string)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; string temp; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_FAMILY).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty FontStyleProperty = BindableProperty.Create(nameof(FontStyle), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_STYLE, new Tizen.NUI.PropertyValue((PropertyMap)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; PropertyMap temp = new PropertyMap(); Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_STYLE).Get(temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.POINT_SIZE, new Tizen.NUI.PropertyValue((float)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.POINT_SIZE).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty MultiLineProperty = BindableProperty.Create(nameof(MultiLine), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.MULTI_LINE, new Tizen.NUI.PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; bool temp = false; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.MULTI_LINE).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.Create(nameof(HorizontalAlignment), typeof(HorizontalAlignment), typeof(TextLabel), HorizontalAlignment.Begin, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; string valueToString = ""; if (newValue != null) { switch ((HorizontalAlignment)newValue) { case HorizontalAlignment.Begin: { valueToString = "BEGIN"; break; } case HorizontalAlignment.Center: { valueToString = "CENTER"; break; } case HorizontalAlignment.End: { valueToString = "END"; break; } default: { valueToString = "BEGIN"; break; } } Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; string temp; if (Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) { NUILog.Error("HorizontalAlignment get error!"); } switch (temp) { case "BEGIN": return HorizontalAlignment.Begin; case "CENTER": return HorizontalAlignment.Center; case "END": return HorizontalAlignment.End; default: return HorizontalAlignment.Begin; } }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.Create(nameof(VerticalAlignment), typeof(VerticalAlignment), typeof(TextLabel), VerticalAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; string valueToString = ""; if (newValue != null) { switch ((VerticalAlignment)newValue) { case VerticalAlignment.Top: { valueToString = "TOP"; break; } case VerticalAlignment.Center: { valueToString = "CENTER"; break; } case VerticalAlignment.Bottom: { valueToString = "BOTTOM"; break; } default: { valueToString = "BOTTOM"; break; } } Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; string temp; if (Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_ALIGNMENT).Get(out temp) == false) { NUILog.Error("VerticalAlignment get error!"); } switch (temp) { case "TOP": return VerticalAlignment.Top; case "CENTER": return VerticalAlignment.Center; case "BOTTOM": return VerticalAlignment.Bottom; default: return VerticalAlignment.Bottom; } }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue((Color)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_COLOR).Get(temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty EnableMarkupProperty = BindableProperty.Create(nameof(EnableMarkup), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; bool temp = false; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_MARKUP).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty EnableAutoScrollProperty = BindableProperty.Create(nameof(EnableAutoScroll), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_AUTO_SCROLL, new Tizen.NUI.PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; bool temp = false; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_AUTO_SCROLL).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty AutoScrollSpeedProperty = BindableProperty.Create(nameof(AutoScrollSpeed), typeof(int), typeof(TextLabel), default(int), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_SPEED, new Tizen.NUI.PropertyValue((int)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; int temp = 0; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_SPEED).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty AutoScrollLoopCountProperty = BindableProperty.Create(nameof(AutoScrollLoopCount), typeof(int), typeof(TextLabel), default(int), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_COUNT, new Tizen.NUI.PropertyValue((int)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; int temp = 0; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_COUNT).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty AutoScrollGapProperty = BindableProperty.Create(nameof(AutoScrollGap), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_GAP, new Tizen.NUI.PropertyValue((float)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_GAP).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty LineSpacingProperty = BindableProperty.Create(nameof(LineSpacing), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_SPACING, new Tizen.NUI.PropertyValue((float)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_SPACING).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE, new Tizen.NUI.PropertyValue((PropertyMap)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; PropertyMap temp = new PropertyMap(); Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE).Get(temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(Shadow), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW, new Tizen.NUI.PropertyValue((PropertyMap)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; PropertyMap temp = new PropertyMap(); Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW).Get(temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(Emboss), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.EMBOSS, new Tizen.NUI.PropertyValue((string)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; string temp; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.EMBOSS).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty OutlineProperty = BindableProperty.Create(nameof(Outline), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.OUTLINE, new Tizen.NUI.PropertyValue((PropertyMap)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; PropertyMap temp = new PropertyMap(); Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.OUTLINE).Get(temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty PixelSizeProperty = BindableProperty.Create(nameof(PixelSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue((float)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.PIXEL_SIZE).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty EllipsisProperty = BindableProperty.Create(nameof(Ellipsis), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ELLIPSIS, new Tizen.NUI.PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; bool temp = false; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.ELLIPSIS).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty AutoScrollLoopDelayProperty = BindableProperty.Create(nameof(AutoScrollLoopDelay), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_DELAY, new Tizen.NUI.PropertyValue((float)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; float temp = 0.0f; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_DELAY).Get(out temp); return temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty AutoScrollStopModeProperty = BindableProperty.Create(nameof(AutoScrollStopMode), typeof(AutoScrollStopMode), typeof(TextLabel), AutoScrollStopMode.FinishLoop, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_STOP_MODE, new Tizen.NUI.PropertyValue((int)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; string temp; if (Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_STOP_MODE).Get(out temp) == false) { NUILog.Error("AutoScrollStopMode get error!"); } switch (temp) { case "FINISH_LOOP": return AutoScrollStopMode.FinishLoop; case "IMMEDIATE": return AutoScrollStopMode.Immediate; default: return AutoScrollStopMode.FinishLoop; } }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty LineWrapModeProperty = BindableProperty.Create(nameof(LineWrapMode), typeof(LineWrapMode), typeof(TextLabel), LineWrapMode.Word, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue((int)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; int temp; if (false == Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_WRAP_MODE).Get(out temp)) { NUILog.Error("LineWrapMode get error!"); } return (LineWrapMode)temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty VerticalLineAlignmentProperty = BindableProperty.Create(nameof(VerticalLineAlignment), typeof(VerticalLineAlignment), typeof(TextLabel), VerticalLineAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_LINE_ALIGNMENT, new Tizen.NUI.PropertyValue((int)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; int temp = 0; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_LINE_ALIGNMENT).Get(out temp); return (VerticalLineAlignment)temp; }); /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty MatchSystemLanguageDirectionProperty = BindableProperty.Create(nameof(MatchSystemLanguageDirection), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION, new Tizen.NUI.PropertyValue((bool)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; bool temp = false; Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION).Get(out temp); return temp; }); /// Only for XAML. No need of public API. Make hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty TextFitProperty = BindableProperty.Create(nameof(TextFit), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) => { var textLabel = (TextLabel)bindable; if (newValue != null) { Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_FIT, new Tizen.NUI.PropertyValue((PropertyMap)newValue)); } }, defaultValueCreator: (bindable) => { var textLabel = (TextLabel)bindable; PropertyMap temp = new PropertyMap(); Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_FIT).Get(temp); return temp; }); private global::System.Runtime.InteropServices.HandleRef swigCPtr; private string textLabelSid = null; private bool systemlangTextFlag = false; /// /// Creates the TextLabel control. /// /// 3 public TextLabel() : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Creates the TextLabel with setting the status of shown or hidden. /// /// false : Not displayed (hidden), true : displayed (shown) /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public TextLabel(bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SetVisible(shown); } /// /// Creates the TextLabel control. /// /// The text to display /// 3 public TextLabel(string text) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Creates the TextLabel with setting the status of shown or hidden. /// /// The text to display /// false : Not displayed (hidden), true : displayed (shown) /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public TextLabel(string text, bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SetVisible(shown); } internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (!shown) { SetVisible(false); } } internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); if (!shown) { SetVisible(false); } } /// /// The TranslatableText property.
/// The text can set the SID value.
///
/// /// ResourceManager about multilingual is null. /// /// 4 public string TranslatableText { get { return textLabelSid; } set { if (NUIApplication.MultilingualResourceManager == null) { throw new ArgumentNullException("ResourceManager about multilingual is null"); } string translatableText = null; textLabelSid = value; translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); if (translatableText != null) { Text = translatableText; if (systemlangTextFlag == false) { SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; systemlangTextFlag = true; } } else { Text = ""; } NotifyPropertyChanged(); } } /// /// The Text property.
/// The text to display in the UTF-8 format.
///
/// 3 public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The FontFamily property.
/// The requested font family to use.
///
/// 3 public string FontFamily { get { return (string)GetValue(FontFamilyProperty); } set { SetValue(FontFamilyProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The FontStyle property.
/// The requested font style to use.
///
/// 3 public PropertyMap FontStyle { get { return (PropertyMap)GetValue(FontStyleProperty); } set { SetValue(FontStyleProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The PointSize property.
/// The size of font in points.
///
/// 3 public float PointSize { get { return (float)GetValue(PointSizeProperty); } set { SetValue(PointSizeProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The MultiLine property.
/// The single-line or multi-line layout option.
///
/// 3 public bool MultiLine { get { return (bool)GetValue(MultiLineProperty); } set { SetValue(MultiLineProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The HorizontalAlignment property.
/// The line horizontal alignment.
///
/// 3 public HorizontalAlignment HorizontalAlignment { get { return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty); } set { SetValue(HorizontalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The VerticalAlignment property.
/// The line vertical alignment.
///
/// 3 public VerticalAlignment VerticalAlignment { get { return (VerticalAlignment)GetValue(VerticalAlignmentProperty); } set { SetValue(VerticalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The TextColor property.
/// The color of the text.
/// Animation framework can be used to change the color of the text when not using mark up.
/// Cannot animate the color when text is auto scrolling.
///
/// 3 public Color TextColor { get { return (Color)GetValue(TextColorProperty); } set { SetValue(TextColorProperty, value); NotifyPropertyChanged(); } } /// /// The ShadowOffset property.
/// The drop shadow offset 0 indicates no shadow.
///
/// 3 /// /// Deprecated.(API Level 6) Use Shadow instead. /// [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")] public Vector2 ShadowOffset { get { Vector2 shadowOffset = new Vector2(); Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset); return shadowOffset; } set { PropertyMap temp = new PropertyMap(); temp.Insert("offset", new PropertyValue(value)); PropertyMap shadowMap = Shadow; shadowMap.Merge(temp); SetValue(ShadowProperty, shadowMap); NotifyPropertyChanged(); } } /// /// The ShadowColor property.
/// The color of a drop shadow.
///
/// 3 /// /// Deprecated.(API Level 6) Use Shadow instead. /// [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")] public Vector4 ShadowColor { get { Vector4 shadowColor = new Vector4(); Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor); return shadowColor; } set { PropertyMap temp = new PropertyMap(); temp.Insert("color", new PropertyValue(value)); PropertyMap shadowMap = Shadow; shadowMap.Merge(temp); SetValue(ShadowProperty, shadowMap); NotifyPropertyChanged(); } } /// /// The UnderlineEnabled property.
/// The underline enabled flag.
///
/// 3 /// /// Deprecated.(API Level 6) Use Underline instead. /// [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")] public bool UnderlineEnabled { get { bool underlineEnabled = false; Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled); return underlineEnabled; } set { PropertyMap temp = new PropertyMap(); temp.Add("enable", new PropertyValue(value)); PropertyMap undelineMap = Underline; undelineMap.Merge(temp); SetValue(UnderlineProperty, undelineMap); NotifyPropertyChanged(); } } /// /// The UnderlineColor property.
/// Overrides the underline height from font metrics.
///
/// 3 /// /// Deprecated.(API Level 6) Use Underline instead. /// [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")] public Vector4 UnderlineColor { get { Vector4 underlineColor = new Vector4(); Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor); return underlineColor; } set { PropertyMap temp = new PropertyMap(); temp.Insert("color", new PropertyValue(value)); PropertyMap undelineMap = Underline; undelineMap.Merge(temp); SetValue(UnderlineProperty, undelineMap); NotifyPropertyChanged(); } } /// /// The UnderlineHeight property.
/// Overrides the underline height from font metrics.
///
/// 3 /// /// Deprecated.(API Level 6) Use Underline instead. /// [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")] public float UnderlineHeight { get { float underlineHeight = 0.0f; Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight); return underlineHeight; } set { PropertyMap temp = new PropertyMap(); temp.Insert("height", new PropertyValue(value)); PropertyMap undelineMap = Underline; undelineMap.Merge(temp); SetValue(UnderlineProperty, undelineMap); NotifyPropertyChanged(); } } /// /// The EnableMarkup property.
/// Whether the mark-up processing is enabled.
///
/// 3 public bool EnableMarkup { get { return (bool)GetValue(EnableMarkupProperty); } set { SetValue(EnableMarkupProperty, value); NotifyPropertyChanged(); } } /// /// The EnableAutoScroll property.
/// Starts or stops auto scrolling.
///
/// 3 public bool EnableAutoScroll { get { return (bool)GetValue(EnableAutoScrollProperty); } set { SetValue(EnableAutoScrollProperty, value); NotifyPropertyChanged(); } } /// /// The AutoScrollSpeed property.
/// Sets the speed of scrolling in pixels per second.
///
/// 3 public int AutoScrollSpeed { get { return (int)GetValue(AutoScrollSpeedProperty); } set { SetValue(AutoScrollSpeedProperty, value); NotifyPropertyChanged(); } } /// /// The AutoScrollLoopCount property.
/// Number of complete loops when scrolling enabled.
///
/// 3 public int AutoScrollLoopCount { get { return (int)GetValue(AutoScrollLoopCountProperty); } set { SetValue(AutoScrollLoopCountProperty, value); NotifyPropertyChanged(); } } /// /// The AutoScrollGap property.
/// Gap before scrolling wraps.
///
/// 3 public float AutoScrollGap { get { return (float)GetValue(AutoScrollGapProperty); } set { SetValue(AutoScrollGapProperty, value); NotifyPropertyChanged(); } } /// /// The LineSpacing property.
/// The default extra space between lines in points.
///
/// 3 public float LineSpacing { get { return (float)GetValue(LineSpacingProperty); } set { SetValue(LineSpacingProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The Underline property.
/// The default underline parameters.
///
/// 3 public PropertyMap Underline { get { return (PropertyMap)GetValue(UnderlineProperty); } set { SetValue(UnderlineProperty, value); NotifyPropertyChanged(); } } /// /// The Shadow property.
/// The default shadow parameters.
///
/// 3 public PropertyMap Shadow { get { return (PropertyMap)GetValue(ShadowProperty); } set { SetValue(ShadowProperty, value); NotifyPropertyChanged(); } } /// /// The Emboss property.
/// The default emboss parameters.
///
/// 3 public string Emboss { get { return (string)GetValue(EmbossProperty); } set { SetValue(EmbossProperty, value); NotifyPropertyChanged(); } } /// /// The Outline property.
/// The default outline parameters.
///
/// 3 public PropertyMap Outline { get { return (PropertyMap)GetValue(OutlineProperty); } set { SetValue(OutlineProperty, value); NotifyPropertyChanged(); } } /// /// The PixelSize property.
/// The size of font in pixels.
///
/// 3 public float PixelSize { get { return (float)GetValue(PixelSizeProperty); } set { SetValue(PixelSizeProperty, value); NotifyPropertyChangedAndRequestLayout(); } } /// /// The Ellipsis property.
/// Enable or disable the ellipsis.
///
/// 3 public bool Ellipsis { get { return (bool)GetValue(EllipsisProperty); } set { SetValue(EllipsisProperty, value); NotifyPropertyChanged(); } } /// /// The AutoScrollLoopDelay property.
/// Do something.
///
/// 3 public float AutoScrollLoopDelay { get { return (float)GetValue(AutoScrollLoopDelayProperty); } set { SetValue(AutoScrollLoopDelayProperty, value); NotifyPropertyChanged(); } } /// /// The AutoScrollStopMode property.
/// Do something.
///
/// 3 public AutoScrollStopMode AutoScrollStopMode { get { return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty); } set { SetValue(AutoScrollStopModeProperty, value); NotifyPropertyChanged(); } } /// /// The line count of the text. /// /// 3 public int LineCount { get { int temp = 0; GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp); return temp; } } /// /// The LineWrapMode property.
/// line wrap mode when the text lines over layout width.
///
/// 4 public LineWrapMode LineWrapMode { get { return (LineWrapMode)GetValue(LineWrapModeProperty); } set { SetValue(LineWrapModeProperty, value); NotifyPropertyChanged(); } } /// /// The direction of the text such as left to right or right to left. /// /// 5 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public TextDirection TextDirection { get { int temp = 0; GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp); return (TextDirection)temp; } } /// /// The vertical line alignment of the text. /// /// 5 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public VerticalLineAlignment VerticalLineAlignment { get { return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty); } set { SetValue(VerticalLineAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The text alignment to match the direction of the system language. /// /// 6 public bool MatchSystemLanguageDirection { get { return (bool)GetValue(MatchSystemLanguageDirectionProperty); } set { SetValue(MatchSystemLanguageDirectionProperty, value); NotifyPropertyChanged(); } } /// /// The text fit parameters.
/// The textFit map contains the following keys :
/// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)
/// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)
/// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)
/// - stepSize (float type) : Step Size for font increase(the default value is 1.f)
/// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public PropertyMap TextFit { get { return (PropertyMap)GetValue(TextFitProperty); } set { SetValue(TextFitProperty, value); NotifyPropertyChanged(); } } /// /// Downcasts a handle to textLabel handle /// /// /// /// 3 /// Please do not use! this will be deprecated! /// Instead please use as keyword. [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " + "Like: " + "BaseHandle handle = new TextLabel(\"Hello World!\"); " + "TextLabel label = handle as TextLabel")] [EditorBrowsable(EditorBrowsableState.Never)] public static TextLabel DownCast(BaseHandle handle) { TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } /// /// Dispose. /// /// 3 protected override void Dispose(DisposeTypes type) { if (disposed) { return; } if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. //You should release all of your own disposable objects here. } //Release your own unmanaged resources here. //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; Interop.TextLabel.delete_TextLabel(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } base.Dispose(type); } /// /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event. /// protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); } private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) { Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-"))); } private void NotifyPropertyChangedAndRequestLayout() { NotifyPropertyChanged(); Layout?.RequestLayout(); } internal new class Property { internal static readonly int RENDERING_BACKEND = Interop.TextLabel.TextLabel_Property_RENDERING_BACKEND_get(); internal static readonly int TEXT = Interop.TextLabel.TextLabel_Property_TEXT_get(); internal static readonly int FONT_FAMILY = Interop.TextLabel.TextLabel_Property_FONT_FAMILY_get(); internal static readonly int FONT_STYLE = Interop.TextLabel.TextLabel_Property_FONT_STYLE_get(); internal static readonly int POINT_SIZE = Interop.TextLabel.TextLabel_Property_POINT_SIZE_get(); internal static readonly int MULTI_LINE = Interop.TextLabel.TextLabel_Property_MULTI_LINE_get(); internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_HORIZONTAL_ALIGNMENT_get(); internal static readonly int VERTICAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_ALIGNMENT_get(); internal static readonly int TEXT_COLOR = Interop.TextLabel.TextLabel_Property_TEXT_COLOR_get(); internal static readonly int ENABLE_MARKUP = Interop.TextLabel.TextLabel_Property_ENABLE_MARKUP_get(); internal static readonly int ENABLE_AUTO_SCROLL = Interop.TextLabel.TextLabel_Property_ENABLE_AUTO_SCROLL_get(); internal static readonly int AUTO_SCROLL_SPEED = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_SPEED_get(); internal static readonly int AUTO_SCROLL_LOOP_COUNT = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get(); internal static readonly int AUTO_SCROLL_GAP = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_GAP_get(); internal static readonly int LINE_SPACING = Interop.TextLabel.TextLabel_Property_LINE_SPACING_get(); internal static readonly int UNDERLINE = Interop.TextLabel.TextLabel_Property_UNDERLINE_get(); internal static readonly int SHADOW = Interop.TextLabel.TextLabel_Property_SHADOW_get(); internal static readonly int EMBOSS = Interop.TextLabel.TextLabel_Property_EMBOSS_get(); internal static readonly int OUTLINE = Interop.TextLabel.TextLabel_Property_OUTLINE_get(); internal static readonly int PIXEL_SIZE = Interop.TextLabel.TextLabel_Property_PIXEL_SIZE_get(); internal static readonly int ELLIPSIS = Interop.TextLabel.TextLabel_Property_ELLIPSIS_get(); internal static readonly int AUTO_SCROLL_STOP_MODE = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get(); internal static readonly int AUTO_SCROLL_LOOP_DELAY = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get(); internal static readonly int LINE_COUNT = Interop.TextLabel.TextLabel_Property_LINE_COUNT_get(); internal static readonly int LINE_WRAP_MODE = Interop.TextLabel.TextLabel_Property_LINE_WRAP_MODE_get(); internal static readonly int TEXT_DIRECTION = Interop.TextLabel.TextLabel_Property_TEXT_DIRECTION_get(); internal static readonly int VERTICAL_LINE_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get(); internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextLabel.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get(); internal static readonly int TEXT_FIT = Interop.TextLabel.TextLabel_Property_TEXT_FIT_get(); } } }