using System.Globalization;
using System.ComponentModel;
using Tizen.NUI.Text;
+using Tizen.NUI.Binding;
namespace Tizen.NUI.BaseComponents
{
if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
{
// GetWidthForHeight is not implemented.
- totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
+ 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
{
- totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), (maxSize.Width < 0 ? Int32.MaxValue : maxSize.Width));
- totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), (maxSize.Height < 0 ? Int32.MaxValue : maxSize.Height));
+ 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);
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 bool systemlangTextFlag = false;
private TextLabelSelectorData selectorData;
+ private string fontFamily = defaultFontFamily;
private float fontSizeScale = 1.0f;
- private bool hasFontSizeChangedCallback = false;
+ 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(), true)
+ public TextLabel() : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
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 TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(), true, viewStyle)
+ public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, viewStyle)
{
}
/// <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 TextLabel(bool shown) : this(Interop.TextLabel.New(), true)
+ public TextLabel(bool shown) : this(Interop.TextLabel.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
/// </summary>
/// <param name="text">The text to display</param>
/// <since_tizen> 3 </since_tizen>
- public TextLabel(string text) : this(Interop.TextLabel.New(text), true)
+ public TextLabel(string text) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <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 TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text), true)
+ public TextLabel(string text, bool shown) : this(Interop.TextLabel.New(text, ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
}
}
- /// <summary>
- /// Create internal layout of TextLabel
- /// </summary>
- internal LayoutItem CreateTextLayout()
+ private bool HasStyle()
{
- return new TextLayout();
+ return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
}
/// <summary>
if (translatableText != null)
{
Text = translatableText;
- if (systemlangTextFlag == false)
+ if (hasSystemLanguageChanged == false)
{
- SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
- systemlangTextFlag = true;
+ systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
+ hasSystemLanguageChanged = true;
}
}
else
}
}
+ private string InternalFontFamily
+ {
+ get
+ {
+ if (HasStyle())
+ return fontFamily;
+ else
+ return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
+ }
+ set
+ {
+ 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);
+ }
+ }
+
+ private void SetInternalFontFamily(string fontFamily)
+ {
+ Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
+ RequestLayout();
+ }
+
/// <summary>
/// The FontStyle property.<br />
/// The requested font style to use.<br />
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap FontStyle
{
get
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetFontStyle(FontStyle fontStyle)
{
- SetProperty(TextLabel.Property.FontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
+ using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
+ {
+ SetValue(FontStyleProperty, fontStyleMap);
+ }
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public FontStyle GetFontStyle()
{
- var map = new PropertyMap();
- GetProperty(TextLabel.Property.FontStyle).Get(map);
- return TextUtils.GetFontStyleStruct(map);
+ FontStyle fontStyle;
+ using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
+ {
+ fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
+ }
+ return fontStyle;
}
/// <summary>
/// The size of font in points.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
public float PointSize
{
get
/// 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("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
+ [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
public Vector2 ShadowOffset
{
get
{
- Vector2 shadowOffset = new Vector2();
- Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
- return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
+ return GetValue(ShadowOffsetProperty) as Vector2;
}
set
{
- PropertyMap temp = new PropertyMap();
- temp.Insert("offset", new PropertyValue(value));
+ SetValue(ShadowOffsetProperty, value);
+ }
+ }
- PropertyMap shadowMap = Shadow;
- shadowMap.Merge(temp);
+ private Vector2 InternalShadowOffset
+ {
+ 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);
- SetValue(ShadowProperty, shadowMap);
- NotifyPropertyChanged();
+ var shadowMap = Shadow;
+ shadowMap.Merge(map);
+
+ SetValue(ShadowProperty, shadowMap);
+ NotifyPropertyChanged();
+ }
}
}
/// 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("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
+ [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
public Vector4 ShadowColor
{
get
{
- Vector4 shadowColor = new Vector4();
- Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
- return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
+ return GetValue(ShadowColorProperty) as Vector4;
}
set
{
- PropertyMap temp = new PropertyMap();
- temp.Insert("color", new PropertyValue(value));
-
- PropertyMap shadowMap = Shadow;
- shadowMap.Merge(temp);
+ SetValue(ShadowColorProperty, value);
+ }
+ }
- SetValue(ShadowProperty, shadowMap);
- NotifyPropertyChanged();
+ private Vector4 InternalShadowColor
+ {
+ get
+ {
+ 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())
+ {
+ 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();
+ }
}
}
/// <remarks>
/// Deprecated.(API Level 6) Use Underline instead.
/// </remarks>
- [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
+ [Obsolete("Do not use this UnderlineEnabled(Deprecated). Use Underline instead.")]
public bool UnderlineEnabled
{
get
{
+ return (bool)GetValue(UnderlineEnabledProperty);
+ }
+ set
+ {
+ SetValue(UnderlineEnabledProperty, value);
+ }
+ }
+
+ private bool InternalUnderlineEnabled
+ {
+ get
+ {
bool underlineEnabled = false;
- Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
+ using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "enable"))
+ {
+ if (propertyValue != null)
+ {
+ propertyValue.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();
-
+ using (var map = new PropertyMap())
+ {
+ map.Add("enable", value);
+ var undelineMap = Underline;
+ undelineMap.Merge(map);
+ SetValue(UnderlineProperty, undelineMap);
+ NotifyPropertyChanged();
+ }
}
}
/// 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("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
+ [Obsolete("Do not use this UnderlineColor(Deprecated). Use Underline instead.")]
public Vector4 UnderlineColor
{
get
{
- Vector4 underlineColor = new Vector4();
- Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
- return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
+ return GetValue(UnderlineColorProperty) as Vector4;
}
set
{
- PropertyMap temp = new PropertyMap();
- temp.Insert("color", new PropertyValue(value));
-
- PropertyMap undelineMap = Underline;
- undelineMap.Merge(temp);
+ SetValue(UnderlineColorProperty, value);
+ }
+ }
- SetValue(UnderlineProperty, undelineMap);
- NotifyPropertyChanged();
+ private Vector4 InternalUnderlineColor
+ {
+ 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();
+ }
}
}
/// <remarks>
/// Deprecated.(API Level 6) Use Underline instead.
/// </remarks>
- [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
+ [Obsolete("Do not use this UnderlineHeight(Deprecated). Use Underline instead.")]
public float UnderlineHeight
{
get
{
+ return (float)GetValue(UnderlineHeightProperty);
+ }
+ set
+ {
+ SetValue(UnderlineHeightProperty, value);
+ }
+ }
+
+ private float InternalUnderlineHeight
+ {
+ get
+ {
float underlineHeight = 0.0f;
- Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
+ using (var propertyValue = Underline.Find(TextLabel.Property.UNDERLINE, "height"))
+ {
+ if (null != propertyValue)
+ {
+ propertyValue.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();
+ using (var map = new PropertyMap())
+ {
+ map.Add("height", value);
+ var undelineMap = Underline;
+ undelineMap.Merge(map);
+ SetValue(UnderlineProperty, undelineMap);
+ NotifyPropertyChanged();
+ }
}
}
}
/// <summary>
+ /// 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>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float RelativeLineHeight
+ {
+ get
+ {
+ return (float)GetValue(RelativeLineHeightProperty);
+ }
+ set
+ {
+ SetValue(RelativeLineHeightProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
/// The Underline property.<br />
/// The default underline parameters.<br />
/// The underline map contains the following keys :<br />
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap Underline
{
get
}
/// <summary>
+ /// 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>
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap Shadow
{
get
}
/// <summary>
+ /// Set Shadow to TextLabel. <br />
+ /// </summary>
+ /// <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>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap Outline
{
get
}
/// <summary>
+ /// 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>
+ [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
public float PixelSize
{
get
/// <summary>
/// The ellipsis position of the text.
- /// The ellipsis position type when the text size over the layout size.<br />
- /// The ellipsis position: End, Start or Middle.<br />
+ /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
/// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <since_tizen> 9 </since_tizen>
public EllipsisPosition EllipsisPosition
{
get
/// <summary>
/// The AutoScrollLoopDelay property.<br />
- /// Do something.<br />
+ /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float AutoScrollLoopDelay
/// <summary>
/// The AutoScrollStopMode property.<br />
- /// Do something.<br />
+ /// The auto scrolling stop behaviour.<br />
+ /// The default value is AutoScrollStopMode.FinishLoop. <br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
public AutoScrollStopMode AutoScrollStopMode
{
get
{
- int temp = 0;
- GetProperty(TextLabel.Property.LineCount).Get(out temp);
- return temp;
+ int lineCount = 0;
+ using (var propertyValue = GetProperty(TextLabel.Property.LineCount))
+ {
+ propertyValue.Get(out lineCount);
+ }
+ return lineCount;
}
}
/// <summary>
/// The direction of the text such as left to right or right to left.
/// </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.
+ /// 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
{
- int temp = 0;
- GetProperty(TextLabel.Property.TextDirection).Get(out temp);
- return (TextDirection)temp;
+ int textDirection = 0;
+ using (var propertyValue = GetProperty(TextLabel.Property.TextDirection))
+ {
+ propertyValue.Get(out textDirection);
+ }
+ return (TextDirection)textDirection;
}
}
/// <summary>
/// The vertical line alignment of the text.
/// </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.
+ /// 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
{
/// <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>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// 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
}
/// <summary>
+ /// Set TextFit to TextLabel. <br />
+ /// </summary>
+ /// <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)
+ {
+ using (var textFitMap = TextMapHelper.GetTextFitMap(textFit))
+ {
+ SetValue(TextFitProperty, textFitMap);
+ }
+ }
+
+ /// <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))
+ {
+ textFit = TextMapHelper.GetTextFitStruct(textFitMap);
+ }
+ return textFit;
+ }
+
+ /// <summary>
/// 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> 8 </since_tizen>
+ /// 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
{
}
/// <summary>
- /// The FontSizeScale property. <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>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float CharacterSpacing
+ {
+ get
+ {
+ return (float)GetValue(CharacterSpacingProperty);
+ }
+ set
+ {
+ SetValue(CharacterSpacingProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
+ /// 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> 9 </since_tizen>
{
get
{
+ return (float)GetValue(FontSizeScaleProperty);
+ }
+ set
+ {
+ SetValue(FontSizeScaleProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ private float InternalFontSizeScale
+ {
+ get
+ {
return fontSizeScale;
}
set
systemSettingsFontSize = SystemSettingsFontSize.Normal;
}
newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
- addFontSizeChangedCallback();
+ AddSystemSettingsFontSizeChanged();
}
else
{
newFontSizeScale = fontSizeScale;
- removeFontSizeChangedCallback();
+ RemoveSystemSettingsFontSizeChanged();
}
- SetValue(FontSizeScaleProperty, newFontSizeScale);
+ SetInternalFontSizeScale(newFontSizeScale);
+ }
+ }
+
+ private void SetInternalFontSizeScale(float fontSizeScale)
+ {
+
+ Object.InternalSetPropertyFloat(this.SwigCPtr, TextLabel.Property.FontSizeScale, (float)fontSizeScale);
+ RequestLayout();
+ }
+
+ /// <summary>
+ /// The EnableFontSizeScale property.<br />
+ /// Whether the font size scale is enabled. (The default value is true)
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool EnableFontSizeScale
+ {
+ get
+ {
+ return (bool)GetValue(EnableFontSizeScaleProperty);
+ }
+ set
+ {
+ SetValue(EnableFontSizeScaleProperty, value);
NotifyPropertyChanged();
}
}
/// <returns></returns>
/// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
/// <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! " +
+ /// 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")]
return;
}
- if (systemlangTextFlag)
+ internalTextColor?.Dispose();
+
+ if (hasSystemLanguageChanged)
{
- SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
+ systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
}
- removeFontSizeChangedCallback();
+ RemoveSystemSettingsFontTypeChanged();
+ RemoveSystemSettingsFontSizeChanged();
if (type == DisposeTypes.Explicit)
{
selectorData?.Reset(this);
}
- base.Dispose(type);
- }
+ if (this.HasBody())
+ {
+ if (textLabelTextFitChangedCallbackDelegate != null)
+ {
+ TextFitChangedSignal().Disconnect(textLabelTextFitChangedCallbackDelegate);
+ }
+ }
- 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;
+ base.Dispose(type);
}
/// This will not be public opened.
return new TextLabelStyle();
}
+ internal override LayoutItem CreateDefaultLayout()
+ {
+ return new TextLayout();
+ }
+
/// <summary>
/// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
/// </summary>
base.OnBindingContextChanged();
}
- private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
+ 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);
- SetValue(FontSizeScaleProperty, newFontSizeScale);
+ SetInternalFontSizeScale(newFontSizeScale);
}
- private void addFontSizeChangedCallback()
+ private void AddSystemSettingsFontSizeChanged()
{
- if (hasFontSizeChangedCallback != true)
+ if (hasSystemFontSizeChanged != true)
{
try
{
- SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
- hasFontSizeChangedCallback = true;
+ SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
+ hasSystemFontSizeChanged = true;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
- hasFontSizeChangedCallback = false;
+ hasSystemFontSizeChanged = false;
}
}
}
- private void removeFontSizeChangedCallback()
+ private void RemoveSystemSettingsFontSizeChanged()
+ {
+ if (hasSystemFontSizeChanged == true)
+ {
+ try
+ {
+ SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
+ hasSystemFontSizeChanged = false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontSizeChanged = true;
+ }
+ }
+ }
+
+ private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
+ {
+ SetInternalFontFamily(e.Value);
+ }
+
+ private void AddSystemSettingsFontTypeChanged()
+ {
+ if (HasStyle() && !hasSystemFontTypeChanged)
+ {
+ try
+ {
+ systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
+ hasSystemFontTypeChanged = true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = false;
+ }
+ }
+ }
+
+ private void RemoveSystemSettingsFontTypeChanged()
{
- if (hasFontSizeChangedCallback == true)
+ if (hasSystemFontTypeChanged)
{
try
{
- SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
- hasFontSizeChangedCallback = false;
+ systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
+ hasSystemFontTypeChanged = false;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
- hasFontSizeChangedCallback = true;
+ hasSystemFontTypeChanged = true;
}
}
}
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 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)