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;
37 private TextFieldSelectorData selectorData;
39 static TextField() { }
41 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
42 [EditorBrowsable(EditorBrowsableState.Never)]
43 public TextFieldStyle Style => new TextFieldStyle(this);
46 /// Creates the TextField control.
48 /// <since_tizen> 3 </since_tizen>
49 public TextField() : this(Interop.TextField.TextField_New(), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55 /// Creates the TextField with setting the status of shown or hidden.
57 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
58 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
59 [EditorBrowsable(EditorBrowsableState.Never)]
60 public TextField(bool shown) : this(Interop.TextField.TextField_New(), true)
62 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// Get attribues, it is abstract function and must be override.
69 /// <since_tizen> 6 </since_tizen>
70 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 protected override ViewStyle GetViewStyle()
74 return new TextFieldStyle();
77 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
85 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn)
93 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103 internal enum ExceedPolicyType
105 ExceedPolicyOriginal,
110 /// The TranslatableText property.<br />
111 /// The text can set the SID value.<br />
113 /// <exception cref='ArgumentNullException'>
114 /// ResourceManager about multilingual is null.
116 /// <since_tizen> 4 </since_tizen>
117 public string TranslatableText
121 return (string)GetValue(TranslatableTextProperty);
125 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
126 SetValue(TranslatableTextProperty, value);
129 private string translatableText
133 return textFieldTextSid;
137 if (NUIApplication.MultilingualResourceManager == null)
139 throw new ArgumentNullException("ResourceManager about multilingual is null");
141 textFieldTextSid = value;
142 Text = SetTranslatable(textFieldTextSid);
143 NotifyPropertyChanged();
148 /// The TranslatablePlaceholderText property.<br />
149 /// The text can set the SID value.<br />
151 /// <exception cref='ArgumentNullException'>
152 /// ResourceManager about multilingual is null.
154 /// <since_tizen> 4 </since_tizen>
155 public string TranslatablePlaceholderText
159 return (string)GetValue(TranslatablePlaceholderTextProperty);
163 SetValue(TranslatablePlaceholderTextProperty, value);
164 selectorData?.TranslatablePlaceholderText.UpdateIfNeeds(this, value);
167 private string translatablePlaceholderText
171 return textFieldPlaceHolderTextSid;
175 if (NUIApplication.MultilingualResourceManager == null)
177 throw new ArgumentNullException("ResourceManager about multilingual is null");
179 textFieldPlaceHolderTextSid = value;
180 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
181 NotifyPropertyChanged();
186 /// The Text property.
188 /// <since_tizen> 3 </since_tizen>
193 return (string)GetValue(TextProperty);
197 SetValueAndForceSendChangeSignal(TextProperty, value);
198 selectorData?.Text.UpdateIfNeeds(this, value);
199 NotifyPropertyChanged();
204 /// The PlaceholderText property.
206 /// <since_tizen> 3 </since_tizen>
207 public string PlaceholderText
211 return (string)GetValue(PlaceholderTextProperty);
215 SetValue(PlaceholderTextProperty, value);
216 NotifyPropertyChanged();
221 /// The PlaceholderTextFocused property.
223 /// <since_tizen> 3 </since_tizen>
224 public string PlaceholderTextFocused
228 return (string)GetValue(PlaceholderTextFocusedProperty);
232 SetValue(PlaceholderTextFocusedProperty, value);
233 NotifyPropertyChanged();
238 /// The FontFamily property.
240 /// <since_tizen> 3 </since_tizen>
241 public string FontFamily
245 return (string)GetValue(FontFamilyProperty);
249 SetValue(FontFamilyProperty, value);
250 selectorData?.FontFamily.UpdateIfNeeds(this, value);
251 NotifyPropertyChanged();
256 /// The FontStyle property.
258 /// <since_tizen> 3 </since_tizen>
259 public PropertyMap FontStyle
263 return (PropertyMap)GetValue(FontStyleProperty);
267 SetValue(FontStyleProperty, value);
268 NotifyPropertyChanged();
273 /// The PointSize property.
275 /// <since_tizen> 3 </since_tizen>
276 public float PointSize
280 return (float)GetValue(PointSizeProperty);
284 SetValue(PointSizeProperty, value);
285 selectorData?.PointSize.UpdateIfNeeds(this, value);
286 NotifyPropertyChanged();
291 /// The MaxLength property.
293 /// <since_tizen> 3 </since_tizen>
298 return (int)GetValue(MaxLengthProperty);
302 SetValue(MaxLengthProperty, value);
303 NotifyPropertyChanged();
308 /// The ExceedPolicy property.
310 /// <since_tizen> 3 </since_tizen>
311 public int ExceedPolicy
315 return (int)GetValue(ExceedPolicyProperty);
319 SetValue(ExceedPolicyProperty, value);
320 NotifyPropertyChanged();
325 /// The HorizontalAlignment property.
327 /// <since_tizen> 3 </since_tizen>
328 public HorizontalAlignment HorizontalAlignment
332 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
336 SetValue(HorizontalAlignmentProperty, value);
337 NotifyPropertyChanged();
342 /// The VerticalAlignment property.
344 /// <since_tizen> 3 </since_tizen>
345 public VerticalAlignment VerticalAlignment
349 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
353 SetValue(VerticalAlignmentProperty, value);
354 NotifyPropertyChanged();
355 NotifyPropertyChanged();
360 /// The TextColor property.
363 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
365 /// <since_tizen> 3 </since_tizen>
366 public Color TextColor
370 Color temp = (Color)GetValue(TextColorProperty);
371 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
375 SetValue(TextColorProperty, value);
376 selectorData?.TextColor.UpdateIfNeeds(this, value);
377 NotifyPropertyChanged();
382 /// The PlaceholderTextColor property.
385 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
387 /// <since_tizen> 3 </since_tizen>
388 public Vector4 PlaceholderTextColor
392 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
393 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
397 SetValue(PlaceholderTextColorProperty, value);
398 selectorData?.PlaceholderTextColor.UpdateIfNeeds(this, value);
399 NotifyPropertyChanged();
404 /// The ShadowOffset property.
406 /// <since_tizen> 3 </since_tizen>
408 /// Deprecated.(API Level 6) Use Shadow instead.
409 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
411 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
412 public Vector2 ShadowOffset
416 PropertyMap map = new PropertyMap();
417 GetProperty(TextField.Property.SHADOW).Get(map);
418 Vector2 shadowOffset = new Vector2();
419 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
420 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
424 PropertyMap temp = new PropertyMap();
425 temp.Insert("offset", new PropertyValue(value));
426 SetValue(ShadowProperty, temp);
427 NotifyPropertyChanged();
432 /// The ShadowColor property.
434 /// <since_tizen> 3 </since_tizen>
436 /// Deprecated.(API Level 6) Use Shadow instead.
437 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
439 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
440 public Vector4 ShadowColor
444 PropertyMap map = new PropertyMap();
445 GetProperty(TextField.Property.SHADOW).Get(map);
446 Vector4 shadowColor = new Vector4();
447 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
448 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
452 PropertyMap temp = new PropertyMap();
453 temp.Insert("color", new PropertyValue(value));
454 SetValue(ShadowProperty, temp);
455 NotifyPropertyChanged();
460 /// The PrimaryCursorColor property.
463 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
465 /// <since_tizen> 3 </since_tizen>
466 public Vector4 PrimaryCursorColor
470 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
471 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
475 SetValue(PrimaryCursorColorProperty, value);
476 selectorData?.PrimaryCursorColor.UpdateIfNeeds(this, value);
477 NotifyPropertyChanged();
482 /// The SecondaryCursorColor property.
485 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
487 /// <since_tizen> 3 </since_tizen>
488 public Vector4 SecondaryCursorColor
492 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
493 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
497 SetValue(SecondaryCursorColorProperty, value);
498 NotifyPropertyChanged();
503 /// The EnableCursorBlink property.
505 /// <since_tizen> 3 </since_tizen>
506 public bool EnableCursorBlink
510 return (bool)GetValue(EnableCursorBlinkProperty);
514 SetValue(EnableCursorBlinkProperty, value);
515 NotifyPropertyChanged();
520 /// The CursorBlinkInterval property.
522 /// <since_tizen> 3 </since_tizen>
523 public float CursorBlinkInterval
527 return (float)GetValue(CursorBlinkIntervalProperty);
531 SetValue(CursorBlinkIntervalProperty, value);
532 NotifyPropertyChanged();
537 /// The CursorBlinkDuration property.
539 /// <since_tizen> 3 </since_tizen>
540 public float CursorBlinkDuration
544 return (float)GetValue(CursorBlinkDurationProperty);
548 SetValue(CursorBlinkDurationProperty, value);
549 NotifyPropertyChanged();
554 /// The CursorWidth property.
556 /// <since_tizen> 3 </since_tizen>
557 public int CursorWidth
561 return (int)GetValue(CursorWidthProperty);
565 SetValue(CursorWidthProperty, value);
566 NotifyPropertyChanged();
571 /// The GrabHandleImage property.
573 /// <since_tizen> 3 </since_tizen>
574 public string GrabHandleImage
578 return (string)GetValue(GrabHandleImageProperty);
582 SetValue(GrabHandleImageProperty, value);
583 NotifyPropertyChanged();
588 /// The GrabHandlePressedImage property.
590 /// <since_tizen> 3 </since_tizen>
591 public string GrabHandlePressedImage
595 return (string)GetValue(GrabHandlePressedImageProperty);
599 SetValue(GrabHandlePressedImageProperty, value);
600 NotifyPropertyChanged();
605 /// The ScrollThreshold property.
607 /// <since_tizen> 3 </since_tizen>
608 public float ScrollThreshold
612 return (float)GetValue(ScrollThresholdProperty);
616 SetValue(ScrollThresholdProperty, value);
617 NotifyPropertyChanged();
622 /// The ScrollSpeed property.
624 /// <since_tizen> 3 </since_tizen>
625 public float ScrollSpeed
629 return (float)GetValue(ScrollSpeedProperty);
633 SetValue(ScrollSpeedProperty, value);
634 NotifyPropertyChanged();
639 /// The SelectionHandleImageLeft property.
641 /// <since_tizen> 3 </since_tizen>
642 public PropertyMap SelectionHandleImageLeft
646 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
650 SetValue(SelectionHandleImageLeftProperty, value);
651 NotifyPropertyChanged();
656 /// The SelectionHandleImageRight property.
658 /// <since_tizen> 3 </since_tizen>
659 public PropertyMap SelectionHandleImageRight
663 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
667 SetValue(SelectionHandleImageRightProperty, value);
668 NotifyPropertyChanged();
673 /// The SelectionHandlePressedImageLeft property.
675 /// <since_tizen> 3 </since_tizen>
676 public PropertyMap SelectionHandlePressedImageLeft
680 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
684 SetValue(SelectionHandlePressedImageLeftProperty, value);
685 NotifyPropertyChanged();
690 /// The SelectionHandlePressedImageRight property.
692 /// <since_tizen> 3 </since_tizen>
693 public PropertyMap SelectionHandlePressedImageRight
697 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
701 SetValue(SelectionHandlePressedImageRightProperty, value);
702 NotifyPropertyChanged();
707 /// The SelectionHandleMarkerImageLeft property.
709 /// <since_tizen> 3 </since_tizen>
710 public PropertyMap SelectionHandleMarkerImageLeft
714 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
718 SetValue(SelectionHandleMarkerImageLeftProperty, value);
719 NotifyPropertyChanged();
724 /// The SelectionHandleMarkerImageRight property.
726 /// <since_tizen> 3 </since_tizen>
727 public PropertyMap SelectionHandleMarkerImageRight
731 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
735 SetValue(SelectionHandleMarkerImageRightProperty, value);
736 NotifyPropertyChanged();
741 /// The SelectionHighlightColor property.
744 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
746 /// <since_tizen> 3 </since_tizen>
747 public Vector4 SelectionHighlightColor
751 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
752 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
756 SetValue(SelectionHighlightColorProperty, value);
757 NotifyPropertyChanged();
762 /// The DecorationBoundingBox property.
765 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
767 /// <since_tizen> 3 </since_tizen>
768 public Rectangle DecorationBoundingBox
772 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
773 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
777 SetValue(DecorationBoundingBoxProperty, value);
778 NotifyPropertyChanged();
783 /// The InputMethodSettings property.
785 /// <since_tizen> 3 </since_tizen>
786 public PropertyMap InputMethodSettings
790 return (PropertyMap)GetValue(InputMethodSettingsProperty);
794 SetValue(InputMethodSettingsProperty, value);
795 NotifyPropertyChanged();
800 /// The InputColor property.
803 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
805 /// <since_tizen> 3 </since_tizen>
806 public Vector4 InputColor
810 Vector4 temp = (Vector4)GetValue(InputColorProperty);
811 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
815 SetValue(InputColorProperty, value);
816 NotifyPropertyChanged();
821 /// The EnableMarkup property.
823 /// <since_tizen> 3 </since_tizen>
824 public bool EnableMarkup
828 return (bool)GetValue(EnableMarkupProperty);
832 SetValue(EnableMarkupProperty, value);
833 NotifyPropertyChanged();
838 /// The InputFontFamily property.
840 /// <since_tizen> 3 </since_tizen>
841 public string InputFontFamily
845 return (string)GetValue(InputFontFamilyProperty);
849 SetValue(InputFontFamilyProperty, value);
850 NotifyPropertyChanged();
855 /// The InputFontStyle property.
857 /// <since_tizen> 3 </since_tizen>
858 public PropertyMap InputFontStyle
862 return (PropertyMap)GetValue(InputFontStyleProperty);
866 SetValue(InputFontStyleProperty, value);
867 NotifyPropertyChanged();
872 /// The InputPointSize property.
874 /// <since_tizen> 3 </since_tizen>
875 public float InputPointSize
879 return (float)GetValue(InputPointSizeProperty);
883 SetValue(InputPointSizeProperty, value);
884 NotifyPropertyChanged();
889 /// The Underline property.
891 /// <since_tizen> 3 </since_tizen>
892 public PropertyMap Underline
896 return (PropertyMap)GetValue(UnderlineProperty);
900 SetValue(UnderlineProperty, value);
901 NotifyPropertyChanged();
906 /// The InputUnderline property.
908 /// <since_tizen> 3 </since_tizen>
909 public string InputUnderline
913 return (string)GetValue(InputUnderlineProperty);
917 SetValue(InputUnderlineProperty, value);
918 NotifyPropertyChanged();
923 /// The Shadow property.
925 /// <since_tizen> 3 </since_tizen>
926 public PropertyMap Shadow
930 return (PropertyMap)GetValue(ShadowProperty);
934 SetValue(ShadowProperty, value);
935 NotifyPropertyChanged();
940 /// The InputShadow property.
942 /// <since_tizen> 3 </since_tizen>
943 public string InputShadow
947 return (string)GetValue(InputShadowProperty);
951 SetValue(InputShadowProperty, value);
952 NotifyPropertyChanged();
957 /// The Emboss property.
959 /// <since_tizen> 3 </since_tizen>
964 return (string)GetValue(EmbossProperty);
968 SetValue(EmbossProperty, value);
969 NotifyPropertyChanged();
974 /// The InputEmboss property.
976 /// <since_tizen> 3 </since_tizen>
977 public string InputEmboss
981 return (string)GetValue(InputEmbossProperty);
985 SetValue(InputEmbossProperty, value);
986 NotifyPropertyChanged();
991 /// The Outline property.
993 /// <since_tizen> 3 </since_tizen>
994 public PropertyMap Outline
998 return (PropertyMap)GetValue(OutlineProperty);
1002 SetValue(OutlineProperty, value);
1003 NotifyPropertyChanged();
1008 /// The InputOutline property.
1010 /// <since_tizen> 3 </since_tizen>
1011 public string InputOutline
1015 return (string)GetValue(InputOutlineProperty);
1019 SetValue(InputOutlineProperty, value);
1020 NotifyPropertyChanged();
1025 /// The HiddenInputSettings property.
1027 /// <since_tizen> 3 </since_tizen>
1028 public Tizen.NUI.PropertyMap HiddenInputSettings
1032 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1036 SetValue(HiddenInputSettingsProperty, value);
1037 NotifyPropertyChanged();
1042 /// The PixelSize property.
1044 /// <since_tizen> 3 </since_tizen>
1045 public float PixelSize
1049 return (float)GetValue(PixelSizeProperty);
1053 SetValue(PixelSizeProperty, value);
1054 NotifyPropertyChanged();
1059 /// The Enable selection property.
1061 /// <since_tizen> 3 </since_tizen>
1062 public bool EnableSelection
1066 return (bool)GetValue(EnableSelectionProperty);
1070 SetValue(EnableSelectionProperty, value);
1071 NotifyPropertyChanged();
1076 /// The Enable selection property.
1078 /// <since_tizen> 6 </since_tizen>
1079 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1080 [EditorBrowsable(EditorBrowsableState.Never)]
1081 public bool EnableGrabHandle
1085 return (bool)GetValue(EnableGrabHandleProperty);
1089 SetValue(EnableGrabHandleProperty, value);
1090 NotifyPropertyChanged();
1095 /// The Enable selection property.
1097 /// <since_tizen> 6 </since_tizen>
1098 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1099 [EditorBrowsable(EditorBrowsableState.Never)]
1100 public bool EnableGrabHandlePopup
1104 return (bool)GetValue(EnableGrabHandlePopupProperty);
1108 SetValue(EnableGrabHandlePopupProperty, value);
1109 NotifyPropertyChanged();
1114 /// The Selected Text property.
1116 /// <since_tizen> 8 </since_tizen>
1117 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1118 [EditorBrowsable(EditorBrowsableState.Never)]
1119 public string SelectedText
1124 GetProperty(TextField.Property.SELECTED_TEXT).Get(out temp);
1130 /// The Placeholder property.
1131 /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1134 /// The following example demonstrates how to set the Placeholder property.
1136 /// PropertyMap propertyMap = new PropertyMap();
1137 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1138 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1139 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1140 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1141 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1143 /// PropertyMap fontStyleMap = new PropertyMap();
1144 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1145 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1146 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1147 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1149 /// TextField field = new TextField();
1150 /// field.Placeholder = propertyMap;
1153 /// <since_tizen> 3 </since_tizen>
1154 public Tizen.NUI.PropertyMap Placeholder
1158 return (PropertyMap)GetValue(PlaceholderProperty);
1162 SetValue(PlaceholderProperty, value);
1163 NotifyPropertyChanged();
1168 /// The Ellipsis property.<br />
1169 /// Enable or disable the ellipsis.<br />
1170 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1172 /// <since_tizen> 4 </since_tizen>
1173 public bool Ellipsis
1177 return (bool)GetValue(EllipsisProperty);
1181 SetValue(EllipsisProperty, value);
1182 NotifyPropertyChanged();
1187 /// Enables selection of the text using the Shift key.
1189 /// <since_tizen> 5 </since_tizen>
1190 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1191 [EditorBrowsable(EditorBrowsableState.Never)]
1192 public bool EnableShiftSelection
1196 return (bool)GetValue(EnableShiftSelectionProperty);
1200 SetValue(EnableShiftSelectionProperty, value);
1201 NotifyPropertyChanged();
1206 /// The text alignment to match the direction of the system language.
1208 /// <since_tizen> 6 </since_tizen>
1209 public bool MatchSystemLanguageDirection
1213 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1217 SetValue(MatchSystemLanguageDirectionProperty, value);
1218 NotifyPropertyChanged();
1222 /// Only used by the IL of xaml, will never changed to not hidden.
1223 [EditorBrowsable(EditorBrowsableState.Never)]
1224 public override bool IsCreateByXaml
1228 return base.IsCreateByXaml;
1232 base.IsCreateByXaml = value;
1236 this.TextChanged += (obj, e) =>
1238 this.Text = this.Text;
1244 private TextFieldSelectorData SelectorData
1248 if (selectorData == null)
1250 selectorData = new TextFieldSelectorData();
1252 return selectorData;
1257 /// Get the InputMethodContext instance.
1259 /// <returns>The InputMethodContext instance.</returns>
1260 /// <since_tizen> 5 </since_tizen>
1261 public InputMethodContext GetInputMethodContext()
1263 if (inputMethodCotext == null)
1265 /*Avoid raising InputMethodContext reference count.*/
1266 inputMethodCotext = new InputMethodContext(Interop.TextField.TextField_GetInputMethodContext(swigCPtr), true);
1267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269 return inputMethodCotext;
1273 /// Select the whole text.
1275 /// <since_tizen> 6 </since_tizen>
1276 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1277 [EditorBrowsable(EditorBrowsableState.Never)]
1278 public void SelectWholeText()
1280 Interop.TextField.TextField_SelectWholeText(swigCPtr);
1281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1285 /// Clear selection of the text.
1287 /// <since_tizen> 8 </since_tizen>
1288 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1289 [EditorBrowsable(EditorBrowsableState.Never)]
1290 public void SelectNone()
1292 Interop.TextField.TextField_SelectNone(swigCPtr);
1293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1296 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1298 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1301 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1303 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);
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1311 /// <since_tizen> 3 </since_tizen>
1312 protected override void Dispose(DisposeTypes type)
1316 DisposeQueue.Instance.Add(this);
1320 if (type == DisposeTypes.Explicit)
1323 //Release your own managed resources here.
1324 //You should release all of your own disposable objects here.
1325 selectorData?.Reset(this);
1328 //Release your own unmanaged resources here.
1329 //You should not access any managed member here except static instance.
1330 //because the execution order of Finalizes is non-deterministic.
1333 if (_textFieldMaxLengthReachedCallbackDelegate != null)
1335 this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
1338 if (_textFieldTextChangedCallbackDelegate != null)
1340 TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
1347 /// This will not be public opened.
1348 [EditorBrowsable(EditorBrowsableState.Never)]
1349 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1351 // In order to speed up IME hide, temporarily add
1352 GetInputMethodContext()?.DestroyContext();
1353 Interop.TextField.delete_TextField(swigCPtr);
1356 private string SetTranslatable(string textFieldSid)
1358 string translatableText = null;
1359 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1360 if (translatableText != null)
1362 if (systemlangTextFlag == false)
1364 SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
1365 systemlangTextFlag = true;
1367 return translatableText;
1371 translatableText = "";
1372 return translatableText;
1376 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1378 if (textFieldTextSid != null)
1380 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1382 if (textFieldPlaceHolderTextSid != null)
1384 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1388 internal new class Property
1390 internal static readonly int TEXT = Interop.TextField.TextField_Property_TEXT_get();
1391 internal static readonly int PLACEHOLDER_TEXT = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_get();
1392 internal static readonly int PLACEHOLDER_TEXT_FOCUSED = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
1393 internal static readonly int FONT_FAMILY = Interop.TextField.TextField_Property_FONT_FAMILY_get();
1394 internal static readonly int FONT_STYLE = Interop.TextField.TextField_Property_FONT_STYLE_get();
1395 internal static readonly int POINT_SIZE = Interop.TextField.TextField_Property_POINT_SIZE_get();
1396 internal static readonly int MAX_LENGTH = Interop.TextField.TextField_Property_MAX_LENGTH_get();
1397 internal static readonly int EXCEED_POLICY = Interop.TextField.TextField_Property_EXCEED_POLICY_get();
1398 internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextField.TextField_Property_HORIZONTAL_ALIGNMENT_get();
1399 internal static readonly int VERTICAL_ALIGNMENT = Interop.TextField.TextField_Property_VERTICAL_ALIGNMENT_get();
1400 internal static readonly int TEXT_COLOR = Interop.TextField.TextField_Property_TEXT_COLOR_get();
1401 internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
1402 internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextField.TextField_Property_PRIMARY_CURSOR_COLOR_get();
1403 internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextField.TextField_Property_SECONDARY_CURSOR_COLOR_get();
1404 internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextField.TextField_Property_ENABLE_CURSOR_BLINK_get();
1405 internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextField.TextField_Property_CURSOR_BLINK_INTERVAL_get();
1406 internal static readonly int CURSOR_BLINK_DURATION = Interop.TextField.TextField_Property_CURSOR_BLINK_DURATION_get();
1407 internal static readonly int CURSOR_WIDTH = Interop.TextField.TextField_Property_CURSOR_WIDTH_get();
1408 internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_IMAGE_get();
1409 internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
1410 internal static readonly int SCROLL_THRESHOLD = Interop.TextField.TextField_Property_SCROLL_THRESHOLD_get();
1411 internal static readonly int SCROLL_SPEED = Interop.TextField.TextField_Property_SCROLL_SPEED_get();
1412 internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
1413 internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
1414 internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
1415 internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
1416 internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
1417 internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
1418 internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextField.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
1419 internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextField.TextField_Property_DECORATION_BOUNDING_BOX_get();
1420 internal static readonly int INPUT_METHOD_SETTINGS = Interop.TextField.TextField_Property_INPUT_METHOD_SETTINGS_get();
1421 internal static readonly int INPUT_COLOR = Interop.TextField.TextField_Property_INPUT_COLOR_get();
1422 internal static readonly int ENABLE_MARKUP = Interop.TextField.TextField_Property_ENABLE_MARKUP_get();
1423 internal static readonly int INPUT_FONT_FAMILY = Interop.TextField.TextField_Property_INPUT_FONT_FAMILY_get();
1424 internal static readonly int INPUT_FONT_STYLE = Interop.TextField.TextField_Property_INPUT_FONT_STYLE_get();
1425 internal static readonly int INPUT_POINT_SIZE = Interop.TextField.TextField_Property_INPUT_POINT_SIZE_get();
1426 internal static readonly int UNDERLINE = Interop.TextField.TextField_Property_UNDERLINE_get();
1427 internal static readonly int INPUT_UNDERLINE = Interop.TextField.TextField_Property_INPUT_UNDERLINE_get();
1428 internal static readonly int SHADOW = Interop.TextField.TextField_Property_SHADOW_get();
1429 internal static readonly int INPUT_SHADOW = Interop.TextField.TextField_Property_INPUT_SHADOW_get();
1430 internal static readonly int EMBOSS = Interop.TextField.TextField_Property_EMBOSS_get();
1431 internal static readonly int INPUT_EMBOSS = Interop.TextField.TextField_Property_INPUT_EMBOSS_get();
1432 internal static readonly int OUTLINE = Interop.TextField.TextField_Property_OUTLINE_get();
1433 internal static readonly int INPUT_OUTLINE = Interop.TextField.TextField_Property_INPUT_OUTLINE_get();
1434 internal static readonly int HIDDEN_INPUT_SETTINGS = Interop.TextField.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
1435 internal static readonly int PIXEL_SIZE = Interop.TextField.TextField_Property_PIXEL_SIZE_get();
1436 internal static readonly int ENABLE_SELECTION = Interop.TextField.TextField_Property_ENABLE_SELECTION_get();
1437 internal static readonly int PLACEHOLDER = Interop.TextField.TextField_Property_PLACEHOLDER_get();
1438 internal static readonly int ELLIPSIS = Interop.TextField.TextField_Property_ELLIPSIS_get();
1439 internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextField.TextField_Property_ENABLE_SHIFT_SELECTION_get();
1440 internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextField.TextField_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1441 internal static readonly int ENABLE_GRAB_HANDLE = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_get();
1442 internal static readonly int ENABLE_GRAB_HANDLE_POPUP = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_POPUP_get();
1443 internal static readonly int SELECTED_TEXT = Interop.TextField.TextField_Property_SELECTED_TEXT_get();
1446 internal class InputStyle
1452 FontFamily = 0x0002,
1462 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1464 DecorationBoundingBox = new Rectangle(x, y, width, height);
1466 private void OnInputColorChanged(float x, float y, float z, float w)
1468 InputColor = new Vector4(x, y, z, w);
1470 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1472 PlaceholderTextColor = new Vector4(r, g, b, a);
1474 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1476 PrimaryCursorColor = new Vector4(x, y, z, w);
1478 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1480 SecondaryCursorColor = new Vector4(x, y, z, w);
1482 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1484 SelectionHighlightColor = new Vector4(x, y, z, w);
1486 private void OnShadowColorChanged(float x, float y, float z, float w)
1488 ShadowColor = new Vector4(x, y, z, w);
1490 private void OnShadowOffsetChanged(float x, float y)
1492 ShadowOffset = new Vector2(x, y);
1494 private void OnTextColorChanged(float r, float g, float b, float a)
1496 TextColor = new Color(r, g, b, a);