/*
- * Copyright(c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
extern alias TizenSystemSettings;
using TizenSystemSettings.Tizen.System;
+
using System;
using System.Globalization;
using System.ComponentModel;
+using Tizen.NUI.Text;
using Tizen.NUI.Binding;
namespace Tizen.NUI.BaseComponents
{
-
/// <summary>
/// A control which renders a short text string.<br />
/// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public class TextLabel : View
+ public partial 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) =>
+ private class TextLayout : LayoutItem
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue((string)newValue));
+ // Padding will be automatically applied by DALi TextLabel.
+ float totalWidth = widthMeasureSpec.Size.AsDecimal();
+ float totalHeight = heightMeasureSpec.Size.AsDecimal();
+
+ if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
+ {
+ if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
+ {
+ totalHeight = Owner.GetHeightForWidth(totalWidth);
+ heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
+ }
+ }
+ else
+ {
+ var minSize = Owner.MinimumSize;
+ var maxSize = Owner.MaximumSize;
+ var naturalSize = Owner.GetNaturalSize();
+
+ if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
+ {
+ // GetWidthForHeight is not implemented.
+ float width = naturalSize != null ? naturalSize.Width : 0;
+ totalWidth = Math.Min(Math.Max(width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
+ widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
+ }
+ else
+ {
+ float width = naturalSize != null ? naturalSize.Width : 0;
+ float height = naturalSize != null ? naturalSize.Height : 0;
+ totalWidth = Math.Min(Math.Max(width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
+ totalHeight = Math.Min(Math.Max(height, minSize.Height), (maxSize.Height < 0 ? Int32.MaxValue : maxSize.Height));
+
+ heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
+ widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
+ }
+ }
+
+ MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
+ MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
+
+ SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
+ ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
}
- },
- defaultValueCreator:(bindable) =>
+ }
+
+ static TextLabel() { }
+
+ private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
+ private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
+ static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextLabel";
+ static private string defaultFontFamily = "BreezeSans";
+ private string textLabelSid = null;
+ private TextLabelSelectorData selectorData;
+ private string fontFamily = defaultFontFamily;
+ private float fontSizeScale = 1.0f;
+ private bool hasSystemLanguageChanged = false;
+ private bool hasSystemFontSizeChanged = false;
+ private bool hasSystemFontTypeChanged = false;
+
+ private Color internalTextColor;
+
+ /// <summary>
+ /// Creates the TextLabel control.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public TextLabel() : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
- 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.
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// 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 static readonly BindableProperty FontStyleProperty = BindableProperty.Create(nameof(FontStyle), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), 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) =>
+ public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, viewStyle)
{
- 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.
+ }
+
+ /// <summary>
+ /// Creates the TextLabel with setting the status of shown or hidden.
+ /// </summary>
+ /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
+ /// 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 static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ public TextLabel(bool shown) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
- 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) =>
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ SetVisible(shown);
+ }
+
+ /// <summary>
+ /// Creates the TextLabel control.
+ /// </summary>
+ /// <param name="text">The text to display</param>
+ /// <since_tizen> 3 </since_tizen>
+ public TextLabel(string text) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
- 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.
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Creates the TextLabel with setting the status of shown or hidden.
+ /// </summary>
+ /// <param name="text">The text to display</param>
+ /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
+ /// 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 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) =>
+ public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
- 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) =>
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ SetVisible(shown);
+ }
+
+ internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.NewTextLabel(TextLabel.getCPtr(handle)), true)
{
- var textLabel = (TextLabel)bindable;
- string valueToString = "";
- if (newValue != null)
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ if (!shown)
{
- 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));
+ SetVisible(false);
}
- },
- defaultValueCreator:(bindable) =>
+ }
+
+ internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
{
- 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)
+ if (!shown)
{
- case "BEGIN": return HorizontalAlignment.Begin;
- case "CENTER": return HorizontalAlignment.Center;
- case "END": return HorizontalAlignment.End;
- default: return HorizontalAlignment.Begin;
+ SetVisible(false);
}
- });
- /// 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) =>
+ }
+
+ internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
{
- var textLabel = (TextLabel)bindable;
- string valueToString = "";
- if (newValue != null)
+ if (!shown)
{
- 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));
+ SetVisible(false);
}
- },
- defaultValueCreator:(bindable) =>
+ }
+
+ private bool HasStyle()
{
- 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!");
- }
+ return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
+ }
- 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), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
+ /// <summary>
+ /// The TranslatableText property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// <since_tizen> 4 </since_tizen>
+ public string TranslatableText
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue((Color)newValue));
+ return (string)GetValue(TranslatableTextProperty);
}
- },
- 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 ShadowOffsetProperty = BindableProperty.Create(nameof(ShadowOffset), typeof(Vector2), typeof(TextLabel), Vector2.Zero, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW_OFFSET, new Tizen.NUI.PropertyValue((Vector2)newValue));
+ SetValue(TranslatableTextProperty, value);
}
- },
- defaultValueCreator:(bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- Vector2 temp = new Vector2(0.0f, 0.0f);
- Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW_OFFSET).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 ShadowColorProperty = BindableProperty.Create(nameof(ShadowColor), typeof(Vector4), typeof(TextLabel), Vector4.Zero, propertyChanged: (bindable, oldValue, newValue) =>
+ }
+ private string translatableText
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW_COLOR, new Tizen.NUI.PropertyValue((Vector4)newValue));
+ return textLabelSid;
}
- },
- defaultValueCreator:(bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
- Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW_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 UnderlineEnabledProperty = BindableProperty.Create(nameof(UnderlineEnabled), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE_ENABLED, new Tizen.NUI.PropertyValue((bool)newValue));
+ if (NUIApplication.MultilingualResourceManager == null)
+ {
+ throw new ArgumentNullException(null, "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 (hasSystemLanguageChanged == false)
+ {
+ systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
+ hasSystemLanguageChanged = true;
+ }
+ }
+ else
+ {
+ Text = "";
+ }
+ NotifyPropertyChanged();
}
- },
- defaultValueCreator:(bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- bool temp = false;
- Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE_ENABLED).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 UnderlineColorProperty = BindableProperty.Create(nameof(UnderlineColor), typeof(Vector4), typeof(TextLabel), Vector4.Zero, propertyChanged: (bindable, oldValue, newValue) =>
+ }
+
+ /// <summary>
+ /// The Text property.<br />
+ /// The text to display in the UTF-8 format.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public string Text
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE_COLOR, new Tizen.NUI.PropertyValue((Vector4)newValue));
+ return (string)GetValue(TextProperty);
}
- },
- defaultValueCreator:(bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
- Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE_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 UnderlineHeightProperty = BindableProperty.Create(nameof(UnderlineHeight), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE_HEIGHT, new Tizen.NUI.PropertyValue((float)newValue));
+ SetValue(TextProperty, value);
+ NotifyPropertyChanged();
}
- },
- defaultValueCreator:(bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- float temp = 0.0f;
- Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE_HEIGHT).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 EnableMarkupProperty = BindableProperty.Create(nameof(EnableMarkup), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
+ }
+
+ /// <summary>
+ /// The FontFamily property.<br />
+ /// The requested font family to use.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public string FontFamily
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue((bool)newValue));
+ return (string)GetValue(FontFamilyProperty);
}
- },
- 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)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_AUTO_SCROLL, new Tizen.NUI.PropertyValue((bool)newValue));
+ SetValue(FontFamilyProperty, value);
+ NotifyPropertyChanged();
}
- },
- 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) =>
+ }
+
+ private string InternalFontFamily
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_SPEED, new Tizen.NUI.PropertyValue((int)newValue));
+ if (HasStyle())
+ return fontFamily;
+ else
+ return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
}
- },
- 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)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_COUNT, new Tizen.NUI.PropertyValue((int)newValue));
+ string newFontFamily;
+
+ if (string.Equals(fontFamily, value)) return;
+
+ fontFamily = value;
+ if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
+ {
+ try
+ {
+ newFontFamily = SystemSettings.FontType;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ newFontFamily = defaultFontFamily;
+ }
+ AddSystemSettingsFontTypeChanged();
+ }
+ else
+ {
+ newFontFamily = fontFamily;
+ RemoveSystemSettingsFontTypeChanged();
+ }
+
+ SetInternalFontFamily(newFontFamily);
}
- },
- defaultValueCreator:(bindable) =>
+ }
+
+ private void SetInternalFontFamily(string fontFamily)
{
- 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) =>
+ Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
+ RequestLayout();
+ }
+
+ /// <summary>
+ /// The FontStyle property.<br />
+ /// The requested font style to use.<br />
+ /// The fontStyle map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
+ /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
+ /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
+ /// </list>
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
+ public PropertyMap FontStyle
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_GAP, new Tizen.NUI.PropertyValue((float)newValue));
+ return (PropertyMap)GetValue(FontStyleProperty);
}
- },
- 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)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_SPACING, new Tizen.NUI.PropertyValue((float)newValue));
+ SetValue(FontStyleProperty, value);
+ NotifyPropertyChanged();
}
- },
- 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.
+ }
+
+ /// <summary>
+ /// Set FontStyle to TextLabel. <br />
+ /// </summary>
+ /// <param name="fontStyle">The FontStyle</param>
+ /// <remarks>
+ /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetFontStyle method.
+ /// <code>
+ /// var fontStyle = new Tizen.NUI.Text.FontStyle();
+ /// fontStyle.Width = FontWidthType.Expanded;
+ /// fontStyle.Weight = FontWeightType.Bold;
+ /// fontStyle.Slant = FontSlantType.Italic;
+ /// label.SetFontStyle(fontStyle);
+ /// </code>
+ /// </example>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
+ public void SetFontStyle(FontStyle fontStyle)
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
+ SetValue(FontStyleProperty, fontStyleMap);
}
- },
- 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.
+ }
+
+ /// <summary>
+ /// Get FontStyle from TextLabel. <br />
+ /// </summary>
+ /// <returns>The FontStyle</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.FontStyle"/>
+ /// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(Shadow), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
+ public FontStyle GetFontStyle()
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ FontStyle fontStyle;
+ using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
+ fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
}
- },
- 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) =>
+ return fontStyle;
+ }
+
+ /// <summary>
+ /// The PointSize property.<br />
+ /// The size of font in points.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
+ public float PointSize
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.EMBOSS, new Tizen.NUI.PropertyValue((string)newValue));
+ return (float)GetValue(PointSizeProperty);
}
- },
- 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), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.OUTLINE, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
+ SetValue(PointSizeProperty, value);
+ NotifyPropertyChanged();
}
- },
- 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) =>
+ }
+
+ /// <summary>
+ /// The MultiLine property.<br />
+ /// The single-line or multi-line layout option.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public bool MultiLine
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue((float)newValue));
+ return (bool)GetValue(MultiLineProperty);
}
- },
- 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)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ELLIPSIS, new Tizen.NUI.PropertyValue((bool)newValue));
+ SetValue(MultiLineProperty, value);
+ NotifyPropertyChanged();
}
- },
- 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) =>
+ }
+
+ /// <summary>
+ /// The HorizontalAlignment property.<br />
+ /// The line horizontal alignment.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public HorizontalAlignment HorizontalAlignment
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_DELAY, new Tizen.NUI.PropertyValue((float)newValue));
+ return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
}
- },
- 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)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_STOP_MODE, new Tizen.NUI.PropertyValue((int)newValue));
+ SetValue(HorizontalAlignmentProperty, value);
+ NotifyPropertyChanged();
}
- },
- defaultValueCreator:(bindable) =>
+ }
+
+ /// <summary>
+ /// The VerticalAlignment property.<br />
+ /// The line vertical alignment.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public VerticalAlignment VerticalAlignment
{
- var textLabel = (TextLabel)bindable;
- string temp;
- if(Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_STOP_MODE).Get(out temp) == false)
+ get
{
- NUILog.Error("AutoScrollStopMode get error!");
+ return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
}
- switch (temp)
+ set
{
- case "FINISH_LOOP": return AutoScrollStopMode.FinishLoop;
- case "IMMEDIATE": return AutoScrollStopMode.Immediate;
- default: return AutoScrollStopMode.FinishLoop;
+ SetValue(VerticalAlignmentProperty, value);
+ NotifyPropertyChanged();
}
- });
- /// 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) =>
+ }
+
+ /// <summary>
+ /// The TextColor property.<br />
+ /// The color of the text.<br />
+ /// Animation framework can be used to change the color of the text when not using mark up.<br />
+ /// Cannot animate the color when text is auto scrolling.<br />
+ /// </summary>
+ /// <remarks>
+ /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
+ /// </remarks>
+ /// <since_tizen> 3 </since_tizen>
+ public Color TextColor
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue((int)newValue));
+ Color temp = (Color)GetValue(TextColorProperty);
+ return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
}
- },
- defaultValueCreator:(bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- int temp;
- if (false == Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_WRAP_MODE).Get(out temp))
+ set
{
- NUILog.Error("LineWrapMode get error!");
+ SetValue(TextColorProperty, value);
+ NotifyPropertyChanged();
}
- 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) =>
+ }
+
+ /// <summary>
+ /// The ShadowOffset property.<br />
+ /// The drop shadow offset 0 indicates no shadow.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// Deprecated.(API Level 6) Use Shadow instead.
+ /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
+ /// </remarks>
+ [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
+ public Vector2 ShadowOffset
{
- var textLabel = (TextLabel)bindable;
- if (newValue != null)
+ get
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_LINE_ALIGNMENT, new Tizen.NUI.PropertyValue((int)newValue));
+ return GetValue(ShadowOffsetProperty) as Vector2;
}
- },
- 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)
+ set
{
- Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION, new Tizen.NUI.PropertyValue((bool)newValue));
+ SetValue(ShadowOffsetProperty, value);
}
- },
- 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 (bool)temp;
- });
-
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
- private string textLabelSid = null;
- private bool systemlangTextFlag = false;
- internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextLabel_SWIGUpcast(cPtr), cMemoryOwn)
- {
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
+ private Vector2 InternalShadowOffset
{
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
- }
+ get
+ {
+ float x = 0.0f, y = 0.0f;
+ using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "offset"))
+ using (var shadowOffset = new Vector2())
+ {
+ if (null != propertyValue)
+ {
+ propertyValue.Get(shadowOffset);
+ x = shadowOffset.X;
+ y = shadowOffset.Y;
+ }
+ }
+ return new Vector2(OnShadowOffsetChanged, x, y);
+ }
+ set
+ {
+ using (var map = new PropertyMap())
+ {
+ map.Add("offset", value);
- /// <summary>
- /// Downcasts a handle to textLabel handle
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- /// <since_tizen> 3 </since_tizen>
- /// 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;
+ var shadowMap = Shadow;
+ shadowMap.Merge(map);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ SetValue(ShadowProperty, shadowMap);
+ NotifyPropertyChanged();
+ }
+ }
}
/// <summary>
- /// Dispose.
+ /// The ShadowColor property.<br />
+ /// The color of a drop shadow.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- protected override void Dispose(DisposeTypes type)
+ /// <remarks>
+ /// Deprecated.(API Level 6) Use Shadow instead.
+ /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
+ /// </remarks>
+ [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
+ public Vector4 ShadowColor
{
- if (disposed)
+ get
{
- return;
+ return GetValue(ShadowColorProperty) as Vector4;
}
-
- if(type == DisposeTypes.Explicit)
+ set
{
- //Called by User
- //Release your own managed resources here.
- //You should release all of your own disposable objects here.
+ SetValue(ShadowColorProperty, value);
}
+ }
- //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)
+ private Vector4 InternalShadowColor
+ {
+ get
{
- if (swigCMemOwn)
+ float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
+ using (var propertyValue = Shadow.Find(TextLabel.Property.SHADOW, "color"))
+ using (var shadowColor = new Vector4())
{
- swigCMemOwn = false;
- NDalicPINVOKE.delete_TextLabel(swigCPtr);
+ if (null != propertyValue)
+ {
+ propertyValue.Get(shadowColor);
+ x = shadowColor.X;
+ y = shadowColor.Y;
+ z = shadowColor.Z;
+ w = shadowColor.W;
+ }
+ }
+ return new Vector4(OnShadowColorChanged, x, y, z, w);
+ }
+ set
+ {
+ using (var map = new PropertyMap())
+ {
+ map.Add("color", value);
+ var shadowMap = Shadow;
+ shadowMap.Merge(map);
+ SetValue(ShadowProperty, shadowMap);
+ NotifyPropertyChanged();
}
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
-
- base.Dispose(type);
- }
-
- internal new class Property
- {
- internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextLabel_Property_RENDERING_BACKEND_get();
- internal static readonly int TEXT = NDalicPINVOKE.TextLabel_Property_TEXT_get();
- internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextLabel_Property_FONT_FAMILY_get();
- internal static readonly int FONT_STYLE = NDalicPINVOKE.TextLabel_Property_FONT_STYLE_get();
- internal static readonly int POINT_SIZE = NDalicPINVOKE.TextLabel_Property_POINT_SIZE_get();
- internal static readonly int MULTI_LINE = NDalicPINVOKE.TextLabel_Property_MULTI_LINE_get();
- internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
- internal static readonly int VERTICAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_VERTICAL_ALIGNMENT_get();
- internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_get();
- internal static readonly int SHADOW_OFFSET = NDalicPINVOKE.TextLabel_Property_SHADOW_OFFSET_get();
- internal static readonly int SHADOW_COLOR = NDalicPINVOKE.TextLabel_Property_SHADOW_COLOR_get();
- internal static readonly int UNDERLINE_ENABLED = NDalicPINVOKE.TextLabel_Property_UNDERLINE_ENABLED_get();
- internal static readonly int UNDERLINE_COLOR = NDalicPINVOKE.TextLabel_Property_UNDERLINE_COLOR_get();
- internal static readonly int UNDERLINE_HEIGHT = NDalicPINVOKE.TextLabel_Property_UNDERLINE_HEIGHT_get();
- internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextLabel_Property_ENABLE_MARKUP_get();
- internal static readonly int ENABLE_AUTO_SCROLL = NDalicPINVOKE.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
- internal static readonly int AUTO_SCROLL_SPEED = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_SPEED_get();
- internal static readonly int AUTO_SCROLL_LOOP_COUNT = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
- internal static readonly int AUTO_SCROLL_GAP = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_GAP_get();
- internal static readonly int LINE_SPACING = NDalicPINVOKE.TextLabel_Property_LINE_SPACING_get();
- internal static readonly int UNDERLINE = NDalicPINVOKE.TextLabel_Property_UNDERLINE_get();
- internal static readonly int SHADOW = NDalicPINVOKE.TextLabel_Property_SHADOW_get();
- internal static readonly int EMBOSS = NDalicPINVOKE.TextLabel_Property_EMBOSS_get();
- internal static readonly int OUTLINE = NDalicPINVOKE.TextLabel_Property_OUTLINE_get();
- internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextLabel_Property_PIXEL_SIZE_get();
- internal static readonly int ELLIPSIS = NDalicManualPINVOKE.TextLabel_Property_ELLIPSIS_get();
- internal static readonly int AUTO_SCROLL_STOP_MODE = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
- internal static readonly int AUTO_SCROLL_LOOP_DELAY = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
- internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextLabel_Property_LINE_COUNT_get();
- internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextLabel_Property_LINE_WRAP_MODE_get();
- internal static readonly int TEXT_DIRECTION = NDalicManualPINVOKE.TextLabel_Property_TEXT_DIRECTION_get();
- internal static readonly int VERTICAL_LINE_ALIGNMENT = NDalicManualPINVOKE.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
- internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = NDalicManualPINVOKE.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
}
/// <summary>
- /// Creates the TextLabel control.
+ /// The UnderlineEnabled property.<br />
+ /// The underline enabled flag.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public TextLabel() : this(NDalicPINVOKE.TextLabel_New__SWIG_0(), true)
+ /// <remarks>
+ /// Deprecated.(API Level 6) Use Underline instead.
+ /// </remarks>
+ [Obsolete("Do not use this UnderlineEnabled(Deprecated). Use Underline instead.")]
+ public bool UnderlineEnabled
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ get
+ {
+ return (bool)GetValue(UnderlineEnabledProperty);
+ }
+ set
+ {
+ SetValue(UnderlineEnabledProperty, value);
+ }
+ }
+ private bool InternalUnderlineEnabled
+ {
+ get
+ {
+ bool underlineEnabled = false;
+ using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "enable"))
+ {
+ if (propertyValue != null)
+ {
+ propertyValue.Get(out underlineEnabled);
+ }
+ }
+ return underlineEnabled;
+ }
+ set
+ {
+ using (var map = new PropertyMap())
+ {
+ map.Add("enable", value);
+ var undelineMap = Underline;
+ undelineMap.Merge(map);
+ SetValue(UnderlineProperty, undelineMap);
+ NotifyPropertyChanged();
+ }
+ }
}
/// <summary>
- /// Creates the TextLabel control.
+ /// The UnderlineColor property.<br />
+ /// Overrides the underline height from font metrics.<br />
/// </summary>
- /// <param name="text">The text to display</param>
/// <since_tizen> 3 </since_tizen>
- public TextLabel(string text) : this(NDalicPINVOKE.TextLabel_New__SWIG_1(text), true)
+ /// <remarks>
+ /// Deprecated.(API Level 6) Use Underline instead.
+ /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
+ /// </remarks>
+ [Obsolete("Do not use this UnderlineColor(Deprecated). Use Underline instead.")]
+ public Vector4 UnderlineColor
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
+ get
+ {
+ return GetValue(UnderlineColorProperty) as Vector4;
+ }
+ set
+ {
+ SetValue(UnderlineColorProperty, value);
+ }
}
- internal TextLabel(TextLabel handle) : this(NDalicPINVOKE.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true)
+ private Vector4 InternalUnderlineColor
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ get
+ {
+ float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
+ using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "color"))
+ using (var underlineColor = new Vector4())
+ {
+ if (null != propertyValue)
+ {
+ propertyValue.Get(underlineColor);
+ x = underlineColor.X;
+ y = underlineColor.Y;
+ z = underlineColor.Z;
+ w = underlineColor.W;
+ }
+ }
+ return new Vector4(OnUnderlineColorChanged, x, y, z, w);
+ }
+ set
+ {
+ using (var map = new PropertyMap())
+ {
+ map.Add("color", value);
+ var undelineMap = Underline;
+ undelineMap.Merge(map);
+ SetValue(UnderlineProperty, undelineMap);
+ NotifyPropertyChanged();
+ }
+ }
}
/// <summary>
- /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
+ /// The UnderlineHeight property.<br />
+ /// Overrides the underline height from font metrics.<br />
/// </summary>
- protected override void OnBindingContextChanged()
+ /// <since_tizen> 3 </since_tizen>
+ /// <remarks>
+ /// Deprecated.(API Level 6) Use Underline instead.
+ /// </remarks>
+ [Obsolete("Do not use this UnderlineHeight(Deprecated). Use Underline instead.")]
+ public float UnderlineHeight
{
- base.OnBindingContextChanged();
+ get
+ {
+ return (float)GetValue(UnderlineHeightProperty);
+ }
+ set
+ {
+ SetValue(UnderlineHeightProperty, value);
+ }
}
-
- /// <summary>
- /// The TranslatableText property.<br />
- /// The text can set the SID value.<br />
- /// </summary>
- /// <exception cref='ArgumentNullException'>
- /// ResourceManager about multilingual is null.
- /// </exception>
- /// <since_tizen> 4 </since_tizen>
- public string TranslatableText
+
+ private float InternalUnderlineHeight
{
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)
+ float underlineHeight = 0.0f;
+ using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "height"))
{
- Text = translatableText;
- if (systemlangTextFlag == false)
+ if (null != propertyValue)
{
- SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
- systemlangTextFlag = true;
+ propertyValue.Get(out underlineHeight);
}
}
- else
+ return underlineHeight;
+ }
+ set
+ {
+ using (var map = new PropertyMap())
{
- Text = "";
+ map.Add("height", value);
+ var undelineMap = Underline;
+ undelineMap.Merge(map);
+ SetValue(UnderlineProperty, undelineMap);
+ NotifyPropertyChanged();
}
- NotifyPropertyChanged();
}
}
- private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
+
+ /// <summary>
+ /// The EnableMarkup property.<br />
+ /// Whether the mark-up processing is enabled.<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public bool EnableMarkup
{
- Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
+ get
+ {
+ return (bool)GetValue(EnableMarkupProperty);
+ }
+ set
+ {
+ SetValue(EnableMarkupProperty, value);
+ NotifyPropertyChanged();
+ }
}
/// <summary>
- /// The Text property.<br />
- /// The text to display in the UTF-8 format.<br />
+ /// The EnableAutoScroll property.<br />
+ /// Starts or stops auto scrolling.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public string Text
+ public bool EnableAutoScroll
{
get
{
- return (string)GetValue(TextProperty);
+ return (bool)GetValue(EnableAutoScrollProperty);
}
set
{
- SetValue(TextProperty, value);
+ SetValue(EnableAutoScrollProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The FontFamily property.<br />
- /// The requested font family to use.<br />
+ /// The AutoScrollSpeed property.<br />
+ /// Sets the speed of scrolling in pixels per second.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public string FontFamily
+ public int AutoScrollSpeed
{
get
{
- return (string)GetValue(FontFamilyProperty);
+ return (int)GetValue(AutoScrollSpeedProperty);
}
set
{
- SetValue(FontFamilyProperty, value);
+ SetValue(AutoScrollSpeedProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The FontStyle property.<br />
- /// The requested font style to use.<br />
+ /// The AutoScrollLoopCount property.<br />
+ /// Number of complete loops when scrolling enabled.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public PropertyMap FontStyle
+ public int AutoScrollLoopCount
{
get
{
- return (PropertyMap)GetValue(FontStyleProperty);
+ return (int)GetValue(AutoScrollLoopCountProperty);
}
set
{
- SetValue(FontStyleProperty, value);
+ SetValue(AutoScrollLoopCountProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The PointSize property.<br />
- /// The size of font in points.<br />
+ /// The AutoScrollGap property.<br />
+ /// Gap before scrolling wraps.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public float PointSize
+ public float AutoScrollGap
{
get
{
- return (float)GetValue(PointSizeProperty);
+ return (float)GetValue(AutoScrollGapProperty);
}
set
{
- SetValue(PointSizeProperty, value);
+ SetValue(AutoScrollGapProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The MultiLine property.<br />
- /// The single-line or multi-line layout option.<br />
+ /// The LineSpacing property.<br />
+ /// The default extra space between lines in points.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public bool MultiLine
+ public float LineSpacing
{
get
{
- return (bool)GetValue(MultiLineProperty);
+ return (float)GetValue(LineSpacingProperty);
}
set
{
- SetValue(MultiLineProperty, value);
+ SetValue(LineSpacingProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The HorizontalAlignment property.<br />
- /// The line horizontal alignment.<br />
+ /// The relative height of the line (a factor that will be multiplied by text height). <br />
+ /// If the value is less than 1, the lines could to be overlapped.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public HorizontalAlignment HorizontalAlignment
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float RelativeLineHeight
{
get
{
- return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
+ return (float)GetValue(RelativeLineHeightProperty);
}
set
{
- SetValue(HorizontalAlignmentProperty, value);
+ SetValue(RelativeLineHeightProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The VerticalAlignment property.<br />
- /// The line vertical alignment.<br />
+ /// The Underline property.<br />
+ /// The default underline parameters.<br />
+ /// The underline map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
+ /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
+ /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public VerticalAlignment VerticalAlignment
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
+ public PropertyMap Underline
{
get
{
- return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
+ return (PropertyMap)GetValue(UnderlineProperty);
}
set
{
- SetValue(VerticalAlignmentProperty, value);
+ SetValue(UnderlineProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The TextColor property.<br />
- /// The color of the text.<br />
- /// Animation framework can be used to change the color of the text when not using mark up.<br />
- /// Cannot animate the color when text is auto scrolling.<br />
+ /// Set Underline to TextLabel. <br />
+ /// </summary>
+ /// <param name="underline">The Underline</param>
+ /// <remarks>
+ /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetUnderline method.
+ /// <code>
+ /// var underline = new Tizen.NUI.Text.Underline();
+ /// underline.Enable = true;
+ /// underline.Color = new Color("#3498DB");
+ /// underline.Height = 2.0f;
+ /// label.SetUnderline(underline);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetUnderline(Underline underline)
+ {
+ using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
+ {
+ SetValue(UnderlineProperty, underlineMap);
+ }
+ }
+
+ /// <summary>
+ /// Get Underline from TextLabel. <br />
+ /// </summary>
+ /// <returns>The Underline</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Underline"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Underline GetUnderline()
+ {
+ Underline underline;
+ using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
+ {
+ underline = TextMapHelper.GetUnderlineStruct(underlineMap);
+ }
+ return underline;
+ }
+
+ /// <summary>
+ /// The Shadow property.<br />
+ /// The default shadow parameters.<br />
+ /// The shadow map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
+ /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
+ /// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public Color TextColor
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
+ public PropertyMap Shadow
{
get
{
- return (Color)GetValue(TextColorProperty);
+ return (PropertyMap)GetValue(ShadowProperty);
}
set
{
- SetValue(TextColorProperty, value);
+ SetValue(ShadowProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The ShadowOffset property.<br />
- /// The drop shadow offset 0 indicates no shadow.<br />
+ /// Set Shadow to TextLabel. <br />
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public Vector2 ShadowOffset
+ /// <param name="shadow">The Shadow</param>
+ /// <remarks>
+ /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetShadow method.
+ /// <code>
+ /// var shadow = new Tizen.NUI.Text.Shadow();
+ /// shadow.Offset = new Vector2(3, 3);
+ /// shadow.Color = new Color("#F1C40F");
+ /// shadow.BlurRadius = 4.0f;
+ /// label.SetShadow(shadow);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
+ {
+ using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
+ {
+ SetValue(ShadowProperty, shadowMap);
+ }
+ }
+
+ /// <summary>
+ /// Get Shadow from TextLabel. <br />
+ /// </summary>
+ /// <returns>The Shadow</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Shadow"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Text.Shadow GetShadow()
+ {
+ Tizen.NUI.Text.Shadow shadow;
+ using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
+ {
+ shadow = TextMapHelper.GetShadowStruct(shadowMap);
+ }
+ return shadow;
+ }
+
+ /// <summary>
+ /// Describes a text shadow for a TextLabel.
+ /// It is null by default.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextShadow TextShadow
{
get
{
- return (Vector2)GetValue(ShadowOffsetProperty);
+ return (TextShadow)GetValue(TextShadowProperty);
}
set
{
- SetValue(ShadowOffsetProperty, value);
+ SetValue(TextShadowProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The ShadowColor property.<br />
- /// The color of a drop shadow.<br />
+ /// The Emboss property.<br />
+ /// The default emboss parameters.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public Vector4 ShadowColor
+ public string Emboss
{
get
{
- return (Vector4)GetValue(ShadowColorProperty);
+ return (string)GetValue(EmbossProperty);
}
set
{
- SetValue(ShadowColorProperty, value);
+ SetValue(EmbossProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The UnderlineEnabled property.<br />
- /// The underline enabled flag.<br />
+ /// The Outline property.<br />
+ /// The default outline parameters.<br />
+ /// The outline map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
+ /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public bool UnderlineEnabled
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
+ public PropertyMap Outline
{
get
{
- return (bool)GetValue(UnderlineEnabledProperty);
+ return (PropertyMap)GetValue(OutlineProperty);
}
set
{
- SetValue(UnderlineEnabledProperty, value);
+ SetValue(OutlineProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The UnderlineColor property.<br />
- /// Overrides the underline height from font metrics.<br />
+ /// Set Outline to TextLabel. <br />
+ /// </summary>
+ /// <param name="outline">The Outline</param>
+ /// <remarks>
+ /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetOutline method.
+ /// <code>
+ /// var outline = new Tizen.NUI.Text.Outline();
+ /// outline.Width = 2.0f;
+ /// outline.Color = new Color("#45B39D");
+ /// label.SetOutline(outline);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetOutline(Outline outline)
+ {
+ using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
+ {
+ SetValue(OutlineProperty, outlineMap);
+ }
+ }
+
+ /// <summary>
+ /// Get Outline from TextLabel. <br />
+ /// </summary>
+ /// <returns>The Outline</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Outline"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Outline GetOutline()
+ {
+ Outline outline;
+ using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
+ {
+ outline = TextMapHelper.GetOutlineStruct(outlineMap);
+ }
+ return outline;
+ }
+
+ /// <summary>
+ /// Set Strikethrough to TextLabel. <br />
+ /// </summary>
+ /// <param name="strikethrough">The Strikethrough</param>
+ /// <remarks>
+ /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetStrikethrough method.
+ /// <code>
+ /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
+ /// strikethrough.Enable = true;
+ /// strikethrough.Color = new Color("#3498DB");
+ /// strikethrough.Height = 2.0f;
+ /// label.SetStrikethrough(strikethrough);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetStrikethrough(Strikethrough strikethrough)
+ {
+ using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
+ using (var propertyValue = new PropertyValue(map))
+ {
+ SetProperty(TextLabel.Property.Strikethrough, propertyValue);
+ }
+ }
+
+ /// <summary>
+ /// Get Strikethrough from TextLabel. <br />
+ /// </summary>
+ /// <returns>The Strikethrough</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Strikethrough"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Strikethrough GetStrikethrough()
+ {
+ Strikethrough strikethrough;
+ using (var propertyValue = GetProperty(TextLabel.Property.Strikethrough))
+ using (var map = new PropertyMap())
+ {
+ propertyValue.Get(map);
+ strikethrough = TextMapHelper.GetStrikethroughStruct(map);
+ }
+ return strikethrough;
+ }
+
+ /// <summary>
+ /// The PixelSize property.<br />
+ /// The size of font in pixels.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public Vector4 UnderlineColor
+ [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
+ public float PixelSize
{
get
{
- return (Vector4)GetValue(UnderlineColorProperty);
+ return (float)GetValue(PixelSizeProperty);
}
set
{
- SetValue(UnderlineColorProperty, value);
+ SetValue(PixelSizeProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The UnderlineHeight property.<br />
- /// Overrides the underline height from font metrics.<br />
+ /// The Ellipsis property.<br />
+ /// Enable or disable the ellipsis.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public float UnderlineHeight
+ public bool Ellipsis
{
get
{
- return (float)GetValue(UnderlineHeightProperty);
+ return (bool)GetValue(EllipsisProperty);
}
set
{
- SetValue(UnderlineHeightProperty, value);
+ SetValue(EllipsisProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The EnableMarkup property.<br />
- /// Whether the mark-up processing is enabled.<br />
+ /// The ellipsis position of the text.
+ /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool EnableMarkup
+ /// <since_tizen> 9 </since_tizen>
+ public EllipsisPosition EllipsisPosition
{
get
{
- return (bool)GetValue(EnableMarkupProperty);
+ return (EllipsisPosition)GetValue(EllipsisPositionProperty);
}
set
{
- SetValue(EnableMarkupProperty, value);
+ SetValue(EllipsisPositionProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The EnableAutoScroll property.<br />
- /// Starts or stops auto scrolling.<br />
+ /// The AutoScrollLoopDelay property.<br />
+ /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public bool EnableAutoScroll
+ public float AutoScrollLoopDelay
{
get
{
- return (bool)GetValue(EnableAutoScrollProperty);
+ return (float)GetValue(AutoScrollLoopDelayProperty);
}
set
{
- SetValue(EnableAutoScrollProperty, value);
+ SetValue(AutoScrollLoopDelayProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The AutoScrollSpeed property.<br />
- /// Sets the speed of scrolling in pixels per second.<br />
+ /// The AutoScrollStopMode property.<br />
+ /// The auto scrolling stop behaviour.<br />
+ /// The default value is AutoScrollStopMode.FinishLoop. <br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public int AutoScrollSpeed
+ public AutoScrollStopMode AutoScrollStopMode
{
get
{
- return (int)GetValue(AutoScrollSpeedProperty);
+ return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
}
set
{
- SetValue(AutoScrollSpeedProperty, value);
- NotifyPropertyChanged();
+ SetValue(AutoScrollStopModeProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
+ /// The line count of the text.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public int LineCount
+ {
+ get
+ {
+ int lineCount = 0;
+ using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
+ {
+ propertyValue.Get(out lineCount);
+ }
+ return lineCount;
}
}
/// <summary>
- /// The AutoScrollLoopCount property.<br />
- /// Number of complete loops when scrolling enabled.<br />
+ /// The LineWrapMode property.<br />
+ /// line wrap mode when the text lines over layout width.<br />
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public int AutoScrollLoopCount
+ /// <since_tizen> 4 </since_tizen>
+ public LineWrapMode LineWrapMode
{
get
{
- return (int)GetValue(AutoScrollLoopCountProperty);
+ return (LineWrapMode)GetValue(LineWrapModeProperty);
}
set
{
- SetValue(AutoScrollLoopCountProperty, value);
+ SetValue(LineWrapModeProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The AutoScrollGap property.<br />
- /// Gap before scrolling wraps.<br />
+ /// The direction of the text such as left to right or right to left.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float AutoScrollGap
+ /// 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 TextDirection TextDirection
{
get
{
- return (float)GetValue(AutoScrollGapProperty);
- }
- set
- {
- SetValue(AutoScrollGapProperty, value);
- NotifyPropertyChanged();
+ int textDirection = 0;
+ using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
+ {
+ propertyValue.Get(out textDirection);
+ }
+ return (TextDirection)textDirection;
}
}
/// <summary>
- /// The LineSpacing property.<br />
- /// The default extra space between lines in points.<br />
+ /// The vertical line alignment of the text.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float LineSpacing
+ /// 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 VerticalLineAlignment VerticalLineAlignment
{
get
{
- return (float)GetValue(LineSpacingProperty);
+ return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
}
set
{
- SetValue(LineSpacingProperty, value);
+ SetValue(VerticalLineAlignmentProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The Underline property.<br />
- /// The default underline parameters.<br />
+ /// The text alignment to match the direction of the system language.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public PropertyMap Underline
+ /// <since_tizen> 6 </since_tizen>
+ public bool MatchSystemLanguageDirection
{
get
{
- return (PropertyMap)GetValue(UnderlineProperty);
+ return (bool)GetValue(MatchSystemLanguageDirectionProperty);
}
set
{
- SetValue(UnderlineProperty, value);
+ SetValue(MatchSystemLanguageDirectionProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The Shadow property.<br />
- /// The default shadow parameters.<br />
+ /// The text fit parameters.<br />
+ /// The textFit map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>enable (bool)</term><description>True to enable the text fit or false to disable (the default value is false)</description></item>
+ /// <item><term>minSize (float)</term><description>Minimum Size for text fit (the default value is 10.f)</description></item>
+ /// <item><term>maxSize (float)</term><description>Maximum Size for text fit (the default value is 100.f)</description></item>
+ /// <item><term>stepSize (float)</term><description>Step Size for font increase (the default value is 1.f)</description></item>
+ /// <item><term>fontSize (string)</term><description>The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")</description></item>
+ /// </list>
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public PropertyMap Shadow
+ /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
+ public PropertyMap TextFit
{
get
{
- return (PropertyMap)GetValue(ShadowProperty);
+ return (PropertyMap)GetValue(TextFitProperty);
}
set
{
- SetValue(ShadowProperty, value);
+ SetValue(TextFitProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The Emboss property.<br />
- /// The default emboss parameters.<br />
+ /// Set TextFit to TextLabel. <br />
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public string Emboss
+ /// <param name="textFit">The TextFit</param>
+ /// <remarks>
+ /// SetTextFit specifies the textFit of the text through <see cref="Tizen.NUI.Text.TextFit"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetTextFit method.
+ /// <code>
+ /// var textFit = new Tizen.NUI.Text.TextFit();
+ /// textFit.Enable = true;
+ /// textFit.MinSize = 10.0f;
+ /// textFit.MaxSize = 100.0f;
+ /// textFit.StepSize = 5.0f;
+ /// textFit.FontSizeType = FontSizeType.PointSize;
+ /// label.SetTextFit(textFit);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetTextFit(TextFit textFit)
{
- get
+ using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
{
- return (string)GetValue(EmbossProperty);
+ SetValue(TextFitProperty, textFitMap);
}
- set
+ }
+
+ /// <summary>
+ /// Get TextFit from TextLabel. <br />
+ /// </summary>
+ /// <returns>The TextFit</returns>
+ /// <remarks>
+ /// TextFit is always returned based on PointSize. <br />
+ /// If the user sets FontSizeType to PixelSize, then MinSize, MaxSize, and StepSize are converted based on PointSize and returned. <br />
+ /// <see cref="Tizen.NUI.Text.TextFit"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextFit GetTextFit()
+ {
+ TextFit textFit;
+ using (var textFitMap = (PropertyMap)GetValue(TextFitProperty))
{
- SetValue(EmbossProperty, value);
- NotifyPropertyChanged();
+ textFit = TextMapHelper.GetTextFitStruct(textFitMap);
}
+ return textFit;
}
/// <summary>
- /// The Outline property.<br />
- /// The default outline parameters.<br />
+ /// The MinLineSize property.<br />
+ /// The height of the line in points. <br />
+ /// If the font size is larger than the line size, it works with the font size. <br />
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public PropertyMap Outline
+ /// 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 float MinLineSize
{
get
{
- return (PropertyMap)GetValue(OutlineProperty);
+ return (float)GetValue(MinLineSizeProperty);
}
set
{
- SetValue(OutlineProperty, value);
+ SetValue(MinLineSizeProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The PixelSize property.<br />
- /// The size of font in pixels.<br />
+ /// The spaces between characters in Pixels.
+ /// <remarks>
+ /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
+ /// The default value is 0.f which does nothing.
+ ///</remarks>
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float PixelSize
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CharacterSpacing
{
get
{
- return (float)GetValue(PixelSizeProperty);
+ return (float)GetValue(CharacterSpacingProperty);
}
set
{
- SetValue(PixelSizeProperty, value);
+ SetValue(CharacterSpacingProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
- /// The Ellipsis property.<br />
- /// Enable or disable the ellipsis.<br />
+ /// The FontSizeScale property for scaling the specified font size up or down. <br />
+ /// The default value is 1.0. <br />
+ /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
+ /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public bool Ellipsis
+ /// <since_tizen> 9 </since_tizen>
+ public float FontSizeScale
{
get
{
- return (bool)GetValue(EllipsisProperty);
+ return (float)GetValue(FontSizeScaleProperty);
}
set
{
- SetValue(EllipsisProperty, value);
+ SetValue(FontSizeScaleProperty, value);
NotifyPropertyChanged();
}
}
- /// <summary>
- /// The AutoScrollLoopDelay property.<br />
- /// Do something.<br />
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public float AutoScrollLoopDelay
+ private float InternalFontSizeScale
{
get
{
- return (float)GetValue(AutoScrollLoopDelayProperty);
+ return fontSizeScale;
}
set
{
- SetValue(AutoScrollLoopDelayProperty, value);
- NotifyPropertyChanged();
+ float newFontSizeScale;
+
+ if (fontSizeScale == value) return;
+
+ fontSizeScale = value;
+ if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
+ {
+ SystemSettingsFontSize systemSettingsFontSize;
+
+ try
+ {
+ systemSettingsFontSize = SystemSettings.FontSize;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ systemSettingsFontSize = SystemSettingsFontSize.Normal;
+ }
+ newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
+ AddSystemSettingsFontSizeChanged();
+ }
+ else
+ {
+ newFontSizeScale = fontSizeScale;
+ RemoveSystemSettingsFontSizeChanged();
+ }
+
+ SetInternalFontSizeScale(newFontSizeScale);
}
}
+ private void SetInternalFontSizeScale(float fontSizeScale)
+ {
+
+ Object.InternalSetPropertyFloat(this.SwigCPtr, TextLabel.Property.FontSizeScale, (float)fontSizeScale);
+ RequestLayout();
+ }
+
/// <summary>
- /// The AutoScrollStopMode property.<br />
- /// Do something.<br />
+ /// The EnableFontSizeScale property.<br />
+ /// Whether the font size scale is enabled. (The default value is true)
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public AutoScrollStopMode AutoScrollStopMode
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableFontSizeScale
{
get
{
- return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
+ return (bool)GetValue(EnableFontSizeScaleProperty);
}
set
{
- SetValue(AutoScrollStopModeProperty, value);
+ SetValue(EnableFontSizeScaleProperty, value);
NotifyPropertyChanged();
}
}
+ private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData());
+
/// <summary>
- /// The line count of the text.
+ /// Downcasts a handle to textLabel handle
/// </summary>
+ /// <param name="handle"></param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
/// <since_tizen> 3 </since_tizen>
- public int LineCount
+ /// Do not use this, that will be deprecated. Use as keyword instead.
+ [Obsolete("Do not use this, that will be deprecated. 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)
{
- get
+ if (null == handle)
{
- int temp = 0;
- GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp);
- return temp;
+ throw new ArgumentNullException(nameof(handle));
}
+ TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
- /// <summary>
- /// The LineWrapMode property.<br />
- /// line wrap mode when the text lines over layout width.<br />
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public LineWrapMode LineWrapMode
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
{
- get
+ if (disposed)
{
- return (LineWrapMode)GetValue(LineWrapModeProperty);
+ return;
}
- set
+
+ internalTextColor?.Dispose();
+
+ if (hasSystemLanguageChanged)
{
- SetValue(LineWrapModeProperty, value);
- NotifyPropertyChanged();
+ systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
+ }
+
+ RemoveSystemSettingsFontTypeChanged();
+ RemoveSystemSettingsFontSizeChanged();
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ selectorData?.Reset(this);
+ }
+
+ if (this.HasBody())
+ {
+ if (textLabelTextFitChangedCallbackDelegate != null)
+ {
+ TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
+ }
}
+
+ base.Dispose(type);
+ }
+
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.TextLabel.DeleteTextLabel(swigCPtr);
}
/// <summary>
- /// The direction of the text such as left to right or right to left.
+ /// Get attribues, it is abstract function and must be override.
/// </summary>
- /// <since_tizen> 5 </since_tizen>
- /// 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
+ protected override ViewStyle CreateViewStyle()
{
- get
- {
- int temp = 0;
- GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp);
- return (TextDirection)temp;
- }
+ return new TextLabelStyle();
+ }
+
+ internal override LayoutItem CreateDefaultLayout()
+ {
+ return new TextLayout();
}
/// <summary>
- /// The vertical line alignment of the text.
+ /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
/// </summary>
- /// <since_tizen> 5 </since_tizen>
- /// 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
+ protected override void OnBindingContextChanged()
{
- get
+ base.OnBindingContextChanged();
+ }
+
+ private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
+ {
+ Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
+ }
+
+ private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
+ {
+ float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
+ SetInternalFontSizeScale(newFontSizeScale);
+ }
+
+ private void AddSystemSettingsFontSizeChanged()
+ {
+ if (hasSystemFontSizeChanged != true)
{
- return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
+ try
+ {
+ SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
+ hasSystemFontSizeChanged = true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontSizeChanged = false;
+ }
}
- set
+ }
+
+ private void RemoveSystemSettingsFontSizeChanged()
+ {
+ if (hasSystemFontSizeChanged == true)
{
- SetValue(VerticalLineAlignmentProperty, value);
- NotifyPropertyChanged();
+ try
+ {
+ SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
+ hasSystemFontSizeChanged = false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontSizeChanged = true;
+ }
}
}
- /// <summary>
- /// The text alignment to match the direction of the system language.
- /// </summary>
- /// <since_tizen> 5 </since_tizen>
- /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool MatchSystemLanguageDirection
+ private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
{
- get
+ SetInternalFontFamily(e.Value);
+ }
+
+ private void AddSystemSettingsFontTypeChanged()
+ {
+ if (HasStyle() && !hasSystemFontTypeChanged)
{
- return (bool)GetValue(MatchSystemLanguageDirectionProperty);
+ try
+ {
+ systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
+ hasSystemFontTypeChanged = true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = false;
+ }
}
- set
+ }
+
+ private void RemoveSystemSettingsFontTypeChanged()
+ {
+ if (hasSystemFontTypeChanged)
{
- SetValue(MatchSystemLanguageDirectionProperty, value);
- NotifyPropertyChanged();
+ try
+ {
+ systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
+ hasSystemFontTypeChanged = false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = true;
+ }
}
}
+
+ private void RequestLayout()
+ {
+ Layout?.RequestLayout();
+ }
+
+ internal new class Property
+ {
+ internal static readonly int TEXT = Interop.TextLabel.TextGet();
+ internal static readonly int FontFamily = Interop.TextLabel.FontFamilyGet();
+ internal static readonly int FontStyle = Interop.TextLabel.FontStyleGet();
+ internal static readonly int PointSize = Interop.TextLabel.PointSizeGet();
+ internal static readonly int MultiLine = Interop.TextLabel.MultiLineGet();
+ internal static readonly int HorizontalAlignment = Interop.TextLabel.HorizontalAlignmentGet();
+ internal static readonly int VerticalAlignment = Interop.TextLabel.VerticalAlignmentGet();
+ internal static readonly int TextColor = Interop.TextLabel.TextColorGet();
+ internal static readonly int EnableMarkup = Interop.TextLabel.EnableMarkupGet();
+ internal static readonly int EnableAutoScroll = Interop.TextLabel.EnableAutoScrollGet();
+ internal static readonly int AutoScrollSpeed = Interop.TextLabel.AutoScrollSpeedGet();
+ internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
+ internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
+ internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
+ internal static readonly int RelativeLineHeight = Interop.TextLabel.RelativeLineHeightGet();
+ internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
+ internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
+ internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
+ internal static readonly int OUTLINE = Interop.TextLabel.OutlineGet();
+ internal static readonly int PixelSize = Interop.TextLabel.PixelSizeGet();
+ internal static readonly int ELLIPSIS = Interop.TextLabel.EllipsisGet();
+ internal static readonly int AutoScrollStopMode = Interop.TextLabel.AutoScrollStopModeGet();
+ internal static readonly int AutoScrollLoopDelay = Interop.TextLabel.AutoScrollLoopDelayGet();
+ internal static readonly int LineCount = Interop.TextLabel.LineCountGet();
+ internal static readonly int LineWrapMode = Interop.TextLabel.LineWrapModeGet();
+ internal static readonly int TextDirection = Interop.TextLabel.TextDirectionGet();
+ internal static readonly int VerticalLineAlignment = Interop.TextLabel.VerticalLineAlignmentGet();
+ internal static readonly int MatchSystemLanguageDirection = Interop.TextLabel.MatchSystemLanguageDirectionGet();
+ internal static readonly int TextFit = Interop.TextLabel.TextFitGet();
+ internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet();
+ internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet();
+ internal static readonly int EnableFontSizeScale = Interop.TextLabel.EnableFontSizeScaleGet();
+ internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
+ internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
+ internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
+ }
+
+ private void OnShadowColorChanged(float x, float y, float z, float w)
+ {
+ ShadowColor = new Vector4(x, y, z, w);
+ }
+ private void OnShadowOffsetChanged(float x, float y)
+ {
+ ShadowOffset = new Vector2(x, y);
+ }
+ private void OnTextColorChanged(float r, float g, float b, float a)
+ {
+ TextColor = new Color(r, g, b, a);
+ }
+ private void OnUnderlineColorChanged(float x, float y, float z, float w)
+ {
+ UnderlineColor = new Vector4(x, y, z, w);
+ }
}
}