2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 extern alias TizenSystemSettings;
18 using TizenSystemSettings.Tizen.System;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
26 namespace Tizen.NUI.BaseComponents
29 /// A control which provides a single line editable text field.
31 /// <since_tizen> 3 </since_tizen>
32 public partial class TextField : View
34 static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextField";
35 static private string defaultFontFamily = "TizenSans";
36 private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
37 private static SystemFontSizeChanged systemFontSizeChanged = new SystemFontSizeChanged();
38 private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
39 private string textFieldTextSid = null;
40 private string textFieldPlaceHolderTextSid = null;
41 private string textFieldPlaceHolderTextFocusedSid = null;
42 private InputMethodContext inputMethodCotext = null;
43 private string fontFamily = defaultFontFamily;
44 private float fontSizeScale = 1.0f;
45 private bool hasSystemLanguageChanged = false;
46 private bool hasSystemFontSizeChanged = false;
47 private bool hasSystemFontTypeChanged = false;
48 private bool isSettingTextInCSharp = false;
50 private Vector4 internalPlaceholderTextColor = null;
51 private Vector4 internalPrimaryCursorColor = null;
52 private Vector4 internalSecondaryCursorColor = null;
53 private Vector4 internalSelectionHighlightColor = null;
54 private Vector4 internalInputColor = null;
55 private Color internalTextColor = null;
56 private Color internalGrabHandleColor = null;
59 static TextField() { }
62 /// Creates the TextField control.
64 /// <since_tizen> 3 </since_tizen>
65 public TextField() : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 /// Creates the TextField with setting the status of shown or hidden.
73 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
74 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public TextField(bool shown) : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83 /// Get attributes, it is abstract function and must be override.
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 protected override ViewStyle CreateViewStyle()
88 return new TextFieldStyle();
91 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
98 TextChanged += TextFieldTextChanged;
101 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
108 TextChanged += TextFieldTextChanged;
111 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116 internal enum ExceedPolicyType
118 ExceedPolicyOriginal,
122 private bool HasStyle()
124 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
128 /// The TranslatableText property.<br />
129 /// The text can set the SID value.<br />
131 /// <exception cref='ArgumentNullException'>
132 /// ResourceManager about multilingual is null.
134 /// <since_tizen> 4 </since_tizen>
135 public string TranslatableText
139 return (string)GetValue(TranslatableTextProperty);
143 SetValue(TranslatableTextProperty, value);
146 private string translatableText
150 return textFieldTextSid;
154 if (NUIApplication.MultilingualResourceManager == null)
156 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
158 textFieldTextSid = value;
159 Text = SetTranslatable(textFieldTextSid);
160 NotifyPropertyChanged();
165 /// The TranslatablePlaceholderText property.<br />
166 /// The text can set the SID value.<br />
168 /// <exception cref='ArgumentNullException'>
169 /// ResourceManager about multilingual is null.
171 /// <since_tizen> 4 </since_tizen>
172 public string TranslatablePlaceholderText
176 return (string)GetValue(TranslatablePlaceholderTextProperty);
180 SetValue(TranslatablePlaceholderTextProperty, value);
183 private string translatablePlaceholderText
187 return textFieldPlaceHolderTextSid;
191 if (NUIApplication.MultilingualResourceManager == null)
193 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
195 textFieldPlaceHolderTextSid = value;
196 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
197 NotifyPropertyChanged();
202 /// The TranslatablePlaceholderTextFocused property.<br />
203 /// The text can set the SID value.<br />
205 /// <exception cref='ArgumentNullException'>
206 /// ResourceManager about multilingual is null.
208 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
209 [EditorBrowsable(EditorBrowsableState.Never)]
210 public string TranslatablePlaceholderTextFocused
214 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
218 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
221 private string translatablePlaceholderTextFocused
225 return textFieldPlaceHolderTextFocusedSid;
229 if (NUIApplication.MultilingualResourceManager == null)
231 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
233 textFieldPlaceHolderTextFocusedSid = value;
234 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
235 NotifyPropertyChanged();
240 /// The Text property.<br />
241 /// The text to display in the UTF-8 format.<br />
243 /// <since_tizen> 3 </since_tizen>
248 return (string)GetValue(TextProperty);
252 SetValue(TextProperty, value);
253 NotifyPropertyChanged();
258 /// The PlaceholderText property.<br />
259 /// The text to display when the TextField is empty and inactive. <br />
261 /// <since_tizen> 3 </since_tizen>
262 public string PlaceholderText
266 return (string)GetValue(PlaceholderTextProperty);
270 SetValue(PlaceholderTextProperty, value);
271 NotifyPropertyChanged();
276 /// The PlaceholderTextFocused property. <br />
277 /// The text to display when the TextField is empty with input focus. <br />
279 /// <since_tizen> 3 </since_tizen>
280 public string PlaceholderTextFocused
284 return (string)GetValue(PlaceholderTextFocusedProperty);
288 SetValue(PlaceholderTextFocusedProperty, value);
289 NotifyPropertyChanged();
294 /// The FontFamily property.<br />
295 /// The requested font family to use.<br />
297 /// <since_tizen> 3 </since_tizen>
298 public string FontFamily
302 return (string)GetValue(FontFamilyProperty);
306 SetValue(FontFamilyProperty, value);
307 NotifyPropertyChanged();
311 private string InternalFontFamily
318 return Object.InternalGetPropertyString(this.SwigCPtr, TextField.Property.FontFamily);
322 string newFontFamily;
324 if (string.Equals(fontFamily, value)) return;
327 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
331 newFontFamily = SystemSettings.FontType;
335 Console.WriteLine("{0} Exception caught.", e);
336 newFontFamily = defaultFontFamily;
338 AddSystemSettingsFontTypeChanged();
342 newFontFamily = fontFamily;
343 RemoveSystemSettingsFontTypeChanged();
346 SetInternalFontFamily(newFontFamily);
350 private void SetInternalFontFamily(string fontFamily)
352 Object.InternalSetPropertyString(this.SwigCPtr, TextField.Property.FontFamily, (string)fontFamily);
356 /// The FontStyle property.<br />
357 /// The requested font style to use.<br />
358 /// The fontStyle map contains the following keys :<br />
359 /// <list type="table">
360 /// <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>
361 /// <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>
362 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
365 /// <since_tizen> 3 </since_tizen>
366 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
367 public PropertyMap FontStyle
371 return (PropertyMap)GetValue(FontStyleProperty);
375 SetValue(FontStyleProperty, value);
376 NotifyPropertyChanged();
381 /// Set FontStyle to TextField. <br />
383 /// <param name="fontStyle">The FontStyle</param>
385 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
388 /// The following example demonstrates how to use the SetFontStyle method.
390 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
391 /// fontStyle.Width = FontWidthType.Expanded;
392 /// fontStyle.Weight = FontWeightType.Bold;
393 /// fontStyle.Slant = FontSlantType.Italic;
394 /// field.SetFontStyle(fontStyle);
397 [EditorBrowsable(EditorBrowsableState.Never)]
398 public void SetFontStyle(FontStyle fontStyle)
400 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
402 SetValue(FontStyleProperty, fontStyleMap);
407 /// Get FontStyle from TextField. <br />
409 /// <returns>The FontStyle</returns>
411 /// <see cref="Tizen.NUI.Text.FontStyle"/>
413 [EditorBrowsable(EditorBrowsableState.Never)]
414 public FontStyle GetFontStyle()
417 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
419 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
425 /// The PointSize property.<br />
426 /// The size of font in points.<br />
428 /// <since_tizen> 3 </since_tizen>
429 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
430 public float PointSize
434 return (float)GetValue(PointSizeProperty);
438 SetValue(PointSizeProperty, value);
439 NotifyPropertyChanged();
444 /// The MaxLength property.<br />
445 /// The maximum number of characters that can be inserted.<br />
447 /// <since_tizen> 3 </since_tizen>
452 return (int)GetValue(MaxLengthProperty);
456 SetValue(MaxLengthProperty, value);
457 NotifyPropertyChanged();
462 /// The ExceedPolicy property.<br />
463 /// Specifies how the text is truncated when it does not fit.<br />
465 /// <since_tizen> 3 </since_tizen>
466 public int ExceedPolicy
470 return (int)GetValue(ExceedPolicyProperty);
474 SetValue(ExceedPolicyProperty, value);
475 NotifyPropertyChanged();
480 /// The HorizontalAlignment property.<br />
481 /// The line horizontal alignment.<br />
483 /// <since_tizen> 3 </since_tizen>
484 public HorizontalAlignment HorizontalAlignment
488 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
492 SetValue(HorizontalAlignmentProperty, value);
493 NotifyPropertyChanged();
498 /// The VerticalAlignment property.<br />
499 /// The line vertical alignment.<br />
501 /// <since_tizen> 3 </since_tizen>
502 public VerticalAlignment VerticalAlignment
506 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
510 SetValue(VerticalAlignmentProperty, value);
511 NotifyPropertyChanged();
512 NotifyPropertyChanged();
517 /// The TextColor property.<br />
518 /// The color of the text.<br />
521 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
523 /// <since_tizen> 3 </since_tizen>
524 public Color TextColor
528 Color temp = (Color)GetValue(TextColorProperty);
529 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
533 SetValue(TextColorProperty, value);
534 NotifyPropertyChanged();
539 /// The PlaceholderTextColor property.
542 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
544 /// <since_tizen> 3 </since_tizen>
545 public Vector4 PlaceholderTextColor
549 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
550 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
554 SetValue(PlaceholderTextColorProperty, value);
555 NotifyPropertyChanged();
560 /// The ShadowOffset property.
562 /// <since_tizen> 3 </since_tizen>
564 /// Deprecated.(API Level 6) Use Shadow instead.
565 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
567 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
568 public Vector2 ShadowOffset
572 return GetValue(ShadowOffsetProperty) as Vector2;
576 SetValue(ShadowOffsetProperty, value);
580 private Vector2 InternalShadowOffset
584 float x = 0.0f, y = 0.0f;
585 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
586 using (var shadowOffset = new Vector2())
588 if (null != propertyValue)
590 propertyValue.Get(shadowOffset);
595 return new Vector2(OnShadowOffsetChanged, x, y);
599 using (var map = new PropertyMap())
601 map.Add("offset", value);
602 var shadowMap = Shadow;
603 shadowMap.Merge(map);
604 SetValue(ShadowProperty, shadowMap);
605 NotifyPropertyChanged();
611 /// The ShadowColor property.
613 /// <since_tizen> 3 </since_tizen>
615 /// Deprecated.(API Level 6) Use Shadow instead.
616 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
618 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
619 public Vector4 ShadowColor
623 return GetValue(ShadowColorProperty) as Vector4;
627 SetValue(ShadowColorProperty, value);
631 private Vector4 InternalShadowColor
635 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
636 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
637 using (var shadowColor = new Vector4())
639 if (null != propertyValue)
641 propertyValue.Get(shadowColor);
648 return new Vector4(OnShadowColorChanged, x, y, z, w);
652 using (var map = new PropertyMap())
654 map.Add("color", value);
655 var shadowMap = Shadow;
656 shadowMap.Merge(map);
657 SetValue(ShadowProperty, shadowMap);
658 NotifyPropertyChanged();
664 /// The PrimaryCursorColor property.<br />
665 /// The color to apply to the primary cursor.<br />
668 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
670 /// <since_tizen> 3 </since_tizen>
671 public Vector4 PrimaryCursorColor
675 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
676 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
680 SetValue(PrimaryCursorColorProperty, value);
681 NotifyPropertyChanged();
686 /// The SecondaryCursorColor property.<br />
687 /// The color to apply to the secondary cursor.<br />
690 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
692 /// <since_tizen> 3 </since_tizen>
693 public Vector4 SecondaryCursorColor
697 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
698 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
702 SetValue(SecondaryCursorColorProperty, value);
703 NotifyPropertyChanged();
708 /// The EnableCursorBlink property.<br />
709 /// Whether the cursor should blink or not.<br />
711 /// <since_tizen> 3 </since_tizen>
712 public bool EnableCursorBlink
716 return (bool)GetValue(EnableCursorBlinkProperty);
720 SetValue(EnableCursorBlinkProperty, value);
721 NotifyPropertyChanged();
726 /// The CursorBlinkInterval property.<br />
727 /// The time interval in seconds between cursor on/off states.<br />
729 /// <since_tizen> 3 </since_tizen>
730 public float CursorBlinkInterval
734 return (float)GetValue(CursorBlinkIntervalProperty);
738 SetValue(CursorBlinkIntervalProperty, value);
739 NotifyPropertyChanged();
744 /// The CursorBlinkDuration property.<br />
745 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
747 /// <since_tizen> 3 </since_tizen>
748 public float CursorBlinkDuration
752 return (float)GetValue(CursorBlinkDurationProperty);
756 SetValue(CursorBlinkDurationProperty, value);
757 NotifyPropertyChanged();
762 /// The CursorWidth property.
764 /// <since_tizen> 3 </since_tizen>
765 public int CursorWidth
769 return (int)GetValue(CursorWidthProperty);
773 SetValue(CursorWidthProperty, value);
774 NotifyPropertyChanged();
779 /// The GrabHandleImage property.<br />
780 /// The image to display for the grab handle.<br />
782 /// <since_tizen> 3 </since_tizen>
783 public string GrabHandleImage
787 return (string)GetValue(GrabHandleImageProperty);
791 SetValue(GrabHandleImageProperty, value);
792 NotifyPropertyChanged();
797 /// The GrabHandlePressedImage property.<br />
798 /// The image to display when the grab handle is pressed.<br />
800 /// <since_tizen> 3 </since_tizen>
801 public string GrabHandlePressedImage
805 return (string)GetValue(GrabHandlePressedImageProperty);
809 SetValue(GrabHandlePressedImageProperty, value);
810 NotifyPropertyChanged();
815 /// The ScrollThreshold property.<br />
816 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
818 /// <since_tizen> 3 </since_tizen>
819 public float ScrollThreshold
823 return (float)GetValue(ScrollThresholdProperty);
827 SetValue(ScrollThresholdProperty, value);
828 NotifyPropertyChanged();
833 /// The ScrollSpeed property.<br />
834 /// The scroll speed in pixels per second.<br />
836 /// <since_tizen> 3 </since_tizen>
837 public float ScrollSpeed
841 return (float)GetValue(ScrollSpeedProperty);
845 SetValue(ScrollSpeedProperty, value);
846 NotifyPropertyChanged();
851 /// The SelectionPopupStyle property.<br />
852 /// The style of the text selection popup can be set through SelectionPopupStyle property.
854 [EditorBrowsable(EditorBrowsableState.Never)]
855 public PropertyMap SelectionPopupStyle
859 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
863 SetValue(SelectionPopupStyleProperty, value);
864 NotifyPropertyChanged();
869 /// The SelectionHandleImageLeft property.<br />
870 /// The image to display for the left selection handle.<br />
871 /// The selectionHandleImageLeft map contains the following key :<br />
872 /// <list type="table">
873 /// <item><term>filename (string)</term><description>The path of image file</description></item>
876 /// <since_tizen> 3 </since_tizen>
877 public PropertyMap SelectionHandleImageLeft
881 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
885 SetValue(SelectionHandleImageLeftProperty, value);
886 NotifyPropertyChanged();
891 /// The SelectionHandleImageRight property.<br />
892 /// The image to display for the right selection handle.<br />
893 /// The selectionHandleImageRight map contains the following key :<br />
894 /// <list type="table">
895 /// <item><term>filename (string)</term><description>The path of image file</description></item>
898 /// <since_tizen> 3 </since_tizen>
899 public PropertyMap SelectionHandleImageRight
903 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
907 SetValue(SelectionHandleImageRightProperty, value);
908 NotifyPropertyChanged();
913 /// Set SelectionHandleImage to TextField. <br />
915 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
917 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
920 /// The following example demonstrates how to use the SetSelectionHandleImage method.
922 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
923 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
924 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
925 /// field.SetSelectionHandleImage(selectionHandleImage);
928 [EditorBrowsable(EditorBrowsableState.Never)]
929 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
931 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
933 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
935 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
939 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
941 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
943 SetValue(SelectionHandleImageRightProperty, rightImageMap);
949 /// Get SelectionHandleImage from TextField. <br />
951 /// <returns>The SelectionHandleImage</returns>
953 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
955 [EditorBrowsable(EditorBrowsableState.Never)]
956 public SelectionHandleImage GetSelectionHandleImage()
958 SelectionHandleImage selectionHandleImage;
959 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
960 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
962 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
964 return selectionHandleImage;
968 /// The SelectionHandlePressedImageLeft property.<br />
969 /// The image to display when the left selection handle is pressed.<br />
970 /// The selectionHandlePressedImageLeft map contains the following key :<br />
971 /// <list type="table">
972 /// <item><term>filename (string)</term><description>The path of image file</description></item>
975 /// <since_tizen> 3 </since_tizen>
976 public PropertyMap SelectionHandlePressedImageLeft
980 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
984 SetValue(SelectionHandlePressedImageLeftProperty, value);
985 NotifyPropertyChanged();
990 /// The SelectionHandlePressedImageRight property.<br />
991 /// The image to display when the right selection handle is pressed.<br />
992 /// The selectionHandlePressedImageRight map contains the following key :<br />
993 /// <list type="table">
994 /// <item><term>filename (string)</term><description>The path of image file</description></item>
997 /// <since_tizen> 3 </since_tizen>
998 public PropertyMap SelectionHandlePressedImageRight
1002 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
1006 SetValue(SelectionHandlePressedImageRightProperty, value);
1007 NotifyPropertyChanged();
1012 /// Set SelectionHandlePressedImage to TextField. <br />
1014 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
1016 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1019 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
1021 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
1022 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
1023 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
1024 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
1027 [EditorBrowsable(EditorBrowsableState.Never)]
1028 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
1030 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
1032 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
1034 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
1038 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
1040 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
1042 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
1048 /// Get SelectionHandlePressedImage from TextField. <br />
1050 /// <returns>The SelectionHandlePressedImage</returns>
1052 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1054 [EditorBrowsable(EditorBrowsableState.Never)]
1055 public SelectionHandleImage GetSelectionHandlePressedImage()
1057 SelectionHandleImage selectionHandleImage;
1058 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
1059 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
1061 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1063 return selectionHandleImage;
1067 /// The SelectionHandleMarkerImageLeft property.<br />
1068 /// The image to display for the left selection handle marker.<br />
1069 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
1070 /// <list type="table">
1071 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1074 /// <since_tizen> 3 </since_tizen>
1075 public PropertyMap SelectionHandleMarkerImageLeft
1079 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1083 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1084 NotifyPropertyChanged();
1089 /// The SelectionHandleMarkerImageRight property.<br />
1090 /// The image to display for the right selection handle marker.<br />
1091 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1092 /// <list type="table">
1093 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1096 /// <since_tizen> 3 </since_tizen>
1097 public PropertyMap SelectionHandleMarkerImageRight
1101 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1105 SetValue(SelectionHandleMarkerImageRightProperty, value);
1106 NotifyPropertyChanged();
1111 /// Set SelectionHandleMarkerImage to TextField. <br />
1113 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1115 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1118 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1120 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1121 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1122 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1123 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1126 [EditorBrowsable(EditorBrowsableState.Never)]
1127 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1129 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1131 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1133 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1137 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1139 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1141 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1147 /// Get SelectionHandleMarkerImage from TextField. <br />
1149 /// <returns>The SelectionHandleMarkerImage</returns>
1151 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1153 [EditorBrowsable(EditorBrowsableState.Never)]
1154 public SelectionHandleImage GetSelectionHandleMarkerImage()
1156 SelectionHandleImage selectionHandleImage;
1157 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1158 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1160 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1162 return selectionHandleImage;
1166 /// The SelectionHighlightColor property.<br />
1167 /// The color of the selection highlight.<br />
1170 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1172 /// <since_tizen> 3 </since_tizen>
1173 public Vector4 SelectionHighlightColor
1177 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1178 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1182 SetValue(SelectionHighlightColorProperty, value);
1183 NotifyPropertyChanged();
1188 /// The DecorationBoundingBox property.<br />
1189 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1192 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1194 /// <since_tizen> 3 </since_tizen>
1195 public Rectangle DecorationBoundingBox
1199 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1200 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1204 SetValue(DecorationBoundingBoxProperty, value);
1205 NotifyPropertyChanged();
1210 /// The InputMethodSettings property.<br />
1211 /// The settings to relating to the System's Input Method, Key and Value.<br />
1214 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
1217 /// The following example demonstrates how to set the InputMethodSettings property.
1219 /// InputMethod method = new InputMethod();
1220 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1221 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1222 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1223 /// method.Variation = 1;
1224 /// textField.InputMethodSettings = method.OutputMap;
1227 /// <since_tizen> 3 </since_tizen>
1228 public PropertyMap InputMethodSettings
1232 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1236 SetValue(InputMethodSettingsProperty, value);
1237 NotifyPropertyChanged();
1242 /// The InputColor property.<br />
1243 /// The color of the new input text.<br />
1246 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1248 /// <since_tizen> 3 </since_tizen>
1249 public Vector4 InputColor
1253 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1254 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1258 SetValue(InputColorProperty, value);
1259 NotifyPropertyChanged();
1264 /// The EnableMarkup property.<br />
1265 /// Whether the mark-up processing is enabled.<br />
1267 /// <since_tizen> 3 </since_tizen>
1268 public bool EnableMarkup
1272 return (bool)GetValue(EnableMarkupProperty);
1276 SetValue(EnableMarkupProperty, value);
1277 NotifyPropertyChanged();
1282 /// The InputFontFamily property.<br />
1283 /// The font's family of the new input text.<br />
1285 /// <since_tizen> 3 </since_tizen>
1286 public string InputFontFamily
1290 return (string)GetValue(InputFontFamilyProperty);
1294 SetValue(InputFontFamilyProperty, value);
1295 NotifyPropertyChanged();
1300 /// The InputFontStyle property.<br />
1301 /// The font's style of the new input text.<br />
1302 /// The inputFontStyle map contains the following keys :<br />
1303 /// <list type="table">
1304 /// <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>
1305 /// <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>
1306 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1309 /// <since_tizen> 3 </since_tizen>
1310 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1311 public PropertyMap InputFontStyle
1315 return (PropertyMap)GetValue(InputFontStyleProperty);
1319 SetValue(InputFontStyleProperty, value);
1320 NotifyPropertyChanged();
1325 /// Set InputFontStyle to TextField. <br />
1327 /// <param name="fontStyle">The FontStyle</param>
1329 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1332 /// The following example demonstrates how to use the SetInputFontStyle method.
1334 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1335 /// fontStyle.Width = FontWidthType.Expanded;
1336 /// fontStyle.Weight = FontWeightType.Bold;
1337 /// fontStyle.Slant = FontSlantType.Italic;
1338 /// field.SetInputFontStyle(fontStyle);
1341 [EditorBrowsable(EditorBrowsableState.Never)]
1342 public void SetInputFontStyle(FontStyle fontStyle)
1344 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1346 SetValue(InputFontStyleProperty, fontStyleMap);
1351 /// Get InputFontStyle from TextField. <br />
1353 /// <returns>The FontStyle</returns>
1355 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1357 [EditorBrowsable(EditorBrowsableState.Never)]
1358 public FontStyle GetInputFontStyle()
1360 FontStyle fontStyle;
1361 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1363 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1369 /// The InputPointSize property.<br />
1370 /// The font's size of the new input text in points.<br />
1372 /// <since_tizen> 3 </since_tizen>
1373 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1374 public float InputPointSize
1378 return (float)GetValue(InputPointSizeProperty);
1382 SetValue(InputPointSizeProperty, value);
1383 NotifyPropertyChanged();
1388 /// The Underline property.<br />
1389 /// The default underline parameters.<br />
1390 /// The underline map contains the following keys :<br />
1391 /// <list type="table">
1392 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1393 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1394 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1397 /// <since_tizen> 3 </since_tizen>
1398 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1399 public PropertyMap Underline
1403 return (PropertyMap)GetValue(UnderlineProperty);
1407 SetValue(UnderlineProperty, value);
1408 NotifyPropertyChanged();
1413 /// Set Underline to TextField. <br />
1415 /// <param name="underline">The Underline</param>
1417 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1420 /// The following example demonstrates how to use the SetUnderline method.
1422 /// var underline = new Tizen.NUI.Text.Underline();
1423 /// underline.Enable = true;
1424 /// underline.Color = new Color("#3498DB");
1425 /// underline.Height = 2.0f;
1426 /// field.SetUnderline(underline);
1429 [EditorBrowsable(EditorBrowsableState.Never)]
1430 public void SetUnderline(Underline underline)
1432 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1434 SetValue(UnderlineProperty, underlineMap);
1439 /// Get Underline from TextField. <br />
1441 /// <returns>The Underline</returns>
1443 /// <see cref="Tizen.NUI.Text.Underline"/>
1445 [EditorBrowsable(EditorBrowsableState.Never)]
1446 public Underline GetUnderline()
1448 Underline underline;
1449 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1451 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1457 /// The InputUnderline property.<br />
1458 /// The underline parameters of the new input text.<br />
1460 /// <since_tizen> 3 </since_tizen>
1461 public string InputUnderline
1465 return (string)GetValue(InputUnderlineProperty);
1469 SetValue(InputUnderlineProperty, value);
1470 NotifyPropertyChanged();
1475 /// The Shadow property.<br />
1476 /// The default shadow parameters.<br />
1477 /// The shadow map contains the following keys :<br />
1478 /// <list type="table">
1479 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1480 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1481 /// <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>
1484 /// <since_tizen> 3 </since_tizen>
1485 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1486 public PropertyMap Shadow
1490 return (PropertyMap)GetValue(ShadowProperty);
1494 SetValue(ShadowProperty, value);
1495 NotifyPropertyChanged();
1500 /// Set Shadow to TextField. <br />
1502 /// <param name="shadow">The Shadow</param>
1504 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1507 /// The following example demonstrates how to use the SetShadow method.
1509 /// var shadow = new Tizen.NUI.Text.Shadow();
1510 /// shadow.Offset = new Vector2(3, 3);
1511 /// shadow.Color = new Color("#F1C40F");
1512 /// field.SetShadow(shadow);
1515 [EditorBrowsable(EditorBrowsableState.Never)]
1516 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1518 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1520 SetValue(ShadowProperty, shadowMap);
1525 /// Get Shadow from TextField. <br />
1527 /// <returns>The Shadow</returns>
1529 /// <see cref="Tizen.NUI.Text.Shadow"/>
1531 [EditorBrowsable(EditorBrowsableState.Never)]
1532 public Tizen.NUI.Text.Shadow GetShadow()
1534 Tizen.NUI.Text.Shadow shadow;
1535 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1537 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1543 /// The InputShadow property.<br />
1544 /// The shadow parameters of the new input text.<br />
1546 /// <since_tizen> 3 </since_tizen>
1547 public string InputShadow
1551 return (string)GetValue(InputShadowProperty);
1555 SetValue(InputShadowProperty, value);
1556 NotifyPropertyChanged();
1561 /// The Emboss property.<br />
1562 /// The default emboss parameters.<br />
1564 /// <since_tizen> 3 </since_tizen>
1565 public string Emboss
1569 return (string)GetValue(EmbossProperty);
1573 SetValue(EmbossProperty, value);
1574 NotifyPropertyChanged();
1579 /// The InputEmboss property.<br />
1580 /// The emboss parameters of the new input text.<br />
1582 /// <since_tizen> 3 </since_tizen>
1583 public string InputEmboss
1587 return (string)GetValue(InputEmbossProperty);
1591 SetValue(InputEmbossProperty, value);
1592 NotifyPropertyChanged();
1597 /// The Outline property.<br />
1598 /// The default outline parameters.<br />
1599 /// The outline map contains the following keys :<br />
1600 /// <list type="table">
1601 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1602 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1605 /// <since_tizen> 3 </since_tizen>
1606 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1607 public PropertyMap Outline
1611 return (PropertyMap)GetValue(OutlineProperty);
1615 SetValue(OutlineProperty, value);
1616 NotifyPropertyChanged();
1621 /// Set Outline to TextField. <br />
1623 /// <param name="outline">The Outline</param>
1625 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1628 /// The following example demonstrates how to use the SetOutline method.
1630 /// var outline = new Tizen.NUI.Text.Outline();
1631 /// outline.Width = 2.0f;
1632 /// outline.Color = new Color("#45B39D");
1633 /// field.SetOutline(outline);
1636 [EditorBrowsable(EditorBrowsableState.Never)]
1637 public void SetOutline(Outline outline)
1639 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1641 SetValue(OutlineProperty, outlineMap);
1646 /// Get Outline from TextField. <br />
1648 /// <returns>The Outline</returns>
1650 /// <see cref="Tizen.NUI.Text.Outline"/>
1652 [EditorBrowsable(EditorBrowsableState.Never)]
1653 public Outline GetOutline()
1656 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1658 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1664 /// The InputOutline property.<br />
1665 /// The outline parameters of the new input text.<br />
1667 /// <since_tizen> 3 </since_tizen>
1668 public string InputOutline
1672 return (string)GetValue(InputOutlineProperty);
1676 SetValue(InputOutlineProperty, value);
1677 NotifyPropertyChanged();
1682 /// The HiddenInputSettings property.<br />
1683 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1684 /// The hiddenInputSettings map contains the following keys :<br />
1685 /// <list type="table">
1686 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1687 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1688 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1689 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1693 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1696 /// The following example demonstrates how to set the HiddenInputSettings property.
1698 /// PropertyMap map = new PropertyMap();
1699 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1700 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1701 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1702 /// textField.HiddenInputSettings = map;
1705 /// <since_tizen> 3 </since_tizen>
1706 public Tizen.NUI.PropertyMap HiddenInputSettings
1710 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1714 SetValue(HiddenInputSettingsProperty, value);
1715 NotifyPropertyChanged();
1720 /// Set HiddenInput to TextField. <br />
1722 /// <param name="hiddenInput">The HiddenInput</param>
1724 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1727 /// The following example demonstrates how to use the SetHiddenInput method.
1729 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1730 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1731 /// hiddenInput.SubstituteCharacter = '★';
1732 /// hiddenInput.SubstituteCount = 0;
1733 /// hiddenInput.ShowLastCharacterDuration = 1000;
1734 /// field.SetHiddenInput(hiddenInput);
1737 [EditorBrowsable(EditorBrowsableState.Never)]
1738 public void SetHiddenInput(HiddenInput hiddenInput)
1740 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1742 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1747 /// Get HiddenInput from TextField. <br />
1749 /// <returns>The HiddenInput</returns>
1751 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1753 [EditorBrowsable(EditorBrowsableState.Never)]
1754 public HiddenInput GetHiddenInput()
1756 HiddenInput hiddenInput;
1757 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1759 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1765 /// The PixelSize property.<br />
1766 /// The size of font in pixels.<br />
1768 /// <since_tizen> 3 </since_tizen>
1769 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1770 public float PixelSize
1774 return (float)GetValue(PixelSizeProperty);
1778 SetValue(PixelSizeProperty, value);
1779 NotifyPropertyChanged();
1784 /// The Enable selection property.<br />
1785 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1787 /// <since_tizen> 3 </since_tizen>
1788 public bool EnableSelection
1792 return (bool)GetValue(EnableSelectionProperty);
1796 SetValue(EnableSelectionProperty, value);
1797 NotifyPropertyChanged();
1802 /// The Enable grab handle property.<br />
1803 /// Enables the grab handles for text selection.<br />
1804 /// The default value is true, which means the grab handles are enabled by default.<br />
1806 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1807 [EditorBrowsable(EditorBrowsableState.Never)]
1808 public bool EnableGrabHandle
1812 return (bool)GetValue(EnableGrabHandleProperty);
1816 SetValue(EnableGrabHandleProperty, value);
1817 NotifyPropertyChanged();
1822 /// The Enable grab handle popup property.<br />
1823 /// Enables the grab handle popup for text selection.<br />
1824 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1826 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1827 [EditorBrowsable(EditorBrowsableState.Never)]
1828 public bool EnableGrabHandlePopup
1832 return (bool)GetValue(EnableGrabHandlePopupProperty);
1836 SetValue(EnableGrabHandlePopupProperty, value);
1837 NotifyPropertyChanged();
1842 /// The portion of the text that has been selected by the user.
1845 /// Empty string when nothing is selected.
1847 /// <since_tizen> 9 </since_tizen>
1848 public string SelectedText
1852 string selectedText;
1853 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1855 propertyValue.Get(out selectedText);
1857 return selectedText;
1862 /// The start index for selection.
1865 /// When there is no selection, the index is current cursor position.
1867 /// <since_tizen> 9 </since_tizen>
1868 public int SelectedTextStart
1872 int selectedTextStart;
1873 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1875 propertyValue.Get(out selectedTextStart);
1877 return selectedTextStart;
1882 /// The end index for selection.
1885 /// When there is no selection, the index is current cursor position.
1887 /// <since_tizen> 9 </since_tizen>
1888 public int SelectedTextEnd
1892 int selectedTextEnd;
1893 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1895 propertyValue.Get(out selectedTextEnd);
1897 return selectedTextEnd;
1902 /// Enable editing in text control.
1904 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1905 [EditorBrowsable(EditorBrowsableState.Never)]
1906 public bool EnableEditing
1910 return (bool)GetValue(EnableEditingProperty);
1914 SetValue(EnableEditingProperty, value);
1918 private bool InternalEnableEditing
1923 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1925 propertyValue.Get(out enableEditing);
1927 return enableEditing;
1931 using (var propertyValue = new PropertyValue(value))
1933 SetProperty(TextField.Property.EnableEditing, propertyValue);
1934 NotifyPropertyChanged();
1940 /// PrimaryCursorPosition property.<br />
1941 /// Specify the position of the primary cursor (caret) in text control.
1944 /// 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).
1946 /// <since_tizen> 10 </since_tizen>
1947 public int PrimaryCursorPosition
1951 return (int)GetValue(PrimaryCursorPositionProperty);
1955 SetValue(PrimaryCursorPositionProperty, value);
1959 private int InternalPrimaryCursorPosition
1963 int primaryCursorPosition;
1964 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1966 propertyValue.Get(out primaryCursorPosition);
1968 return primaryCursorPosition;
1972 using (PropertyValue propertyValue = new PropertyValue(value))
1974 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1975 NotifyPropertyChanged();
1981 /// The GrabHandleColor property.
1984 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1986 [EditorBrowsable(EditorBrowsableState.Never)]
1987 public Color GrabHandleColor
1991 Color temp = (Color)GetValue(GrabHandleColorProperty);
1992 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1996 SetValue(GrabHandleColorProperty, value);
1997 NotifyPropertyChanged();
2002 /// The ellipsis position of the text.
2003 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2005 /// <since_tizen> 9 </since_tizen>
2006 public EllipsisPosition EllipsisPosition
2010 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2014 SetValue(EllipsisPositionProperty, value);
2015 NotifyPropertyChanged();
2020 /// The spaces between characters in Pixels.
2022 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2023 /// The default value is 0.f which does nothing.
2026 [EditorBrowsable(EditorBrowsableState.Never)]
2027 public float CharacterSpacing
2031 return (float)GetValue(CharacterSpacingProperty);
2035 SetValue(CharacterSpacingProperty, value);
2036 NotifyPropertyChanged();
2041 /// Set InputFilter to TextField.
2043 /// <param name="inputFilter">The InputFilter</param>
2045 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
2046 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
2047 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
2050 /// The following example demonstrates how to use the SetInputFilter method.
2052 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
2053 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
2054 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
2055 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
2058 /// <since_tizen> 9 </since_tizen>
2059 public void SetInputFilter(InputFilter inputFilter)
2061 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
2062 using (var propertyValue = new PropertyValue(map))
2064 SetProperty(TextField.Property.InputFilter, propertyValue);
2069 /// Get InputFilter from TextField.
2071 /// <returns>The InputFilter</returns>
2073 /// <see cref="Tizen.NUI.Text.InputFilter"/>
2075 /// <since_tizen> 9 </since_tizen>
2076 public InputFilter GetInputFilter()
2078 InputFilter inputFilter;
2079 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
2080 using (var map = new PropertyMap())
2082 propertyValue.Get(map);
2083 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2089 /// Set Strikethrough to TextField. <br />
2091 /// <param name="strikethrough">The Strikethrough</param>
2093 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2096 /// The following example demonstrates how to use the SetStrikethrough method.
2098 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2099 /// strikethrough.Enable = true;
2100 /// strikethrough.Color = new Color("#3498DB");
2101 /// strikethrough.Height = 2.0f;
2102 /// field.SetStrikethrough(strikethrough);
2105 [EditorBrowsable(EditorBrowsableState.Never)]
2106 public void SetStrikethrough(Strikethrough strikethrough)
2108 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2109 using (var propertyValue = new PropertyValue(map))
2111 SetProperty(TextField.Property.Strikethrough, propertyValue);
2116 /// Get Strikethrough from TextField. <br />
2118 /// <returns>The Strikethrough</returns>
2120 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2122 [EditorBrowsable(EditorBrowsableState.Never)]
2123 public Strikethrough GetStrikethrough()
2125 Strikethrough strikethrough;
2126 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2127 using (var map = new PropertyMap())
2129 propertyValue.Get(map);
2130 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2132 return strikethrough;
2136 /// The Placeholder property.
2137 /// The placeholder map contains the following keys :<br />
2138 /// <list type="table">
2139 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2140 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2141 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2142 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2143 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2144 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2145 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2146 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2150 /// The following example demonstrates how to set the Placeholder property.
2152 /// PropertyMap propertyMap = new PropertyMap();
2153 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2154 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2155 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2156 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2157 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2159 /// PropertyMap fontStyleMap = new PropertyMap();
2160 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2161 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2162 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2163 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2165 /// TextField field = new TextField();
2166 /// field.Placeholder = propertyMap;
2169 /// <since_tizen> 3 </since_tizen>
2170 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2171 public Tizen.NUI.PropertyMap Placeholder
2175 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2176 string defalutText = "";
2178 if (TextMapHelper.IsValue(map, 0))
2179 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2181 if (TextMapHelper.IsValue(map, 1))
2182 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2184 if (TextMapHelper.IsValue(map, 2))
2186 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2188 map.Add("color", color);
2192 if (TextMapHelper.IsValue(map, 3))
2193 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2195 if (TextMapHelper.IsValue(map, 4))
2197 using (var properyValue = map.Find(4))
2198 using (var fontStyle = new PropertyMap())
2200 properyValue.Get(fontStyle);
2201 using (var fontStyleValue = new PropertyValue(fontStyle))
2203 map.Add("fontStyle", fontStyleValue);
2208 if (TextMapHelper.IsValue(map, 5))
2209 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2211 if (TextMapHelper.IsValue(map, 6))
2212 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2214 if (TextMapHelper.IsValue(map, 7))
2215 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2221 SetValue(PlaceholderProperty, value);
2222 NotifyPropertyChanged();
2227 /// Set Placeholder to TextField. <br />
2229 /// <param name="placeholder">The Placeholder</param>
2231 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2234 /// The following example demonstrates how to use the SetPlaceholder method.
2236 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2237 /// placeholder.Text = "placeholder text";
2238 /// placeholder.TextFocused = "placeholder textFocused";
2239 /// placeholder.Color = new Color("#45B39D");
2240 /// placeholder.FontFamily = "BreezeSans";
2241 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2243 /// Width = FontWidthType.Expanded,
2244 /// Weight = FontWeightType.ExtraLight,
2245 /// Slant = FontSlantType.Italic,
2247 /// placeholder.PointSize = 25.0f;
2248 /// //placeholder.PixelSize = 50.0f;
2249 /// placeholder.Ellipsis = true;
2250 /// field.SetPlaceholder(placeholder);
2253 [EditorBrowsable(EditorBrowsableState.Never)]
2254 public void SetPlaceholder(Placeholder placeholder)
2256 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2258 SetValue(PlaceholderProperty, placeholderMap);
2263 /// Get Placeholder from TextField. <br />
2265 /// <returns>The Placeholder</returns>
2267 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2269 [EditorBrowsable(EditorBrowsableState.Never)]
2270 public Placeholder GetPlaceholder()
2272 Placeholder placeholder;
2273 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2275 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2281 /// The Ellipsis property.<br />
2282 /// Enable or disable the ellipsis.<br />
2283 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2285 /// <since_tizen> 4 </since_tizen>
2286 public bool Ellipsis
2290 return (bool)GetValue(EllipsisProperty);
2294 SetValue(EllipsisProperty, value);
2295 NotifyPropertyChanged();
2300 /// Enables selection of the text using the Shift key.
2302 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2303 [EditorBrowsable(EditorBrowsableState.Never)]
2304 public bool EnableShiftSelection
2308 return (bool)GetValue(EnableShiftSelectionProperty);
2312 SetValue(EnableShiftSelectionProperty, value);
2313 NotifyPropertyChanged();
2318 /// The text alignment to match the direction of the system language.<br />
2319 /// The default value is true.<br />
2321 /// <since_tizen> 6 </since_tizen>
2322 public bool MatchSystemLanguageDirection
2326 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2330 SetValue(MatchSystemLanguageDirectionProperty, value);
2331 NotifyPropertyChanged();
2336 /// The FontSizeScale property. <br />
2337 /// The default value is 1.0. <br />
2338 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2339 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2341 /// <since_tizen> 9 </since_tizen>
2342 public float FontSizeScale
2346 return (float)GetValue(FontSizeScaleProperty);
2350 SetValue(FontSizeScaleProperty, value);
2351 NotifyPropertyChanged();
2355 private float InternalFontSizeScale
2359 return fontSizeScale;
2363 float newFontSizeScale;
2365 if (fontSizeScale == value) return;
2367 fontSizeScale = value;
2368 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2370 SystemSettingsFontSize systemSettingsFontSize;
2374 systemSettingsFontSize = SystemSettings.FontSize;
2378 Console.WriteLine("{0} Exception caught.", e);
2379 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2381 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2382 AddSystemSettingsFontSizeChanged();
2386 newFontSizeScale = fontSizeScale;
2387 RemoveSystemSettingsFontSizeChanged();
2390 SetInternalFontSizeScale(newFontSizeScale);
2394 private void SetInternalFontSizeScale(float fontSizeScale)
2396 Object.InternalSetPropertyFloat(this.SwigCPtr, TextField.Property.FontSizeScale, (float)fontSizeScale);
2400 /// The EnableFontSizeScale property.<br />
2401 /// Whether the font size scale is enabled. (The default value is true)
2403 [EditorBrowsable(EditorBrowsableState.Never)]
2404 public bool EnableFontSizeScale
2408 return (bool)GetValue(EnableFontSizeScaleProperty);
2412 SetValue(EnableFontSizeScaleProperty, value);
2413 NotifyPropertyChanged();
2418 /// Get the InputMethodContext instance.
2420 /// <returns>The InputMethodContext instance.</returns>
2421 /// <since_tizen> 5 </since_tizen>
2422 public InputMethodContext GetInputMethodContext()
2424 if (inputMethodCotext == null)
2426 /*Avoid raising InputMethodContext reference count.*/
2427 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2428 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2430 return inputMethodCotext;
2434 /// Select the whole text.
2436 /// <since_tizen> 9 </since_tizen>
2437 public void SelectWholeText()
2439 Interop.TextField.SelectWholeText(SwigCPtr);
2440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2444 /// Select text from start to end index. <br />
2445 /// The index is valid when 0 or positive.
2447 /// <param name="start">The start index for selection.</param>
2448 /// <param name="end">The end index for selection.</param>
2450 /// If the end index exceeds the maximum value, it is set to the length of the text.
2452 /// <since_tizen> 9 </since_tizen>
2453 public void SelectText(int start, int end)
2456 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2458 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2460 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2461 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2465 /// Clear selection of the text. <br />
2466 /// Valid when selection is activate.
2468 /// <since_tizen> 9 </since_tizen>
2469 public void SelectNone()
2471 _ = Interop.TextField.SelectNone(SwigCPtr);
2472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2475 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2477 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));
2478 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2485 /// <since_tizen> 3 </since_tizen>
2486 protected override void Dispose(DisposeTypes type)
2490 DisposeQueue.Instance.Add(this);
2495 internalPlaceholderTextColor?.Dispose();
2496 internalPrimaryCursorColor?.Dispose();
2497 internalSecondaryCursorColor?.Dispose();
2498 internalSelectionHighlightColor?.Dispose();
2499 internalInputColor?.Dispose();
2500 internalTextColor?.Dispose();
2501 internalGrabHandleColor?.Dispose();
2503 if (hasSystemLanguageChanged)
2505 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
2508 RemoveSystemSettingsFontTypeChanged();
2509 RemoveSystemSettingsFontSizeChanged();
2511 if (type == DisposeTypes.Explicit)
2514 //Release your own managed resources here.
2515 //You should release all of your own disposable objects here.
2518 //Release your own unmanaged resources here.
2519 //You should not access any managed member here except static instance.
2520 //because the execution order of Finalizes is non-deterministic.
2523 if (textFieldCursorPositionChangedCallbackDelegate != null)
2525 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2528 if (textFieldMaxLengthReachedCallbackDelegate != null)
2530 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2533 if (textFieldSelectionStartedCallbackDelegate != null)
2535 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2538 if (textFieldSelectionClearedCallbackDelegate != null)
2540 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2543 if (textFieldSelectionChangedCallbackDelegate != null)
2545 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2548 if (textFieldTextChangedCallbackDelegate != null)
2550 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2554 TextChanged -= TextFieldTextChanged;
2555 GetInputMethodContext()?.DestroyContext();
2560 /// This will not be public opened.
2561 [EditorBrowsable(EditorBrowsableState.Never)]
2562 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2564 Interop.TextField.DeleteTextField(swigCPtr);
2567 internal override LayoutItem CreateDefaultLayout()
2569 return new TextFieldLayout();
2572 internal void SetTextWithoutTextChanged(string text)
2574 invokeTextChanged = false;
2575 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2576 invokeTextChanged = true;
2579 private string SetTranslatable(string textFieldSid)
2581 string translatableText = null;
2582 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2583 if (translatableText != null)
2585 if (hasSystemLanguageChanged == false)
2587 systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
2588 hasSystemLanguageChanged = true;
2590 return translatableText;
2594 translatableText = "";
2595 return translatableText;
2599 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2601 if (textFieldTextSid != null)
2603 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2605 if (textFieldPlaceHolderTextSid != null)
2607 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2609 if (textFieldPlaceHolderTextFocusedSid != null)
2611 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2615 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2617 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2618 SetInternalFontSizeScale(newFontSizeScale);
2621 private void AddSystemSettingsFontSizeChanged()
2623 if (hasSystemFontSizeChanged != true)
2627 systemFontSizeChanged.Add(SystemSettingsFontSizeChanged);
2628 hasSystemFontSizeChanged = true;
2632 Console.WriteLine("{0} Exception caught.", e);
2633 hasSystemFontSizeChanged = false;
2638 private void RemoveSystemSettingsFontSizeChanged()
2640 if (hasSystemFontSizeChanged == true)
2644 systemFontSizeChanged.Remove(SystemSettingsFontSizeChanged);
2645 hasSystemFontSizeChanged = false;
2649 Console.WriteLine("{0} Exception caught.", e);
2650 hasSystemFontSizeChanged = true;
2655 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2657 SetInternalFontFamily(e.Value);
2660 private void AddSystemSettingsFontTypeChanged()
2662 if (HasStyle() && !hasSystemFontTypeChanged)
2666 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2667 hasSystemFontTypeChanged = true;
2671 Console.WriteLine("{0} Exception caught.", e);
2672 hasSystemFontTypeChanged = false;
2677 private void RemoveSystemSettingsFontTypeChanged()
2679 if (hasSystemFontTypeChanged)
2683 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2684 hasSystemFontTypeChanged = false;
2688 Console.WriteLine("{0} Exception caught.", e);
2689 hasSystemFontTypeChanged = true;
2694 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2696 if (!isSettingTextInCSharp)
2698 EnforceNotifyBindedInstance(TextProperty);
2702 internal new class Property
2704 internal static readonly int TEXT = Interop.TextField.TextGet();
2705 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2706 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2707 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2708 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2709 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2710 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2711 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2712 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2713 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2714 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2715 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2716 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2717 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2718 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2719 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2720 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2721 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2722 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2723 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2724 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2725 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2726 internal static readonly int SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet();
2727 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2728 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2729 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2730 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2731 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2732 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2733 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2734 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2735 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2736 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2737 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2738 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2739 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2740 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2741 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2742 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2743 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2744 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2745 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2746 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2747 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2748 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2749 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2750 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2751 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2752 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2753 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2754 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2755 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2756 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2757 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2758 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2759 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2760 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2761 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2762 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2763 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2764 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2765 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2766 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2767 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2768 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2769 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2772 internal class InputStyle
2778 FontFamily = 0x0002,
2788 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2790 DecorationBoundingBox = new Rectangle(x, y, width, height);
2792 private void OnInputColorChanged(float x, float y, float z, float w)
2794 InputColor = new Vector4(x, y, z, w);
2796 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2798 PlaceholderTextColor = new Vector4(r, g, b, a);
2800 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2802 PrimaryCursorColor = new Vector4(x, y, z, w);
2804 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2806 SecondaryCursorColor = new Vector4(x, y, z, w);
2808 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2810 SelectionHighlightColor = new Vector4(x, y, z, w);
2812 private void OnShadowColorChanged(float x, float y, float z, float w)
2814 ShadowColor = new Vector4(x, y, z, w);
2816 private void OnShadowOffsetChanged(float x, float y)
2818 ShadowOffset = new Vector2(x, y);
2820 private void OnTextColorChanged(float r, float g, float b, float a)
2822 TextColor = new Color(r, g, b, a);
2824 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2826 GrabHandleColor = new Color(r, g, b, a);
2829 private class TextFieldLayout : LayoutItem
2831 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2833 // Padding will be automatically applied by DALi TextField.
2834 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2835 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2836 var minSize = Owner.MinimumSize;
2837 var maxSize = Owner.MaximumSize;
2838 var naturalSize = Owner.GetNaturalSize();
2840 if (((TextField)Owner).Text.Length == 0)
2842 // Calculate height of TextField by setting Text with " ".
2843 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2844 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2846 // Store original WidthSpecification to restore it after setting ResizePolicy.
2847 var widthSpecification = Owner.WidthSpecification;
2849 // In DALi's Size logic, if Width or Height is set to be 0, then
2850 // ResizePolicy is not changed to Fixed.
2851 // This causes Size changes after NUI Layout's OnMeasure is finished.
2852 // e.g. TextField's Width fills to its parent although Text is null and
2853 // WidthSpecification is WrapContent.
2854 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2855 // in advance if Text is null.
2856 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2858 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2859 Owner.WidthSpecification = widthSpecification;
2861 naturalSize = Owner.GetNaturalSize();
2863 // Restore TextField's Text after calculating height of TextField.
2864 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2865 ((TextField)Owner).SetTextWithoutTextChanged("");
2868 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2870 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2873 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2875 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2878 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2879 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2881 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2882 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2884 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2885 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));