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)
87 ApplyStyle(ThemeManager.GetStyle(nameof(TextField)));
95 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105 internal enum ExceedPolicyType
107 ExceedPolicyOriginal,
112 /// The TranslatableText property.<br />
113 /// The text can set the SID value.<br />
115 /// <exception cref='ArgumentNullException'>
116 /// ResourceManager about multilingual is null.
118 /// <since_tizen> 4 </since_tizen>
119 public string TranslatableText
123 return (string)GetValue(TranslatableTextProperty);
127 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
128 SetValue(TranslatableTextProperty, value);
131 private string translatableText
135 return textFieldTextSid;
139 if (NUIApplication.MultilingualResourceManager == null)
141 throw new ArgumentNullException("ResourceManager about multilingual is null");
143 textFieldTextSid = value;
144 Text = SetTranslatable(textFieldTextSid);
145 NotifyPropertyChanged();
150 /// The TranslatablePlaceholderText property.<br />
151 /// The text can set the SID value.<br />
153 /// <exception cref='ArgumentNullException'>
154 /// ResourceManager about multilingual is null.
156 /// <since_tizen> 4 </since_tizen>
157 public string TranslatablePlaceholderText
161 return (string)GetValue(TranslatablePlaceholderTextProperty);
165 SetValue(TranslatablePlaceholderTextProperty, value);
166 selectorData?.TranslatablePlaceholderText.UpdateIfNeeds(this, value);
169 private string translatablePlaceholderText
173 return textFieldPlaceHolderTextSid;
177 if (NUIApplication.MultilingualResourceManager == null)
179 throw new ArgumentNullException("ResourceManager about multilingual is null");
181 textFieldPlaceHolderTextSid = value;
182 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
183 NotifyPropertyChanged();
188 /// The Text property.
190 /// <since_tizen> 3 </since_tizen>
195 return (string)GetValue(TextProperty);
199 SetValueAndForceSendChangeSignal(TextProperty, value);
200 selectorData?.Text.UpdateIfNeeds(this, value);
201 NotifyPropertyChanged();
206 /// The PlaceholderText property.
208 /// <since_tizen> 3 </since_tizen>
209 public string PlaceholderText
213 return (string)GetValue(PlaceholderTextProperty);
217 SetValue(PlaceholderTextProperty, value);
218 NotifyPropertyChanged();
223 /// The PlaceholderTextFocused property.
225 /// <since_tizen> 3 </since_tizen>
226 public string PlaceholderTextFocused
230 return (string)GetValue(PlaceholderTextFocusedProperty);
234 SetValue(PlaceholderTextFocusedProperty, value);
235 NotifyPropertyChanged();
240 /// The FontFamily property.
242 /// <since_tizen> 3 </since_tizen>
243 public string FontFamily
247 return (string)GetValue(FontFamilyProperty);
251 SetValue(FontFamilyProperty, value);
252 selectorData?.FontFamily.UpdateIfNeeds(this, value);
253 NotifyPropertyChanged();
258 /// The FontStyle property.
260 /// <since_tizen> 3 </since_tizen>
261 public PropertyMap FontStyle
265 return (PropertyMap)GetValue(FontStyleProperty);
269 SetValue(FontStyleProperty, value);
270 NotifyPropertyChanged();
275 /// The PointSize property.
277 /// <since_tizen> 3 </since_tizen>
278 public float PointSize
282 return (float)GetValue(PointSizeProperty);
286 SetValue(PointSizeProperty, value);
287 selectorData?.PointSize.UpdateIfNeeds(this, value);
288 NotifyPropertyChanged();
293 /// The MaxLength property.
295 /// <since_tizen> 3 </since_tizen>
300 return (int)GetValue(MaxLengthProperty);
304 SetValue(MaxLengthProperty, value);
305 NotifyPropertyChanged();
310 /// The ExceedPolicy property.
312 /// <since_tizen> 3 </since_tizen>
313 public int ExceedPolicy
317 return (int)GetValue(ExceedPolicyProperty);
321 SetValue(ExceedPolicyProperty, value);
322 NotifyPropertyChanged();
327 /// The HorizontalAlignment property.
329 /// <since_tizen> 3 </since_tizen>
330 public HorizontalAlignment HorizontalAlignment
334 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
338 SetValue(HorizontalAlignmentProperty, value);
339 NotifyPropertyChanged();
344 /// The VerticalAlignment property.
346 /// <since_tizen> 3 </since_tizen>
347 public VerticalAlignment VerticalAlignment
351 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
355 SetValue(VerticalAlignmentProperty, value);
356 NotifyPropertyChanged();
357 NotifyPropertyChanged();
362 /// The TextColor property.
365 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
367 /// <since_tizen> 3 </since_tizen>
368 public Color TextColor
372 Color temp = (Color)GetValue(TextColorProperty);
373 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
377 SetValue(TextColorProperty, value);
378 selectorData?.TextColor.UpdateIfNeeds(this, value);
379 NotifyPropertyChanged();
384 /// The PlaceholderTextColor property.
387 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
389 /// <since_tizen> 3 </since_tizen>
390 public Vector4 PlaceholderTextColor
394 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
395 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
399 SetValue(PlaceholderTextColorProperty, value);
400 selectorData?.PlaceholderTextColor.UpdateIfNeeds(this, value);
401 NotifyPropertyChanged();
406 /// The ShadowOffset property.
408 /// <since_tizen> 3 </since_tizen>
410 /// Deprecated.(API Level 6) Use Shadow instead.
411 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
413 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
414 public Vector2 ShadowOffset
418 PropertyMap map = new PropertyMap();
419 GetProperty(TextField.Property.SHADOW).Get(map);
420 Vector2 shadowOffset = new Vector2();
421 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
422 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
426 PropertyMap temp = new PropertyMap();
427 temp.Insert("offset", new PropertyValue(value));
428 SetValue(ShadowProperty, temp);
429 NotifyPropertyChanged();
434 /// The ShadowColor property.
436 /// <since_tizen> 3 </since_tizen>
438 /// Deprecated.(API Level 6) Use Shadow instead.
439 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
441 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
442 public Vector4 ShadowColor
446 PropertyMap map = new PropertyMap();
447 GetProperty(TextField.Property.SHADOW).Get(map);
448 Vector4 shadowColor = new Vector4();
449 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
450 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
454 PropertyMap temp = new PropertyMap();
455 temp.Insert("color", new PropertyValue(value));
456 SetValue(ShadowProperty, temp);
457 NotifyPropertyChanged();
462 /// The PrimaryCursorColor property.
465 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
467 /// <since_tizen> 3 </since_tizen>
468 public Vector4 PrimaryCursorColor
472 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
473 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
477 SetValue(PrimaryCursorColorProperty, value);
478 selectorData?.PrimaryCursorColor.UpdateIfNeeds(this, value);
479 NotifyPropertyChanged();
484 /// The SecondaryCursorColor property.
487 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
489 /// <since_tizen> 3 </since_tizen>
490 public Vector4 SecondaryCursorColor
494 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
495 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
499 SetValue(SecondaryCursorColorProperty, value);
500 NotifyPropertyChanged();
505 /// The EnableCursorBlink property.
507 /// <since_tizen> 3 </since_tizen>
508 public bool EnableCursorBlink
512 return (bool)GetValue(EnableCursorBlinkProperty);
516 SetValue(EnableCursorBlinkProperty, value);
517 NotifyPropertyChanged();
522 /// The CursorBlinkInterval property.
524 /// <since_tizen> 3 </since_tizen>
525 public float CursorBlinkInterval
529 return (float)GetValue(CursorBlinkIntervalProperty);
533 SetValue(CursorBlinkIntervalProperty, value);
534 NotifyPropertyChanged();
539 /// The CursorBlinkDuration property.
541 /// <since_tizen> 3 </since_tizen>
542 public float CursorBlinkDuration
546 return (float)GetValue(CursorBlinkDurationProperty);
550 SetValue(CursorBlinkDurationProperty, value);
551 NotifyPropertyChanged();
556 /// The CursorWidth property.
558 /// <since_tizen> 3 </since_tizen>
559 public int CursorWidth
563 return (int)GetValue(CursorWidthProperty);
567 SetValue(CursorWidthProperty, value);
568 NotifyPropertyChanged();
573 /// The GrabHandleImage property.
575 /// <since_tizen> 3 </since_tizen>
576 public string GrabHandleImage
580 return (string)GetValue(GrabHandleImageProperty);
584 SetValue(GrabHandleImageProperty, value);
585 NotifyPropertyChanged();
590 /// The GrabHandlePressedImage property.
592 /// <since_tizen> 3 </since_tizen>
593 public string GrabHandlePressedImage
597 return (string)GetValue(GrabHandlePressedImageProperty);
601 SetValue(GrabHandlePressedImageProperty, value);
602 NotifyPropertyChanged();
607 /// The ScrollThreshold property.
609 /// <since_tizen> 3 </since_tizen>
610 public float ScrollThreshold
614 return (float)GetValue(ScrollThresholdProperty);
618 SetValue(ScrollThresholdProperty, value);
619 NotifyPropertyChanged();
624 /// The ScrollSpeed property.
626 /// <since_tizen> 3 </since_tizen>
627 public float ScrollSpeed
631 return (float)GetValue(ScrollSpeedProperty);
635 SetValue(ScrollSpeedProperty, value);
636 NotifyPropertyChanged();
641 /// The SelectionHandleImageLeft property.
643 /// <since_tizen> 3 </since_tizen>
644 public PropertyMap SelectionHandleImageLeft
648 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
652 SetValue(SelectionHandleImageLeftProperty, value);
653 NotifyPropertyChanged();
658 /// The SelectionHandleImageRight property.
660 /// <since_tizen> 3 </since_tizen>
661 public PropertyMap SelectionHandleImageRight
665 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
669 SetValue(SelectionHandleImageRightProperty, value);
670 NotifyPropertyChanged();
675 /// The SelectionHandlePressedImageLeft property.
677 /// <since_tizen> 3 </since_tizen>
678 public PropertyMap SelectionHandlePressedImageLeft
682 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
686 SetValue(SelectionHandlePressedImageLeftProperty, value);
687 NotifyPropertyChanged();
692 /// The SelectionHandlePressedImageRight property.
694 /// <since_tizen> 3 </since_tizen>
695 public PropertyMap SelectionHandlePressedImageRight
699 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
703 SetValue(SelectionHandlePressedImageRightProperty, value);
704 NotifyPropertyChanged();
709 /// The SelectionHandleMarkerImageLeft property.
711 /// <since_tizen> 3 </since_tizen>
712 public PropertyMap SelectionHandleMarkerImageLeft
716 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
720 SetValue(SelectionHandleMarkerImageLeftProperty, value);
721 NotifyPropertyChanged();
726 /// The SelectionHandleMarkerImageRight property.
728 /// <since_tizen> 3 </since_tizen>
729 public PropertyMap SelectionHandleMarkerImageRight
733 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
737 SetValue(SelectionHandleMarkerImageRightProperty, value);
738 NotifyPropertyChanged();
743 /// The SelectionHighlightColor property.
746 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
748 /// <since_tizen> 3 </since_tizen>
749 public Vector4 SelectionHighlightColor
753 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
754 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
758 SetValue(SelectionHighlightColorProperty, value);
759 NotifyPropertyChanged();
764 /// The DecorationBoundingBox property.
767 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
769 /// <since_tizen> 3 </since_tizen>
770 public Rectangle DecorationBoundingBox
774 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
775 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
779 SetValue(DecorationBoundingBoxProperty, value);
780 NotifyPropertyChanged();
785 /// The InputMethodSettings property.
787 /// <since_tizen> 3 </since_tizen>
788 public PropertyMap InputMethodSettings
792 return (PropertyMap)GetValue(InputMethodSettingsProperty);
796 SetValue(InputMethodSettingsProperty, value);
797 NotifyPropertyChanged();
802 /// The InputColor property.
805 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
807 /// <since_tizen> 3 </since_tizen>
808 public Vector4 InputColor
812 Vector4 temp = (Vector4)GetValue(InputColorProperty);
813 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
817 SetValue(InputColorProperty, value);
818 NotifyPropertyChanged();
823 /// The EnableMarkup property.
825 /// <since_tizen> 3 </since_tizen>
826 public bool EnableMarkup
830 return (bool)GetValue(EnableMarkupProperty);
834 SetValue(EnableMarkupProperty, value);
835 NotifyPropertyChanged();
840 /// The InputFontFamily property.
842 /// <since_tizen> 3 </since_tizen>
843 public string InputFontFamily
847 return (string)GetValue(InputFontFamilyProperty);
851 SetValue(InputFontFamilyProperty, value);
852 NotifyPropertyChanged();
857 /// The InputFontStyle property.
859 /// <since_tizen> 3 </since_tizen>
860 public PropertyMap InputFontStyle
864 return (PropertyMap)GetValue(InputFontStyleProperty);
868 SetValue(InputFontStyleProperty, value);
869 NotifyPropertyChanged();
874 /// The InputPointSize property.
876 /// <since_tizen> 3 </since_tizen>
877 public float InputPointSize
881 return (float)GetValue(InputPointSizeProperty);
885 SetValue(InputPointSizeProperty, value);
886 NotifyPropertyChanged();
891 /// The Underline property.
893 /// <since_tizen> 3 </since_tizen>
894 public PropertyMap Underline
898 return (PropertyMap)GetValue(UnderlineProperty);
902 SetValue(UnderlineProperty, value);
903 NotifyPropertyChanged();
908 /// The InputUnderline property.
910 /// <since_tizen> 3 </since_tizen>
911 public string InputUnderline
915 return (string)GetValue(InputUnderlineProperty);
919 SetValue(InputUnderlineProperty, value);
920 NotifyPropertyChanged();
925 /// The Shadow property.
927 /// <since_tizen> 3 </since_tizen>
928 public PropertyMap Shadow
932 return (PropertyMap)GetValue(ShadowProperty);
936 SetValue(ShadowProperty, value);
937 NotifyPropertyChanged();
942 /// The InputShadow property.
944 /// <since_tizen> 3 </since_tizen>
945 public string InputShadow
949 return (string)GetValue(InputShadowProperty);
953 SetValue(InputShadowProperty, value);
954 NotifyPropertyChanged();
959 /// The Emboss property.
961 /// <since_tizen> 3 </since_tizen>
966 return (string)GetValue(EmbossProperty);
970 SetValue(EmbossProperty, value);
971 NotifyPropertyChanged();
976 /// The InputEmboss property.
978 /// <since_tizen> 3 </since_tizen>
979 public string InputEmboss
983 return (string)GetValue(InputEmbossProperty);
987 SetValue(InputEmbossProperty, value);
988 NotifyPropertyChanged();
993 /// The Outline property.
995 /// <since_tizen> 3 </since_tizen>
996 public PropertyMap Outline
1000 return (PropertyMap)GetValue(OutlineProperty);
1004 SetValue(OutlineProperty, value);
1005 NotifyPropertyChanged();
1010 /// The InputOutline property.
1012 /// <since_tizen> 3 </since_tizen>
1013 public string InputOutline
1017 return (string)GetValue(InputOutlineProperty);
1021 SetValue(InputOutlineProperty, value);
1022 NotifyPropertyChanged();
1027 /// The HiddenInputSettings property.
1029 /// <since_tizen> 3 </since_tizen>
1030 public Tizen.NUI.PropertyMap HiddenInputSettings
1034 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1038 SetValue(HiddenInputSettingsProperty, value);
1039 NotifyPropertyChanged();
1044 /// The PixelSize property.
1046 /// <since_tizen> 3 </since_tizen>
1047 public float PixelSize
1051 return (float)GetValue(PixelSizeProperty);
1055 SetValue(PixelSizeProperty, value);
1056 NotifyPropertyChanged();
1061 /// The Enable selection property.
1063 /// <since_tizen> 3 </since_tizen>
1064 public bool EnableSelection
1068 return (bool)GetValue(EnableSelectionProperty);
1072 SetValue(EnableSelectionProperty, value);
1073 NotifyPropertyChanged();
1078 /// The Enable selection property.
1080 /// <since_tizen> 6 </since_tizen>
1081 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1082 [EditorBrowsable(EditorBrowsableState.Never)]
1083 public bool EnableGrabHandle
1087 return (bool)GetValue(EnableGrabHandleProperty);
1091 SetValue(EnableGrabHandleProperty, value);
1092 NotifyPropertyChanged();
1097 /// The Enable selection property.
1099 /// <since_tizen> 6 </since_tizen>
1100 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1101 [EditorBrowsable(EditorBrowsableState.Never)]
1102 public bool EnableGrabHandlePopup
1106 return (bool)GetValue(EnableGrabHandlePopupProperty);
1110 SetValue(EnableGrabHandlePopupProperty, value);
1111 NotifyPropertyChanged();
1116 /// The Selected Text property.
1118 /// <since_tizen> 8 </since_tizen>
1119 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1120 [EditorBrowsable(EditorBrowsableState.Never)]
1121 public string SelectedText
1126 GetProperty(TextField.Property.SELECTED_TEXT).Get(out temp);
1132 /// The Placeholder property.
1133 /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1136 /// The following example demonstrates how to set the Placeholder property.
1138 /// PropertyMap propertyMap = new PropertyMap();
1139 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1140 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1141 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1142 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1143 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1145 /// PropertyMap fontStyleMap = new PropertyMap();
1146 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1147 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1148 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1149 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1151 /// TextField field = new TextField();
1152 /// field.Placeholder = propertyMap;
1155 /// <since_tizen> 3 </since_tizen>
1156 public Tizen.NUI.PropertyMap Placeholder
1160 return (PropertyMap)GetValue(PlaceholderProperty);
1164 SetValue(PlaceholderProperty, value);
1165 NotifyPropertyChanged();
1170 /// The Ellipsis property.<br />
1171 /// Enable or disable the ellipsis.<br />
1172 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1174 /// <since_tizen> 4 </since_tizen>
1175 public bool Ellipsis
1179 return (bool)GetValue(EllipsisProperty);
1183 SetValue(EllipsisProperty, value);
1184 NotifyPropertyChanged();
1189 /// Enables selection of the text using the Shift key.
1191 /// <since_tizen> 5 </since_tizen>
1192 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1193 [EditorBrowsable(EditorBrowsableState.Never)]
1194 public bool EnableShiftSelection
1198 return (bool)GetValue(EnableShiftSelectionProperty);
1202 SetValue(EnableShiftSelectionProperty, value);
1203 NotifyPropertyChanged();
1208 /// The text alignment to match the direction of the system language.
1210 /// <since_tizen> 6 </since_tizen>
1211 public bool MatchSystemLanguageDirection
1215 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1219 SetValue(MatchSystemLanguageDirectionProperty, value);
1220 NotifyPropertyChanged();
1224 /// Only used by the IL of xaml, will never changed to not hidden.
1225 [EditorBrowsable(EditorBrowsableState.Never)]
1226 public override bool IsCreateByXaml
1230 return base.IsCreateByXaml;
1234 base.IsCreateByXaml = value;
1238 this.TextChanged += (obj, e) =>
1240 this.Text = this.Text;
1246 private TextFieldSelectorData SelectorData
1250 if (selectorData == null)
1252 selectorData = new TextFieldSelectorData();
1254 return selectorData;
1259 /// Get the InputMethodContext instance.
1261 /// <returns>The InputMethodContext instance.</returns>
1262 /// <since_tizen> 5 </since_tizen>
1263 public InputMethodContext GetInputMethodContext()
1265 if (inputMethodCotext == null)
1267 /*Avoid raising InputMethodContext reference count.*/
1268 inputMethodCotext = new InputMethodContext(Interop.TextField.TextField_GetInputMethodContext(swigCPtr), true);
1269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1271 return inputMethodCotext;
1275 /// Select the whole text.
1277 /// <since_tizen> 6 </since_tizen>
1278 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1279 [EditorBrowsable(EditorBrowsableState.Never)]
1280 public void SelectWholeText()
1282 Interop.TextField.TextField_SelectWholeText(swigCPtr);
1283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1287 /// Clear selection of the text.
1289 /// <since_tizen> 8 </since_tizen>
1290 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1291 [EditorBrowsable(EditorBrowsableState.Never)]
1292 public void SelectNone()
1294 Interop.TextField.TextField_SelectNone(swigCPtr);
1295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1298 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1300 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1303 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1305 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);
1306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1313 /// <since_tizen> 3 </since_tizen>
1314 protected override void Dispose(DisposeTypes type)
1318 DisposeQueue.Instance.Add(this);
1322 if (type == DisposeTypes.Explicit)
1325 //Release your own managed resources here.
1326 //You should release all of your own disposable objects here.
1327 selectorData?.Reset(this);
1330 //Release your own unmanaged resources here.
1331 //You should not access any managed member here except static instance.
1332 //because the execution order of Finalizes is non-deterministic.
1335 if (_textFieldMaxLengthReachedCallbackDelegate != null)
1337 this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
1340 if (_textFieldTextChangedCallbackDelegate != null)
1342 TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
1349 /// This will not be public opened.
1350 [EditorBrowsable(EditorBrowsableState.Never)]
1351 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1353 // In order to speed up IME hide, temporarily add
1354 GetInputMethodContext()?.DestroyContext();
1355 Interop.TextField.delete_TextField(swigCPtr);
1358 private string SetTranslatable(string textFieldSid)
1360 string translatableText = null;
1361 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1362 if (translatableText != null)
1364 if (systemlangTextFlag == false)
1366 SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
1367 systemlangTextFlag = true;
1369 return translatableText;
1373 translatableText = "";
1374 return translatableText;
1378 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1380 if (textFieldTextSid != null)
1382 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1384 if (textFieldPlaceHolderTextSid != null)
1386 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1390 internal new class Property
1392 internal static readonly int TEXT = Interop.TextField.TextField_Property_TEXT_get();
1393 internal static readonly int PLACEHOLDER_TEXT = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_get();
1394 internal static readonly int PLACEHOLDER_TEXT_FOCUSED = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
1395 internal static readonly int FONT_FAMILY = Interop.TextField.TextField_Property_FONT_FAMILY_get();
1396 internal static readonly int FONT_STYLE = Interop.TextField.TextField_Property_FONT_STYLE_get();
1397 internal static readonly int POINT_SIZE = Interop.TextField.TextField_Property_POINT_SIZE_get();
1398 internal static readonly int MAX_LENGTH = Interop.TextField.TextField_Property_MAX_LENGTH_get();
1399 internal static readonly int EXCEED_POLICY = Interop.TextField.TextField_Property_EXCEED_POLICY_get();
1400 internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextField.TextField_Property_HORIZONTAL_ALIGNMENT_get();
1401 internal static readonly int VERTICAL_ALIGNMENT = Interop.TextField.TextField_Property_VERTICAL_ALIGNMENT_get();
1402 internal static readonly int TEXT_COLOR = Interop.TextField.TextField_Property_TEXT_COLOR_get();
1403 internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
1404 internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextField.TextField_Property_PRIMARY_CURSOR_COLOR_get();
1405 internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextField.TextField_Property_SECONDARY_CURSOR_COLOR_get();
1406 internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextField.TextField_Property_ENABLE_CURSOR_BLINK_get();
1407 internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextField.TextField_Property_CURSOR_BLINK_INTERVAL_get();
1408 internal static readonly int CURSOR_BLINK_DURATION = Interop.TextField.TextField_Property_CURSOR_BLINK_DURATION_get();
1409 internal static readonly int CURSOR_WIDTH = Interop.TextField.TextField_Property_CURSOR_WIDTH_get();
1410 internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_IMAGE_get();
1411 internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
1412 internal static readonly int SCROLL_THRESHOLD = Interop.TextField.TextField_Property_SCROLL_THRESHOLD_get();
1413 internal static readonly int SCROLL_SPEED = Interop.TextField.TextField_Property_SCROLL_SPEED_get();
1414 internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
1415 internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
1416 internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
1417 internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
1418 internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
1419 internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
1420 internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextField.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
1421 internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextField.TextField_Property_DECORATION_BOUNDING_BOX_get();
1422 internal static readonly int INPUT_METHOD_SETTINGS = Interop.TextField.TextField_Property_INPUT_METHOD_SETTINGS_get();
1423 internal static readonly int INPUT_COLOR = Interop.TextField.TextField_Property_INPUT_COLOR_get();
1424 internal static readonly int ENABLE_MARKUP = Interop.TextField.TextField_Property_ENABLE_MARKUP_get();
1425 internal static readonly int INPUT_FONT_FAMILY = Interop.TextField.TextField_Property_INPUT_FONT_FAMILY_get();
1426 internal static readonly int INPUT_FONT_STYLE = Interop.TextField.TextField_Property_INPUT_FONT_STYLE_get();
1427 internal static readonly int INPUT_POINT_SIZE = Interop.TextField.TextField_Property_INPUT_POINT_SIZE_get();
1428 internal static readonly int UNDERLINE = Interop.TextField.TextField_Property_UNDERLINE_get();
1429 internal static readonly int INPUT_UNDERLINE = Interop.TextField.TextField_Property_INPUT_UNDERLINE_get();
1430 internal static readonly int SHADOW = Interop.TextField.TextField_Property_SHADOW_get();
1431 internal static readonly int INPUT_SHADOW = Interop.TextField.TextField_Property_INPUT_SHADOW_get();
1432 internal static readonly int EMBOSS = Interop.TextField.TextField_Property_EMBOSS_get();
1433 internal static readonly int INPUT_EMBOSS = Interop.TextField.TextField_Property_INPUT_EMBOSS_get();
1434 internal static readonly int OUTLINE = Interop.TextField.TextField_Property_OUTLINE_get();
1435 internal static readonly int INPUT_OUTLINE = Interop.TextField.TextField_Property_INPUT_OUTLINE_get();
1436 internal static readonly int HIDDEN_INPUT_SETTINGS = Interop.TextField.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
1437 internal static readonly int PIXEL_SIZE = Interop.TextField.TextField_Property_PIXEL_SIZE_get();
1438 internal static readonly int ENABLE_SELECTION = Interop.TextField.TextField_Property_ENABLE_SELECTION_get();
1439 internal static readonly int PLACEHOLDER = Interop.TextField.TextField_Property_PLACEHOLDER_get();
1440 internal static readonly int ELLIPSIS = Interop.TextField.TextField_Property_ELLIPSIS_get();
1441 internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextField.TextField_Property_ENABLE_SHIFT_SELECTION_get();
1442 internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextField.TextField_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1443 internal static readonly int ENABLE_GRAB_HANDLE = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_get();
1444 internal static readonly int ENABLE_GRAB_HANDLE_POPUP = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_POPUP_get();
1445 internal static readonly int SELECTED_TEXT = Interop.TextField.TextField_Property_SELECTED_TEXT_get();
1448 internal class InputStyle
1454 FontFamily = 0x0002,
1464 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1466 DecorationBoundingBox = new Rectangle(x, y, width, height);
1468 private void OnInputColorChanged(float x, float y, float z, float w)
1470 InputColor = new Vector4(x, y, z, w);
1472 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1474 PlaceholderTextColor = new Vector4(r, g, b, a);
1476 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1478 PrimaryCursorColor = new Vector4(x, y, z, w);
1480 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1482 SecondaryCursorColor = new Vector4(x, y, z, w);
1484 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1486 SelectionHighlightColor = new Vector4(x, y, z, w);
1488 private void OnShadowColorChanged(float x, float y, float z, float w)
1490 ShadowColor = new Vector4(x, y, z, w);
1492 private void OnShadowOffsetChanged(float x, float y)
1494 ShadowOffset = new Vector2(x, y);
1496 private void OnTextColorChanged(float r, float g, float b, float a)
1498 TextColor = new Color(r, g, b, a);