/*
- * Copyright(c) 2019 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.
using System.Globalization;
using System.ComponentModel;
using Tizen.NUI.Binding;
+using Tizen.NUI.Text;
namespace Tizen.NUI.BaseComponents
{
{
private string textFieldTextSid = null;
private string textFieldPlaceHolderTextSid = null;
+ private string textFieldPlaceHolderTextFocusedSid = null;
private bool systemlangTextFlag = false;
private InputMethodContext inputMethodCotext = null;
+ private float fontSizeScale = 1.0f;
+ private bool hasFontSizeChangedCallback = false;
+ private bool isSettingTextInCSharp = false;
static TextField() { }
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TextFieldStyle Style => ViewStyle as TextFieldStyle;
-
/// <summary>
/// Creates the TextField control.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public TextField() : this(Interop.TextField.TextField_New(), true)
+ public TextField() : this(Interop.TextField.New(), 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 TextField(bool shown) : this(Interop.TextField.TextField_New(), true)
+ public TextField(bool shown) : this(Interop.TextField.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
}
/// <summary>
- /// Get attribues, it is abstract function and must be override.
+ /// Get attributes, it is abstract function and must be override.
/// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- protected override ViewStyle GetViewStyle()
+ protected override ViewStyle CreateViewStyle()
{
return new TextFieldStyle();
}
- internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
+ internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
{
if (!shown)
{
SetVisible(false);
}
+
+ TextChanged += TextEditorTextChanged;
}
- internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn)
+ internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
{
if (!shown)
{
SetVisible(false);
}
+
+ TextChanged += TextEditorTextChanged;
}
- internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
+ internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
{
SetVisible(false);
}
+
+ TextChanged += TextEditorTextChanged;
}
internal enum ExceedPolicyType
{
if (NUIApplication.MultilingualResourceManager == null)
{
- throw new ArgumentNullException("ResourceManager about multilingual is null");
+ throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
}
textFieldTextSid = value;
Text = SetTranslatable(textFieldTextSid);
{
if (NUIApplication.MultilingualResourceManager == null)
{
- throw new ArgumentNullException("ResourceManager about multilingual is null");
+ throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
}
textFieldPlaceHolderTextSid = value;
PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
}
/// <summary>
+ /// The TranslatablePlaceholderTextFocused property.<br />
+ /// The text can set the SID value.<br />
+ /// </summary>
+ /// <exception cref='ArgumentNullException'>
+ /// ResourceManager about multilingual is null.
+ /// </exception>
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string TranslatablePlaceholderTextFocused
+ {
+ get
+ {
+ return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
+ }
+ set
+ {
+ SetValue(TranslatablePlaceholderTextFocusedProperty, value);
+ }
+ }
+ private string translatablePlaceholderTextFocused
+ {
+ get
+ {
+ return textFieldPlaceHolderTextFocusedSid;
+ }
+ set
+ {
+ if (NUIApplication.MultilingualResourceManager == null)
+ {
+ throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
+ }
+ textFieldPlaceHolderTextFocusedSid = value;
+ PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
/// The Text property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}
set
{
- SetValueAndForceSendChangeSignal(TextProperty, value);
+ SetValue(TextProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The FontStyle property.
+ /// 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
{
get
}
/// <summary>
+ /// Set FontStyle to TextField. <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;
+ /// field.SetFontStyle(fontStyle);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetFontStyle(FontStyle fontStyle)
+ {
+ SetValue(FontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
+ }
+
+ /// <summary>
+ /// Get FontStyle from TextField. <br />
+ /// </summary>
+ /// <returns>The FontStyle</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.FontStyle"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FontStyle GetFontStyle()
+ {
+ return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(FontStyleProperty));
+ }
+
+ /// <summary>
/// The PointSize property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <summary>
/// The SelectionHandleImageLeft property.
+ /// The selectionHandleImageLeft map contains the following key :<br />
+ /// <list type="table">
+ /// <item><term>filename (string)</term><description>The path of image file</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleImageLeft
/// <summary>
/// The SelectionHandleImageRight property.
+ /// The selectionHandleImageRight map contains the following key :<br />
+ /// <list type="table">
+ /// <item><term>filename (string)</term><description>The path of image file</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleImageRight
}
/// <summary>
+ /// Set SelectionHandleImage to TextField. <br />
+ /// </summary>
+ /// <param name="selectionHandleImage">The SelectionHandleImage</param>
+ /// <remarks>
+ /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetSelectionHandleImage method.
+ /// <code>
+ /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
+ /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
+ /// selectionHandleImage.RightImageUrl = "handle_downright.png";
+ /// field.SetSelectionHandleImage(selectionHandleImage);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
+ {
+ if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
+ {
+ SetValue(SelectionHandleImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleImage.LeftImageUrl));
+ }
+
+ if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
+ {
+ SetValue(SelectionHandleImageRightProperty, TextUtils.GetFileNameMap(selectionHandleImage.RightImageUrl));
+ }
+ }
+
+ /// <summary>
+ /// Get SelectionHandleImage from TextField. <br />
+ /// </summary>
+ /// <returns>The SelectionHandleImage</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public SelectionHandleImage GetSelectionHandleImage()
+ {
+ return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleImageLeftProperty), (PropertyMap)GetValue(SelectionHandleImageRightProperty));
+ }
+
+ /// <summary>
/// The SelectionHandlePressedImageLeft property.
+ /// The selectionHandlePressedImageLeft map contains the following key :<br />
+ /// <list type="table">
+ /// <item><term>filename (string)</term><description>The path of image file</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandlePressedImageLeft
/// <summary>
/// The SelectionHandlePressedImageRight property.
+ /// The selectionHandlePressedImageRight map contains the following key :<br />
+ /// <list type="table">
+ /// <item><term>filename (string)</term><description>The path of image file</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandlePressedImageRight
}
/// <summary>
+ /// Set SelectionHandlePressedImage to TextField. <br />
+ /// </summary>
+ /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
+ /// <remarks>
+ /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
+ /// <code>
+ /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
+ /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
+ /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
+ /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
+ {
+ if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
+ {
+ SetValue(SelectionHandlePressedImageLeftProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl));
+ }
+
+ if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
+ {
+ SetValue(SelectionHandlePressedImageRightProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.RightImageUrl));
+ }
+ }
+
+ /// <summary>
+ /// Get SelectionHandlePressedImage from TextField. <br />
+ /// </summary>
+ /// <returns>The SelectionHandlePressedImage</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public SelectionHandleImage GetSelectionHandlePressedImage()
+ {
+ return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty), (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty));
+ }
+
+ /// <summary>
/// The SelectionHandleMarkerImageLeft property.
+ /// The selectionHandleMarkerImageLeft map contains the following key :<br />
+ /// <list type="table">
+ /// <item><term>filename (string)</term><description>The path of image file</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleMarkerImageLeft
/// <summary>
/// The SelectionHandleMarkerImageRight property.
+ /// The selectionHandleMarkerImageRight map contains the following key :<br />
+ /// <list type="table">
+ /// <item><term>filename (string)</term><description>The path of image file</description></item>
+ /// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleMarkerImageRight
}
/// <summary>
+ /// Set SelectionHandleMarkerImage to TextField. <br />
+ /// </summary>
+ /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
+ /// <remarks>
+ /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
+ /// <code>
+ /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
+ /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
+ /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
+ /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
+ {
+ if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
+ {
+ SetValue(SelectionHandleMarkerImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl));
+ }
+
+ if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
+ {
+ SetValue(SelectionHandleMarkerImageRightProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl));
+ }
+ }
+
+ /// <summary>
+ /// Get SelectionHandleMarkerImage from TextField. <br />
+ /// </summary>
+ /// <returns>The SelectionHandleMarkerImage</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public SelectionHandleImage GetSelectionHandleMarkerImage()
+ {
+ return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty), (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty));
+ }
+
+ /// <summary>
/// The SelectionHighlightColor property.
/// </summary>
/// <remarks>
/// <summary>
/// The InputMethodSettings property.
/// </summary>
+ /// <remarks>
+ /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to set the InputMethodSettings property.
+ /// <code>
+ /// InputMethod method = new InputMethod();
+ /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
+ /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
+ /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
+ /// method.Variation = 1;
+ /// textField.InputMethodSettings = method.OutputMap;
+ /// </code>
+ /// </example>
/// <since_tizen> 3 </since_tizen>
public PropertyMap InputMethodSettings
{
/// <summary>
/// The InputFontStyle property.
+ /// The inputFontStyle 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 InputFontStyle
{
get
}
/// <summary>
+ /// Set InputFontStyle to TextField. <br />
+ /// </summary>
+ /// <param name="fontStyle">The FontStyle</param>
+ /// <remarks>
+ /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetInputFontStyle method.
+ /// <code>
+ /// var fontStyle = new Tizen.NUI.Text.FontStyle();
+ /// fontStyle.Width = FontWidthType.Expanded;
+ /// fontStyle.Weight = FontWeightType.Bold;
+ /// fontStyle.Slant = FontSlantType.Italic;
+ /// field.SetInputFontStyle(fontStyle);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetInputFontStyle(FontStyle fontStyle)
+ {
+ SetValue(InputFontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
+ }
+
+ /// <summary>
+ /// Get InputFontStyle from TextField. <br />
+ /// </summary>
+ /// <returns>The FontStyle</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.FontStyle"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FontStyle GetInputFontStyle()
+ {
+ return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(InputFontStyleProperty));
+ }
+
+ /// <summary>
/// The InputPointSize property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <summary>
/// The Underline property.
+ /// 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>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap Underline
{
get
}
/// <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)
+ {
+ SetValue(UnderlineProperty, 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()
+ {
+ return TextUtils.GetUnderlineStruct((PropertyMap)GetValue(UnderlineProperty));
+ }
+
+ /// <summary>
/// The InputUnderline property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <summary>
/// The Shadow property.
+ /// 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>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap Shadow
{
get
}
/// <summary>
+ /// Set Shadow to TextField. <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");
+ /// field.SetShadow(shadow);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
+ {
+ SetValue(ShadowProperty, TextUtils.GetShadowMap(shadow));
+ }
+
+ /// <summary>
+ /// Get Shadow from TextField. <br />
+ /// </summary>
+ /// <returns>The Shadow</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Shadow"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Tizen.NUI.Text.Shadow GetShadow()
+ {
+ return TextUtils.GetShadowStruct((PropertyMap)GetValue(ShadowProperty));
+ }
+
+ /// <summary>
/// The InputShadow property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <summary>
/// The Outline property.
+ /// 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>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public PropertyMap Outline
{
get
}
/// <summary>
+ /// Set Outline to TextField. <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");
+ /// field.SetOutline(outline);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetOutline(Outline outline)
+ {
+ SetValue(OutlineProperty, TextUtils.GetOutlineMap(outline));
+ }
+
+ /// <summary>
+ /// Get Outline from TextField. <br />
+ /// </summary>
+ /// <returns>The Outline</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Outline"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Outline GetOutline()
+ {
+ return TextUtils.GetOutlineStruct((PropertyMap)GetValue(OutlineProperty));
+ }
+
+ /// <summary>
/// The InputOutline property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <summary>
/// The HiddenInputSettings property.
+ /// The hiddenInputSettings map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
+ /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
+ /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
+ /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
+ /// </list>
/// </summary>
+ /// <remarks>
+ /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to set the HiddenInputSettings property.
+ /// <code>
+ /// PropertyMap map = new PropertyMap();
+ /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
+ /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
+ /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
+ /// textField.HiddenInputSettings = map;
+ /// </code>
+ /// </example>
/// <since_tizen> 3 </since_tizen>
public Tizen.NUI.PropertyMap HiddenInputSettings
{
}
/// <summary>
+ /// Set HiddenInput to TextField. <br />
+ /// </summary>
+ /// <param name="hiddenInput">The HiddenInput</param>
+ /// <remarks>
+ /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetHiddenInput method.
+ /// <code>
+ /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
+ /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
+ /// hiddenInput.SubstituteCharacter = '★';
+ /// hiddenInput.SubstituteCount = 0;
+ /// hiddenInput.ShowLastCharacterDuration = 1000;
+ /// field.SetHiddenInput(hiddenInput);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetHiddenInput(HiddenInput hiddenInput)
+ {
+ SetValue(HiddenInputSettingsProperty, TextUtils.GetHiddenInputMap(hiddenInput));
+ }
+
+ /// <summary>
+ /// Get HiddenInput from TextField. <br />
+ /// </summary>
+ /// <returns>The HiddenInput</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.HiddenInput"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public HiddenInput GetHiddenInput()
+ {
+ return TextUtils.GetHiddenInputStruct((PropertyMap)GetValue(HiddenInputSettingsProperty));
+ }
+
+ /// <summary>
/// The PixelSize property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
}
/// <summary>
- /// The Selected Text property.
+ /// The portion of the text that has been selected by the user.
+ /// </summary>
+ /// <remarks>
+ /// Empty string when nothing is selected.
+ /// </remarks>
+ /// <since_tizen> 9 </since_tizen>
+ public string SelectedText
+ {
+ get
+ {
+ string temp;
+ GetProperty(TextField.Property.SelectedText).Get(out temp);
+ return temp;
+ }
+ }
+
+ /// <summary>
+ /// The start index for selection.
+ /// </summary>
+ /// <remarks>
+ /// When there is no selection, the index is current cursor position.
+ /// </remarks>
+ /// <since_tizen> 9 </since_tizen>
+ public int SelectedTextStart
+ {
+ get
+ {
+ int temp;
+ GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
+ return temp;
+ }
+ }
+
+ /// <summary>
+ /// The end index for selection.
+ /// </summary>
+ /// <remarks>
+ /// When there is no selection, the index is current cursor position.
+ /// </remarks>
+ /// <since_tizen> 9 </since_tizen>
+ public int SelectedTextEnd
+ {
+ get
+ {
+ int temp;
+ GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
+ return temp;
+ }
+ }
+
+ /// <summary>
+ /// Enable editing in text control.
/// </summary>
/// <since_tizen> 8 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- public string SelectedText
+ public bool EnableEditing
{
get
{
- string temp;
- GetProperty(TextField.Property.SELECTED_TEXT).Get(out temp);
- return (string)temp;
+ bool temp;
+ GetProperty(TextField.Property.EnableEditing).Get(out temp);
+ return temp;
+ }
+ set
+ {
+ SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
+ /// Specify primary cursor (caret) position in text control.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int PrimaryCursorPosition
+ {
+ get
+ {
+ int temp;
+ using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
+ {
+ propertyValue.Get(out temp);
+ }
+ return temp;
+ }
+ set
+ {
+ using (PropertyValue propertyValue = new PropertyValue(value))
+ {
+ SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
+ NotifyPropertyChanged();
+ }
+ }
+ }
+
+ /// <summary>
+ /// The GrabHandleColor property.
+ /// </summary>
+ /// <remarks>
+ /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color GrabHandleColor
+ {
+ get
+ {
+ Color temp = (Color)GetValue(GrabHandleColorProperty);
+ return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
+ }
+ set
+ {
+ SetValue(GrabHandleColorProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
+ /// <summary>
+ /// 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> 9 </since_tizen>
+ public EllipsisPosition EllipsisPosition
+ {
+ get
+ {
+ return (EllipsisPosition)GetValue(EllipsisPositionProperty);
+ }
+ set
+ {
+ SetValue(EllipsisPositionProperty, value);
+ NotifyPropertyChanged();
}
}
/// <summary>
+ /// Set InputFilter to TextField.
+ /// </summary>
+ /// <param name="inputFilter">The InputFilter</param>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
+ /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
+ /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetInputFilter method.
+ /// <code>
+ /// var inputFilter = new Tizen.NUI.Text.InputFilter();
+ /// inputFilter.Accepted = @"[\d]"; // accept whole digits
+ /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
+ /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
+ /// </code>
+ /// </example>
+ /// <since_tizen> 9 </since_tizen>
+ public void SetInputFilter(InputFilter inputFilter)
+ {
+ SetProperty(TextField.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter)));
+ }
+
+ /// <summary>
+ /// Get InputFilter from TextField.
+ /// </summary>
+ /// <returns>The InputFilter</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.InputFilter"/>
+ /// </remarks>
+ /// <since_tizen> 9 </since_tizen>
+ public InputFilter GetInputFilter()
+ {
+ var map = new PropertyMap();
+ GetProperty(TextField.Property.InputFilter).Get(map);
+ return TextUtils.GetInputFilterStruct(map);
+ }
+
+ /// <summary>
/// The Placeholder property.
- /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
+ /// The placeholder map contains the following keys :<br />
+ /// <list type="table">
+ /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
+ /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
+ /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
+ /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
+ /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
+ /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
+ /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
+ /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
+ /// </list>
/// </summary>
/// <example>
/// The following example demonstrates how to set the Placeholder property.
/// </code>
/// </example>
/// <since_tizen> 3 </since_tizen>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
public Tizen.NUI.PropertyMap Placeholder
{
get
{
- return (PropertyMap)GetValue(PlaceholderProperty);
+ PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
+ PropertyValue value = null;
+
+ // text
+ value = map.Find(0);
+ if (null != value)
+ {
+ value.Get(out string text);
+ map.Add("text", new PropertyValue(text));
+ }
+
+ // textFocused
+ value = map.Find(1);
+ if (null != value)
+ {
+ value.Get(out string textFocused);
+ map.Add("textFocused", new PropertyValue(textFocused));
+ }
+
+ // color
+ value = map.Find(2);
+ if (null != value)
+ {
+ Color color = new Color();
+ value.Get(color);
+ map.Add("color", new PropertyValue(color));
+ }
+
+ // fontFamily
+ value = map.Find(3);
+ if (null != value)
+ {
+ value.Get(out string fontFamily);
+ map.Add("fontFamily", new PropertyValue(fontFamily));
+ }
+
+ // fontStyle
+ value = map.Find(4);
+ if (null != value)
+ {
+ PropertyMap fontStyle = new PropertyMap();
+ value.Get(fontStyle);
+ map.Add("fontStyle", new PropertyValue(fontStyle));
+ }
+
+ // pointSize
+ value = map.Find(5);
+ if (null != value)
+ {
+ value.Get(out float pointSize);
+ map.Add("pointSize", new PropertyValue(pointSize));
+ }
+
+ // pixelSize
+ value = map.Find(6);
+ if (null != value)
+ {
+ value.Get(out float pixelSize);
+ map.Add("pixelSize", new PropertyValue(pixelSize));
+ }
+
+ // ellipsis
+ value = map.Find(7);
+ if (null != value)
+ {
+ value.Get(out bool ellipsis);
+ map.Add("ellipsis", new PropertyValue(ellipsis));
+ }
+
+ return map;
}
set
{
}
/// <summary>
+ /// Set Placeholder to TextField. <br />
+ /// </summary>
+ /// <param name="placeholder">The Placeholder</param>
+ /// <remarks>
+ /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
+ /// </remarks>
+ /// <example>
+ /// The following example demonstrates how to use the SetPlaceholder method.
+ /// <code>
+ /// var placeholder = new Tizen.NUI.Text.Placeholder();
+ /// placeholder.Text = "placeholder text";
+ /// placeholder.TextFocused = "placeholder textFocused";
+ /// placeholder.Color = new Color("#45B39D");
+ /// placeholder.FontFamily = "BreezeSans";
+ /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
+ /// {
+ /// Width = FontWidthType.Expanded,
+ /// Weight = FontWeightType.ExtraLight,
+ /// Slant = FontSlantType.Italic,
+ /// };
+ /// placeholder.PointSize = 25.0f;
+ /// //placeholder.PixelSize = 50.0f;
+ /// placeholder.Ellipsis = true;
+ /// field.SetPlaceholder(placeholder);
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetPlaceholder(Placeholder placeholder)
+ {
+ SetValue(PlaceholderProperty, TextUtils.GetPlaceholderMap(placeholder));
+ }
+
+ /// <summary>
+ /// Get Placeholder from TextField. <br />
+ /// </summary>
+ /// <returns>The Placeholder</returns>
+ /// <remarks>
+ /// <see cref="Tizen.NUI.Text.Placeholder"/>
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Placeholder GetPlaceholder()
+ {
+ return TextUtils.GetPlaceholderStruct((PropertyMap)GetValue(PlaceholderProperty));
+ }
+
+ /// <summary>
/// The Ellipsis property.<br />
/// Enable or disable the ellipsis.<br />
/// Placeholder PropertyMap is used to add ellipsis to placeholder text.
}
}
- /// Only used by the IL of xaml, will never changed to not hidden.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool IsCreateByXaml
+ /// <summary>
+ /// The FontSizeScale property. <br />
+ /// The default value is 1.0. <br />
+ /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public float FontSizeScale
{
get
{
- return base.IsCreateByXaml;
+ return fontSizeScale;
}
set
{
- base.IsCreateByXaml = value;
+ float newFontSizeScale;
+
+ if (fontSizeScale == value) return;
- if (value == true)
+ fontSizeScale = value;
+ if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
{
- this.TextChanged += (obj, e) =>
+ SystemSettingsFontSize systemSettingsFontSize;
+
+ try
+ {
+ systemSettingsFontSize = SystemSettings.FontSize;
+ }
+ catch (Exception e)
{
- this.Text = this.Text;
- };
+ Console.WriteLine("{0} Exception caught.", e);
+ systemSettingsFontSize = SystemSettingsFontSize.Normal;
+ }
+ newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
+ addFontSizeChangedCallback();
+ }
+ else
+ {
+ newFontSizeScale = fontSizeScale;
+ removeFontSizeChangedCallback();
}
+
+ SetValue(FontSizeScaleProperty, newFontSizeScale);
+ NotifyPropertyChanged();
}
}
if (inputMethodCotext == null)
{
/*Avoid raising InputMethodContext reference count.*/
- inputMethodCotext = new InputMethodContext(Interop.TextField.TextField_GetInputMethodContext(swigCPtr), true);
+ inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
return inputMethodCotext;
/// <summary>
/// Select the whole text.
/// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <since_tizen> 9 </since_tizen>
public void SelectWholeText()
{
- Interop.TextField.TextField_SelectWholeText(swigCPtr);
+ Interop.TextField.SelectWholeText(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
- /// Clear selection of the text.
+ /// Select text from start to end index. <br />
+ /// The index is valid when 0 or positive.
/// </summary>
- /// <since_tizen> 8 </since_tizen>
- /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void TextField_SelectNone()
+ /// <param name="start">The start index for selection.</param>
+ /// <param name="end">The end index for selection.</param>
+ /// <remarks>
+ /// If the end index exceeds the maximum value, it is set to the length of the text.
+ /// </remarks>
+ /// <since_tizen> 9 </since_tizen>
+ public void SelectText(int start, int end)
{
- Interop.TextField.TextField_SelectNone(swigCPtr);
+ if (start < 0)
+ throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
+ if (end < 0)
+ throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
+
+ Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
+ /// <summary>
+ /// Clear selection of the text. <br />
+ /// Valid when selection is activate.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public void SelectNone()
{
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ _ = Interop.TextField.SelectNone(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
{
- SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.TextField_InputStyleChangedSignal(swigCPtr), false);
+ SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.InputStyleChangedSignal(SwigCPtr));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
return;
}
+ if (systemlangTextFlag)
+ {
+ SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
+ }
+
+ removeFontSizeChangedCallback();
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (this.HasBody())
{
- if (_textFieldMaxLengthReachedCallbackDelegate != null)
+ if (textFieldCursorPositionChangedCallbackDelegate != null)
+ {
+ this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
+ }
+
+ if (textFieldMaxLengthReachedCallbackDelegate != null)
+ {
+ this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
+ }
+
+ if (textFieldSelectionClearedCallbackDelegate != null)
+ {
+ this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
+ }
+
+ if (textFieldSelectionChangedCallbackDelegate != null)
{
- this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
+ this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
}
- if (_textFieldTextChangedCallbackDelegate != null)
+ if (textFieldTextChangedCallbackDelegate != null)
{
- TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
+ TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
}
}
+ TextChanged -= TextEditorTextChanged;
+
base.Dispose(type);
}
{
// In order to speed up IME hide, temporarily add
GetInputMethodContext()?.DestroyContext();
- Interop.TextField.delete_TextField(swigCPtr);
+ Interop.TextField.DeleteTextField(swigCPtr);
}
private string SetTranslatable(string textFieldSid)
{
if (systemlangTextFlag == false)
{
- SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
+ SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
systemlangTextFlag = true;
}
return translatableText;
{
PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
}
- }
-
- internal new class Property
- {
- internal static readonly int TEXT = Interop.TextField.TextField_Property_TEXT_get();
- internal static readonly int PLACEHOLDER_TEXT = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_get();
- internal static readonly int PLACEHOLDER_TEXT_FOCUSED = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
- internal static readonly int FONT_FAMILY = Interop.TextField.TextField_Property_FONT_FAMILY_get();
- internal static readonly int FONT_STYLE = Interop.TextField.TextField_Property_FONT_STYLE_get();
- internal static readonly int POINT_SIZE = Interop.TextField.TextField_Property_POINT_SIZE_get();
- internal static readonly int MAX_LENGTH = Interop.TextField.TextField_Property_MAX_LENGTH_get();
- internal static readonly int EXCEED_POLICY = Interop.TextField.TextField_Property_EXCEED_POLICY_get();
- internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextField.TextField_Property_HORIZONTAL_ALIGNMENT_get();
- internal static readonly int VERTICAL_ALIGNMENT = Interop.TextField.TextField_Property_VERTICAL_ALIGNMENT_get();
- internal static readonly int TEXT_COLOR = Interop.TextField.TextField_Property_TEXT_COLOR_get();
- internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
- internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextField.TextField_Property_PRIMARY_CURSOR_COLOR_get();
- internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextField.TextField_Property_SECONDARY_CURSOR_COLOR_get();
- internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextField.TextField_Property_ENABLE_CURSOR_BLINK_get();
- internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextField.TextField_Property_CURSOR_BLINK_INTERVAL_get();
- internal static readonly int CURSOR_BLINK_DURATION = Interop.TextField.TextField_Property_CURSOR_BLINK_DURATION_get();
- internal static readonly int CURSOR_WIDTH = Interop.TextField.TextField_Property_CURSOR_WIDTH_get();
- internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_IMAGE_get();
- internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
- internal static readonly int SCROLL_THRESHOLD = Interop.TextField.TextField_Property_SCROLL_THRESHOLD_get();
- internal static readonly int SCROLL_SPEED = Interop.TextField.TextField_Property_SCROLL_SPEED_get();
- internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
- internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
- internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
- internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
- internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
- internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
- internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextField.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
- internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextField.TextField_Property_DECORATION_BOUNDING_BOX_get();
- internal static readonly int INPUT_METHOD_SETTINGS = Interop.TextField.TextField_Property_INPUT_METHOD_SETTINGS_get();
- internal static readonly int INPUT_COLOR = Interop.TextField.TextField_Property_INPUT_COLOR_get();
- internal static readonly int ENABLE_MARKUP = Interop.TextField.TextField_Property_ENABLE_MARKUP_get();
- internal static readonly int INPUT_FONT_FAMILY = Interop.TextField.TextField_Property_INPUT_FONT_FAMILY_get();
- internal static readonly int INPUT_FONT_STYLE = Interop.TextField.TextField_Property_INPUT_FONT_STYLE_get();
- internal static readonly int INPUT_POINT_SIZE = Interop.TextField.TextField_Property_INPUT_POINT_SIZE_get();
- internal static readonly int UNDERLINE = Interop.TextField.TextField_Property_UNDERLINE_get();
- internal static readonly int INPUT_UNDERLINE = Interop.TextField.TextField_Property_INPUT_UNDERLINE_get();
- internal static readonly int SHADOW = Interop.TextField.TextField_Property_SHADOW_get();
- internal static readonly int INPUT_SHADOW = Interop.TextField.TextField_Property_INPUT_SHADOW_get();
- internal static readonly int EMBOSS = Interop.TextField.TextField_Property_EMBOSS_get();
- internal static readonly int INPUT_EMBOSS = Interop.TextField.TextField_Property_INPUT_EMBOSS_get();
- internal static readonly int OUTLINE = Interop.TextField.TextField_Property_OUTLINE_get();
- internal static readonly int INPUT_OUTLINE = Interop.TextField.TextField_Property_INPUT_OUTLINE_get();
- internal static readonly int HIDDEN_INPUT_SETTINGS = Interop.TextField.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
- internal static readonly int PIXEL_SIZE = Interop.TextField.TextField_Property_PIXEL_SIZE_get();
- internal static readonly int ENABLE_SELECTION = Interop.TextField.TextField_Property_ENABLE_SELECTION_get();
- internal static readonly int PLACEHOLDER = Interop.TextField.TextField_Property_PLACEHOLDER_get();
- internal static readonly int ELLIPSIS = Interop.TextField.TextField_Property_ELLIPSIS_get();
- internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextField.TextField_Property_ENABLE_SHIFT_SELECTION_get();
- internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextField.TextField_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
- internal static readonly int ENABLE_GRAB_HANDLE = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_get();
- internal static readonly int ENABLE_GRAB_HANDLE_POPUP = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_POPUP_get();
- internal static readonly int SELECTED_TEXT = Interop.TextField.TextField_Property_SELECTED_TEXT_get();
- }
-
- internal class InputStyle
- {
- internal enum Mask
+ if (textFieldPlaceHolderTextFocusedSid != null)
{
- None = 0x0000,
- Color = 0x0001,
- FontFamily = 0x0002,
- PointSize = 0x0004,
- FontStyle = 0x0008,
- Underline = 0x0010,
- Shadow = 0x0020,
- Emboss = 0x0040,
- Outline = 0x0080
+ PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
}
}
- internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.translatableTextSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.translatableTextSelector;
- });
- internal static readonly BindableProperty TranslatablePlaceholderTextSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.translatablePlaceholderTextSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.translatablePlaceholderTextSelector;
- });
- internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.textSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.textSelector;
- });
- internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.fontFamilySelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.fontFamilySelector;
- });
- internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.pointSizeSelector.Clone((Selector<float?>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.pointSizeSelector;
- });
- internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.textColorSelector.Clone((Selector<Color>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.textColorSelector;
- });
- internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.placeholderTextColorSelector.Clone((Selector<Vector4>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.placeholderTextColorSelector;
- });
- internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.primaryCursorColorSelector.Clone((Selector<Vector4>)newValue);
- },
- defaultValueCreator: (bindable) =>
+ private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
{
- var textField = (TextField)bindable;
- return textField.primaryCursorColorSelector;
- });
-
- private TriggerableSelector<string> _translatableTextSelector;
- private TriggerableSelector<string> translatableTextSelector
- {
- get
- {
- if (null == _translatableTextSelector)
- {
- _translatableTextSelector = new TriggerableSelector<string>(this, TranslatableTextProperty);
- }
- return _translatableTextSelector;
- }
+ float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
+ SetValue(FontSizeScaleProperty, newFontSizeScale);
+ NotifyPropertyChanged();
}
- private TriggerableSelector<string> _translatablePlaceholderTextSelector;
- private TriggerableSelector<string> translatablePlaceholderTextSelector
+ private void addFontSizeChangedCallback()
{
- get
+ if (hasFontSizeChangedCallback != true)
{
- if (null == _translatablePlaceholderTextSelector)
+ try
{
- _translatablePlaceholderTextSelector = new TriggerableSelector<string>(this, TranslatablePlaceholderTextProperty);
+ SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
+ hasFontSizeChangedCallback = true;
}
- return _translatablePlaceholderTextSelector;
- }
- }
-
- private TriggerableSelector<string> _textSelector;
- private TriggerableSelector<string> textSelector
- {
- get
- {
- if (null == _textSelector)
+ catch (Exception e)
{
- _textSelector = new TriggerableSelector<string>(this, TextProperty);
+ Console.WriteLine("{0} Exception caught.", e);
+ hasFontSizeChangedCallback = false;
}
- return _textSelector;
}
}
- private TriggerableSelector<string> _fontFamilySelector;
- private TriggerableSelector<string> fontFamilySelector
+ private void removeFontSizeChangedCallback()
{
- get
+ if (hasFontSizeChangedCallback == true)
{
- if (null == _fontFamilySelector)
+ try
{
- _fontFamilySelector = new TriggerableSelector<string>(this, FontFamilyProperty);
+ SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
+ hasFontSizeChangedCallback = false;
}
- return _fontFamilySelector;
- }
- }
-
- private TriggerableSelector<Color> _textColorSelector;
- private TriggerableSelector<Color> textColorSelector
- {
- get
- {
- if (null == _textColorSelector)
+ catch (Exception e)
{
- _textColorSelector = new TriggerableSelector<Color>(this, TextColorProperty);
+ Console.WriteLine("{0} Exception caught.", e);
+ hasFontSizeChangedCallback = true;
}
- return _textColorSelector;
}
}
- private TriggerableSelector<float?> _pointSizeSelector;
- private TriggerableSelector<float?> pointSizeSelector
+ private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
{
- get
+ if (!isSettingTextInCSharp)
{
- if (null == _pointSizeSelector)
- {
- _pointSizeSelector = new TriggerableSelector<float?>(this, PointSizeProperty);
- }
- return _pointSizeSelector;
+ EnforceNotifyBindedInstance(TextProperty);
}
}
- private TriggerableSelector<Vector4> _placeholderTextColorSelector;
- private TriggerableSelector<Vector4> placeholderTextColorSelector
+ internal new class Property
{
- get
- {
- if (null == _placeholderTextColorSelector)
- {
- _placeholderTextColorSelector = new TriggerableSelector<Vector4>(this, PlaceholderTextColorProperty);
- }
- return _placeholderTextColorSelector;
- }
+ internal static readonly int TEXT = Interop.TextField.TextGet();
+ internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
+ internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
+ internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
+ internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
+ internal static readonly int PointSize = Interop.TextField.PointSizeGet();
+ internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
+ internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
+ internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
+ internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
+ internal static readonly int TextColor = Interop.TextField.TextColorGet();
+ internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
+ internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
+ internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
+ internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
+ internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
+ internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
+ internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
+ internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
+ internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
+ internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
+ internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
+ internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
+ internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
+ internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
+ internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
+ internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
+ internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
+ internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
+ internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
+ internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
+ internal static readonly int InputColor = Interop.TextField.InputColorGet();
+ internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
+ internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
+ internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
+ internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
+ internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
+ internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
+ internal static readonly int SHADOW = Interop.TextField.ShadowGet();
+ internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
+ internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
+ internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
+ internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
+ internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
+ internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
+ internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
+ internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
+ internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
+ internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
+ internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
+ internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
+ internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
+ internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
+ internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
+ internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
+ internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
+ internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
+ internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
+ internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
+ internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
+ internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
+ internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
}
- private TriggerableSelector<Vector4> _primaryCursorColorSelector;
- private TriggerableSelector<Vector4> primaryCursorColorSelector
+ internal class InputStyle
{
- get
+ internal enum Mask
{
- if (null == _primaryCursorColorSelector)
- {
- _primaryCursorColorSelector = new TriggerableSelector<Vector4>(this, PrimaryCursorColorProperty);
- }
- return _primaryCursorColorSelector;
+ None = 0x0000,
+ Color = 0x0001,
+ FontFamily = 0x0002,
+ PointSize = 0x0004,
+ FontStyle = 0x0008,
+ Underline = 0x0010,
+ Shadow = 0x0020,
+ Emboss = 0x0040,
+ Outline = 0x0080
}
}
{
TextColor = new Color(r, g, b, a);
}
+ private void OnGrabHandleColorChanged(float r, float g, float b, float a)
+ {
+ GrabHandleColor = new Color(r, g, b, a);
+ }
}
}