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 private string textFieldTextSid = null;
35 private string textFieldPlaceHolderTextSid = null;
36 private string textFieldPlaceHolderTextFocusedSid = null;
37 private bool systemlangTextFlag = false;
38 private InputMethodContext inputMethodCotext = null;
39 private float fontSizeScale = 1.0f;
40 private bool hasFontSizeChangedCallback = false;
42 static TextField() { }
45 /// Creates the TextField control.
47 /// <since_tizen> 3 </since_tizen>
48 public TextField() : this(Interop.TextField.New(), true)
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 /// Creates the TextField with setting the status of shown or hidden.
56 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
57 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 public TextField(bool shown) : this(Interop.TextField.New(), true)
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66 /// Get attributes, it is abstract function and must be override.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected override ViewStyle CreateViewStyle()
71 return new TextFieldStyle();
74 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
82 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
90 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 internal enum ExceedPolicyType
102 ExceedPolicyOriginal,
107 /// The TranslatableText property.<br />
108 /// The text can set the SID value.<br />
110 /// <exception cref='ArgumentNullException'>
111 /// ResourceManager about multilingual is null.
113 /// <since_tizen> 4 </since_tizen>
114 public string TranslatableText
118 return (string)GetValue(TranslatableTextProperty);
122 SetValue(TranslatableTextProperty, value);
125 private string translatableText
129 return textFieldTextSid;
133 if (NUIApplication.MultilingualResourceManager == null)
135 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
137 textFieldTextSid = value;
138 Text = SetTranslatable(textFieldTextSid);
139 NotifyPropertyChanged();
144 /// The TranslatablePlaceholderText property.<br />
145 /// The text can set the SID value.<br />
147 /// <exception cref='ArgumentNullException'>
148 /// ResourceManager about multilingual is null.
150 /// <since_tizen> 4 </since_tizen>
151 public string TranslatablePlaceholderText
155 return (string)GetValue(TranslatablePlaceholderTextProperty);
159 SetValue(TranslatablePlaceholderTextProperty, value);
162 private string translatablePlaceholderText
166 return textFieldPlaceHolderTextSid;
170 if (NUIApplication.MultilingualResourceManager == null)
172 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
174 textFieldPlaceHolderTextSid = value;
175 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
176 NotifyPropertyChanged();
181 /// The TranslatablePlaceholderTextFocused property.<br />
182 /// The text can set the SID value.<br />
184 /// <exception cref='ArgumentNullException'>
185 /// ResourceManager about multilingual is null.
187 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
188 [EditorBrowsable(EditorBrowsableState.Never)]
189 public string TranslatablePlaceholderTextFocused
193 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
197 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
200 private string translatablePlaceholderTextFocused
204 return textFieldPlaceHolderTextFocusedSid;
208 if (NUIApplication.MultilingualResourceManager == null)
210 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
212 textFieldPlaceHolderTextFocusedSid = value;
213 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
214 NotifyPropertyChanged();
219 /// The Text property.
221 /// <since_tizen> 3 </since_tizen>
226 return (string)GetValue(TextProperty);
230 SetValueAndForceSendChangeSignal(TextProperty, value);
231 NotifyPropertyChanged();
236 /// The PlaceholderText property.
238 /// <since_tizen> 3 </since_tizen>
239 public string PlaceholderText
243 return (string)GetValue(PlaceholderTextProperty);
247 SetValue(PlaceholderTextProperty, value);
248 NotifyPropertyChanged();
253 /// The PlaceholderTextFocused property.
255 /// <since_tizen> 3 </since_tizen>
256 public string PlaceholderTextFocused
260 return (string)GetValue(PlaceholderTextFocusedProperty);
264 SetValue(PlaceholderTextFocusedProperty, value);
265 NotifyPropertyChanged();
270 /// The FontFamily property.
272 /// <since_tizen> 3 </since_tizen>
273 public string FontFamily
277 return (string)GetValue(FontFamilyProperty);
281 SetValue(FontFamilyProperty, value);
282 NotifyPropertyChanged();
287 /// The FontStyle property.
288 /// The fontStyle map contains the following keys :<br />
289 /// <list type="table">
290 /// <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>
291 /// <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>
292 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
295 /// <since_tizen> 3 </since_tizen>
296 public PropertyMap FontStyle
300 return (PropertyMap)GetValue(FontStyleProperty);
304 SetValue(FontStyleProperty, value);
305 NotifyPropertyChanged();
310 /// Set FontStyle to TextField. <br />
312 /// <param name="fontStyle">The FontStyle</param>
314 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
317 /// The following example demonstrates how to use the SetFontStyle method.
319 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
320 /// fontStyle.Width = FontWidthType.Expanded;
321 /// fontStyle.Weight = FontWeightType.Bold;
322 /// fontStyle.Slant = FontSlantType.Italic;
323 /// field.SetFontStyle(fontStyle);
326 [EditorBrowsable(EditorBrowsableState.Never)]
327 public void SetFontStyle(FontStyle fontStyle)
329 SetProperty(TextField.Property.FontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
330 NotifyPropertyChanged();
334 /// Get FontStyle from TextField. <br />
336 /// <returns>The FontStyle</returns>
338 /// <see cref="Tizen.NUI.Text.FontStyle"/>
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public FontStyle GetFontStyle()
343 var map = new PropertyMap();
344 GetProperty(TextField.Property.FontStyle).Get(map);
345 return TextUtils.GetFontStyleStruct(map);
349 /// The PointSize property.
351 /// <since_tizen> 3 </since_tizen>
352 public float PointSize
356 return (float)GetValue(PointSizeProperty);
360 SetValue(PointSizeProperty, value);
361 NotifyPropertyChanged();
366 /// The MaxLength property.
368 /// <since_tizen> 3 </since_tizen>
373 return (int)GetValue(MaxLengthProperty);
377 SetValue(MaxLengthProperty, value);
378 NotifyPropertyChanged();
383 /// The ExceedPolicy property.
385 /// <since_tizen> 3 </since_tizen>
386 public int ExceedPolicy
390 return (int)GetValue(ExceedPolicyProperty);
394 SetValue(ExceedPolicyProperty, value);
395 NotifyPropertyChanged();
400 /// The HorizontalAlignment property.
402 /// <since_tizen> 3 </since_tizen>
403 public HorizontalAlignment HorizontalAlignment
407 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
411 SetValue(HorizontalAlignmentProperty, value);
412 NotifyPropertyChanged();
417 /// The VerticalAlignment property.
419 /// <since_tizen> 3 </since_tizen>
420 public VerticalAlignment VerticalAlignment
424 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
428 SetValue(VerticalAlignmentProperty, value);
429 NotifyPropertyChanged();
430 NotifyPropertyChanged();
435 /// The TextColor property.
438 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
440 /// <since_tizen> 3 </since_tizen>
441 public Color TextColor
445 Color temp = (Color)GetValue(TextColorProperty);
446 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
450 SetValue(TextColorProperty, value);
451 NotifyPropertyChanged();
456 /// The PlaceholderTextColor property.
459 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
461 /// <since_tizen> 3 </since_tizen>
462 public Vector4 PlaceholderTextColor
466 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
467 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
471 SetValue(PlaceholderTextColorProperty, value);
472 NotifyPropertyChanged();
477 /// The ShadowOffset property.
479 /// <since_tizen> 3 </since_tizen>
481 /// Deprecated.(API Level 6) Use Shadow instead.
482 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
484 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
485 public Vector2 ShadowOffset
489 PropertyMap map = new PropertyMap();
490 GetProperty(TextField.Property.SHADOW).Get(map);
491 Vector2 shadowOffset = new Vector2();
492 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
493 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
497 PropertyMap temp = new PropertyMap();
498 temp.Insert("offset", new PropertyValue(value));
499 SetValue(ShadowProperty, temp);
500 NotifyPropertyChanged();
505 /// The ShadowColor property.
507 /// <since_tizen> 3 </since_tizen>
509 /// Deprecated.(API Level 6) Use Shadow instead.
510 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
512 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
513 public Vector4 ShadowColor
517 PropertyMap map = new PropertyMap();
518 GetProperty(TextField.Property.SHADOW).Get(map);
519 Vector4 shadowColor = new Vector4();
520 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
521 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
525 PropertyMap temp = new PropertyMap();
526 temp.Insert("color", new PropertyValue(value));
527 SetValue(ShadowProperty, temp);
528 NotifyPropertyChanged();
533 /// The PrimaryCursorColor property.
536 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
538 /// <since_tizen> 3 </since_tizen>
539 public Vector4 PrimaryCursorColor
543 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
544 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
548 SetValue(PrimaryCursorColorProperty, value);
549 NotifyPropertyChanged();
554 /// The SecondaryCursorColor property.
557 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
559 /// <since_tizen> 3 </since_tizen>
560 public Vector4 SecondaryCursorColor
564 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
565 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
569 SetValue(SecondaryCursorColorProperty, value);
570 NotifyPropertyChanged();
575 /// The EnableCursorBlink property.
577 /// <since_tizen> 3 </since_tizen>
578 public bool EnableCursorBlink
582 return (bool)GetValue(EnableCursorBlinkProperty);
586 SetValue(EnableCursorBlinkProperty, value);
587 NotifyPropertyChanged();
592 /// The CursorBlinkInterval property.
594 /// <since_tizen> 3 </since_tizen>
595 public float CursorBlinkInterval
599 return (float)GetValue(CursorBlinkIntervalProperty);
603 SetValue(CursorBlinkIntervalProperty, value);
604 NotifyPropertyChanged();
609 /// The CursorBlinkDuration property.
611 /// <since_tizen> 3 </since_tizen>
612 public float CursorBlinkDuration
616 return (float)GetValue(CursorBlinkDurationProperty);
620 SetValue(CursorBlinkDurationProperty, value);
621 NotifyPropertyChanged();
626 /// The CursorWidth property.
628 /// <since_tizen> 3 </since_tizen>
629 public int CursorWidth
633 return (int)GetValue(CursorWidthProperty);
637 SetValue(CursorWidthProperty, value);
638 NotifyPropertyChanged();
643 /// The GrabHandleImage property.
645 /// <since_tizen> 3 </since_tizen>
646 public string GrabHandleImage
650 return (string)GetValue(GrabHandleImageProperty);
654 SetValue(GrabHandleImageProperty, value);
655 NotifyPropertyChanged();
660 /// The GrabHandlePressedImage property.
662 /// <since_tizen> 3 </since_tizen>
663 public string GrabHandlePressedImage
667 return (string)GetValue(GrabHandlePressedImageProperty);
671 SetValue(GrabHandlePressedImageProperty, value);
672 NotifyPropertyChanged();
677 /// The ScrollThreshold property.
679 /// <since_tizen> 3 </since_tizen>
680 public float ScrollThreshold
684 return (float)GetValue(ScrollThresholdProperty);
688 SetValue(ScrollThresholdProperty, value);
689 NotifyPropertyChanged();
694 /// The ScrollSpeed property.
696 /// <since_tizen> 3 </since_tizen>
697 public float ScrollSpeed
701 return (float)GetValue(ScrollSpeedProperty);
705 SetValue(ScrollSpeedProperty, value);
706 NotifyPropertyChanged();
711 /// The SelectionHandleImageLeft property.
712 /// The selectionHandleImageLeft map contains the following key :<br />
713 /// <list type="table">
714 /// <item><term>filename (string)</term><description>The path of image file</description></item>
717 /// <since_tizen> 3 </since_tizen>
718 public PropertyMap SelectionHandleImageLeft
722 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
726 SetValue(SelectionHandleImageLeftProperty, value);
727 NotifyPropertyChanged();
732 /// The SelectionHandleImageRight property.
733 /// The selectionHandleImageRight map contains the following key :<br />
734 /// <list type="table">
735 /// <item><term>filename (string)</term><description>The path of image file</description></item>
738 /// <since_tizen> 3 </since_tizen>
739 public PropertyMap SelectionHandleImageRight
743 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
747 SetValue(SelectionHandleImageRightProperty, value);
748 NotifyPropertyChanged();
753 /// The SelectionHandlePressedImageLeft property.
754 /// The selectionHandlePressedImageLeft map contains the following key :<br />
755 /// <list type="table">
756 /// <item><term>filename (string)</term><description>The path of image file</description></item>
759 /// <since_tizen> 3 </since_tizen>
760 public PropertyMap SelectionHandlePressedImageLeft
764 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
768 SetValue(SelectionHandlePressedImageLeftProperty, value);
769 NotifyPropertyChanged();
774 /// The SelectionHandlePressedImageRight property.
775 /// The selectionHandlePressedImageRight map contains the following key :<br />
776 /// <list type="table">
777 /// <item><term>filename (string)</term><description>The path of image file</description></item>
780 /// <since_tizen> 3 </since_tizen>
781 public PropertyMap SelectionHandlePressedImageRight
785 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
789 SetValue(SelectionHandlePressedImageRightProperty, value);
790 NotifyPropertyChanged();
795 /// The SelectionHandleMarkerImageLeft property.
796 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
797 /// <list type="table">
798 /// <item><term>filename (string)</term><description>The path of image file</description></item>
801 /// <since_tizen> 3 </since_tizen>
802 public PropertyMap SelectionHandleMarkerImageLeft
806 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
810 SetValue(SelectionHandleMarkerImageLeftProperty, value);
811 NotifyPropertyChanged();
816 /// The SelectionHandleMarkerImageRight property.
817 /// The selectionHandleMarkerImageRight map contains the following key :<br />
818 /// <list type="table">
819 /// <item><term>filename (string)</term><description>The path of image file</description></item>
822 /// <since_tizen> 3 </since_tizen>
823 public PropertyMap SelectionHandleMarkerImageRight
827 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
831 SetValue(SelectionHandleMarkerImageRightProperty, value);
832 NotifyPropertyChanged();
837 /// The SelectionHighlightColor property.
840 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
842 /// <since_tizen> 3 </since_tizen>
843 public Vector4 SelectionHighlightColor
847 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
848 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
852 SetValue(SelectionHighlightColorProperty, value);
853 NotifyPropertyChanged();
858 /// The DecorationBoundingBox property.
861 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
863 /// <since_tizen> 3 </since_tizen>
864 public Rectangle DecorationBoundingBox
868 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
869 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
873 SetValue(DecorationBoundingBoxProperty, value);
874 NotifyPropertyChanged();
879 /// The InputMethodSettings property.
882 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
885 /// The following example demonstrates how to set the InputMethodSettings property.
887 /// InputMethod method = new InputMethod();
888 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
889 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
890 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
891 /// method.Variation = 1;
892 /// textField.InputMethodSettings = method.OutputMap;
895 /// <since_tizen> 3 </since_tizen>
896 public PropertyMap InputMethodSettings
900 return (PropertyMap)GetValue(InputMethodSettingsProperty);
904 SetValue(InputMethodSettingsProperty, value);
905 NotifyPropertyChanged();
910 /// The InputColor property.
913 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
915 /// <since_tizen> 3 </since_tizen>
916 public Vector4 InputColor
920 Vector4 temp = (Vector4)GetValue(InputColorProperty);
921 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
925 SetValue(InputColorProperty, value);
926 NotifyPropertyChanged();
931 /// The EnableMarkup property.
933 /// <since_tizen> 3 </since_tizen>
934 public bool EnableMarkup
938 return (bool)GetValue(EnableMarkupProperty);
942 SetValue(EnableMarkupProperty, value);
943 NotifyPropertyChanged();
948 /// The InputFontFamily property.
950 /// <since_tizen> 3 </since_tizen>
951 public string InputFontFamily
955 return (string)GetValue(InputFontFamilyProperty);
959 SetValue(InputFontFamilyProperty, value);
960 NotifyPropertyChanged();
965 /// The InputFontStyle property.
966 /// The inputFontStyle map contains the following keys :<br />
967 /// <list type="table">
968 /// <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>
969 /// <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>
970 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
973 /// <since_tizen> 3 </since_tizen>
974 public PropertyMap InputFontStyle
978 return (PropertyMap)GetValue(InputFontStyleProperty);
982 SetValue(InputFontStyleProperty, value);
983 NotifyPropertyChanged();
988 /// Set InputFontStyle to TextField. <br />
990 /// <param name="fontStyle">The FontStyle</param>
992 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
995 /// The following example demonstrates how to use the SetInputFontStyle method.
997 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
998 /// fontStyle.Width = FontWidthType.Expanded;
999 /// fontStyle.Weight = FontWeightType.Bold;
1000 /// fontStyle.Slant = FontSlantType.Italic;
1001 /// field.SetInputFontStyle(fontStyle);
1004 [EditorBrowsable(EditorBrowsableState.Never)]
1005 public void SetInputFontStyle(FontStyle fontStyle)
1007 SetProperty(TextField.Property.InputFontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
1008 NotifyPropertyChanged();
1012 /// Get InputFontStyle from TextField. <br />
1014 /// <returns>The FontStyle</returns>
1016 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1018 [EditorBrowsable(EditorBrowsableState.Never)]
1019 public FontStyle GetInputFontStyle()
1021 var map = new PropertyMap();
1022 GetProperty(TextField.Property.InputFontStyle).Get(map);
1023 return TextUtils.GetFontStyleStruct(map);
1027 /// The InputPointSize property.
1029 /// <since_tizen> 3 </since_tizen>
1030 public float InputPointSize
1034 return (float)GetValue(InputPointSizeProperty);
1038 SetValue(InputPointSizeProperty, value);
1039 NotifyPropertyChanged();
1044 /// The Underline property.
1045 /// The underline map contains the following keys :<br />
1046 /// <list type="table">
1047 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1048 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1049 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1052 /// <since_tizen> 3 </since_tizen>
1053 public PropertyMap Underline
1057 return (PropertyMap)GetValue(UnderlineProperty);
1061 SetValue(UnderlineProperty, value);
1062 NotifyPropertyChanged();
1067 /// Set Underline to TextField. <br />
1069 /// <param name="underline">The Underline</param>
1071 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1074 /// The following example demonstrates how to use the SetUnderline method.
1076 /// var underline = new Tizen.NUI.Text.Underline();
1077 /// underline.Enable = true;
1078 /// underline.Color = new Color("#3498DB");
1079 /// underline.Height = 2.0f;
1080 /// field.SetUnderline(underline);
1083 [EditorBrowsable(EditorBrowsableState.Never)]
1084 public void SetUnderline(Underline underline)
1086 SetProperty(TextField.Property.UNDERLINE, new PropertyValue(TextUtils.GetUnderlineMap(underline)));
1090 /// Get Underline from TextField. <br />
1092 /// <returns>The Underline</returns>
1094 /// <see cref="Tizen.NUI.Text.Underline"/>
1096 [EditorBrowsable(EditorBrowsableState.Never)]
1097 public Underline GetUnderline()
1099 var map = new PropertyMap();
1100 GetProperty(TextField.Property.UNDERLINE).Get(map);
1101 return TextUtils.GetUnderlineStruct(map);
1105 /// The InputUnderline property.
1107 /// <since_tizen> 3 </since_tizen>
1108 public string InputUnderline
1112 return (string)GetValue(InputUnderlineProperty);
1116 SetValue(InputUnderlineProperty, value);
1117 NotifyPropertyChanged();
1122 /// The Shadow property.
1123 /// The shadow map contains the following keys :<br />
1124 /// <list type="table">
1125 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1126 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1127 /// <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>
1130 /// <since_tizen> 3 </since_tizen>
1131 public PropertyMap Shadow
1135 return (PropertyMap)GetValue(ShadowProperty);
1139 SetValue(ShadowProperty, value);
1140 NotifyPropertyChanged();
1145 /// The InputShadow property.
1147 /// <since_tizen> 3 </since_tizen>
1148 public string InputShadow
1152 return (string)GetValue(InputShadowProperty);
1156 SetValue(InputShadowProperty, value);
1157 NotifyPropertyChanged();
1162 /// The Emboss property.
1164 /// <since_tizen> 3 </since_tizen>
1165 public string Emboss
1169 return (string)GetValue(EmbossProperty);
1173 SetValue(EmbossProperty, value);
1174 NotifyPropertyChanged();
1179 /// The InputEmboss property.
1181 /// <since_tizen> 3 </since_tizen>
1182 public string InputEmboss
1186 return (string)GetValue(InputEmbossProperty);
1190 SetValue(InputEmbossProperty, value);
1191 NotifyPropertyChanged();
1196 /// The Outline property.
1197 /// The outline map contains the following keys :<br />
1198 /// <list type="table">
1199 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1200 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1203 /// <since_tizen> 3 </since_tizen>
1204 public PropertyMap Outline
1208 return (PropertyMap)GetValue(OutlineProperty);
1212 SetValue(OutlineProperty, value);
1213 NotifyPropertyChanged();
1218 /// The InputOutline property.
1220 /// <since_tizen> 3 </since_tizen>
1221 public string InputOutline
1225 return (string)GetValue(InputOutlineProperty);
1229 SetValue(InputOutlineProperty, value);
1230 NotifyPropertyChanged();
1235 /// The HiddenInputSettings property.
1236 /// The hiddenInputSettings map contains the following keys :<br />
1237 /// <list type="table">
1238 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1239 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1240 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1241 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1245 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1248 /// The following example demonstrates how to set the HiddenInputSettings property.
1250 /// PropertyMap map = new PropertyMap();
1251 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1252 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1253 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1254 /// textField.HiddenInputSettings = map;
1257 /// <since_tizen> 3 </since_tizen>
1258 public Tizen.NUI.PropertyMap HiddenInputSettings
1262 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1266 SetValue(HiddenInputSettingsProperty, value);
1267 NotifyPropertyChanged();
1272 /// The PixelSize property.
1274 /// <since_tizen> 3 </since_tizen>
1275 public float PixelSize
1279 return (float)GetValue(PixelSizeProperty);
1283 SetValue(PixelSizeProperty, value);
1284 NotifyPropertyChanged();
1289 /// The Enable selection property.
1291 /// <since_tizen> 3 </since_tizen>
1292 public bool EnableSelection
1296 return (bool)GetValue(EnableSelectionProperty);
1300 SetValue(EnableSelectionProperty, value);
1301 NotifyPropertyChanged();
1306 /// The Enable selection property.
1308 /// <since_tizen> 6 </since_tizen>
1309 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1310 [EditorBrowsable(EditorBrowsableState.Never)]
1311 public bool EnableGrabHandle
1315 return (bool)GetValue(EnableGrabHandleProperty);
1319 SetValue(EnableGrabHandleProperty, value);
1320 NotifyPropertyChanged();
1325 /// The Enable selection property.
1327 /// <since_tizen> 6 </since_tizen>
1328 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1329 [EditorBrowsable(EditorBrowsableState.Never)]
1330 public bool EnableGrabHandlePopup
1334 return (bool)GetValue(EnableGrabHandlePopupProperty);
1338 SetValue(EnableGrabHandlePopupProperty, value);
1339 NotifyPropertyChanged();
1344 /// The Selected Text property.
1346 /// <since_tizen> 8 </since_tizen>
1347 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1348 [EditorBrowsable(EditorBrowsableState.Never)]
1349 public string SelectedText
1354 GetProperty(TextField.Property.SelectedText).Get(out temp);
1360 /// The start index for selection.
1362 /// <since_tizen> 8 </since_tizen>
1363 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1364 [EditorBrowsable(EditorBrowsableState.Never)]
1365 public int SelectedTextStart
1370 GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
1375 SetProperty(TextField.Property.SelectedTextStart, new PropertyValue(value));
1376 NotifyPropertyChanged();
1381 /// The end index for selection.
1383 /// <since_tizen> 8 </since_tizen>
1384 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1385 [EditorBrowsable(EditorBrowsableState.Never)]
1386 public int SelectedTextEnd
1391 GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
1396 SetProperty(TextField.Property.SelectedTextEnd, new PropertyValue(value));
1397 NotifyPropertyChanged();
1402 /// Enable editing in text control.
1404 /// <since_tizen> 8 </since_tizen>
1405 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1406 [EditorBrowsable(EditorBrowsableState.Never)]
1407 public bool EnableEditing
1412 GetProperty(TextField.Property.EnableEditing).Get(out temp);
1417 SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
1418 NotifyPropertyChanged();
1423 /// Specify primary cursor (caret) position in text control.
1425 [EditorBrowsable(EditorBrowsableState.Never)]
1426 public int PrimaryCursorPosition
1431 using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1433 propertyValue.Get(out temp);
1439 using (PropertyValue propertyValue = new PropertyValue(value))
1441 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1442 NotifyPropertyChanged();
1448 /// The GrabHandleColor property.
1451 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1453 [EditorBrowsable(EditorBrowsableState.Never)]
1454 public Color GrabHandleColor
1458 Color temp = (Color)GetValue(GrabHandleColorProperty);
1459 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1463 SetValue(GrabHandleColorProperty, value);
1464 NotifyPropertyChanged();
1469 /// The ellipsis position of the text.
1470 /// The ellipsis position type when the text size over the layout size.<br />
1471 /// The ellipsis position: End, Start or Middle.<br />
1473 [EditorBrowsable(EditorBrowsableState.Never)]
1474 public EllipsisPosition EllipsisPosition
1478 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1482 SetValue(EllipsisPositionProperty, value);
1483 NotifyPropertyChanged();
1488 /// Set InputFilter to TextField. <br />
1490 /// <param name="inputFilter">The InputFilter</param>
1492 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1493 /// Users can set the Accepted or Rejected regular expression set, or both. <br />
1494 /// If both are used, Rejected has higher priority. <br />
1495 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1496 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description. <br />
1499 /// The following example demonstrates how to use the SetInputFilter method.
1501 /// Tizen.NUI.Text.InputFilter inputFilter;
1502 /// inputFilter.Accepted = new Regex(@"[\d]"); // accept whole digits
1503 /// inputFilter.Rejected = new Regex("[0-3]"); // reject 0, 1, 2, 3
1504 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1507 [EditorBrowsable(EditorBrowsableState.Never)]
1508 public void SetInputFilter(InputFilter inputFilter)
1510 SetProperty(TextField.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter)));
1514 /// Get InputFilter from TextField. <br />
1516 /// <returns>The InputFilter</returns>
1518 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1520 [EditorBrowsable(EditorBrowsableState.Never)]
1521 public InputFilter GetInputFilter()
1523 var map = new PropertyMap();
1524 GetProperty(TextField.Property.InputFilter).Get(map);
1525 return TextUtils.GetInputFilterStruct(map);
1529 /// The Placeholder property.
1530 /// The placeholder map contains the following keys :<br />
1531 /// <list type="table">
1532 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
1533 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1534 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1535 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1536 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1537 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1538 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1539 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1543 /// The following example demonstrates how to set the Placeholder property.
1545 /// PropertyMap propertyMap = new PropertyMap();
1546 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1547 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1548 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1549 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1550 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1552 /// PropertyMap fontStyleMap = new PropertyMap();
1553 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1554 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1555 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1556 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1558 /// TextField field = new TextField();
1559 /// field.Placeholder = propertyMap;
1562 /// <since_tizen> 3 </since_tizen>
1563 public Tizen.NUI.PropertyMap Placeholder
1567 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1568 PropertyValue value = null;
1571 value = map.Find(0);
1574 value.Get(out string text);
1575 map.Add("text", new PropertyValue(text));
1579 value = map.Find(1);
1582 value.Get(out string textFocused);
1583 map.Add("textFocused", new PropertyValue(textFocused));
1587 value = map.Find(2);
1590 Color color = new Color();
1592 map.Add("color", new PropertyValue(color));
1596 value = map.Find(3);
1599 value.Get(out string fontFamily);
1600 map.Add("fontFamily", new PropertyValue(fontFamily));
1604 value = map.Find(4);
1607 PropertyMap fontStyle = new PropertyMap();
1608 value.Get(fontStyle);
1609 map.Add("fontStyle", new PropertyValue(fontStyle));
1613 value = map.Find(5);
1616 value.Get(out float pointSize);
1617 map.Add("pointSize", new PropertyValue(pointSize));
1621 value = map.Find(6);
1624 value.Get(out float pixelSize);
1625 map.Add("pixelSize", new PropertyValue(pixelSize));
1629 value = map.Find(7);
1632 value.Get(out bool ellipsis);
1633 map.Add("ellipsis", new PropertyValue(ellipsis));
1640 SetValue(PlaceholderProperty, value);
1641 NotifyPropertyChanged();
1646 /// The Ellipsis property.<br />
1647 /// Enable or disable the ellipsis.<br />
1648 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1650 /// <since_tizen> 4 </since_tizen>
1651 public bool Ellipsis
1655 return (bool)GetValue(EllipsisProperty);
1659 SetValue(EllipsisProperty, value);
1660 NotifyPropertyChanged();
1665 /// Enables selection of the text using the Shift key.
1667 /// <since_tizen> 5 </since_tizen>
1668 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1669 [EditorBrowsable(EditorBrowsableState.Never)]
1670 public bool EnableShiftSelection
1674 return (bool)GetValue(EnableShiftSelectionProperty);
1678 SetValue(EnableShiftSelectionProperty, value);
1679 NotifyPropertyChanged();
1684 /// The text alignment to match the direction of the system language.
1686 /// <since_tizen> 6 </since_tizen>
1687 public bool MatchSystemLanguageDirection
1691 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1695 SetValue(MatchSystemLanguageDirectionProperty, value);
1696 NotifyPropertyChanged();
1701 /// The FontSizeScale property. <br />
1702 /// The default value is 1.0. <br />
1703 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1705 /// <since_tizen> 9 </since_tizen>
1706 public float FontSizeScale
1710 return fontSizeScale;
1714 float newFontSizeScale;
1716 if (fontSizeScale == value) return;
1718 fontSizeScale = value;
1719 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1721 SystemSettingsFontSize systemSettingsFontSize;
1725 systemSettingsFontSize = SystemSettings.FontSize;
1729 Console.WriteLine("{0} Exception caught.", e);
1730 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1732 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1733 addFontSizeChangedCallback();
1737 newFontSizeScale = fontSizeScale;
1738 removeFontSizeChangedCallback();
1741 SetValue(FontSizeScaleProperty, newFontSizeScale);
1742 NotifyPropertyChanged();
1746 /// Only used by the IL of xaml, will never changed to not hidden.
1747 [EditorBrowsable(EditorBrowsableState.Never)]
1748 public override bool IsCreateByXaml
1752 return base.IsCreateByXaml;
1756 base.IsCreateByXaml = value;
1760 this.TextChanged += (obj, e) =>
1762 this.Text = e.TextField.Text;
1769 /// Get the InputMethodContext instance.
1771 /// <returns>The InputMethodContext instance.</returns>
1772 /// <since_tizen> 5 </since_tizen>
1773 public InputMethodContext GetInputMethodContext()
1775 if (inputMethodCotext == null)
1777 /*Avoid raising InputMethodContext reference count.*/
1778 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
1779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1781 return inputMethodCotext;
1785 /// Select the whole text.
1787 /// <since_tizen> 6 </since_tizen>
1788 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1789 [EditorBrowsable(EditorBrowsableState.Never)]
1790 public void SelectWholeText()
1792 Interop.TextField.SelectWholeText(SwigCPtr);
1793 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1797 /// Select text from start to end index.
1799 /// <param name="start">The start index for selection.</param>
1800 /// <param name="end">The end index for selection.</param>
1801 [EditorBrowsable(EditorBrowsableState.Never)]
1802 public void SelectText(uint start, uint end)
1804 Interop.TextField.SelectText(SwigCPtr, start, end);
1805 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1809 /// Clear selection of the text.
1811 /// <since_tizen> 8 </since_tizen>
1812 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1813 [EditorBrowsable(EditorBrowsableState.Never)]
1814 public void SelectNone()
1816 _ = Interop.TextField.SelectNone(SwigCPtr);
1817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1820 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1822 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1825 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1827 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));
1828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1835 /// <since_tizen> 3 </since_tizen>
1836 protected override void Dispose(DisposeTypes type)
1840 DisposeQueue.Instance.Add(this);
1844 if (systemlangTextFlag)
1846 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1849 removeFontSizeChangedCallback();
1851 if (type == DisposeTypes.Explicit)
1854 //Release your own managed resources here.
1855 //You should release all of your own disposable objects here.
1858 //Release your own unmanaged resources here.
1859 //You should not access any managed member here except static instance.
1860 //because the execution order of Finalizes is non-deterministic.
1863 if (textFieldMaxLengthReachedCallbackDelegate != null)
1865 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
1868 if (textFieldTextChangedCallbackDelegate != null)
1870 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
1877 /// This will not be public opened.
1878 [EditorBrowsable(EditorBrowsableState.Never)]
1879 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1881 // In order to speed up IME hide, temporarily add
1882 GetInputMethodContext()?.DestroyContext();
1883 Interop.TextField.DeleteTextField(swigCPtr);
1886 private string SetTranslatable(string textFieldSid)
1888 string translatableText = null;
1889 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1890 if (translatableText != null)
1892 if (systemlangTextFlag == false)
1894 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1895 systemlangTextFlag = true;
1897 return translatableText;
1901 translatableText = "";
1902 return translatableText;
1906 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1908 if (textFieldTextSid != null)
1910 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1912 if (textFieldPlaceHolderTextSid != null)
1914 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1916 if (textFieldPlaceHolderTextFocusedSid != null)
1918 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
1922 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1924 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1925 SetValue(FontSizeScaleProperty, newFontSizeScale);
1926 NotifyPropertyChanged();
1929 private void addFontSizeChangedCallback()
1931 if (hasFontSizeChangedCallback != true)
1935 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
1936 hasFontSizeChangedCallback = true;
1940 Console.WriteLine("{0} Exception caught.", e);
1941 hasFontSizeChangedCallback = false;
1946 private void removeFontSizeChangedCallback()
1948 if (hasFontSizeChangedCallback == true)
1952 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
1953 hasFontSizeChangedCallback = false;
1957 Console.WriteLine("{0} Exception caught.", e);
1958 hasFontSizeChangedCallback = true;
1963 internal new class Property
1965 internal static readonly int TEXT = Interop.TextField.TextGet();
1966 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
1967 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
1968 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
1969 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
1970 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
1971 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
1972 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
1973 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
1974 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
1975 internal static readonly int TextColor = Interop.TextField.TextColorGet();
1976 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
1977 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
1978 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
1979 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
1980 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
1981 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
1982 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
1983 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
1984 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
1985 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
1986 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
1987 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
1988 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
1989 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
1990 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
1991 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
1992 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
1993 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
1994 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
1995 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
1996 internal static readonly int InputColor = Interop.TextField.InputColorGet();
1997 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
1998 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
1999 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2000 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2001 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2002 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2003 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2004 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2005 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2006 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2007 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2008 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2009 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2010 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2011 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2012 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2013 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2014 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2015 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2016 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2017 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2018 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2019 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2020 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2021 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2022 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2023 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2024 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2025 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2026 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2029 internal class InputStyle
2035 FontFamily = 0x0002,
2045 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2047 DecorationBoundingBox = new Rectangle(x, y, width, height);
2049 private void OnInputColorChanged(float x, float y, float z, float w)
2051 InputColor = new Vector4(x, y, z, w);
2053 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2055 PlaceholderTextColor = new Vector4(r, g, b, a);
2057 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2059 PrimaryCursorColor = new Vector4(x, y, z, w);
2061 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2063 SecondaryCursorColor = new Vector4(x, y, z, w);
2065 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2067 SelectionHighlightColor = new Vector4(x, y, z, w);
2069 private void OnShadowColorChanged(float x, float y, float z, float w)
2071 ShadowColor = new Vector4(x, y, z, w);
2073 private void OnShadowOffsetChanged(float x, float y)
2075 ShadowOffset = new Vector2(x, y);
2077 private void OnTextColorChanged(float r, float g, float b, float a)
2079 TextColor = new Color(r, g, b, a);
2081 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2083 GrabHandleColor = new Color(r, g, b, a);