2 * Copyright(c) 2019 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;
25 namespace Tizen.NUI.BaseComponents
28 /// A control which provides a single line editable text field.
30 /// <since_tizen> 3 </since_tizen>
31 public partial class TextField : View
33 private string textFieldTextSid = null;
34 private string textFieldPlaceHolderTextSid = null;
35 private bool systemlangTextFlag = false;
36 private InputMethodContext inputMethodCotext = null;
38 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
39 [EditorBrowsable(EditorBrowsableState.Never)]
40 public TextFieldStyle Style => ViewStyle as TextFieldStyle;
43 /// Creates the TextField control.
45 /// <since_tizen> 3 </since_tizen>
46 public TextField() : this(Interop.TextField.TextField_New(), true)
48 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52 /// Creates the TextField with setting the status of shown or hidden.
54 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
55 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 public TextField(bool shown) : this(Interop.TextField.TextField_New(), true)
59 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
64 /// Get attribues, it is abstract function and must be override.
66 /// <since_tizen> 6 </since_tizen>
67 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected override ViewStyle GetViewStyle()
71 return new TextFieldStyle();
74 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
82 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn)
90 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.new_TextField__SWIG_1(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("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("ResourceManager about multilingual is null");
174 textFieldPlaceHolderTextSid = value;
175 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
176 NotifyPropertyChanged();
181 /// The Text property.
183 /// <since_tizen> 3 </since_tizen>
188 return (string)GetValue(TextProperty);
192 SetValueAndForceSendChangeSignal(TextProperty, value);
193 NotifyPropertyChanged();
198 /// The PlaceholderText property.
200 /// <since_tizen> 3 </since_tizen>
201 public string PlaceholderText
205 return (string)GetValue(PlaceholderTextProperty);
209 SetValue(PlaceholderTextProperty, value);
210 NotifyPropertyChanged();
215 /// The PlaceholderTextFocused property.
217 /// <since_tizen> 3 </since_tizen>
218 public string PlaceholderTextFocused
222 return (string)GetValue(PlaceholderTextFocusedProperty);
226 SetValue(PlaceholderTextFocusedProperty, value);
227 NotifyPropertyChanged();
232 /// The FontFamily property.
234 /// <since_tizen> 3 </since_tizen>
235 public string FontFamily
239 return (string)GetValue(FontFamilyProperty);
243 SetValue(FontFamilyProperty, value);
244 NotifyPropertyChanged();
249 /// The FontStyle property.
251 /// <since_tizen> 3 </since_tizen>
252 public PropertyMap FontStyle
256 return (PropertyMap)GetValue(FontStyleProperty);
260 SetValue(FontStyleProperty, value);
261 NotifyPropertyChanged();
266 /// The PointSize property.
268 /// <since_tizen> 3 </since_tizen>
269 public float PointSize
273 return (float)GetValue(PointSizeProperty);
277 SetValue(PointSizeProperty, value);
278 NotifyPropertyChanged();
283 /// The MaxLength property.
285 /// <since_tizen> 3 </since_tizen>
290 return (int)GetValue(MaxLengthProperty);
294 SetValue(MaxLengthProperty, value);
295 NotifyPropertyChanged();
300 /// The ExceedPolicy property.
302 /// <since_tizen> 3 </since_tizen>
303 public int ExceedPolicy
307 return (int)GetValue(ExceedPolicyProperty);
311 SetValue(ExceedPolicyProperty, value);
312 NotifyPropertyChanged();
317 /// The HorizontalAlignment property.
319 /// <since_tizen> 3 </since_tizen>
320 public HorizontalAlignment HorizontalAlignment
324 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
328 SetValue(HorizontalAlignmentProperty, value);
329 NotifyPropertyChanged();
334 /// The VerticalAlignment property.
336 /// <since_tizen> 3 </since_tizen>
337 public VerticalAlignment VerticalAlignment
341 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
345 SetValue(VerticalAlignmentProperty, value);
346 NotifyPropertyChanged();
347 NotifyPropertyChanged();
352 /// The TextColor property.
355 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
357 /// <since_tizen> 3 </since_tizen>
358 public Color TextColor
362 Color temp = (Color)GetValue(TextColorProperty);
363 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
367 SetValue(TextColorProperty, value);
368 NotifyPropertyChanged();
373 /// The PlaceholderTextColor property.
376 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
378 /// <since_tizen> 3 </since_tizen>
379 public Vector4 PlaceholderTextColor
383 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
384 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
388 SetValue(PlaceholderTextColorProperty, value);
389 NotifyPropertyChanged();
394 /// The ShadowOffset property.
396 /// <since_tizen> 3 </since_tizen>
398 /// Deprecated.(API Level 6) Use Shadow instead.
399 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
401 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
402 public Vector2 ShadowOffset
406 PropertyMap map = new PropertyMap();
407 GetProperty(TextField.Property.SHADOW).Get(map);
408 Vector2 shadowOffset = new Vector2();
409 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
410 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
414 PropertyMap temp = new PropertyMap();
415 temp.Insert("offset", new PropertyValue(value));
416 SetValue(ShadowProperty, temp);
417 NotifyPropertyChanged();
422 /// The ShadowColor property.
424 /// <since_tizen> 3 </since_tizen>
426 /// Deprecated.(API Level 6) Use Shadow instead.
427 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
429 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
430 public Vector4 ShadowColor
434 PropertyMap map = new PropertyMap();
435 GetProperty(TextField.Property.SHADOW).Get(map);
436 Vector4 shadowColor = new Vector4();
437 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
438 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
442 PropertyMap temp = new PropertyMap();
443 temp.Insert("color", new PropertyValue(value));
444 SetValue(ShadowProperty, temp);
445 NotifyPropertyChanged();
450 /// The PrimaryCursorColor property.
453 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
455 /// <since_tizen> 3 </since_tizen>
456 public Vector4 PrimaryCursorColor
460 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
461 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
465 SetValue(PrimaryCursorColorProperty, value);
466 NotifyPropertyChanged();
471 /// The SecondaryCursorColor property.
474 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
476 /// <since_tizen> 3 </since_tizen>
477 public Vector4 SecondaryCursorColor
481 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
482 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
486 SetValue(SecondaryCursorColorProperty, value);
487 NotifyPropertyChanged();
492 /// The EnableCursorBlink property.
494 /// <since_tizen> 3 </since_tizen>
495 public bool EnableCursorBlink
499 return (bool)GetValue(EnableCursorBlinkProperty);
503 SetValue(EnableCursorBlinkProperty, value);
504 NotifyPropertyChanged();
509 /// The CursorBlinkInterval property.
511 /// <since_tizen> 3 </since_tizen>
512 public float CursorBlinkInterval
516 return (float)GetValue(CursorBlinkIntervalProperty);
520 SetValue(CursorBlinkIntervalProperty, value);
521 NotifyPropertyChanged();
526 /// The CursorBlinkDuration property.
528 /// <since_tizen> 3 </since_tizen>
529 public float CursorBlinkDuration
533 return (float)GetValue(CursorBlinkDurationProperty);
537 SetValue(CursorBlinkDurationProperty, value);
538 NotifyPropertyChanged();
543 /// The CursorWidth property.
545 /// <since_tizen> 3 </since_tizen>
546 public int CursorWidth
550 return (int)GetValue(CursorWidthProperty);
554 SetValue(CursorWidthProperty, value);
555 NotifyPropertyChanged();
560 /// The GrabHandleImage property.
562 /// <since_tizen> 3 </since_tizen>
563 public string GrabHandleImage
567 return (string)GetValue(GrabHandleImageProperty);
571 SetValue(GrabHandleImageProperty, value);
572 NotifyPropertyChanged();
577 /// The GrabHandlePressedImage property.
579 /// <since_tizen> 3 </since_tizen>
580 public string GrabHandlePressedImage
584 return (string)GetValue(GrabHandlePressedImageProperty);
588 SetValue(GrabHandlePressedImageProperty, value);
589 NotifyPropertyChanged();
594 /// The ScrollThreshold property.
596 /// <since_tizen> 3 </since_tizen>
597 public float ScrollThreshold
601 return (float)GetValue(ScrollThresholdProperty);
605 SetValue(ScrollThresholdProperty, value);
606 NotifyPropertyChanged();
611 /// The ScrollSpeed property.
613 /// <since_tizen> 3 </since_tizen>
614 public float ScrollSpeed
618 return (float)GetValue(ScrollSpeedProperty);
622 SetValue(ScrollSpeedProperty, value);
623 NotifyPropertyChanged();
628 /// The SelectionHandleImageLeft property.
630 /// <since_tizen> 3 </since_tizen>
631 public PropertyMap SelectionHandleImageLeft
635 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
639 SetValue(SelectionHandleImageLeftProperty, value);
640 NotifyPropertyChanged();
645 /// The SelectionHandleImageRight property.
647 /// <since_tizen> 3 </since_tizen>
648 public PropertyMap SelectionHandleImageRight
652 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
656 SetValue(SelectionHandleImageRightProperty, value);
657 NotifyPropertyChanged();
662 /// The SelectionHandlePressedImageLeft property.
664 /// <since_tizen> 3 </since_tizen>
665 public PropertyMap SelectionHandlePressedImageLeft
669 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
673 SetValue(SelectionHandlePressedImageLeftProperty, value);
674 NotifyPropertyChanged();
679 /// The SelectionHandlePressedImageRight property.
681 /// <since_tizen> 3 </since_tizen>
682 public PropertyMap SelectionHandlePressedImageRight
686 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
690 SetValue(SelectionHandlePressedImageRightProperty, value);
691 NotifyPropertyChanged();
696 /// The SelectionHandleMarkerImageLeft property.
698 /// <since_tizen> 3 </since_tizen>
699 public PropertyMap SelectionHandleMarkerImageLeft
703 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
707 SetValue(SelectionHandleMarkerImageLeftProperty, value);
708 NotifyPropertyChanged();
713 /// The SelectionHandleMarkerImageRight property.
715 /// <since_tizen> 3 </since_tizen>
716 public PropertyMap SelectionHandleMarkerImageRight
720 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
724 SetValue(SelectionHandleMarkerImageRightProperty, value);
725 NotifyPropertyChanged();
730 /// The SelectionHighlightColor property.
733 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
735 /// <since_tizen> 3 </since_tizen>
736 public Vector4 SelectionHighlightColor
740 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
741 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
745 SetValue(SelectionHighlightColorProperty, value);
746 NotifyPropertyChanged();
751 /// The DecorationBoundingBox property.
754 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
756 /// <since_tizen> 3 </since_tizen>
757 public Rectangle DecorationBoundingBox
761 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
762 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
766 SetValue(DecorationBoundingBoxProperty, value);
767 NotifyPropertyChanged();
772 /// The InputMethodSettings property.
774 /// <since_tizen> 3 </since_tizen>
775 public PropertyMap InputMethodSettings
779 return (PropertyMap)GetValue(InputMethodSettingsProperty);
783 SetValue(InputMethodSettingsProperty, value);
784 NotifyPropertyChanged();
789 /// The InputColor property.
792 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
794 /// <since_tizen> 3 </since_tizen>
795 public Vector4 InputColor
799 Vector4 temp = (Vector4)GetValue(InputColorProperty);
800 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
804 SetValue(InputColorProperty, value);
805 NotifyPropertyChanged();
810 /// The EnableMarkup property.
812 /// <since_tizen> 3 </since_tizen>
813 public bool EnableMarkup
817 return (bool)GetValue(EnableMarkupProperty);
821 SetValue(EnableMarkupProperty, value);
822 NotifyPropertyChanged();
827 /// The InputFontFamily property.
829 /// <since_tizen> 3 </since_tizen>
830 public string InputFontFamily
834 return (string)GetValue(InputFontFamilyProperty);
838 SetValue(InputFontFamilyProperty, value);
839 NotifyPropertyChanged();
844 /// The InputFontStyle property.
846 /// <since_tizen> 3 </since_tizen>
847 public PropertyMap InputFontStyle
851 return (PropertyMap)GetValue(InputFontStyleProperty);
855 SetValue(InputFontStyleProperty, value);
856 NotifyPropertyChanged();
861 /// The InputPointSize property.
863 /// <since_tizen> 3 </since_tizen>
864 public float InputPointSize
868 return (float)GetValue(InputPointSizeProperty);
872 SetValue(InputPointSizeProperty, value);
873 NotifyPropertyChanged();
878 /// The Underline property.
880 /// <since_tizen> 3 </since_tizen>
881 public PropertyMap Underline
885 return (PropertyMap)GetValue(UnderlineProperty);
889 SetValue(UnderlineProperty, value);
890 NotifyPropertyChanged();
895 /// The InputUnderline property.
897 /// <since_tizen> 3 </since_tizen>
898 public string InputUnderline
902 return (string)GetValue(InputUnderlineProperty);
906 SetValue(InputUnderlineProperty, value);
907 NotifyPropertyChanged();
912 /// The Shadow property.
914 /// <since_tizen> 3 </since_tizen>
915 public PropertyMap Shadow
919 return (PropertyMap)GetValue(ShadowProperty);
923 SetValue(ShadowProperty, value);
924 NotifyPropertyChanged();
929 /// The InputShadow property.
931 /// <since_tizen> 3 </since_tizen>
932 public string InputShadow
936 return (string)GetValue(InputShadowProperty);
940 SetValue(InputShadowProperty, value);
941 NotifyPropertyChanged();
946 /// The Emboss property.
948 /// <since_tizen> 3 </since_tizen>
953 return (string)GetValue(EmbossProperty);
957 SetValue(EmbossProperty, value);
958 NotifyPropertyChanged();
963 /// The InputEmboss property.
965 /// <since_tizen> 3 </since_tizen>
966 public string InputEmboss
970 return (string)GetValue(InputEmbossProperty);
974 SetValue(InputEmbossProperty, value);
975 NotifyPropertyChanged();
980 /// The Outline property.
982 /// <since_tizen> 3 </since_tizen>
983 public PropertyMap Outline
987 return (PropertyMap)GetValue(OutlineProperty);
991 SetValue(OutlineProperty, value);
992 NotifyPropertyChanged();
997 /// The InputOutline property.
999 /// <since_tizen> 3 </since_tizen>
1000 public string InputOutline
1004 return (string)GetValue(InputOutlineProperty);
1008 SetValue(InputOutlineProperty, value);
1009 NotifyPropertyChanged();
1014 /// The HiddenInputSettings property.
1016 /// <since_tizen> 3 </since_tizen>
1017 public Tizen.NUI.PropertyMap HiddenInputSettings
1021 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1025 SetValue(HiddenInputSettingsProperty, value);
1026 NotifyPropertyChanged();
1031 /// The PixelSize property.
1033 /// <since_tizen> 3 </since_tizen>
1034 public float PixelSize
1038 return (float)GetValue(PixelSizeProperty);
1042 SetValue(PixelSizeProperty, value);
1043 NotifyPropertyChanged();
1048 /// The Enable selection property.
1050 /// <since_tizen> 3 </since_tizen>
1051 public bool EnableSelection
1055 return (bool)GetValue(EnableSelectionProperty);
1059 SetValue(EnableSelectionProperty, value);
1060 NotifyPropertyChanged();
1065 /// The Enable selection property.
1067 /// <since_tizen> 6 </since_tizen>
1068 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1069 [EditorBrowsable(EditorBrowsableState.Never)]
1070 public bool EnableGrabHandle
1074 return (bool)GetValue(EnableGrabHandleProperty);
1078 SetValue(EnableGrabHandleProperty, value);
1079 NotifyPropertyChanged();
1084 /// The Enable selection property.
1086 /// <since_tizen> 6 </since_tizen>
1087 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1088 [EditorBrowsable(EditorBrowsableState.Never)]
1089 public bool EnableGrabHandlePopup
1093 return (bool)GetValue(EnableGrabHandlePopupProperty);
1097 SetValue(EnableGrabHandlePopupProperty, value);
1098 NotifyPropertyChanged();
1103 /// The Placeholder property.
1104 /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1107 /// The following example demonstrates how to set the Placeholder property.
1109 /// PropertyMap propertyMap = new PropertyMap();
1110 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1111 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1112 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1113 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1114 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1116 /// PropertyMap fontStyleMap = new PropertyMap();
1117 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1118 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1119 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1120 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1122 /// TextField field = new TextField();
1123 /// field.Placeholder = propertyMap;
1126 /// <since_tizen> 3 </since_tizen>
1127 public Tizen.NUI.PropertyMap Placeholder
1131 return (PropertyMap)GetValue(PlaceholderProperty);
1135 SetValue(PlaceholderProperty, value);
1136 NotifyPropertyChanged();
1141 /// The Ellipsis property.<br />
1142 /// Enable or disable the ellipsis.<br />
1143 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1145 /// <since_tizen> 4 </since_tizen>
1146 public bool Ellipsis
1150 return (bool)GetValue(EllipsisProperty);
1154 SetValue(EllipsisProperty, value);
1155 NotifyPropertyChanged();
1160 /// Enables selection of the text using the Shift key.
1162 /// <since_tizen> 5 </since_tizen>
1163 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1164 [EditorBrowsable(EditorBrowsableState.Never)]
1165 public bool EnableShiftSelection
1169 return (bool)GetValue(EnableShiftSelectionProperty);
1173 SetValue(EnableShiftSelectionProperty, value);
1174 NotifyPropertyChanged();
1179 /// The text alignment to match the direction of the system language.
1181 /// <since_tizen> 6 </since_tizen>
1182 public bool MatchSystemLanguageDirection
1186 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1190 SetValue(MatchSystemLanguageDirectionProperty, value);
1191 NotifyPropertyChanged();
1195 /// Only used by the IL of xaml, will never changed to not hidden.
1196 [EditorBrowsable(EditorBrowsableState.Never)]
1197 public override bool IsCreateByXaml
1201 return base.IsCreateByXaml;
1205 base.IsCreateByXaml = value;
1209 this.TextChanged += (obj, e) =>
1211 this.Text = this.Text;
1218 /// Get the InputMethodContext instance.
1220 /// <returns>The InputMethodContext instance.</returns>
1221 /// <since_tizen> 5 </since_tizen>
1222 public InputMethodContext GetInputMethodContext()
1224 if (inputMethodCotext == null)
1226 /*Avoid raising InputMethodContext reference count.*/
1227 inputMethodCotext = new InputMethodContext(Interop.TextField.TextField_GetInputMethodContext(swigCPtr), true);
1228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1230 return inputMethodCotext;
1234 /// Select the whole text.
1236 /// <since_tizen> 6 </since_tizen>
1237 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1238 [EditorBrowsable(EditorBrowsableState.Never)]
1239 public void SelectWholeText()
1241 Interop.TextField.TextField_SelectWholeText(swigCPtr);
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1247 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1250 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1252 SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.TextField_InputStyleChangedSignal(swigCPtr), false);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1260 /// <since_tizen> 3 </since_tizen>
1261 protected override void Dispose(DisposeTypes type)
1265 DisposeQueue.Instance.Add(this);
1269 //Release your own unmanaged resources here.
1270 //You should not access any managed member here except static instance.
1271 //because the execution order of Finalizes is non-deterministic.
1274 if (_textFieldMaxLengthReachedCallbackDelegate != null)
1276 this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
1279 if (_textFieldTextChangedCallbackDelegate != null)
1281 TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
1288 /// This will not be public opened.
1289 [EditorBrowsable(EditorBrowsableState.Never)]
1290 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1292 // In order to speed up IME hide, temporarily add
1293 GetInputMethodContext()?.DestroyContext();
1294 Interop.TextField.delete_TextField(swigCPtr);
1297 private string SetTranslatable(string textFieldSid)
1299 string translatableText = null;
1300 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1301 if (translatableText != null)
1303 if (systemlangTextFlag == false)
1305 SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
1306 systemlangTextFlag = true;
1308 return translatableText;
1312 translatableText = "";
1313 return translatableText;
1317 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1319 if (textFieldTextSid != null)
1321 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1323 if (textFieldPlaceHolderTextSid != null)
1325 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1329 internal new class Property
1331 internal static readonly int RENDERING_BACKEND = Interop.TextField.TextField_Property_RENDERING_BACKEND_get();
1332 internal static readonly int TEXT = Interop.TextField.TextField_Property_TEXT_get();
1333 internal static readonly int PLACEHOLDER_TEXT = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_get();
1334 internal static readonly int PLACEHOLDER_TEXT_FOCUSED = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
1335 internal static readonly int FONT_FAMILY = Interop.TextField.TextField_Property_FONT_FAMILY_get();
1336 internal static readonly int FONT_STYLE = Interop.TextField.TextField_Property_FONT_STYLE_get();
1337 internal static readonly int POINT_SIZE = Interop.TextField.TextField_Property_POINT_SIZE_get();
1338 internal static readonly int MAX_LENGTH = Interop.TextField.TextField_Property_MAX_LENGTH_get();
1339 internal static readonly int EXCEED_POLICY = Interop.TextField.TextField_Property_EXCEED_POLICY_get();
1340 internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextField.TextField_Property_HORIZONTAL_ALIGNMENT_get();
1341 internal static readonly int VERTICAL_ALIGNMENT = Interop.TextField.TextField_Property_VERTICAL_ALIGNMENT_get();
1342 internal static readonly int TEXT_COLOR = Interop.TextField.TextField_Property_TEXT_COLOR_get();
1343 internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
1344 internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextField.TextField_Property_PRIMARY_CURSOR_COLOR_get();
1345 internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextField.TextField_Property_SECONDARY_CURSOR_COLOR_get();
1346 internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextField.TextField_Property_ENABLE_CURSOR_BLINK_get();
1347 internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextField.TextField_Property_CURSOR_BLINK_INTERVAL_get();
1348 internal static readonly int CURSOR_BLINK_DURATION = Interop.TextField.TextField_Property_CURSOR_BLINK_DURATION_get();
1349 internal static readonly int CURSOR_WIDTH = Interop.TextField.TextField_Property_CURSOR_WIDTH_get();
1350 internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_IMAGE_get();
1351 internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
1352 internal static readonly int SCROLL_THRESHOLD = Interop.TextField.TextField_Property_SCROLL_THRESHOLD_get();
1353 internal static readonly int SCROLL_SPEED = Interop.TextField.TextField_Property_SCROLL_SPEED_get();
1354 internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
1355 internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
1356 internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
1357 internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
1358 internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
1359 internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
1360 internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextField.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
1361 internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextField.TextField_Property_DECORATION_BOUNDING_BOX_get();
1362 internal static readonly int INPUT_METHOD_SETTINGS = Interop.TextField.TextField_Property_INPUT_METHOD_SETTINGS_get();
1363 internal static readonly int INPUT_COLOR = Interop.TextField.TextField_Property_INPUT_COLOR_get();
1364 internal static readonly int ENABLE_MARKUP = Interop.TextField.TextField_Property_ENABLE_MARKUP_get();
1365 internal static readonly int INPUT_FONT_FAMILY = Interop.TextField.TextField_Property_INPUT_FONT_FAMILY_get();
1366 internal static readonly int INPUT_FONT_STYLE = Interop.TextField.TextField_Property_INPUT_FONT_STYLE_get();
1367 internal static readonly int INPUT_POINT_SIZE = Interop.TextField.TextField_Property_INPUT_POINT_SIZE_get();
1368 internal static readonly int UNDERLINE = Interop.TextField.TextField_Property_UNDERLINE_get();
1369 internal static readonly int INPUT_UNDERLINE = Interop.TextField.TextField_Property_INPUT_UNDERLINE_get();
1370 internal static readonly int SHADOW = Interop.TextField.TextField_Property_SHADOW_get();
1371 internal static readonly int INPUT_SHADOW = Interop.TextField.TextField_Property_INPUT_SHADOW_get();
1372 internal static readonly int EMBOSS = Interop.TextField.TextField_Property_EMBOSS_get();
1373 internal static readonly int INPUT_EMBOSS = Interop.TextField.TextField_Property_INPUT_EMBOSS_get();
1374 internal static readonly int OUTLINE = Interop.TextField.TextField_Property_OUTLINE_get();
1375 internal static readonly int INPUT_OUTLINE = Interop.TextField.TextField_Property_INPUT_OUTLINE_get();
1376 internal static readonly int HIDDEN_INPUT_SETTINGS = Interop.TextField.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
1377 internal static readonly int PIXEL_SIZE = Interop.TextField.TextField_Property_PIXEL_SIZE_get();
1378 internal static readonly int ENABLE_SELECTION = Interop.TextField.TextField_Property_ENABLE_SELECTION_get();
1379 internal static readonly int PLACEHOLDER = Interop.TextField.TextField_Property_PLACEHOLDER_get();
1380 internal static readonly int ELLIPSIS = Interop.TextField.TextField_Property_ELLIPSIS_get();
1381 internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextField.TextField_Property_ENABLE_SHIFT_SELECTION_get();
1382 internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextField.TextField_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1383 internal static readonly int ENABLE_GRAB_HANDLE = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_get();
1384 internal static readonly int ENABLE_GRAB_HANDLE_POPUP = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_POPUP_get();
1387 internal class InputStyle
1393 FontFamily = 0x0002,
1403 internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1405 var textField = (TextField)bindable;
1406 textField.translatableTextSelector.Clone((Selector<string>)newValue);
1408 defaultValueCreator: (bindable) =>
1410 var textField = (TextField)bindable;
1411 return textField.translatableTextSelector;
1413 internal static readonly BindableProperty TranslatablePlaceholderTextSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1415 var textField = (TextField)bindable;
1416 textField.translatablePlaceholderTextSelector.Clone((Selector<string>)newValue);
1418 defaultValueCreator: (bindable) =>
1420 var textField = (TextField)bindable;
1421 return textField.translatablePlaceholderTextSelector;
1423 internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1425 var textField = (TextField)bindable;
1426 textField.textSelector.Clone((Selector<string>)newValue);
1428 defaultValueCreator: (bindable) =>
1430 var textField = (TextField)bindable;
1431 return textField.textSelector;
1433 internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1435 var textField = (TextField)bindable;
1436 textField.fontFamilySelector.Clone((Selector<string>)newValue);
1438 defaultValueCreator: (bindable) =>
1440 var textField = (TextField)bindable;
1441 return textField.fontFamilySelector;
1443 internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1445 var textField = (TextField)bindable;
1446 textField.pointSizeSelector.Clone((Selector<float?>)newValue);
1448 defaultValueCreator: (bindable) =>
1450 var textField = (TextField)bindable;
1451 return textField.pointSizeSelector;
1453 internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1455 var textField = (TextField)bindable;
1456 textField.textColorSelector.Clone((Selector<Color>)newValue);
1458 defaultValueCreator: (bindable) =>
1460 var textField = (TextField)bindable;
1461 return textField.textColorSelector;
1463 internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1465 var textField = (TextField)bindable;
1466 textField.placeholderTextColorSelector.Clone((Selector<Vector4>)newValue);
1468 defaultValueCreator: (bindable) =>
1470 var textField = (TextField)bindable;
1471 return textField.placeholderTextColorSelector;
1473 internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
1475 var textField = (TextField)bindable;
1476 textField.primaryCursorColorSelector.Clone((Selector<Vector4>)newValue);
1478 defaultValueCreator: (bindable) =>
1480 var textField = (TextField)bindable;
1481 return textField.primaryCursorColorSelector;
1484 private TriggerableSelector<string> _translatableTextSelector;
1485 private TriggerableSelector<string> translatableTextSelector
1489 if (null == _translatableTextSelector)
1491 _translatableTextSelector = new TriggerableSelector<string>(this, TranslatableTextProperty);
1493 return _translatableTextSelector;
1497 private TriggerableSelector<string> _translatablePlaceholderTextSelector;
1498 private TriggerableSelector<string> translatablePlaceholderTextSelector
1502 if (null == _translatablePlaceholderTextSelector)
1504 _translatablePlaceholderTextSelector = new TriggerableSelector<string>(this, TranslatablePlaceholderTextProperty);
1506 return _translatablePlaceholderTextSelector;
1510 private TriggerableSelector<string> _textSelector;
1511 private TriggerableSelector<string> textSelector
1515 if (null == _textSelector)
1517 _textSelector = new TriggerableSelector<string>(this, TextProperty);
1519 return _textSelector;
1523 private TriggerableSelector<string> _fontFamilySelector;
1524 private TriggerableSelector<string> fontFamilySelector
1528 if (null == _fontFamilySelector)
1530 _fontFamilySelector = new TriggerableSelector<string>(this, FontFamilyProperty);
1532 return _fontFamilySelector;
1536 private TriggerableSelector<Color> _textColorSelector;
1537 private TriggerableSelector<Color> textColorSelector
1541 if (null == _textColorSelector)
1543 _textColorSelector = new TriggerableSelector<Color>(this, TextColorProperty);
1545 return _textColorSelector;
1549 private TriggerableSelector<float?> _pointSizeSelector;
1550 private TriggerableSelector<float?> pointSizeSelector
1554 if (null == _pointSizeSelector)
1556 _pointSizeSelector = new TriggerableSelector<float?>(this, PointSizeProperty);
1558 return _pointSizeSelector;
1562 private TriggerableSelector<Vector4> _placeholderTextColorSelector;
1563 private TriggerableSelector<Vector4> placeholderTextColorSelector
1567 if (null == _placeholderTextColorSelector)
1569 _placeholderTextColorSelector = new TriggerableSelector<Vector4>(this, PlaceholderTextColorProperty);
1571 return _placeholderTextColorSelector;
1575 private TriggerableSelector<Vector4> _primaryCursorColorSelector;
1576 private TriggerableSelector<Vector4> primaryCursorColorSelector
1580 if (null == _primaryCursorColorSelector)
1582 _primaryCursorColorSelector = new TriggerableSelector<Vector4>(this, PrimaryCursorColorProperty);
1584 return _primaryCursorColorSelector;
1588 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1590 DecorationBoundingBox = new Rectangle(x, y, width, height);
1592 private void OnInputColorChanged(float x, float y, float z, float w)
1594 InputColor = new Vector4(x, y, z, w);
1596 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1598 PlaceholderTextColor = new Vector4(r, g, b, a);
1600 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1602 PrimaryCursorColor = new Vector4(x, y, z, w);
1604 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1606 SecondaryCursorColor = new Vector4(x, y, z, w);
1608 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1610 SelectionHighlightColor = new Vector4(x, y, z, w);
1612 private void OnShadowColorChanged(float x, float y, float z, float w)
1614 ShadowColor = new Vector4(x, y, z, w);
1616 private void OnShadowOffsetChanged(float x, float y)
1618 ShadowOffset = new Vector2(x, y);
1620 private void OnTextColorChanged(float r, float g, float b, float a)
1622 TextColor = new Color(r, g, b, a);