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() { }
42 /// Creates the TextField control.
44 /// <since_tizen> 3 </since_tizen>
45 public TextField() : this(Interop.TextField.New(), true)
47 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51 /// Creates the TextField with setting the status of shown or hidden.
53 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
54 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public TextField(bool shown) : this(Interop.TextField.New(), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// Get attribues, it is abstract function and must be override.
65 /// <since_tizen> 6 </since_tizen>
66 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 protected override ViewStyle GetViewStyle()
70 return new TextFieldStyle();
73 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextField.Upcast(cPtr), cMemoryOwn, viewStyle)
81 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.Upcast(cPtr), cMemoryOwn, null)
89 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 internal enum ExceedPolicyType
101 ExceedPolicyOriginal,
106 /// The TranslatableText property.<br />
107 /// The text can set the SID value.<br />
109 /// <exception cref='ArgumentNullException'>
110 /// ResourceManager about multilingual is null.
112 /// <since_tizen> 4 </since_tizen>
113 public string TranslatableText
117 return (string)GetValue(TranslatableTextProperty);
121 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
122 SetValue(TranslatableTextProperty, value);
125 private string translatableText
129 return textFieldTextSid;
133 if (NUIApplication.MultilingualResourceManager == null)
135 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
137 textFieldTextSid = value;
138 Text = SetTranslatable(textFieldTextSid);
139 NotifyPropertyChanged();
144 /// The TranslatablePlaceholderText property.<br />
145 /// The text can set the SID value.<br />
147 /// <exception cref='ArgumentNullException'>
148 /// ResourceManager about multilingual is null.
150 /// <since_tizen> 4 </since_tizen>
151 public string TranslatablePlaceholderText
155 return (string)GetValue(TranslatablePlaceholderTextProperty);
159 SetValue(TranslatablePlaceholderTextProperty, value);
160 selectorData?.TranslatablePlaceholderText.UpdateIfNeeds(this, value);
163 private string translatablePlaceholderText
167 return textFieldPlaceHolderTextSid;
171 if (NUIApplication.MultilingualResourceManager == null)
173 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
175 textFieldPlaceHolderTextSid = value;
176 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
177 NotifyPropertyChanged();
182 /// The Text property.
184 /// <since_tizen> 3 </since_tizen>
189 return (string)GetValue(TextProperty);
193 SetValueAndForceSendChangeSignal(TextProperty, value);
194 selectorData?.Text.UpdateIfNeeds(this, value);
195 NotifyPropertyChanged();
200 /// The PlaceholderText property.
202 /// <since_tizen> 3 </since_tizen>
203 public string PlaceholderText
207 return (string)GetValue(PlaceholderTextProperty);
211 SetValue(PlaceholderTextProperty, value);
212 NotifyPropertyChanged();
217 /// The PlaceholderTextFocused property.
219 /// <since_tizen> 3 </since_tizen>
220 public string PlaceholderTextFocused
224 return (string)GetValue(PlaceholderTextFocusedProperty);
228 SetValue(PlaceholderTextFocusedProperty, value);
229 NotifyPropertyChanged();
234 /// The FontFamily property.
236 /// <since_tizen> 3 </since_tizen>
237 public string FontFamily
241 return (string)GetValue(FontFamilyProperty);
245 SetValue(FontFamilyProperty, value);
246 selectorData?.FontFamily.UpdateIfNeeds(this, value);
247 NotifyPropertyChanged();
252 /// The FontStyle property.
254 /// <since_tizen> 3 </since_tizen>
255 public PropertyMap FontStyle
259 return (PropertyMap)GetValue(FontStyleProperty);
263 SetValue(FontStyleProperty, value);
264 NotifyPropertyChanged();
269 /// The PointSize property.
271 /// <since_tizen> 3 </since_tizen>
272 public float PointSize
276 return (float)GetValue(PointSizeProperty);
280 SetValue(PointSizeProperty, value);
281 selectorData?.PointSize.UpdateIfNeeds(this, value);
282 NotifyPropertyChanged();
287 /// The MaxLength property.
289 /// <since_tizen> 3 </since_tizen>
294 return (int)GetValue(MaxLengthProperty);
298 SetValue(MaxLengthProperty, value);
299 NotifyPropertyChanged();
304 /// The ExceedPolicy property.
306 /// <since_tizen> 3 </since_tizen>
307 public int ExceedPolicy
311 return (int)GetValue(ExceedPolicyProperty);
315 SetValue(ExceedPolicyProperty, value);
316 NotifyPropertyChanged();
321 /// The HorizontalAlignment property.
323 /// <since_tizen> 3 </since_tizen>
324 public HorizontalAlignment HorizontalAlignment
328 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
332 SetValue(HorizontalAlignmentProperty, value);
333 NotifyPropertyChanged();
338 /// The VerticalAlignment property.
340 /// <since_tizen> 3 </since_tizen>
341 public VerticalAlignment VerticalAlignment
345 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
349 SetValue(VerticalAlignmentProperty, value);
350 NotifyPropertyChanged();
351 NotifyPropertyChanged();
356 /// The TextColor property.
359 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
361 /// <since_tizen> 3 </since_tizen>
362 public Color TextColor
366 Color temp = (Color)GetValue(TextColorProperty);
367 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
371 SetValue(TextColorProperty, value);
372 selectorData?.TextColor.UpdateIfNeeds(this, value);
373 NotifyPropertyChanged();
378 /// The PlaceholderTextColor property.
381 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
383 /// <since_tizen> 3 </since_tizen>
384 public Vector4 PlaceholderTextColor
388 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
389 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
393 SetValue(PlaceholderTextColorProperty, value);
394 selectorData?.PlaceholderTextColor.UpdateIfNeeds(this, value);
395 NotifyPropertyChanged();
400 /// The ShadowOffset property.
402 /// <since_tizen> 3 </since_tizen>
404 /// Deprecated.(API Level 6) Use Shadow instead.
405 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
407 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
408 public Vector2 ShadowOffset
412 PropertyMap map = new PropertyMap();
413 GetProperty(TextField.Property.SHADOW).Get(map);
414 Vector2 shadowOffset = new Vector2();
415 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
416 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
420 PropertyMap temp = new PropertyMap();
421 temp.Insert("offset", new PropertyValue(value));
422 SetValue(ShadowProperty, temp);
423 NotifyPropertyChanged();
428 /// The ShadowColor property.
430 /// <since_tizen> 3 </since_tizen>
432 /// Deprecated.(API Level 6) Use Shadow instead.
433 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
435 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
436 public Vector4 ShadowColor
440 PropertyMap map = new PropertyMap();
441 GetProperty(TextField.Property.SHADOW).Get(map);
442 Vector4 shadowColor = new Vector4();
443 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
444 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
448 PropertyMap temp = new PropertyMap();
449 temp.Insert("color", new PropertyValue(value));
450 SetValue(ShadowProperty, temp);
451 NotifyPropertyChanged();
456 /// The PrimaryCursorColor property.
459 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
461 /// <since_tizen> 3 </since_tizen>
462 public Vector4 PrimaryCursorColor
466 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
467 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
471 SetValue(PrimaryCursorColorProperty, value);
472 selectorData?.PrimaryCursorColor.UpdateIfNeeds(this, value);
473 NotifyPropertyChanged();
478 /// The SecondaryCursorColor property.
481 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
483 /// <since_tizen> 3 </since_tizen>
484 public Vector4 SecondaryCursorColor
488 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
489 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
493 SetValue(SecondaryCursorColorProperty, value);
494 NotifyPropertyChanged();
499 /// The EnableCursorBlink property.
501 /// <since_tizen> 3 </since_tizen>
502 public bool EnableCursorBlink
506 return (bool)GetValue(EnableCursorBlinkProperty);
510 SetValue(EnableCursorBlinkProperty, value);
511 NotifyPropertyChanged();
516 /// The CursorBlinkInterval property.
518 /// <since_tizen> 3 </since_tizen>
519 public float CursorBlinkInterval
523 return (float)GetValue(CursorBlinkIntervalProperty);
527 SetValue(CursorBlinkIntervalProperty, value);
528 NotifyPropertyChanged();
533 /// The CursorBlinkDuration property.
535 /// <since_tizen> 3 </since_tizen>
536 public float CursorBlinkDuration
540 return (float)GetValue(CursorBlinkDurationProperty);
544 SetValue(CursorBlinkDurationProperty, value);
545 NotifyPropertyChanged();
550 /// The CursorWidth property.
552 /// <since_tizen> 3 </since_tizen>
553 public int CursorWidth
557 return (int)GetValue(CursorWidthProperty);
561 SetValue(CursorWidthProperty, value);
562 NotifyPropertyChanged();
567 /// The GrabHandleImage property.
569 /// <since_tizen> 3 </since_tizen>
570 public string GrabHandleImage
574 return (string)GetValue(GrabHandleImageProperty);
578 SetValue(GrabHandleImageProperty, value);
579 NotifyPropertyChanged();
584 /// The GrabHandlePressedImage property.
586 /// <since_tizen> 3 </since_tizen>
587 public string GrabHandlePressedImage
591 return (string)GetValue(GrabHandlePressedImageProperty);
595 SetValue(GrabHandlePressedImageProperty, value);
596 NotifyPropertyChanged();
601 /// The ScrollThreshold property.
603 /// <since_tizen> 3 </since_tizen>
604 public float ScrollThreshold
608 return (float)GetValue(ScrollThresholdProperty);
612 SetValue(ScrollThresholdProperty, value);
613 NotifyPropertyChanged();
618 /// The ScrollSpeed property.
620 /// <since_tizen> 3 </since_tizen>
621 public float ScrollSpeed
625 return (float)GetValue(ScrollSpeedProperty);
629 SetValue(ScrollSpeedProperty, value);
630 NotifyPropertyChanged();
635 /// The SelectionHandleImageLeft property.
637 /// <since_tizen> 3 </since_tizen>
638 public PropertyMap SelectionHandleImageLeft
642 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
646 SetValue(SelectionHandleImageLeftProperty, value);
647 NotifyPropertyChanged();
652 /// The SelectionHandleImageRight property.
654 /// <since_tizen> 3 </since_tizen>
655 public PropertyMap SelectionHandleImageRight
659 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
663 SetValue(SelectionHandleImageRightProperty, value);
664 NotifyPropertyChanged();
669 /// The SelectionHandlePressedImageLeft property.
671 /// <since_tizen> 3 </since_tizen>
672 public PropertyMap SelectionHandlePressedImageLeft
676 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
680 SetValue(SelectionHandlePressedImageLeftProperty, value);
681 NotifyPropertyChanged();
686 /// The SelectionHandlePressedImageRight property.
688 /// <since_tizen> 3 </since_tizen>
689 public PropertyMap SelectionHandlePressedImageRight
693 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
697 SetValue(SelectionHandlePressedImageRightProperty, value);
698 NotifyPropertyChanged();
703 /// The SelectionHandleMarkerImageLeft property.
705 /// <since_tizen> 3 </since_tizen>
706 public PropertyMap SelectionHandleMarkerImageLeft
710 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
714 SetValue(SelectionHandleMarkerImageLeftProperty, value);
715 NotifyPropertyChanged();
720 /// The SelectionHandleMarkerImageRight property.
722 /// <since_tizen> 3 </since_tizen>
723 public PropertyMap SelectionHandleMarkerImageRight
727 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
731 SetValue(SelectionHandleMarkerImageRightProperty, value);
732 NotifyPropertyChanged();
737 /// The SelectionHighlightColor property.
740 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
742 /// <since_tizen> 3 </since_tizen>
743 public Vector4 SelectionHighlightColor
747 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
748 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
752 SetValue(SelectionHighlightColorProperty, value);
753 NotifyPropertyChanged();
758 /// The DecorationBoundingBox property.
761 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
763 /// <since_tizen> 3 </since_tizen>
764 public Rectangle DecorationBoundingBox
768 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
769 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
773 SetValue(DecorationBoundingBoxProperty, value);
774 NotifyPropertyChanged();
779 /// The InputMethodSettings property.
781 /// <since_tizen> 3 </since_tizen>
782 public PropertyMap InputMethodSettings
786 return (PropertyMap)GetValue(InputMethodSettingsProperty);
790 SetValue(InputMethodSettingsProperty, value);
791 NotifyPropertyChanged();
796 /// The InputColor property.
799 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
801 /// <since_tizen> 3 </since_tizen>
802 public Vector4 InputColor
806 Vector4 temp = (Vector4)GetValue(InputColorProperty);
807 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
811 SetValue(InputColorProperty, value);
812 NotifyPropertyChanged();
817 /// The EnableMarkup property.
819 /// <since_tizen> 3 </since_tizen>
820 public bool EnableMarkup
824 return (bool)GetValue(EnableMarkupProperty);
828 SetValue(EnableMarkupProperty, value);
829 NotifyPropertyChanged();
834 /// The InputFontFamily property.
836 /// <since_tizen> 3 </since_tizen>
837 public string InputFontFamily
841 return (string)GetValue(InputFontFamilyProperty);
845 SetValue(InputFontFamilyProperty, value);
846 NotifyPropertyChanged();
851 /// The InputFontStyle property.
853 /// <since_tizen> 3 </since_tizen>
854 public PropertyMap InputFontStyle
858 return (PropertyMap)GetValue(InputFontStyleProperty);
862 SetValue(InputFontStyleProperty, value);
863 NotifyPropertyChanged();
868 /// The InputPointSize property.
870 /// <since_tizen> 3 </since_tizen>
871 public float InputPointSize
875 return (float)GetValue(InputPointSizeProperty);
879 SetValue(InputPointSizeProperty, value);
880 NotifyPropertyChanged();
885 /// The Underline property.
887 /// <since_tizen> 3 </since_tizen>
888 public PropertyMap Underline
892 return (PropertyMap)GetValue(UnderlineProperty);
896 SetValue(UnderlineProperty, value);
897 NotifyPropertyChanged();
902 /// The InputUnderline property.
904 /// <since_tizen> 3 </since_tizen>
905 public string InputUnderline
909 return (string)GetValue(InputUnderlineProperty);
913 SetValue(InputUnderlineProperty, value);
914 NotifyPropertyChanged();
919 /// The Shadow property.
921 /// <since_tizen> 3 </since_tizen>
922 public PropertyMap Shadow
926 return (PropertyMap)GetValue(ShadowProperty);
930 SetValue(ShadowProperty, value);
931 NotifyPropertyChanged();
936 /// The InputShadow property.
938 /// <since_tizen> 3 </since_tizen>
939 public string InputShadow
943 return (string)GetValue(InputShadowProperty);
947 SetValue(InputShadowProperty, value);
948 NotifyPropertyChanged();
953 /// The Emboss property.
955 /// <since_tizen> 3 </since_tizen>
960 return (string)GetValue(EmbossProperty);
964 SetValue(EmbossProperty, value);
965 NotifyPropertyChanged();
970 /// The InputEmboss property.
972 /// <since_tizen> 3 </since_tizen>
973 public string InputEmboss
977 return (string)GetValue(InputEmbossProperty);
981 SetValue(InputEmbossProperty, value);
982 NotifyPropertyChanged();
987 /// The Outline property.
989 /// <since_tizen> 3 </since_tizen>
990 public PropertyMap Outline
994 return (PropertyMap)GetValue(OutlineProperty);
998 SetValue(OutlineProperty, value);
999 NotifyPropertyChanged();
1004 /// The InputOutline property.
1006 /// <since_tizen> 3 </since_tizen>
1007 public string InputOutline
1011 return (string)GetValue(InputOutlineProperty);
1015 SetValue(InputOutlineProperty, value);
1016 NotifyPropertyChanged();
1021 /// The HiddenInputSettings property.
1023 /// <since_tizen> 3 </since_tizen>
1024 public Tizen.NUI.PropertyMap HiddenInputSettings
1028 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1032 SetValue(HiddenInputSettingsProperty, value);
1033 NotifyPropertyChanged();
1038 /// The PixelSize property.
1040 /// <since_tizen> 3 </since_tizen>
1041 public float PixelSize
1045 return (float)GetValue(PixelSizeProperty);
1049 SetValue(PixelSizeProperty, value);
1050 NotifyPropertyChanged();
1055 /// The Enable selection property.
1057 /// <since_tizen> 3 </since_tizen>
1058 public bool EnableSelection
1062 return (bool)GetValue(EnableSelectionProperty);
1066 SetValue(EnableSelectionProperty, value);
1067 NotifyPropertyChanged();
1072 /// The Enable selection property.
1074 /// <since_tizen> 6 </since_tizen>
1075 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1076 [EditorBrowsable(EditorBrowsableState.Never)]
1077 public bool EnableGrabHandle
1081 return (bool)GetValue(EnableGrabHandleProperty);
1085 SetValue(EnableGrabHandleProperty, value);
1086 NotifyPropertyChanged();
1091 /// The Enable selection property.
1093 /// <since_tizen> 6 </since_tizen>
1094 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1095 [EditorBrowsable(EditorBrowsableState.Never)]
1096 public bool EnableGrabHandlePopup
1100 return (bool)GetValue(EnableGrabHandlePopupProperty);
1104 SetValue(EnableGrabHandlePopupProperty, value);
1105 NotifyPropertyChanged();
1110 /// The Selected Text property.
1112 /// <since_tizen> 8 </since_tizen>
1113 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1114 [EditorBrowsable(EditorBrowsableState.Never)]
1115 public string SelectedText
1120 GetProperty(TextField.Property.SelectedText).Get(out temp);
1126 /// The start index for selection.
1128 /// <since_tizen> 8 </since_tizen>
1129 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1130 [EditorBrowsable(EditorBrowsableState.Never)]
1131 public int SelectedTextStart
1136 GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
1141 SetProperty(TextField.Property.SelectedTextStart, new PropertyValue(value));
1142 NotifyPropertyChanged();
1147 /// The end index for selection.
1149 /// <since_tizen> 8 </since_tizen>
1150 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1151 [EditorBrowsable(EditorBrowsableState.Never)]
1152 public int SelectedTextEnd
1157 GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
1162 SetProperty(TextField.Property.SelectedTextEnd, new PropertyValue(value));
1163 NotifyPropertyChanged();
1168 /// Enable editing in text control.
1170 /// <since_tizen> 8 </since_tizen>
1171 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1172 [EditorBrowsable(EditorBrowsableState.Never)]
1173 public bool EnableEditing
1178 GetProperty(TextField.Property.EnableEditing).Get(out temp);
1183 SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
1184 NotifyPropertyChanged();
1189 /// Specify primary cursor (caret) position in text control.
1191 [EditorBrowsable(EditorBrowsableState.Never)]
1192 public int PrimaryCursorPosition
1197 using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1199 propertyValue.Get(out temp);
1205 using (PropertyValue propertyValue = new PropertyValue(value))
1207 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1208 NotifyPropertyChanged();
1214 /// The Placeholder property.
1215 /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1218 /// The following example demonstrates how to set the Placeholder property.
1220 /// PropertyMap propertyMap = new PropertyMap();
1221 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1222 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1223 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1224 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1225 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1227 /// PropertyMap fontStyleMap = new PropertyMap();
1228 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1229 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1230 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1231 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1233 /// TextField field = new TextField();
1234 /// field.Placeholder = propertyMap;
1237 /// <since_tizen> 3 </since_tizen>
1238 public Tizen.NUI.PropertyMap Placeholder
1242 return (PropertyMap)GetValue(PlaceholderProperty);
1246 SetValue(PlaceholderProperty, value);
1247 NotifyPropertyChanged();
1252 /// The Ellipsis property.<br />
1253 /// Enable or disable the ellipsis.<br />
1254 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1256 /// <since_tizen> 4 </since_tizen>
1257 public bool Ellipsis
1261 return (bool)GetValue(EllipsisProperty);
1265 SetValue(EllipsisProperty, value);
1266 NotifyPropertyChanged();
1271 /// Enables selection of the text using the Shift key.
1273 /// <since_tizen> 5 </since_tizen>
1274 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1275 [EditorBrowsable(EditorBrowsableState.Never)]
1276 public bool EnableShiftSelection
1280 return (bool)GetValue(EnableShiftSelectionProperty);
1284 SetValue(EnableShiftSelectionProperty, value);
1285 NotifyPropertyChanged();
1290 /// The text alignment to match the direction of the system language.
1292 /// <since_tizen> 6 </since_tizen>
1293 public bool MatchSystemLanguageDirection
1297 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1301 SetValue(MatchSystemLanguageDirectionProperty, value);
1302 NotifyPropertyChanged();
1306 /// Only used by the IL of xaml, will never changed to not hidden.
1307 [EditorBrowsable(EditorBrowsableState.Never)]
1308 public override bool IsCreateByXaml
1312 return base.IsCreateByXaml;
1316 base.IsCreateByXaml = value;
1320 this.TextChanged += (obj, e) =>
1322 this.Text = e.TextField.Text;
1328 private TextFieldSelectorData SelectorData
1332 if (selectorData == null)
1334 selectorData = new TextFieldSelectorData();
1336 return selectorData;
1341 /// Get the InputMethodContext instance.
1343 /// <returns>The InputMethodContext instance.</returns>
1344 /// <since_tizen> 5 </since_tizen>
1345 public InputMethodContext GetInputMethodContext()
1347 if (inputMethodCotext == null)
1349 /*Avoid raising InputMethodContext reference count.*/
1350 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
1351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1353 return inputMethodCotext;
1357 /// Select the whole text.
1359 /// <since_tizen> 6 </since_tizen>
1360 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1361 [EditorBrowsable(EditorBrowsableState.Never)]
1362 public void SelectWholeText()
1364 Interop.TextField.SelectWholeText(SwigCPtr);
1365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1369 /// Clear selection of the text.
1371 /// <since_tizen> 8 </since_tizen>
1372 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1373 [EditorBrowsable(EditorBrowsableState.Never)]
1374 public void SelectNone()
1376 _ = Interop.TextField.SelectNone(SwigCPtr);
1377 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1380 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1382 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1385 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1387 SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.InputStyleChangedSignal(SwigCPtr));
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1395 /// <since_tizen> 3 </since_tizen>
1396 protected override void Dispose(DisposeTypes type)
1400 DisposeQueue.Instance.Add(this);
1404 if (systemlangTextFlag)
1406 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1409 if (type == DisposeTypes.Explicit)
1412 //Release your own managed resources here.
1413 //You should release all of your own disposable objects here.
1414 selectorData?.Reset(this);
1417 //Release your own unmanaged resources here.
1418 //You should not access any managed member here except static instance.
1419 //because the execution order of Finalizes is non-deterministic.
1422 if (_textFieldMaxLengthReachedCallbackDelegate != null)
1424 this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
1427 if (_textFieldTextChangedCallbackDelegate != null)
1429 TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
1436 /// This will not be public opened.
1437 [EditorBrowsable(EditorBrowsableState.Never)]
1438 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1440 // In order to speed up IME hide, temporarily add
1441 GetInputMethodContext()?.DestroyContext();
1442 Interop.TextField.DeleteTextField(swigCPtr);
1445 private string SetTranslatable(string textFieldSid)
1447 string translatableText = null;
1448 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1449 if (translatableText != null)
1451 if (systemlangTextFlag == false)
1453 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1454 systemlangTextFlag = true;
1456 return translatableText;
1460 translatableText = "";
1461 return translatableText;
1465 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1467 if (textFieldTextSid != null)
1469 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1471 if (textFieldPlaceHolderTextSid != null)
1473 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1477 internal new class Property
1479 internal static readonly int TEXT = Interop.TextField.TextGet();
1480 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
1481 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
1482 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
1483 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
1484 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
1485 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
1486 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
1487 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
1488 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
1489 internal static readonly int TextColor = Interop.TextField.TextColorGet();
1490 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
1491 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
1492 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
1493 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
1494 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
1495 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
1496 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
1497 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
1498 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
1499 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
1500 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
1501 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
1502 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
1503 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
1504 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
1505 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
1506 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
1507 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
1508 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
1509 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
1510 internal static readonly int InputColor = Interop.TextField.InputColorGet();
1511 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
1512 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
1513 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
1514 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
1515 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
1516 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
1517 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
1518 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
1519 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
1520 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
1521 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
1522 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
1523 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
1524 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
1525 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
1526 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
1527 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
1528 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
1529 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
1530 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
1531 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
1532 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
1533 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
1534 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
1535 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
1536 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
1539 internal class InputStyle
1545 FontFamily = 0x0002,
1555 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1557 DecorationBoundingBox = new Rectangle(x, y, width, height);
1559 private void OnInputColorChanged(float x, float y, float z, float w)
1561 InputColor = new Vector4(x, y, z, w);
1563 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1565 PlaceholderTextColor = new Vector4(r, g, b, a);
1567 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1569 PrimaryCursorColor = new Vector4(x, y, z, w);
1571 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1573 SecondaryCursorColor = new Vector4(x, y, z, w);
1575 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1577 SelectionHighlightColor = new Vector4(x, y, z, w);
1579 private void OnShadowColorChanged(float x, float y, float z, float w)
1581 ShadowColor = new Vector4(x, y, z, w);
1583 private void OnShadowOffsetChanged(float x, float y)
1585 ShadowOffset = new Vector2(x, y);
1587 private void OnTextColorChanged(float r, float g, float b, float a)
1589 TextColor = new Color(r, g, b, a);