/* * 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ extern alias TizenSystemSettings; using TizenSystemSettings.Tizen.System; using System; using System.Globalization; using System.ComponentModel; using Tizen.NUI.Binding; using Tizen.NUI.Text; namespace Tizen.NUI.BaseComponents { /// /// A control which provides a single line editable text field. /// /// 3 public partial class TextField : View { 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; #if NUI_PROPERTY_CHANGE_2 private Vector4 internalPlaceholderTextColor = null; private Vector4 internalPrimaryCursorColor = null; private Vector4 internalSecondaryCursorColor = null; private Vector4 internalSelectionHighlightColor = null; private Vector4 internalInputColor = null; private Color internalTextColor = null; private Color internalGrabHandleColor = null; #endif static TextField() { } /// /// Creates the TextField control. /// /// 3 public TextField() : this(Interop.TextField.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Creates the TextField with setting the status of shown or hidden. /// /// false : Not displayed (hidden), true : displayed (shown) /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public TextField(bool shown) : this(Interop.TextField.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SetVisible(shown); } /// /// Get attributes, it is abstract function and must be override. /// [EditorBrowsable(EditorBrowsableState.Never)] protected override ViewStyle CreateViewStyle() { return new TextFieldStyle(); } internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle) { if (!shown) { SetVisible(false); } Focusable = true; TextChanged += TextFieldTextChanged; } internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null) { if (!shown) { SetVisible(false); } Focusable = true; TextChanged += TextFieldTextChanged; } internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal enum ExceedPolicyType { ExceedPolicyOriginal, ExceedPolicyClip } /// /// The TranslatableText property.
/// The text can set the SID value.
///
/// /// ResourceManager about multilingual is null. /// /// 4 public string TranslatableText { get { return (string)GetValue(TranslatableTextProperty); } set { SetValue(TranslatableTextProperty, value); } } private string translatableText { get { return textFieldTextSid; } set { if (NUIApplication.MultilingualResourceManager == null) { throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } textFieldTextSid = value; Text = SetTranslatable(textFieldTextSid); NotifyPropertyChanged(); } } /// /// The TranslatablePlaceholderText property.
/// The text can set the SID value.
///
/// /// ResourceManager about multilingual is null. /// /// 4 public string TranslatablePlaceholderText { get { return (string)GetValue(TranslatablePlaceholderTextProperty); } set { SetValue(TranslatablePlaceholderTextProperty, value); } } private string translatablePlaceholderText { get { return textFieldPlaceHolderTextSid; } set { if (NUIApplication.MultilingualResourceManager == null) { throw new ArgumentNullException(null, "ResourceManager about multilingual is null"); } textFieldPlaceHolderTextSid = value; PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid); NotifyPropertyChanged(); } } /// /// The TranslatablePlaceholderTextFocused property.
/// The text can set the SID value.
///
/// /// ResourceManager about multilingual is null. /// /// 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(); } } /// /// The Text property.
/// The text to display in the UTF-8 format.
///
/// 3 public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); NotifyPropertyChanged(); } } /// /// The PlaceholderText property.
/// The text to display when the TextField is empty and inactive.
///
/// 3 public string PlaceholderText { get { return (string)GetValue(PlaceholderTextProperty); } set { SetValue(PlaceholderTextProperty, value); NotifyPropertyChanged(); } } /// /// The PlaceholderTextFocused property.
/// The text to display when the TextField is empty with input focus.
///
/// 3 public string PlaceholderTextFocused { get { return (string)GetValue(PlaceholderTextFocusedProperty); } set { SetValue(PlaceholderTextFocusedProperty, value); NotifyPropertyChanged(); } } /// /// The FontFamily property.
/// The requested font family to use.
///
/// 3 public string FontFamily { get { return (string)GetValue(FontFamilyProperty); } set { SetValue(FontFamilyProperty, value); NotifyPropertyChanged(); } } /// /// The FontStyle property.
/// The requested font style to use.
/// The fontStyle map contains the following keys :
/// /// width (string)The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded) /// weight (string)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) /// slant (string)The slant key defines whether to use italics. (values: normal, roman, italic, oblique) /// ///
/// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap FontStyle { get { return (PropertyMap)GetValue(FontStyleProperty); } set { SetValue(FontStyleProperty, value); NotifyPropertyChanged(); } } /// /// Set FontStyle to TextField.
///
/// The FontStyle /// /// SetFontStyle specifies the requested font style through .
///
/// /// The following example demonstrates how to use the SetFontStyle method. /// /// var fontStyle = new Tizen.NUI.Text.FontStyle(); /// fontStyle.Width = FontWidthType.Expanded; /// fontStyle.Weight = FontWeightType.Bold; /// fontStyle.Slant = FontSlantType.Italic; /// field.SetFontStyle(fontStyle); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetFontStyle(FontStyle fontStyle) { using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle)) { SetValue(FontStyleProperty, fontStyleMap); } } /// /// Get FontStyle from TextField.
///
/// The FontStyle /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public FontStyle GetFontStyle() { FontStyle fontStyle; using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty)) { fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap); } return fontStyle; } /// /// The PointSize property.
/// The size of font in points.
///
/// 3 [Binding.TypeConverter(typeof(PointSizeTypeConverter))] public float PointSize { get { return (float)GetValue(PointSizeProperty); } set { SetValue(PointSizeProperty, value); NotifyPropertyChanged(); } } /// /// The MaxLength property.
/// The maximum number of characters that can be inserted.
///
/// 3 public int MaxLength { get { return (int)GetValue(MaxLengthProperty); } set { SetValue(MaxLengthProperty, value); NotifyPropertyChanged(); } } /// /// The ExceedPolicy property.
/// Specifies how the text is truncated when it does not fit.
///
/// 3 public int ExceedPolicy { get { return (int)GetValue(ExceedPolicyProperty); } set { SetValue(ExceedPolicyProperty, value); NotifyPropertyChanged(); } } /// /// The HorizontalAlignment property.
/// The line horizontal alignment.
///
/// 3 public HorizontalAlignment HorizontalAlignment { get { return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty); } set { SetValue(HorizontalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The VerticalAlignment property.
/// The line vertical alignment.
///
/// 3 public VerticalAlignment VerticalAlignment { get { return (VerticalAlignment)GetValue(VerticalAlignmentProperty); } set { SetValue(VerticalAlignmentProperty, value); NotifyPropertyChanged(); NotifyPropertyChanged(); } } /// /// The TextColor property.
/// The color of the text.
///
/// /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible. /// /// 3 public Color TextColor { get { Color temp = (Color)GetValue(TextColorProperty); return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A); } set { SetValue(TextColorProperty, value); NotifyPropertyChanged(); } } /// /// The PlaceholderTextColor property. /// /// /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible. /// /// 3 public Vector4 PlaceholderTextColor { get { Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty); return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(PlaceholderTextColorProperty, value); NotifyPropertyChanged(); } } /// /// The ShadowOffset property. /// /// 3 /// /// Deprecated.(API Level 6) Use Shadow instead. /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible. /// [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")] public Vector2 ShadowOffset { get { return GetValue(ShadowOffsetProperty) as Vector2; } set { SetValue(ShadowOffsetProperty, value); } } private Vector2 InternalShadowOffset { get { float x = 0.0f, y = 0.0f; using (var propertyValue = Shadow.Find(TextField.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); var shadowMap = Shadow; shadowMap.Merge(map); SetValue(ShadowProperty, shadowMap); NotifyPropertyChanged(); } } } /// /// The ShadowColor property. /// /// 3 /// /// Deprecated.(API Level 6) Use Shadow instead. /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible. /// [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")] public Vector4 ShadowColor { get { return GetValue(ShadowColorProperty) as Vector4; } set { SetValue(ShadowColorProperty, value); } } private Vector4 InternalShadowColor { get { float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f; using (var propertyValue = Shadow.Find(TextField.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(); } } } /// /// The PrimaryCursorColor property.
/// The color to apply to the primary cursor.
///
/// /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible. /// /// 3 public Vector4 PrimaryCursorColor { get { Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty); return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(PrimaryCursorColorProperty, value); NotifyPropertyChanged(); } } /// /// The SecondaryCursorColor property.
/// The color to apply to the secondary cursor.
///
/// /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible. /// /// 3 public Vector4 SecondaryCursorColor { get { Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty); return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(SecondaryCursorColorProperty, value); NotifyPropertyChanged(); } } /// /// The EnableCursorBlink property.
/// Whether the cursor should blink or not.
///
/// 3 public bool EnableCursorBlink { get { return (bool)GetValue(EnableCursorBlinkProperty); } set { SetValue(EnableCursorBlinkProperty, value); NotifyPropertyChanged(); } } /// /// The CursorBlinkInterval property.
/// The time interval in seconds between cursor on/off states.
///
/// 3 public float CursorBlinkInterval { get { return (float)GetValue(CursorBlinkIntervalProperty); } set { SetValue(CursorBlinkIntervalProperty, value); NotifyPropertyChanged(); } } /// /// The CursorBlinkDuration property.
/// The cursor will stop blinking after this number of seconds (if non-zero).
///
/// 3 public float CursorBlinkDuration { get { return (float)GetValue(CursorBlinkDurationProperty); } set { SetValue(CursorBlinkDurationProperty, value); NotifyPropertyChanged(); } } /// /// The CursorWidth property. /// /// 3 public int CursorWidth { get { return (int)GetValue(CursorWidthProperty); } set { SetValue(CursorWidthProperty, value); NotifyPropertyChanged(); } } /// /// The GrabHandleImage property.
/// The image to display for the grab handle.
///
/// 3 public string GrabHandleImage { get { return (string)GetValue(GrabHandleImageProperty); } set { SetValue(GrabHandleImageProperty, value); NotifyPropertyChanged(); } } /// /// The GrabHandlePressedImage property.
/// The image to display when the grab handle is pressed.
///
/// 3 public string GrabHandlePressedImage { get { return (string)GetValue(GrabHandlePressedImageProperty); } set { SetValue(GrabHandlePressedImageProperty, value); NotifyPropertyChanged(); } } /// /// The ScrollThreshold property.
/// Horizontal scrolling will occur if the cursor is this close to the control border.
///
/// 3 public float ScrollThreshold { get { return (float)GetValue(ScrollThresholdProperty); } set { SetValue(ScrollThresholdProperty, value); NotifyPropertyChanged(); } } /// /// The ScrollSpeed property.
/// The scroll speed in pixels per second.
///
/// 3 public float ScrollSpeed { get { return (float)GetValue(ScrollSpeedProperty); } set { SetValue(ScrollSpeedProperty, value); NotifyPropertyChanged(); } } /// /// The SelectionPopupStyle property.
/// The style of the text selection popup can be set through SelectionPopupStyle property. ///
[EditorBrowsable(EditorBrowsableState.Never)] public PropertyMap SelectionPopupStyle { get { return (PropertyMap)GetValue(SelectionPopupStyleProperty); } set { SetValue(SelectionPopupStyleProperty, value); NotifyPropertyChanged(); } } /// /// The SelectionHandleImageLeft property.
/// The image to display for the left selection handle.
/// The selectionHandleImageLeft map contains the following key :
/// /// filename (string)The path of image file /// ///
/// 3 public PropertyMap SelectionHandleImageLeft { get { return (PropertyMap)GetValue(SelectionHandleImageLeftProperty); } set { SetValue(SelectionHandleImageLeftProperty, value); NotifyPropertyChanged(); } } /// /// The SelectionHandleImageRight property.
/// The image to display for the right selection handle.
/// The selectionHandleImageRight map contains the following key :
/// /// filename (string)The path of image file /// ///
/// 3 public PropertyMap SelectionHandleImageRight { get { return (PropertyMap)GetValue(SelectionHandleImageRightProperty); } set { SetValue(SelectionHandleImageRightProperty, value); NotifyPropertyChanged(); } } /// /// Set SelectionHandleImage to TextField.
///
/// The SelectionHandleImage /// /// SetSelectionHandleImage specifies the display image used for the selection handle through .
///
/// /// The following example demonstrates how to use the SetSelectionHandleImage method. /// /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage(); /// selectionHandleImage.LeftImageUrl = "handle_downleft.png"; /// selectionHandleImage.RightImageUrl = "handle_downright.png"; /// field.SetSelectionHandleImage(selectionHandleImage); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage) { if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl)) { using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl)) { SetValue(SelectionHandleImageLeftProperty, leftImageMap); } } if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl)) { using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl)) { SetValue(SelectionHandleImageRightProperty, rightImageMap); } } } /// /// Get SelectionHandleImage from TextField.
///
/// The SelectionHandleImage /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public SelectionHandleImage GetSelectionHandleImage() { SelectionHandleImage selectionHandleImage; using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty)) using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty)) { selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap); } return selectionHandleImage; } /// /// The SelectionHandlePressedImageLeft property.
/// The image to display when the left selection handle is pressed.
/// The selectionHandlePressedImageLeft map contains the following key :
/// /// filename (string)The path of image file /// ///
/// 3 public PropertyMap SelectionHandlePressedImageLeft { get { return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty); } set { SetValue(SelectionHandlePressedImageLeftProperty, value); NotifyPropertyChanged(); } } /// /// The SelectionHandlePressedImageRight property.
/// The image to display when the right selection handle is pressed.
/// The selectionHandlePressedImageRight map contains the following key :
/// /// filename (string)The path of image file /// ///
/// 3 public PropertyMap SelectionHandlePressedImageRight { get { return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty); } set { SetValue(SelectionHandlePressedImageRightProperty, value); NotifyPropertyChanged(); } } /// /// Set SelectionHandlePressedImage to TextField.
///
/// The SelectionHandleImage /// /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through .
///
/// /// The following example demonstrates how to use the SetSelectionHandlePressedImage method. /// /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage(); /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png"; /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png"; /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage) { if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl)) { using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl)) { SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap); } } if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl)) { using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl)) { SetValue(SelectionHandlePressedImageRightProperty, rightImageMap); } } } /// /// Get SelectionHandlePressedImage from TextField.
///
/// The SelectionHandlePressedImage /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public SelectionHandleImage GetSelectionHandlePressedImage() { SelectionHandleImage selectionHandleImage; using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty)) using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty)) { selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap); } return selectionHandleImage; } /// /// The SelectionHandleMarkerImageLeft property.
/// The image to display for the left selection handle marker.
/// The selectionHandleMarkerImageLeft map contains the following key :
/// /// filename (string)The path of image file /// ///
/// 3 public PropertyMap SelectionHandleMarkerImageLeft { get { return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty); } set { SetValue(SelectionHandleMarkerImageLeftProperty, value); NotifyPropertyChanged(); } } /// /// The SelectionHandleMarkerImageRight property.
/// The image to display for the right selection handle marker.
/// The selectionHandleMarkerImageRight map contains the following key :
/// /// filename (string)The path of image file /// ///
/// 3 public PropertyMap SelectionHandleMarkerImageRight { get { return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty); } set { SetValue(SelectionHandleMarkerImageRightProperty, value); NotifyPropertyChanged(); } } /// /// Set SelectionHandleMarkerImage to TextField.
///
/// The SelectionHandleImage /// /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through .
///
/// /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method. /// /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage(); /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png"; /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png"; /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage) { if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl)) { using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl)) { SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap); } } if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl)) { using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl)) { SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap); } } } /// /// Get SelectionHandleMarkerImage from TextField.
///
/// The SelectionHandleMarkerImage /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public SelectionHandleImage GetSelectionHandleMarkerImage() { SelectionHandleImage selectionHandleImage; using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty)) using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty)) { selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap); } return selectionHandleImage; } /// /// The SelectionHighlightColor property.
/// The color of the selection highlight.
///
/// /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible. /// /// 3 public Vector4 SelectionHighlightColor { get { Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty); return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(SelectionHighlightColorProperty, value); NotifyPropertyChanged(); } } /// /// The DecorationBoundingBox property.
/// The decorations (handles etc) will positioned within this area on-screen.
///
/// /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible. /// /// 3 public Rectangle DecorationBoundingBox { get { Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty); return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height); } set { SetValue(DecorationBoundingBoxProperty, value); NotifyPropertyChanged(); } } /// /// The InputMethodSettings property.
/// The settings to relating to the System's Input Method, Key and Value.
///
/// /// is a class encapsulating the input method map. Use the class for this property. /// /// /// The following example demonstrates how to set the InputMethodSettings property. /// /// 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; /// /// /// 3 public PropertyMap InputMethodSettings { get { return (PropertyMap)GetValue(InputMethodSettingsProperty); } set { SetValue(InputMethodSettingsProperty, value); NotifyPropertyChanged(); } } /// /// The InputColor property.
/// The color of the new input text.
///
/// /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible. /// /// 3 public Vector4 InputColor { get { Vector4 temp = (Vector4)GetValue(InputColorProperty); return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(InputColorProperty, value); NotifyPropertyChanged(); } } /// /// The EnableMarkup property.
/// Whether the mark-up processing is enabled.
///
/// 3 public bool EnableMarkup { get { return (bool)GetValue(EnableMarkupProperty); } set { SetValue(EnableMarkupProperty, value); NotifyPropertyChanged(); } } /// /// The InputFontFamily property.
/// The font's family of the new input text.
///
/// 3 public string InputFontFamily { get { return (string)GetValue(InputFontFamilyProperty); } set { SetValue(InputFontFamilyProperty, value); NotifyPropertyChanged(); } } /// /// The InputFontStyle property.
/// The font's style of the new input text.
/// The inputFontStyle map contains the following keys :
/// /// width (string)The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded) /// weight (string)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) /// slant (string)The slant key defines whether to use italics. (values: normal, roman, italic, oblique) /// ///
/// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap InputFontStyle { get { return (PropertyMap)GetValue(InputFontStyleProperty); } set { SetValue(InputFontStyleProperty, value); NotifyPropertyChanged(); } } /// /// Set InputFontStyle to TextField.
///
/// The FontStyle /// /// SetInputFontStyle specifies the requested font style for new input text through .
///
/// /// The following example demonstrates how to use the SetInputFontStyle method. /// /// var fontStyle = new Tizen.NUI.Text.FontStyle(); /// fontStyle.Width = FontWidthType.Expanded; /// fontStyle.Weight = FontWeightType.Bold; /// fontStyle.Slant = FontSlantType.Italic; /// field.SetInputFontStyle(fontStyle); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetInputFontStyle(FontStyle fontStyle) { using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle)) { SetValue(InputFontStyleProperty, fontStyleMap); } } /// /// Get InputFontStyle from TextField.
///
/// The FontStyle /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public FontStyle GetInputFontStyle() { FontStyle fontStyle; using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty)) { fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap); } return fontStyle; } /// /// The InputPointSize property.
/// The font's size of the new input text in points.
///
/// 3 [Binding.TypeConverter(typeof(PointSizeTypeConverter))] public float InputPointSize { get { return (float)GetValue(InputPointSizeProperty); } set { SetValue(InputPointSizeProperty, value); NotifyPropertyChanged(); } } /// /// The Underline property.
/// The default underline parameters.
/// The underline map contains the following keys :
/// /// enable (bool)Whether the underline is enabled (the default value is false) /// color (Color)The color of the underline (If not provided then the color of the text is used) /// height (float)The height in pixels of the underline (the default value is 1.f) /// ///
/// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap Underline { get { return (PropertyMap)GetValue(UnderlineProperty); } set { SetValue(UnderlineProperty, value); NotifyPropertyChanged(); } } /// /// Set Underline to TextField.
///
/// The Underline /// /// SetUnderline specifies the underline of the text through .
///
/// /// The following example demonstrates how to use the SetUnderline method. /// /// var underline = new Tizen.NUI.Text.Underline(); /// underline.Enable = true; /// underline.Color = new Color("#3498DB"); /// underline.Height = 2.0f; /// field.SetUnderline(underline); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetUnderline(Underline underline) { using (var underlineMap = TextMapHelper.GetUnderlineMap(underline)) { SetValue(UnderlineProperty, underlineMap); } } /// /// Get Underline from TextField.
///
/// The Underline /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public Underline GetUnderline() { Underline underline; using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty)) { underline = TextMapHelper.GetUnderlineStruct(underlineMap); } return underline; } /// /// The InputUnderline property.
/// The underline parameters of the new input text.
///
/// 3 public string InputUnderline { get { return (string)GetValue(InputUnderlineProperty); } set { SetValue(InputUnderlineProperty, value); NotifyPropertyChanged(); } } /// /// The Shadow property.
/// The default shadow parameters.
/// The shadow map contains the following keys :
/// /// color (Color)The color of the shadow (the default color is Color.Black) /// offset (Vector2)The offset in pixels of the shadow (If not provided then the shadow is not enabled) /// blurRadius (float)The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled) /// ///
/// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap Shadow { get { return (PropertyMap)GetValue(ShadowProperty); } set { SetValue(ShadowProperty, value); NotifyPropertyChanged(); } } /// /// Set Shadow to TextField.
///
/// The Shadow /// /// SetShadow specifies the shadow of the text through .
///
/// /// The following example demonstrates how to use the SetShadow method. /// /// var shadow = new Tizen.NUI.Text.Shadow(); /// shadow.Offset = new Vector2(3, 3); /// shadow.Color = new Color("#F1C40F"); /// field.SetShadow(shadow); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetShadow(Tizen.NUI.Text.Shadow shadow) { using (var shadowMap = TextMapHelper.GetShadowMap(shadow)) { SetValue(ShadowProperty, shadowMap); } } /// /// Get Shadow from TextField.
///
/// The Shadow /// /// /// [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; } /// /// The InputShadow property.
/// The shadow parameters of the new input text.
///
/// 3 public string InputShadow { get { return (string)GetValue(InputShadowProperty); } set { SetValue(InputShadowProperty, value); NotifyPropertyChanged(); } } /// /// The Emboss property.
/// The default emboss parameters.
///
/// 3 public string Emboss { get { return (string)GetValue(EmbossProperty); } set { SetValue(EmbossProperty, value); NotifyPropertyChanged(); } } /// /// The InputEmboss property.
/// The emboss parameters of the new input text.
///
/// 3 public string InputEmboss { get { return (string)GetValue(InputEmbossProperty); } set { SetValue(InputEmbossProperty, value); NotifyPropertyChanged(); } } /// /// The Outline property.
/// The default outline parameters.
/// The outline map contains the following keys :
/// /// color (Color)The color of the outline (the default color is Color.White) /// width (float)The width in pixels of the outline (If not provided then the outline is not enabled) /// ///
/// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap Outline { get { return (PropertyMap)GetValue(OutlineProperty); } set { SetValue(OutlineProperty, value); NotifyPropertyChanged(); } } /// /// Set Outline to TextField.
///
/// The Outline /// /// SetOutline specifies the outline of the text through .
///
/// /// The following example demonstrates how to use the SetOutline method. /// /// var outline = new Tizen.NUI.Text.Outline(); /// outline.Width = 2.0f; /// outline.Color = new Color("#45B39D"); /// field.SetOutline(outline); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetOutline(Outline outline) { using (var outlineMap = TextMapHelper.GetOutlineMap(outline)) { SetValue(OutlineProperty, outlineMap); } } /// /// Get Outline from TextField.
///
/// The Outline /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public Outline GetOutline() { Outline outline; using (var outlineMap = (PropertyMap)GetValue(OutlineProperty)) { outline = TextMapHelper.GetOutlineStruct(outlineMap); } return outline; } /// /// The InputOutline property.
/// The outline parameters of the new input text.
///
/// 3 public string InputOutline { get { return (string)GetValue(InputOutlineProperty); } set { SetValue(InputOutlineProperty, value); NotifyPropertyChanged(); } } /// /// The HiddenInputSettings property.
/// Hides the input characters and instead shows a default character for password or pin entry.
/// The hiddenInputSettings map contains the following keys :
/// /// HiddenInputProperty.Mode (int)The mode for input text display (Use HiddenInputModeType) /// HiddenInputProperty.SubstituteCharacter (int)All input characters are substituted by this character /// HiddenInputProperty.SubstituteCount (int)Length of text to show or hide, available when HideCount/ShowCount mode is used /// HiddenInputProperty.ShowLastCharacterDuration (int)Hide last character after this duration, available when ShowLastCharacter mode /// ///
/// /// See and for a detailed description. /// /// /// The following example demonstrates how to set the HiddenInputSettings property. /// /// 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; /// /// /// 3 public Tizen.NUI.PropertyMap HiddenInputSettings { get { return (PropertyMap)GetValue(HiddenInputSettingsProperty); } set { SetValue(HiddenInputSettingsProperty, value); NotifyPropertyChanged(); } } /// /// Set HiddenInput to TextField.
///
/// The HiddenInput /// /// SetHiddenInput specifies the requested font style through .
///
/// /// The following example demonstrates how to use the SetHiddenInput method. /// /// var hiddenInput = new Tizen.NUI.Text.HiddenInput(); /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter; /// hiddenInput.SubstituteCharacter = '★'; /// hiddenInput.SubstituteCount = 0; /// hiddenInput.ShowLastCharacterDuration = 1000; /// field.SetHiddenInput(hiddenInput); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetHiddenInput(HiddenInput hiddenInput) { using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput)) { SetValue(HiddenInputSettingsProperty, hiddenInputMap); } } /// /// Get HiddenInput from TextField.
///
/// The HiddenInput /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public HiddenInput GetHiddenInput() { HiddenInput hiddenInput; using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty)) { hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap); } return hiddenInput; } /// /// The PixelSize property.
/// The size of font in pixels.
///
/// 3 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))] public float PixelSize { get { return (float)GetValue(PixelSizeProperty); } set { SetValue(PixelSizeProperty, value); NotifyPropertyChanged(); } } /// /// The Enable selection property.
/// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.
///
/// 3 public bool EnableSelection { get { return (bool)GetValue(EnableSelectionProperty); } set { SetValue(EnableSelectionProperty, value); NotifyPropertyChanged(); } } /// /// The Enable grab handle property.
/// Enables the grab handles for text selection.
/// The default value is true, which means the grab handles are enabled by default.
///
/// 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 bool EnableGrabHandle { get { return (bool)GetValue(EnableGrabHandleProperty); } set { SetValue(EnableGrabHandleProperty, value); NotifyPropertyChanged(); } } /// /// The Enable grab handle popup property.
/// Enables the grab handle popup for text selection.
/// The default value is true, which means the grab handle popup is enabled by default.
///
/// 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 bool EnableGrabHandlePopup { get { return (bool)GetValue(EnableGrabHandlePopupProperty); } set { SetValue(EnableGrabHandlePopupProperty, value); NotifyPropertyChanged(); } } /// /// The portion of the text that has been selected by the user. /// /// /// Empty string when nothing is selected. /// /// 9 public string SelectedText { get { string selectedText; using (var propertyValue = GetProperty(TextField.Property.SelectedText)) { propertyValue.Get(out selectedText); } return selectedText; } } /// /// The start index for selection. /// /// /// When there is no selection, the index is current cursor position. /// /// 9 public int SelectedTextStart { get { int selectedTextStart; using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart)) { propertyValue.Get(out selectedTextStart); } return selectedTextStart; } } /// /// The end index for selection. /// /// /// When there is no selection, the index is current cursor position. /// /// 9 public int SelectedTextEnd { get { int selectedTextEnd; using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd)) { propertyValue.Get(out selectedTextEnd); } return selectedTextEnd; } } /// /// Enable editing in text control. /// /// 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 bool EnableEditing { get { return (bool)GetValue(EnableEditingProperty); } set { SetValue(EnableEditingProperty, value); } } private bool InternalEnableEditing { get { bool enableEditing; using (var propertyValue = GetProperty(TextField.Property.EnableEditing)) { propertyValue.Get(out enableEditing); } return enableEditing; } set { using (var propertyValue = new PropertyValue(value)) { SetProperty(TextField.Property.EnableEditing, propertyValue); NotifyPropertyChanged(); } } } /// /// PrimaryCursorPosition property.
/// Specify the position of the primary cursor (caret) in text control. ///
/// /// If the value set is out of range (negative or greater than or equal the number of characters in Text) then the PrimaryCursorPosition is moved to the end of Text (the number of characters in Text). /// /// 10 public int PrimaryCursorPosition { get { return (int)GetValue(PrimaryCursorPositionProperty); } set { SetValue(PrimaryCursorPositionProperty, value); } } private int InternalPrimaryCursorPosition { get { int primaryCursorPosition; using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition)) { propertyValue.Get(out primaryCursorPosition); } return primaryCursorPosition; } set { using (PropertyValue propertyValue = new PropertyValue(value)) { SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue); NotifyPropertyChanged(); } } } /// /// The GrabHandleColor property. /// /// /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible. /// [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(); } } /// /// 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.
///
/// 9 public EllipsisPosition EllipsisPosition { get { return (EllipsisPosition)GetValue(EllipsisPositionProperty); } set { SetValue(EllipsisPositionProperty, value); NotifyPropertyChanged(); } } /// /// The spaces between characters in Pixels. /// /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
/// The default value is 0.f which does nothing. ///
///
[EditorBrowsable(EditorBrowsableState.Never)] public float CharacterSpacing { get { return (float)GetValue(CharacterSpacingProperty); } set { SetValue(CharacterSpacingProperty, value); NotifyPropertyChanged(); } } /// /// Set InputFilter to TextField. /// /// The InputFilter /// /// filters input based on regular expressions.
/// InputFiltered signal is emitted when the input is filtered by InputFilter
/// See , and for a detailed description. ///
/// /// The following example demonstrates how to use the SetInputFilter method. /// /// 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 /// /// /// 9 public void SetInputFilter(InputFilter inputFilter) { using (var map = TextMapHelper.GetInputFilterMap(inputFilter)) using (var propertyValue = new PropertyValue(map)) { SetProperty(TextField.Property.InputFilter, propertyValue); } } /// /// Get InputFilter from TextField. /// /// The InputFilter /// /// /// /// 9 public InputFilter GetInputFilter() { InputFilter inputFilter; using (var propertyValue = GetProperty(TextField.Property.InputFilter)) using (var map = new PropertyMap()) { propertyValue.Get(map); inputFilter = TextMapHelper.GetInputFilterStruct(map); } return inputFilter; } /// /// Set Strikethrough to TextField.
///
/// The Strikethrough /// /// SetStrikethrough specifies the strikethrough of the text through .
///
/// /// The following example demonstrates how to use the SetStrikethrough method. /// /// var strikethrough = new Tizen.NUI.Text.Strikethrough(); /// strikethrough.Enable = true; /// strikethrough.Color = new Color("#3498DB"); /// strikethrough.Height = 2.0f; /// field.SetStrikethrough(strikethrough); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetStrikethrough(Strikethrough strikethrough) { using (var map = TextMapHelper.GetStrikethroughMap(strikethrough)) using (var propertyValue = new PropertyValue(map)) { SetProperty(TextField.Property.Strikethrough, propertyValue); } } /// /// Get Strikethrough from TextField.
///
/// The Strikethrough /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public Strikethrough GetStrikethrough() { Strikethrough strikethrough; using (var propertyValue = GetProperty(TextField.Property.Strikethrough)) using (var map = new PropertyMap()) { propertyValue.Get(map); strikethrough = TextMapHelper.GetStrikethroughStruct(map); } return strikethrough; } /// /// The Placeholder property. /// The placeholder map contains the following keys :
/// /// text (string)The text to display when the TextField is empty and inactive /// textFocused (string)The text to display when the placeholder has focus /// color (Color)The color of the placeholder text /// fontFamily (string)The fontFamily of the placeholder text /// fontStyle (PropertyMap)The fontStyle of the placeholder text /// pointSize (float)The pointSize of the placeholder text /// pixelSize (float)The pixelSize of the placeholder text /// ellipsis (bool)The ellipsis of the placeholder text /// ///
/// /// The following example demonstrates how to set the Placeholder property. /// /// PropertyMap propertyMap = new PropertyMap(); /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text")); /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused")); /// propertyMap.Add("color", new PropertyValue(Color.Red)); /// propertyMap.Add("fontFamily", new PropertyValue("Arial")); /// propertyMap.Add("pointSize", new PropertyValue(12.0f)); /// /// PropertyMap fontStyleMap = new PropertyMap(); /// fontStyleMap.Add("weight", new PropertyValue("bold")); /// fontStyleMap.Add("width", new PropertyValue("condensed")); /// fontStyleMap.Add("slant", new PropertyValue("italic")); /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap)); /// /// TextField field = new TextField(); /// field.Placeholder = propertyMap; /// /// /// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public Tizen.NUI.PropertyMap Placeholder { get { PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty); string defalutText = ""; if (TextMapHelper.IsValue(map, 0)) map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText)); if (TextMapHelper.IsValue(map, 1)) map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText)); if (TextMapHelper.IsValue(map, 2)) { using (var color = TextMapHelper.GetColorFromMap(map, 2)) { map.Add("color", color); } } if (TextMapHelper.IsValue(map, 3)) map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText)); if (TextMapHelper.IsValue(map, 4)) { using (var properyValue = map.Find(4)) using (var fontStyle = new PropertyMap()) { properyValue.Get(fontStyle); using (var fontStyleValue = new PropertyValue(fontStyle)) { map.Add("fontStyle", fontStyleValue); } } } if (TextMapHelper.IsValue(map, 5)) map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5)); if (TextMapHelper.IsValue(map, 6)) map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6)); if (TextMapHelper.IsValue(map, 7)) map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false)); return map; } set { SetValue(PlaceholderProperty, value); NotifyPropertyChanged(); } } /// /// Set Placeholder to TextField.
///
/// The Placeholder /// /// SetPlaceholder specifies the attributes of the placeholder property through .
///
/// /// The following example demonstrates how to use the SetPlaceholder method. /// /// 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); /// /// [EditorBrowsable(EditorBrowsableState.Never)] public void SetPlaceholder(Placeholder placeholder) { using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder)) { SetValue(PlaceholderProperty, placeholderMap); } } /// /// Get Placeholder from TextField.
///
/// The Placeholder /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public Placeholder GetPlaceholder() { Placeholder placeholder; using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty)) { placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap); } return placeholder; } /// /// The Ellipsis property.
/// Enable or disable the ellipsis.
/// Placeholder PropertyMap is used to add ellipsis to placeholder text. ///
/// 4 public bool Ellipsis { get { return (bool)GetValue(EllipsisProperty); } set { SetValue(EllipsisProperty, value); NotifyPropertyChanged(); } } /// /// Enables selection of the text using the Shift key. /// /// 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 bool EnableShiftSelection { get { return (bool)GetValue(EnableShiftSelectionProperty); } set { SetValue(EnableShiftSelectionProperty, value); NotifyPropertyChanged(); } } /// /// The text alignment to match the direction of the system language.
/// The default value is true.
///
/// 6 public bool MatchSystemLanguageDirection { get { return (bool)GetValue(MatchSystemLanguageDirectionProperty); } set { SetValue(MatchSystemLanguageDirectionProperty, value); NotifyPropertyChanged(); } } /// /// The FontSizeScale property.
/// The default value is 1.0.
/// The given font size scale value is used for multiplying the specified font size before querying fonts.
/// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally.
///
/// 9 public float FontSizeScale { get { return fontSizeScale; } set { float newFontSizeScale; if (fontSizeScale == value) return; fontSizeScale = value; if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting) { SystemSettingsFontSize systemSettingsFontSize; try { systemSettingsFontSize = SystemSettings.FontSize; } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); systemSettingsFontSize = SystemSettingsFontSize.Normal; } newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize); addFontSizeChangedCallback(); } else { newFontSizeScale = fontSizeScale; removeFontSizeChangedCallback(); } SetValue(FontSizeScaleProperty, newFontSizeScale); NotifyPropertyChanged(); } } /// /// The EnableFontSizeScale property.
/// Whether the font size scale is enabled. (The default value is true) ///
[EditorBrowsable(EditorBrowsableState.Never)] public bool EnableFontSizeScale { get { return (bool)GetValue(EnableFontSizeScaleProperty); } set { SetValue(EnableFontSizeScaleProperty, value); NotifyPropertyChanged(); } } /// /// Get the InputMethodContext instance. /// /// The InputMethodContext instance. /// 5 public InputMethodContext GetInputMethodContext() { if (inputMethodCotext == null) { /*Avoid raising InputMethodContext reference count.*/ inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return inputMethodCotext; } /// /// Select the whole text. /// /// 9 public void SelectWholeText() { Interop.TextField.SelectWholeText(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Select text from start to end index.
/// The index is valid when 0 or positive. ///
/// The start index for selection. /// The end index for selection. /// /// If the end index exceeds the maximum value, it is set to the length of the text. /// /// 9 public void SelectText(int start, int end) { 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(); } /// /// Clear selection of the text.
/// Valid when selection is activate. ///
/// 9 public void SelectNone() { _ = 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.InputStyleChangedSignal(SwigCPtr)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Dispose. /// /// 3 protected override void Dispose(DisposeTypes type) { if (disposed) { DisposeQueue.Instance.Add(this); return; } #if NUI_PROPERTY_CHANGE_2 internalPlaceholderTextColor?.Dispose(); internalPrimaryCursorColor?.Dispose(); internalSecondaryCursorColor?.Dispose(); internalSelectionHighlightColor?.Dispose(); internalInputColor?.Dispose(); internalTextColor?.Dispose(); internalGrabHandleColor?.Dispose(); #endif 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 (textFieldCursorPositionChangedCallbackDelegate != null) { this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate); } if (textFieldMaxLengthReachedCallbackDelegate != null) { this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate); } if (textFieldSelectionStartedCallbackDelegate != null) { this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate); } if (textFieldSelectionClearedCallbackDelegate != null) { this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate); } if (textFieldSelectionChangedCallbackDelegate != null) { this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate); } if (textFieldTextChangedCallbackDelegate != null) { TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate); } } TextChanged -= TextFieldTextChanged; base.Dispose(type); } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { // In order to speed up IME hide, temporarily add GetInputMethodContext()?.DestroyContext(); Interop.TextField.DeleteTextField(swigCPtr); } internal override LayoutItem CreateDefaultLayout() { return new TextFieldLayout(); } internal void SetTextWithoutTextChanged(string text) { invokeTextChanged = false; Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text)); invokeTextChanged = true; } private string SetTranslatable(string textFieldSid) { string translatableText = null; translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); if (translatableText != null) { if (systemlangTextFlag == false) { SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged; systemlangTextFlag = true; } return translatableText; } else { translatableText = ""; return translatableText; } } private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) { if (textFieldTextSid != null) { Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-"))); } if (textFieldPlaceHolderTextSid != null) { PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-"))); } if (textFieldPlaceHolderTextFocusedSid != null) { PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-"))); } } private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e) { float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value); SetValue(FontSizeScaleProperty, newFontSizeScale); NotifyPropertyChanged(); } private void addFontSizeChangedCallback() { if (hasFontSizeChangedCallback != true) { try { SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged; hasFontSizeChangedCallback = true; } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); hasFontSizeChangedCallback = false; } } } private void removeFontSizeChangedCallback() { if (hasFontSizeChangedCallback == true) { try { SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged; hasFontSizeChangedCallback = false; } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); hasFontSizeChangedCallback = true; } } } private void TextFieldTextChanged(object sender, TextChangedEventArgs e) { if (!isSettingTextInCSharp) { EnforceNotifyBindedInstance(TextProperty); } } internal new class Property { 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 SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet(); 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 EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet(); internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet(); internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet(); internal static readonly int InputFilter = Interop.TextField.InputFilterGet(); internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet(); internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet(); } internal class InputStyle { internal enum Mask { None = 0x0000, Color = 0x0001, FontFamily = 0x0002, PointSize = 0x0004, FontStyle = 0x0008, Underline = 0x0010, Shadow = 0x0020, Emboss = 0x0040, Outline = 0x0080 } } private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height) { DecorationBoundingBox = new Rectangle(x, y, width, height); } private void OnInputColorChanged(float x, float y, float z, float w) { InputColor = new Vector4(x, y, z, w); } private void OnPlaceholderTextColorChanged(float r, float g, float b, float a) { PlaceholderTextColor = new Vector4(r, g, b, a); } private void OnPrimaryCursorColorChanged(float x, float y, float z, float w) { PrimaryCursorColor = new Vector4(x, y, z, w); } private void OnSecondaryCursorColorChanged(float x, float y, float z, float w) { SecondaryCursorColor = new Vector4(x, y, z, w); } private void OnSelectionHighlightColorChanged(float x, float y, float z, float w) { SelectionHighlightColor = new Vector4(x, y, z, w); } private void OnShadowColorChanged(float x, float y, float z, float w) { ShadowColor = new Vector4(x, y, z, w); } private void OnShadowOffsetChanged(float x, float y) { ShadowOffset = new Vector2(x, y); } private void OnTextColorChanged(float r, float g, float b, float a) { TextColor = new Color(r, g, b, a); } private void OnGrabHandleColorChanged(float r, float g, float b, float a) { GrabHandleColor = new Color(r, g, b, a); } private class TextFieldLayout : LayoutItem { protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec) { // Padding will be automatically applied by DALi TextField. var totalWidth = widthMeasureSpec.Size.AsDecimal(); var totalHeight = heightMeasureSpec.Size.AsDecimal(); var minSize = Owner.MinimumSize; var maxSize = Owner.MaximumSize; var naturalSize = Owner.GetNaturalSize(); if (((TextField)Owner).Text.Length == 0) { // Calculate height of TextField by setting Text with " ". // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this. ((TextField)Owner).SetTextWithoutTextChanged(" "); // Store original WidthSpecification to restore it after setting ResizePolicy. var widthSpecification = Owner.WidthSpecification; // In DALi's Size logic, if Width or Height is set to be 0, then // ResizePolicy is not changed to Fixed. // This causes Size changes after NUI Layout's OnMeasure is finished. // e.g. TextField's Width fills to its parent although Text is null and // WidthSpecification is WrapContent. // To prevent the Size changes, WidthResizePolicy is set to be Fixed // in advance if Text is null. Owner.WidthResizePolicy = ResizePolicyType.Fixed; // Restore WidthSpecification because ResizePolicy changes WidthSpecification. Owner.WidthSpecification = widthSpecification; naturalSize = Owner.GetNaturalSize(); // Restore TextField's Text after calculating height of TextField. // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this. ((TextField)Owner).SetTextWithoutTextChanged(""); } if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly) { totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width); } if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly) { totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height); } widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly); heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly); MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK; MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK; SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState), ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState)); } } } }