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.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.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.Upcast(cPtr), cMemoryOwn, viewStyle)
85 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.Upcast(cPtr), cMemoryOwn, null)
93 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(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(null, "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(null, "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.SelectedText).Get(out temp);
1130 /// The start index for selection.
1132 /// <since_tizen> 8 </since_tizen>
1133 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1134 [EditorBrowsable(EditorBrowsableState.Never)]
1135 public int SelectedTextStart
1140 GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
1145 SetProperty(TextField.Property.SelectedTextStart, new PropertyValue(value));
1146 NotifyPropertyChanged();
1151 /// The end index for selection.
1153 /// <since_tizen> 8 </since_tizen>
1154 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1155 [EditorBrowsable(EditorBrowsableState.Never)]
1156 public int SelectedTextEnd
1161 GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
1166 SetProperty(TextField.Property.SelectedTextEnd, new PropertyValue(value));
1167 NotifyPropertyChanged();
1171 /// Enable editing in text control.
1173 /// <since_tizen> 8 </since_tizen>
1174 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1175 [EditorBrowsable(EditorBrowsableState.Never)]
1176 public bool EnableEditing
1181 GetProperty(TextField.Property.EnableEditing).Get(out temp);
1186 SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
1187 NotifyPropertyChanged();
1192 /// The Placeholder property.
1193 /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1196 /// The following example demonstrates how to set the Placeholder property.
1198 /// PropertyMap propertyMap = new PropertyMap();
1199 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1200 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1201 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1202 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1203 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1205 /// PropertyMap fontStyleMap = new PropertyMap();
1206 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1207 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1208 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1209 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1211 /// TextField field = new TextField();
1212 /// field.Placeholder = propertyMap;
1215 /// <since_tizen> 3 </since_tizen>
1216 public Tizen.NUI.PropertyMap Placeholder
1220 return (PropertyMap)GetValue(PlaceholderProperty);
1224 SetValue(PlaceholderProperty, value);
1225 NotifyPropertyChanged();
1230 /// The Ellipsis property.<br />
1231 /// Enable or disable the ellipsis.<br />
1232 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1234 /// <since_tizen> 4 </since_tizen>
1235 public bool Ellipsis
1239 return (bool)GetValue(EllipsisProperty);
1243 SetValue(EllipsisProperty, value);
1244 NotifyPropertyChanged();
1249 /// Enables selection of the text using the Shift key.
1251 /// <since_tizen> 5 </since_tizen>
1252 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1253 [EditorBrowsable(EditorBrowsableState.Never)]
1254 public bool EnableShiftSelection
1258 return (bool)GetValue(EnableShiftSelectionProperty);
1262 SetValue(EnableShiftSelectionProperty, value);
1263 NotifyPropertyChanged();
1268 /// The text alignment to match the direction of the system language.
1270 /// <since_tizen> 6 </since_tizen>
1271 public bool MatchSystemLanguageDirection
1275 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1279 SetValue(MatchSystemLanguageDirectionProperty, value);
1280 NotifyPropertyChanged();
1284 /// Only used by the IL of xaml, will never changed to not hidden.
1285 [EditorBrowsable(EditorBrowsableState.Never)]
1286 public override bool IsCreateByXaml
1290 return base.IsCreateByXaml;
1294 base.IsCreateByXaml = value;
1298 this.TextChanged += (obj, e) =>
1300 this.Text = e.TextField.Text;
1306 private TextFieldSelectorData SelectorData
1310 if (selectorData == null)
1312 selectorData = new TextFieldSelectorData();
1314 return selectorData;
1319 /// Get the InputMethodContext instance.
1321 /// <returns>The InputMethodContext instance.</returns>
1322 /// <since_tizen> 5 </since_tizen>
1323 public InputMethodContext GetInputMethodContext()
1325 if (inputMethodCotext == null)
1327 /*Avoid raising InputMethodContext reference count.*/
1328 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(swigCPtr), true);
1329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1331 return inputMethodCotext;
1335 /// Select the whole text.
1337 /// <since_tizen> 6 </since_tizen>
1338 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
1339 [EditorBrowsable(EditorBrowsableState.Never)]
1340 public void SelectWholeText()
1342 Interop.TextField.SelectWholeText(swigCPtr);
1343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1347 /// Clear selection of the text.
1349 /// <since_tizen> 8 </since_tizen>
1350 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1351 [EditorBrowsable(EditorBrowsableState.Never)]
1352 public void SelectNone()
1354 Interop.TextField.SelectNone(swigCPtr);
1355 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1358 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
1360 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1363 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
1365 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));
1366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1373 /// <since_tizen> 3 </since_tizen>
1374 protected override void Dispose(DisposeTypes type)
1378 DisposeQueue.Instance.Add(this);
1382 if (systemlangTextFlag)
1384 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1387 if (type == DisposeTypes.Explicit)
1390 //Release your own managed resources here.
1391 //You should release all of your own disposable objects here.
1392 selectorData?.Reset(this);
1395 //Release your own unmanaged resources here.
1396 //You should not access any managed member here except static instance.
1397 //because the execution order of Finalizes is non-deterministic.
1400 if (_textFieldMaxLengthReachedCallbackDelegate != null)
1402 this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
1405 if (_textFieldTextChangedCallbackDelegate != null)
1407 TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
1414 /// This will not be public opened.
1415 [EditorBrowsable(EditorBrowsableState.Never)]
1416 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1418 // In order to speed up IME hide, temporarily add
1419 GetInputMethodContext()?.DestroyContext();
1420 Interop.TextField.DeleteTextField(swigCPtr);
1423 private string SetTranslatable(string textFieldSid)
1425 string translatableText = null;
1426 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1427 if (translatableText != null)
1429 if (systemlangTextFlag == false)
1431 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1432 systemlangTextFlag = true;
1434 return translatableText;
1438 translatableText = "";
1439 return translatableText;
1443 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1445 if (textFieldTextSid != null)
1447 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1449 if (textFieldPlaceHolderTextSid != null)
1451 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1455 internal new class Property
1457 internal static readonly int TEXT = Interop.TextField.TextGet();
1458 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
1459 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
1460 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
1461 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
1462 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
1463 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
1464 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
1465 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
1466 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
1467 internal static readonly int TextColor = Interop.TextField.TextColorGet();
1468 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
1469 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
1470 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
1471 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
1472 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
1473 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
1474 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
1475 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
1476 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
1477 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
1478 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
1479 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
1480 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
1481 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
1482 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
1483 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
1484 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
1485 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
1486 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
1487 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
1488 internal static readonly int InputColor = Interop.TextField.InputColorGet();
1489 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
1490 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
1491 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
1492 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
1493 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
1494 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
1495 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
1496 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
1497 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
1498 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
1499 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
1500 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
1501 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
1502 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
1503 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
1504 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
1505 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
1506 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
1507 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
1508 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
1509 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
1510 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
1511 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
1512 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
1513 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
1516 internal class InputStyle
1522 FontFamily = 0x0002,
1532 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1534 DecorationBoundingBox = new Rectangle(x, y, width, height);
1536 private void OnInputColorChanged(float x, float y, float z, float w)
1538 InputColor = new Vector4(x, y, z, w);
1540 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1542 PlaceholderTextColor = new Vector4(r, g, b, a);
1544 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1546 PrimaryCursorColor = new Vector4(x, y, z, w);
1548 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1550 SecondaryCursorColor = new Vector4(x, y, z, w);
1552 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1554 SelectionHighlightColor = new Vector4(x, y, z, w);
1556 private void OnShadowColorChanged(float x, float y, float z, float w)
1558 ShadowColor = new Vector4(x, y, z, w);
1560 private void OnShadowOffsetChanged(float x, float y)
1562 ShadowOffset = new Vector2(x, y);
1564 private void OnTextColorChanged(float r, float g, float b, float a)
1566 TextColor = new Color(r, g, b, a);