Add a Underline struct to pass data of DALi Underline PropertyMap.
The Underline struct can be used as an argument to
SetUnderline and GetUnderline methods.
// example
var underline = new Tizen.NUI.Text.Underline();
underline.Enable = true;
underline.Color = new Color("#3498DB");
underline.Height = 2.0f;
label.SetUnderline(underline);
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
}
/// <summary>
+ /// Set Underline to TextEditor. <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;
+ /// editor.SetUnderline(underline);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetUnderline(Underline underline)
+ {
+ SetProperty(TextEditor.Property.UNDERLINE, new PropertyValue(TextUtils.GetUnderlineMap(underline)));
+ }
+
+ /// <summary>
+ /// Get Underline from TextEditor. <br />
+ /// </summary>
+ /// <returns>The Underline</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Underline"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Underline GetUnderline()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextEditor.Property.UNDERLINE).Get(map);
+ return TextUtils.GetUnderlineStruct(map);
+ }
+
+ /// <summary>
/// The InputUnderline property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}
/// <summary>
+ /// Set Underline to TextField. <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;
+ /// field.SetUnderline(underline);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetUnderline(Underline underline)
+ {
+ SetProperty(TextField.Property.UNDERLINE, new PropertyValue(TextUtils.GetUnderlineMap(underline)));
+ }
+
+ /// <summary>
+ /// Get Underline from TextField. <br />
+ /// </summary>
+ /// <returns>The Underline</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Underline"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Underline GetUnderline()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextField.Property.UNDERLINE).Get(map);
+ return TextUtils.GetUnderlineStruct(map);
+ }
+
+ /// <summary>
/// The InputUnderline property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}
/// <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)
+ {
+ SetProperty(TextLabel.Property.UNDERLINE, new PropertyValue(TextUtils.GetUnderlineMap(underline)));
+ }
+
+ /// <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()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextLabel.Property.UNDERLINE).Get(map);
+ return TextUtils.GetUnderlineStruct(map);
+ }
+
+ /// <summary>
/// The Shadow property.<br />
/// The default shadow parameters.<br />
/// The shadow map contains the following keys :<br />
return inputFilter;
}
+
+ /// <summary>
+ /// This method converts a Underline struct to a PropertyMap and returns it.
+ /// The returned map can be used for set Underline PropertyMap in the SetUnderline method.
+ /// <param name="underline">The Underline struct value.</param>
+ /// <returns> A PropertyMap for Underline property. </returns>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static PropertyMap GetUnderlineMap(Underline underline)
+ {
+ var map = new PropertyMap();
+
+ if (underline.Color != null)
+ map.Add("color", new PropertyValue(underline.Color));
+
+ map.Add("enable", new PropertyValue(underline.Enable));
+ map.Add("height", new PropertyValue(underline.Height));
+
+ return map;
+ }
+
+ /// <summary>
+ /// This method converts a Underline map to a struct and returns it.
+ /// The returned struct can be returned to the user as a Underline in the GetUnderline method.
+ /// <param name="map">The Underline PropertyMap.</param>
+ /// <returns> A Underline struct. </returns>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Underline GetUnderlineStruct(PropertyMap map)
+ {
+ Color color = new Color();
+ map.Find(0, "enable").Get(out bool enable);
+ map.Find(0, "color").Get(color);
+ map.Find(0, "height").Get(out float height);
+
+ var underline = new Underline();
+ underline.Enable = enable;
+ underline.Color = color;
+ underline.Height = height;
+
+ return underline;
+ }
+
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public FontSlantType Slant { get; set; }
}
+
+ /// <summary>
+ /// A struct to pass data of Underline PropertyMap. <br />
+ /// </summary>
+ /// <remarks>
+ /// The Underline struct is used as an argument to SetUnderline and GetUnderline methods. <br />
+ /// See <see cref="Tizen.NUI.BaseComponents.TextLabel.SetUnderline"/>, <see cref="Tizen.NUI.BaseComponents.TextLabel.GetUnderline"/>, <see cref="Tizen.NUI.BaseComponents.TextField.SetUnderline"/>, <see cref="Tizen.NUI.BaseComponents.TextField.GetUnderline"/>, <see cref="Tizen.NUI.BaseComponents.TextEditor.SetUnderline"/> and <see cref="Tizen.NUI.BaseComponents.TextEditor.GetUnderline"/>. <br />
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public struct Underline
+ {
+ /// <summary>
+ /// Whether the underline is enabled (the default value is false).
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Enable { get; set; }
+
+ /// <summary>
+ /// The color of the underline (if not provided then the color of the text is used).
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color Color { get; set; }
+
+ /// <summary>
+ /// The height in pixels of the underline (the default value is 1.0f, value can not be set to 0.0f, if set to 0.0f then the height is set to 1.0f).
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float Height { get; set; }
+ }
}
}