2 * Copyright(c) 2021 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;
26 namespace Tizen.NUI.BaseComponents
29 /// A control which provides a single line editable text field.
31 /// <since_tizen> 3 </since_tizen>
32 public partial class TextField : View
34 private string textFieldTextSid = null;
35 private string textFieldPlaceHolderTextSid = null;
36 private string textFieldPlaceHolderTextFocusedSid = null;
37 private bool systemlangTextFlag = false;
38 private InputMethodContext inputMethodCotext = null;
39 private float fontSizeScale = 1.0f;
40 private bool hasFontSizeChangedCallback = false;
42 static TextField() { }
45 /// Creates the TextField control.
47 /// <since_tizen> 3 </since_tizen>
48 public TextField() : this(Interop.TextField.New(), true)
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 /// Creates the TextField with setting the status of shown or hidden.
56 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
57 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 public TextField(bool shown) : this(Interop.TextField.New(), true)
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66 /// Get attributes, it is abstract function and must be override.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected override ViewStyle CreateViewStyle()
71 return new TextFieldStyle();
74 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
83 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
92 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102 internal enum ExceedPolicyType
104 ExceedPolicyOriginal,
109 /// The TranslatableText property.<br />
110 /// The text can set the SID value.<br />
112 /// <exception cref='ArgumentNullException'>
113 /// ResourceManager about multilingual is null.
115 /// <since_tizen> 4 </since_tizen>
116 public string TranslatableText
120 return (string)GetValue(TranslatableTextProperty);
124 SetValue(TranslatableTextProperty, value);
127 private string translatableText
131 return textFieldTextSid;
135 if (NUIApplication.MultilingualResourceManager == null)
137 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
139 textFieldTextSid = value;
140 Text = SetTranslatable(textFieldTextSid);
141 NotifyPropertyChanged();
146 /// The TranslatablePlaceholderText property.<br />
147 /// The text can set the SID value.<br />
149 /// <exception cref='ArgumentNullException'>
150 /// ResourceManager about multilingual is null.
152 /// <since_tizen> 4 </since_tizen>
153 public string TranslatablePlaceholderText
157 return (string)GetValue(TranslatablePlaceholderTextProperty);
161 SetValue(TranslatablePlaceholderTextProperty, value);
164 private string translatablePlaceholderText
168 return textFieldPlaceHolderTextSid;
172 if (NUIApplication.MultilingualResourceManager == null)
174 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
176 textFieldPlaceHolderTextSid = value;
177 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
178 NotifyPropertyChanged();
183 /// The TranslatablePlaceholderTextFocused property.<br />
184 /// The text can set the SID value.<br />
186 /// <exception cref='ArgumentNullException'>
187 /// ResourceManager about multilingual is null.
189 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public string TranslatablePlaceholderTextFocused
195 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
199 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
202 private string translatablePlaceholderTextFocused
206 return textFieldPlaceHolderTextFocusedSid;
210 if (NUIApplication.MultilingualResourceManager == null)
212 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
214 textFieldPlaceHolderTextFocusedSid = value;
215 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
216 NotifyPropertyChanged();
221 /// The Text property.<br />
222 /// The text to display in the UTF-8 format.<br />
224 /// <since_tizen> 3 </since_tizen>
229 return (string)GetValue(TextProperty);
233 SetValueAndForceSendChangeSignal(TextProperty, value);
234 NotifyPropertyChanged();
239 /// The PlaceholderText property.<br />
240 /// The text to display when the TextField is empty and inactive. <br />
242 /// <since_tizen> 3 </since_tizen>
243 public string PlaceholderText
247 return (string)GetValue(PlaceholderTextProperty);
251 SetValue(PlaceholderTextProperty, value);
252 NotifyPropertyChanged();
257 /// The PlaceholderTextFocused property. <br />
258 /// The text to display when the TextField is empty with input focus. <br />
260 /// <since_tizen> 3 </since_tizen>
261 public string PlaceholderTextFocused
265 return (string)GetValue(PlaceholderTextFocusedProperty);
269 SetValue(PlaceholderTextFocusedProperty, value);
270 NotifyPropertyChanged();
275 /// The FontFamily property.<br />
276 /// The requested font family to use.<br />
278 /// <since_tizen> 3 </since_tizen>
279 public string FontFamily
283 return (string)GetValue(FontFamilyProperty);
287 SetValue(FontFamilyProperty, value);
288 NotifyPropertyChanged();
293 /// The FontStyle property.<br />
294 /// The requested font style to use.<br />
295 /// The fontStyle map contains the following keys :<br />
296 /// <list type="table">
297 /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
298 /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
299 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
302 /// <since_tizen> 3 </since_tizen>
303 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
304 public PropertyMap FontStyle
308 return (PropertyMap)GetValue(FontStyleProperty);
312 SetValue(FontStyleProperty, value);
313 NotifyPropertyChanged();
318 /// Set FontStyle to TextField. <br />
320 /// <param name="fontStyle">The FontStyle</param>
322 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
325 /// The following example demonstrates how to use the SetFontStyle method.
327 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
328 /// fontStyle.Width = FontWidthType.Expanded;
329 /// fontStyle.Weight = FontWeightType.Bold;
330 /// fontStyle.Slant = FontSlantType.Italic;
331 /// field.SetFontStyle(fontStyle);
334 [EditorBrowsable(EditorBrowsableState.Never)]
335 public void SetFontStyle(FontStyle fontStyle)
337 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
339 SetValue(FontStyleProperty, fontStyleMap);
344 /// Get FontStyle from TextField. <br />
346 /// <returns>The FontStyle</returns>
348 /// <see cref="Tizen.NUI.Text.FontStyle"/>
350 [EditorBrowsable(EditorBrowsableState.Never)]
351 public FontStyle GetFontStyle()
354 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
356 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
362 /// The PointSize property.<br />
363 /// The size of font in points.<br />
365 /// <since_tizen> 3 </since_tizen>
366 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
367 public float PointSize
371 return (float)GetValue(PointSizeProperty);
375 SetValue(PointSizeProperty, value);
376 NotifyPropertyChanged();
381 /// The MaxLength property.<br />
382 /// The maximum number of characters that can be inserted.<br />
384 /// <since_tizen> 3 </since_tizen>
389 return (int)GetValue(MaxLengthProperty);
393 SetValue(MaxLengthProperty, value);
394 NotifyPropertyChanged();
399 /// The ExceedPolicy property.<br />
400 /// Specifies how the text is truncated when it does not fit.<br />
402 /// <since_tizen> 3 </since_tizen>
403 public int ExceedPolicy
407 return (int)GetValue(ExceedPolicyProperty);
411 SetValue(ExceedPolicyProperty, value);
412 NotifyPropertyChanged();
417 /// The HorizontalAlignment property.<br />
418 /// The line horizontal alignment.<br />
420 /// <since_tizen> 3 </since_tizen>
421 public HorizontalAlignment HorizontalAlignment
425 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
429 SetValue(HorizontalAlignmentProperty, value);
430 NotifyPropertyChanged();
435 /// The VerticalAlignment property.<br />
436 /// The line vertical alignment.<br />
438 /// <since_tizen> 3 </since_tizen>
439 public VerticalAlignment VerticalAlignment
443 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
447 SetValue(VerticalAlignmentProperty, value);
448 NotifyPropertyChanged();
449 NotifyPropertyChanged();
454 /// The TextColor property.<br />
455 /// The color of the text.<br />
458 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
460 /// <since_tizen> 3 </since_tizen>
461 public Color TextColor
465 Color temp = (Color)GetValue(TextColorProperty);
466 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
470 SetValue(TextColorProperty, value);
471 NotifyPropertyChanged();
476 /// The PlaceholderTextColor property.
479 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
481 /// <since_tizen> 3 </since_tizen>
482 public Vector4 PlaceholderTextColor
486 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
487 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
491 SetValue(PlaceholderTextColorProperty, value);
492 NotifyPropertyChanged();
497 /// The ShadowOffset property.
499 /// <since_tizen> 3 </since_tizen>
501 /// Deprecated.(API Level 6) Use Shadow instead.
502 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
504 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
505 public Vector2 ShadowOffset
509 return GetValue(ShadowOffsetProperty) as Vector2;
513 SetValue(ShadowOffsetProperty, value);
517 private Vector2 InternalShadowOffset
521 float x = 0.0f, y = 0.0f;
522 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
523 using (var shadowOffset = new Vector2())
525 if (null != propertyValue)
527 propertyValue.Get(shadowOffset);
532 return new Vector2(OnShadowOffsetChanged, x, y);
536 using (var map = new PropertyMap())
538 map.Add("offset", value);
539 var shadowMap = Shadow;
540 shadowMap.Merge(map);
541 SetValue(ShadowProperty, shadowMap);
542 NotifyPropertyChanged();
548 /// The ShadowColor property.
550 /// <since_tizen> 3 </since_tizen>
552 /// Deprecated.(API Level 6) Use Shadow instead.
553 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
555 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
556 public Vector4 ShadowColor
560 return GetValue(ShadowColorProperty) as Vector4;
564 SetValue(ShadowColorProperty, value);
568 private Vector4 InternalShadowColor
572 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
573 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
574 using (var shadowColor = new Vector4())
576 if (null != propertyValue)
578 propertyValue.Get(shadowColor);
585 return new Vector4(OnShadowColorChanged, x, y, z, w);
589 using (var map = new PropertyMap())
591 map.Add("color", value);
592 var shadowMap = Shadow;
593 shadowMap.Merge(map);
594 SetValue(ShadowProperty, shadowMap);
595 NotifyPropertyChanged();
601 /// The PrimaryCursorColor property.<br />
602 /// The color to apply to the primary cursor.<br />
605 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
607 /// <since_tizen> 3 </since_tizen>
608 public Vector4 PrimaryCursorColor
612 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
613 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
617 SetValue(PrimaryCursorColorProperty, value);
618 NotifyPropertyChanged();
623 /// The SecondaryCursorColor property.<br />
624 /// The color to apply to the secondary cursor.<br />
627 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
629 /// <since_tizen> 3 </since_tizen>
630 public Vector4 SecondaryCursorColor
634 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
635 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
639 SetValue(SecondaryCursorColorProperty, value);
640 NotifyPropertyChanged();
645 /// The EnableCursorBlink property.<br />
646 /// Whether the cursor should blink or not.<br />
648 /// <since_tizen> 3 </since_tizen>
649 public bool EnableCursorBlink
653 return (bool)GetValue(EnableCursorBlinkProperty);
657 SetValue(EnableCursorBlinkProperty, value);
658 NotifyPropertyChanged();
663 /// The CursorBlinkInterval property.<br />
664 /// The time interval in seconds between cursor on/off states.<br />
666 /// <since_tizen> 3 </since_tizen>
667 public float CursorBlinkInterval
671 return (float)GetValue(CursorBlinkIntervalProperty);
675 SetValue(CursorBlinkIntervalProperty, value);
676 NotifyPropertyChanged();
681 /// The CursorBlinkDuration property.<br />
682 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
684 /// <since_tizen> 3 </since_tizen>
685 public float CursorBlinkDuration
689 return (float)GetValue(CursorBlinkDurationProperty);
693 SetValue(CursorBlinkDurationProperty, value);
694 NotifyPropertyChanged();
699 /// The CursorWidth property.
701 /// <since_tizen> 3 </since_tizen>
702 public int CursorWidth
706 return (int)GetValue(CursorWidthProperty);
710 SetValue(CursorWidthProperty, value);
711 NotifyPropertyChanged();
716 /// The GrabHandleImage property.<br />
717 /// The image to display for the grab handle.<br />
719 /// <since_tizen> 3 </since_tizen>
720 public string GrabHandleImage
724 return (string)GetValue(GrabHandleImageProperty);
728 SetValue(GrabHandleImageProperty, value);
729 NotifyPropertyChanged();
734 /// The GrabHandlePressedImage property.<br />
735 /// The image to display when the grab handle is pressed.<br />
737 /// <since_tizen> 3 </since_tizen>
738 public string GrabHandlePressedImage
742 return (string)GetValue(GrabHandlePressedImageProperty);
746 SetValue(GrabHandlePressedImageProperty, value);
747 NotifyPropertyChanged();
752 /// The ScrollThreshold property.<br />
753 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
755 /// <since_tizen> 3 </since_tizen>
756 public float ScrollThreshold
760 return (float)GetValue(ScrollThresholdProperty);
764 SetValue(ScrollThresholdProperty, value);
765 NotifyPropertyChanged();
770 /// The ScrollSpeed property.<br />
771 /// The scroll speed in pixels per second.<br />
773 /// <since_tizen> 3 </since_tizen>
774 public float ScrollSpeed
778 return (float)GetValue(ScrollSpeedProperty);
782 SetValue(ScrollSpeedProperty, value);
783 NotifyPropertyChanged();
788 /// The SelectionHandleImageLeft property.<br />
789 /// The image to display for the left selection handle.<br />
790 /// The selectionHandleImageLeft map contains the following key :<br />
791 /// <list type="table">
792 /// <item><term>filename (string)</term><description>The path of image file</description></item>
795 /// <since_tizen> 3 </since_tizen>
796 public PropertyMap SelectionHandleImageLeft
800 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
804 SetValue(SelectionHandleImageLeftProperty, value);
805 NotifyPropertyChanged();
810 /// The SelectionHandleImageRight property.<br />
811 /// The image to display for the right selection handle.<br />
812 /// The selectionHandleImageRight map contains the following key :<br />
813 /// <list type="table">
814 /// <item><term>filename (string)</term><description>The path of image file</description></item>
817 /// <since_tizen> 3 </since_tizen>
818 public PropertyMap SelectionHandleImageRight
822 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
826 SetValue(SelectionHandleImageRightProperty, value);
827 NotifyPropertyChanged();
832 /// Set SelectionHandleImage to TextField. <br />
834 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
836 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
839 /// The following example demonstrates how to use the SetSelectionHandleImage method.
841 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
842 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
843 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
844 /// field.SetSelectionHandleImage(selectionHandleImage);
847 [EditorBrowsable(EditorBrowsableState.Never)]
848 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
850 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
852 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
854 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
858 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
860 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
862 SetValue(SelectionHandleImageRightProperty, rightImageMap);
868 /// Get SelectionHandleImage from TextField. <br />
870 /// <returns>The SelectionHandleImage</returns>
872 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
874 [EditorBrowsable(EditorBrowsableState.Never)]
875 public SelectionHandleImage GetSelectionHandleImage()
877 SelectionHandleImage selectionHandleImage;
878 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
879 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
881 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
883 return selectionHandleImage;
887 /// The SelectionHandlePressedImageLeft property.<br />
888 /// The image to display when the left selection handle is pressed.<br />
889 /// The selectionHandlePressedImageLeft map contains the following key :<br />
890 /// <list type="table">
891 /// <item><term>filename (string)</term><description>The path of image file</description></item>
894 /// <since_tizen> 3 </since_tizen>
895 public PropertyMap SelectionHandlePressedImageLeft
899 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
903 SetValue(SelectionHandlePressedImageLeftProperty, value);
904 NotifyPropertyChanged();
909 /// The SelectionHandlePressedImageRight property.<br />
910 /// The image to display when the right selection handle is pressed.<br />
911 /// The selectionHandlePressedImageRight map contains the following key :<br />
912 /// <list type="table">
913 /// <item><term>filename (string)</term><description>The path of image file</description></item>
916 /// <since_tizen> 3 </since_tizen>
917 public PropertyMap SelectionHandlePressedImageRight
921 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
925 SetValue(SelectionHandlePressedImageRightProperty, value);
926 NotifyPropertyChanged();
931 /// Set SelectionHandlePressedImage to TextField. <br />
933 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
935 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
938 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
940 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
941 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
942 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
943 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
946 [EditorBrowsable(EditorBrowsableState.Never)]
947 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
949 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
951 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
953 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
957 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
959 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
961 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
967 /// Get SelectionHandlePressedImage from TextField. <br />
969 /// <returns>The SelectionHandlePressedImage</returns>
971 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
973 [EditorBrowsable(EditorBrowsableState.Never)]
974 public SelectionHandleImage GetSelectionHandlePressedImage()
976 SelectionHandleImage selectionHandleImage;
977 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
978 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
980 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
982 return selectionHandleImage;
986 /// The SelectionHandleMarkerImageLeft property.<br />
987 /// The image to display for the left selection handle marker.<br />
988 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
989 /// <list type="table">
990 /// <item><term>filename (string)</term><description>The path of image file</description></item>
993 /// <since_tizen> 3 </since_tizen>
994 public PropertyMap SelectionHandleMarkerImageLeft
998 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1002 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1003 NotifyPropertyChanged();
1008 /// The SelectionHandleMarkerImageRight property.<br />
1009 /// The image to display for the right selection handle marker.<br />
1010 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1011 /// <list type="table">
1012 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1015 /// <since_tizen> 3 </since_tizen>
1016 public PropertyMap SelectionHandleMarkerImageRight
1020 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1024 SetValue(SelectionHandleMarkerImageRightProperty, value);
1025 NotifyPropertyChanged();
1030 /// Set SelectionHandleMarkerImage to TextField. <br />
1032 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1034 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1037 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1039 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1040 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1041 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1042 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1045 [EditorBrowsable(EditorBrowsableState.Never)]
1046 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1048 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1050 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1052 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1056 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1058 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1060 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1066 /// Get SelectionHandleMarkerImage from TextField. <br />
1068 /// <returns>The SelectionHandleMarkerImage</returns>
1070 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1072 [EditorBrowsable(EditorBrowsableState.Never)]
1073 public SelectionHandleImage GetSelectionHandleMarkerImage()
1075 SelectionHandleImage selectionHandleImage;
1076 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1077 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1079 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1081 return selectionHandleImage;
1085 /// The SelectionHighlightColor property.<br />
1086 /// The color of the selection highlight.<br />
1089 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1091 /// <since_tizen> 3 </since_tizen>
1092 public Vector4 SelectionHighlightColor
1096 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1097 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1101 SetValue(SelectionHighlightColorProperty, value);
1102 NotifyPropertyChanged();
1107 /// The DecorationBoundingBox property.<br />
1108 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1111 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1113 /// <since_tizen> 3 </since_tizen>
1114 public Rectangle DecorationBoundingBox
1118 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1119 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1123 SetValue(DecorationBoundingBoxProperty, value);
1124 NotifyPropertyChanged();
1129 /// The InputMethodSettings property.<br />
1130 /// The settings to relating to the System's Input Method, Key and Value.<br />
1133 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1136 /// The following example demonstrates how to set the InputMethodSettings property.
1138 /// InputMethod method = new InputMethod();
1139 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1140 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1141 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1142 /// method.Variation = 1;
1143 /// textField.InputMethodSettings = method.OutputMap;
1146 /// <since_tizen> 3 </since_tizen>
1147 public PropertyMap InputMethodSettings
1151 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1155 SetValue(InputMethodSettingsProperty, value);
1156 NotifyPropertyChanged();
1161 /// The InputColor property.<br />
1162 /// The color of the new input text.<br />
1165 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1167 /// <since_tizen> 3 </since_tizen>
1168 public Vector4 InputColor
1172 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1173 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1177 SetValue(InputColorProperty, value);
1178 NotifyPropertyChanged();
1183 /// The EnableMarkup property.<br />
1184 /// Whether the mark-up processing is enabled.<br />
1186 /// <since_tizen> 3 </since_tizen>
1187 public bool EnableMarkup
1191 return (bool)GetValue(EnableMarkupProperty);
1195 SetValue(EnableMarkupProperty, value);
1196 NotifyPropertyChanged();
1201 /// The InputFontFamily property.<br />
1202 /// The font's family of the new input text.<br />
1204 /// <since_tizen> 3 </since_tizen>
1205 public string InputFontFamily
1209 return (string)GetValue(InputFontFamilyProperty);
1213 SetValue(InputFontFamilyProperty, value);
1214 NotifyPropertyChanged();
1219 /// The InputFontStyle property.<br />
1220 /// The font's style of the new input text.<br />
1221 /// The inputFontStyle map contains the following keys :<br />
1222 /// <list type="table">
1223 /// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
1224 /// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
1225 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1228 /// <since_tizen> 3 </since_tizen>
1229 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1230 public PropertyMap InputFontStyle
1234 return (PropertyMap)GetValue(InputFontStyleProperty);
1238 SetValue(InputFontStyleProperty, value);
1239 NotifyPropertyChanged();
1244 /// Set InputFontStyle to TextField. <br />
1246 /// <param name="fontStyle">The FontStyle</param>
1248 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1251 /// The following example demonstrates how to use the SetInputFontStyle method.
1253 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1254 /// fontStyle.Width = FontWidthType.Expanded;
1255 /// fontStyle.Weight = FontWeightType.Bold;
1256 /// fontStyle.Slant = FontSlantType.Italic;
1257 /// field.SetInputFontStyle(fontStyle);
1260 [EditorBrowsable(EditorBrowsableState.Never)]
1261 public void SetInputFontStyle(FontStyle fontStyle)
1263 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1265 SetValue(InputFontStyleProperty, fontStyleMap);
1270 /// Get InputFontStyle from TextField. <br />
1272 /// <returns>The FontStyle</returns>
1274 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1276 [EditorBrowsable(EditorBrowsableState.Never)]
1277 public FontStyle GetInputFontStyle()
1279 FontStyle fontStyle;
1280 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1282 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1288 /// The InputPointSize property.<br />
1289 /// The font's size of the new input text in points.<br />
1291 /// <since_tizen> 3 </since_tizen>
1292 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1293 public float InputPointSize
1297 return (float)GetValue(InputPointSizeProperty);
1301 SetValue(InputPointSizeProperty, value);
1302 NotifyPropertyChanged();
1307 /// The Underline property.<br />
1308 /// The default underline parameters.<br />
1309 /// The underline map contains the following keys :<br />
1310 /// <list type="table">
1311 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1312 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1313 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1316 /// <since_tizen> 3 </since_tizen>
1317 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1318 public PropertyMap Underline
1322 return (PropertyMap)GetValue(UnderlineProperty);
1326 SetValue(UnderlineProperty, value);
1327 NotifyPropertyChanged();
1332 /// Set Underline to TextField. <br />
1334 /// <param name="underline">The Underline</param>
1336 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1339 /// The following example demonstrates how to use the SetUnderline method.
1341 /// var underline = new Tizen.NUI.Text.Underline();
1342 /// underline.Enable = true;
1343 /// underline.Color = new Color("#3498DB");
1344 /// underline.Height = 2.0f;
1345 /// field.SetUnderline(underline);
1348 [EditorBrowsable(EditorBrowsableState.Never)]
1349 public void SetUnderline(Underline underline)
1351 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1353 SetValue(UnderlineProperty, underlineMap);
1358 /// Get Underline from TextField. <br />
1360 /// <returns>The Underline</returns>
1362 /// <see cref="Tizen.NUI.Text.Underline"/>
1364 [EditorBrowsable(EditorBrowsableState.Never)]
1365 public Underline GetUnderline()
1367 Underline underline;
1368 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1370 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1376 /// The InputUnderline property.<br />
1377 /// The underline parameters of the new input text.<br />
1379 /// <since_tizen> 3 </since_tizen>
1380 public string InputUnderline
1384 return (string)GetValue(InputUnderlineProperty);
1388 SetValue(InputUnderlineProperty, value);
1389 NotifyPropertyChanged();
1394 /// The Shadow property.<br />
1395 /// The default shadow parameters.<br />
1396 /// The shadow map contains the following keys :<br />
1397 /// <list type="table">
1398 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1399 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1400 /// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
1403 /// <since_tizen> 3 </since_tizen>
1404 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1405 public PropertyMap Shadow
1409 return (PropertyMap)GetValue(ShadowProperty);
1413 SetValue(ShadowProperty, value);
1414 NotifyPropertyChanged();
1419 /// Set Shadow to TextField. <br />
1421 /// <param name="shadow">The Shadow</param>
1423 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1426 /// The following example demonstrates how to use the SetShadow method.
1428 /// var shadow = new Tizen.NUI.Text.Shadow();
1429 /// shadow.Offset = new Vector2(3, 3);
1430 /// shadow.Color = new Color("#F1C40F");
1431 /// field.SetShadow(shadow);
1434 [EditorBrowsable(EditorBrowsableState.Never)]
1435 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1437 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1439 SetValue(ShadowProperty, shadowMap);
1444 /// Get Shadow from TextField. <br />
1446 /// <returns>The Shadow</returns>
1448 /// <see cref="Tizen.NUI.Text.Shadow"/>
1450 [EditorBrowsable(EditorBrowsableState.Never)]
1451 public Tizen.NUI.Text.Shadow GetShadow()
1453 Tizen.NUI.Text.Shadow shadow;
1454 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1456 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1462 /// The InputShadow property.<br />
1463 /// The shadow parameters of the new input text.<br />
1465 /// <since_tizen> 3 </since_tizen>
1466 public string InputShadow
1470 return (string)GetValue(InputShadowProperty);
1474 SetValue(InputShadowProperty, value);
1475 NotifyPropertyChanged();
1480 /// The Emboss property.<br />
1481 /// The default emboss parameters.<br />
1483 /// <since_tizen> 3 </since_tizen>
1484 public string Emboss
1488 return (string)GetValue(EmbossProperty);
1492 SetValue(EmbossProperty, value);
1493 NotifyPropertyChanged();
1498 /// The InputEmboss property.<br />
1499 /// The emboss parameters of the new input text.<br />
1501 /// <since_tizen> 3 </since_tizen>
1502 public string InputEmboss
1506 return (string)GetValue(InputEmbossProperty);
1510 SetValue(InputEmbossProperty, value);
1511 NotifyPropertyChanged();
1516 /// The Outline property.<br />
1517 /// The default outline parameters.<br />
1518 /// The outline map contains the following keys :<br />
1519 /// <list type="table">
1520 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1521 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1524 /// <since_tizen> 3 </since_tizen>
1525 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1526 public PropertyMap Outline
1530 return (PropertyMap)GetValue(OutlineProperty);
1534 SetValue(OutlineProperty, value);
1535 NotifyPropertyChanged();
1540 /// Set Outline to TextField. <br />
1542 /// <param name="outline">The Outline</param>
1544 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1547 /// The following example demonstrates how to use the SetOutline method.
1549 /// var outline = new Tizen.NUI.Text.Outline();
1550 /// outline.Width = 2.0f;
1551 /// outline.Color = new Color("#45B39D");
1552 /// field.SetOutline(outline);
1555 [EditorBrowsable(EditorBrowsableState.Never)]
1556 public void SetOutline(Outline outline)
1558 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1560 SetValue(OutlineProperty, outlineMap);
1565 /// Get Outline from TextField. <br />
1567 /// <returns>The Outline</returns>
1569 /// <see cref="Tizen.NUI.Text.Outline"/>
1571 [EditorBrowsable(EditorBrowsableState.Never)]
1572 public Outline GetOutline()
1575 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1577 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1583 /// The InputOutline property.<br />
1584 /// The outline parameters of the new input text.<br />
1586 /// <since_tizen> 3 </since_tizen>
1587 public string InputOutline
1591 return (string)GetValue(InputOutlineProperty);
1595 SetValue(InputOutlineProperty, value);
1596 NotifyPropertyChanged();
1601 /// The HiddenInputSettings property.<br />
1602 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1603 /// The hiddenInputSettings map contains the following keys :<br />
1604 /// <list type="table">
1605 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1606 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1607 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1608 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1612 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1615 /// The following example demonstrates how to set the HiddenInputSettings property.
1617 /// PropertyMap map = new PropertyMap();
1618 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1619 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1620 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1621 /// textField.HiddenInputSettings = map;
1624 /// <since_tizen> 3 </since_tizen>
1625 public Tizen.NUI.PropertyMap HiddenInputSettings
1629 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1633 SetValue(HiddenInputSettingsProperty, value);
1634 NotifyPropertyChanged();
1639 /// Set HiddenInput to TextField. <br />
1641 /// <param name="hiddenInput">The HiddenInput</param>
1643 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1646 /// The following example demonstrates how to use the SetHiddenInput method.
1648 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1649 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1650 /// hiddenInput.SubstituteCharacter = '★';
1651 /// hiddenInput.SubstituteCount = 0;
1652 /// hiddenInput.ShowLastCharacterDuration = 1000;
1653 /// field.SetHiddenInput(hiddenInput);
1656 [EditorBrowsable(EditorBrowsableState.Never)]
1657 public void SetHiddenInput(HiddenInput hiddenInput)
1659 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1661 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1666 /// Get HiddenInput from TextField. <br />
1668 /// <returns>The HiddenInput</returns>
1670 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1672 [EditorBrowsable(EditorBrowsableState.Never)]
1673 public HiddenInput GetHiddenInput()
1675 HiddenInput hiddenInput;
1676 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1678 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1684 /// The PixelSize property.<br />
1685 /// The size of font in pixels.<br />
1687 /// <since_tizen> 3 </since_tizen>
1688 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1689 public float PixelSize
1693 return (float)GetValue(PixelSizeProperty);
1697 SetValue(PixelSizeProperty, value);
1698 NotifyPropertyChanged();
1703 /// The Enable selection property.<br />
1704 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1706 /// <since_tizen> 3 </since_tizen>
1707 public bool EnableSelection
1711 return (bool)GetValue(EnableSelectionProperty);
1715 SetValue(EnableSelectionProperty, value);
1716 NotifyPropertyChanged();
1721 /// The Enable grab handle property.<br />
1722 /// Enables the grab handles for text selection.<br />
1723 /// The default value is true, which means the grab handles are enabled by default.<br />
1725 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1726 [EditorBrowsable(EditorBrowsableState.Never)]
1727 public bool EnableGrabHandle
1731 return (bool)GetValue(EnableGrabHandleProperty);
1735 SetValue(EnableGrabHandleProperty, value);
1736 NotifyPropertyChanged();
1741 /// The Enable grab handle popup property.<br />
1742 /// Enables the grab handle popup for text selection.<br />
1743 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1745 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1746 [EditorBrowsable(EditorBrowsableState.Never)]
1747 public bool EnableGrabHandlePopup
1751 return (bool)GetValue(EnableGrabHandlePopupProperty);
1755 SetValue(EnableGrabHandlePopupProperty, value);
1756 NotifyPropertyChanged();
1761 /// The portion of the text that has been selected by the user.
1764 /// Empty string when nothing is selected.
1766 /// <since_tizen> 9 </since_tizen>
1767 public string SelectedText
1771 string selectedText;
1772 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1774 propertyValue.Get(out selectedText);
1776 return selectedText;
1781 /// The start index for selection.
1784 /// When there is no selection, the index is current cursor position.
1786 /// <since_tizen> 9 </since_tizen>
1787 public int SelectedTextStart
1791 int selectedTextStart;
1792 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1794 propertyValue.Get(out selectedTextStart);
1796 return selectedTextStart;
1801 /// The end index for selection.
1804 /// When there is no selection, the index is current cursor position.
1806 /// <since_tizen> 9 </since_tizen>
1807 public int SelectedTextEnd
1811 int selectedTextEnd;
1812 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1814 propertyValue.Get(out selectedTextEnd);
1816 return selectedTextEnd;
1821 /// Enable editing in text control.
1823 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1824 [EditorBrowsable(EditorBrowsableState.Never)]
1825 public bool EnableEditing
1829 return (bool)GetValue(EnableEditingProperty);
1833 SetValue(EnableEditingProperty, value);
1837 private bool InternalEnableEditing
1842 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1844 propertyValue.Get(out enableEditing);
1846 return enableEditing;
1850 using (var propertyValue = new PropertyValue(value))
1852 SetProperty(TextField.Property.EnableEditing, propertyValue);
1853 NotifyPropertyChanged();
1859 /// Specify primary cursor (caret) position in text control.
1861 [EditorBrowsable(EditorBrowsableState.Never)]
1862 public int PrimaryCursorPosition
1866 return (int)GetValue(PrimaryCursorPositionProperty);
1870 SetValue(PrimaryCursorPositionProperty, value);
1874 private int InternalPrimaryCursorPosition
1878 int primaryCursorPosition;
1879 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1881 propertyValue.Get(out primaryCursorPosition);
1883 return primaryCursorPosition;
1887 using (PropertyValue propertyValue = new PropertyValue(value))
1889 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1890 NotifyPropertyChanged();
1896 /// The GrabHandleColor property.
1899 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1901 [EditorBrowsable(EditorBrowsableState.Never)]
1902 public Color GrabHandleColor
1906 Color temp = (Color)GetValue(GrabHandleColorProperty);
1907 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1911 SetValue(GrabHandleColorProperty, value);
1912 NotifyPropertyChanged();
1917 /// The ellipsis position of the text.
1918 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1920 /// <since_tizen> 9 </since_tizen>
1921 public EllipsisPosition EllipsisPosition
1925 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1929 SetValue(EllipsisPositionProperty, value);
1930 NotifyPropertyChanged();
1935 /// The spaces between characters in Pixels.
1937 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1938 /// The default value is 0.f which does nothing.
1941 [EditorBrowsable(EditorBrowsableState.Never)]
1942 public float CharacterSpacing
1946 return (float)GetValue(CharacterSpacingProperty);
1950 SetValue(CharacterSpacingProperty, value);
1951 NotifyPropertyChanged();
1956 /// Set InputFilter to TextField.
1958 /// <param name="inputFilter">The InputFilter</param>
1960 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1961 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1962 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1965 /// The following example demonstrates how to use the SetInputFilter method.
1967 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1968 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1969 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1970 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1973 /// <since_tizen> 9 </since_tizen>
1974 public void SetInputFilter(InputFilter inputFilter)
1976 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1977 using (var propertyValue = new PropertyValue(map))
1979 SetProperty(TextField.Property.InputFilter, propertyValue);
1984 /// Get InputFilter from TextField.
1986 /// <returns>The InputFilter</returns>
1988 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1990 /// <since_tizen> 9 </since_tizen>
1991 public InputFilter GetInputFilter()
1993 InputFilter inputFilter;
1994 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
1995 using (var map = new PropertyMap())
1997 propertyValue.Get(map);
1998 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2004 /// Set Strikethrough to TextField. <br />
2006 /// <param name="strikethrough">The Strikethrough</param>
2008 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2011 /// The following example demonstrates how to use the SetStrikethrough method.
2013 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2014 /// strikethrough.Enable = true;
2015 /// strikethrough.Color = new Color("#3498DB");
2016 /// strikethrough.Height = 2.0f;
2017 /// field.SetStrikethrough(strikethrough);
2020 [EditorBrowsable(EditorBrowsableState.Never)]
2021 public void SetStrikethrough(Strikethrough strikethrough)
2023 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2024 using (var propertyValue = new PropertyValue(map))
2026 SetProperty(TextField.Property.Strikethrough, propertyValue);
2031 /// Get Strikethrough from TextField. <br />
2033 /// <returns>The Strikethrough</returns>
2035 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2037 [EditorBrowsable(EditorBrowsableState.Never)]
2038 public Strikethrough GetStrikethrough()
2040 Strikethrough strikethrough;
2041 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2042 using (var map = new PropertyMap())
2044 propertyValue.Get(map);
2045 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2047 return strikethrough;
2051 /// The Placeholder property.
2052 /// The placeholder map contains the following keys :<br />
2053 /// <list type="table">
2054 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2055 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2056 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2057 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2058 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2059 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2060 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2061 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2065 /// The following example demonstrates how to set the Placeholder property.
2067 /// PropertyMap propertyMap = new PropertyMap();
2068 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2069 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2070 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2071 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2072 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2074 /// PropertyMap fontStyleMap = new PropertyMap();
2075 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2076 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2077 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2078 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2080 /// TextField field = new TextField();
2081 /// field.Placeholder = propertyMap;
2084 /// <since_tizen> 3 </since_tizen>
2085 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2086 public Tizen.NUI.PropertyMap Placeholder
2090 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2091 string defalutText = "";
2093 if (TextMapHelper.IsValue(map, 0))
2094 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2096 if (TextMapHelper.IsValue(map, 1))
2097 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2099 if (TextMapHelper.IsValue(map, 2))
2101 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2103 map.Add("color", color);
2107 if (TextMapHelper.IsValue(map, 3))
2108 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2110 if (TextMapHelper.IsValue(map, 4))
2112 using (var properyValue = map.Find(4))
2113 using (var fontStyle = new PropertyMap())
2115 properyValue.Get(fontStyle);
2116 using (var fontStyleValue = new PropertyValue(fontStyle))
2118 map.Add("fontStyle", fontStyleValue);
2123 if (TextMapHelper.IsValue(map, 5))
2124 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2126 if (TextMapHelper.IsValue(map, 6))
2127 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2129 if (TextMapHelper.IsValue(map, 7))
2130 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2136 SetValue(PlaceholderProperty, value);
2137 NotifyPropertyChanged();
2142 /// Set Placeholder to TextField. <br />
2144 /// <param name="placeholder">The Placeholder</param>
2146 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2149 /// The following example demonstrates how to use the SetPlaceholder method.
2151 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2152 /// placeholder.Text = "placeholder text";
2153 /// placeholder.TextFocused = "placeholder textFocused";
2154 /// placeholder.Color = new Color("#45B39D");
2155 /// placeholder.FontFamily = "BreezeSans";
2156 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2158 /// Width = FontWidthType.Expanded,
2159 /// Weight = FontWeightType.ExtraLight,
2160 /// Slant = FontSlantType.Italic,
2162 /// placeholder.PointSize = 25.0f;
2163 /// //placeholder.PixelSize = 50.0f;
2164 /// placeholder.Ellipsis = true;
2165 /// field.SetPlaceholder(placeholder);
2168 [EditorBrowsable(EditorBrowsableState.Never)]
2169 public void SetPlaceholder(Placeholder placeholder)
2171 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2173 SetValue(PlaceholderProperty, placeholderMap);
2178 /// Get Placeholder from TextField. <br />
2180 /// <returns>The Placeholder</returns>
2182 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2184 [EditorBrowsable(EditorBrowsableState.Never)]
2185 public Placeholder GetPlaceholder()
2187 Placeholder placeholder;
2188 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2190 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2196 /// The Ellipsis property.<br />
2197 /// Enable or disable the ellipsis.<br />
2198 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2200 /// <since_tizen> 4 </since_tizen>
2201 public bool Ellipsis
2205 return (bool)GetValue(EllipsisProperty);
2209 SetValue(EllipsisProperty, value);
2210 NotifyPropertyChanged();
2215 /// Enables selection of the text using the Shift key.
2217 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2218 [EditorBrowsable(EditorBrowsableState.Never)]
2219 public bool EnableShiftSelection
2223 return (bool)GetValue(EnableShiftSelectionProperty);
2227 SetValue(EnableShiftSelectionProperty, value);
2228 NotifyPropertyChanged();
2233 /// The text alignment to match the direction of the system language.<br />
2234 /// The default value is true.<br />
2236 /// <since_tizen> 6 </since_tizen>
2237 public bool MatchSystemLanguageDirection
2241 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2245 SetValue(MatchSystemLanguageDirectionProperty, value);
2246 NotifyPropertyChanged();
2251 /// The FontSizeScale property. <br />
2252 /// The default value is 1.0. <br />
2253 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2254 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2256 /// <since_tizen> 9 </since_tizen>
2257 public float FontSizeScale
2261 return fontSizeScale;
2265 float newFontSizeScale;
2267 if (fontSizeScale == value) return;
2269 fontSizeScale = value;
2270 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2272 SystemSettingsFontSize systemSettingsFontSize;
2276 systemSettingsFontSize = SystemSettings.FontSize;
2280 Console.WriteLine("{0} Exception caught.", e);
2281 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2283 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2284 addFontSizeChangedCallback();
2288 newFontSizeScale = fontSizeScale;
2289 removeFontSizeChangedCallback();
2292 SetValue(FontSizeScaleProperty, newFontSizeScale);
2293 NotifyPropertyChanged();
2298 /// The EnableFontSizeScale property.<br />
2299 /// Whether the font size scale is enabled. (The default value is true)
2301 [EditorBrowsable(EditorBrowsableState.Never)]
2302 public bool EnableFontSizeScale
2306 return (bool)GetValue(EnableFontSizeScaleProperty);
2310 SetValue(EnableFontSizeScaleProperty, value);
2311 NotifyPropertyChanged();
2315 /// Only used by the IL of xaml, will never changed to not hidden.
2316 [EditorBrowsable(EditorBrowsableState.Never)]
2317 public override bool IsCreateByXaml
2321 return base.IsCreateByXaml;
2325 base.IsCreateByXaml = value;
2329 this.TextChanged += (obj, e) =>
2331 this.Text = e.TextField.Text;
2338 /// Get the InputMethodContext instance.
2340 /// <returns>The InputMethodContext instance.</returns>
2341 /// <since_tizen> 5 </since_tizen>
2342 public InputMethodContext GetInputMethodContext()
2344 if (inputMethodCotext == null)
2346 /*Avoid raising InputMethodContext reference count.*/
2347 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2348 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2350 return inputMethodCotext;
2354 /// Select the whole text.
2356 /// <since_tizen> 9 </since_tizen>
2357 public void SelectWholeText()
2359 Interop.TextField.SelectWholeText(SwigCPtr);
2360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2364 /// Select text from start to end index. <br />
2365 /// The index is valid when 0 or positive.
2367 /// <param name="start">The start index for selection.</param>
2368 /// <param name="end">The end index for selection.</param>
2370 /// If the end index exceeds the maximum value, it is set to the length of the text.
2372 /// <since_tizen> 9 </since_tizen>
2373 public void SelectText(int start, int end)
2376 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2378 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2380 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2385 /// Clear selection of the text. <br />
2386 /// Valid when selection is activate.
2388 /// <since_tizen> 9 </since_tizen>
2389 public void SelectNone()
2391 _ = Interop.TextField.SelectNone(SwigCPtr);
2392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2395 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2397 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));
2398 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2405 /// <since_tizen> 3 </since_tizen>
2406 protected override void Dispose(DisposeTypes type)
2410 DisposeQueue.Instance.Add(this);
2414 if (systemlangTextFlag)
2416 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2419 removeFontSizeChangedCallback();
2421 if (type == DisposeTypes.Explicit)
2424 //Release your own managed resources here.
2425 //You should release all of your own disposable objects here.
2428 //Release your own unmanaged resources here.
2429 //You should not access any managed member here except static instance.
2430 //because the execution order of Finalizes is non-deterministic.
2433 if (textFieldCursorPositionChangedCallbackDelegate != null)
2435 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2438 if (textFieldMaxLengthReachedCallbackDelegate != null)
2440 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2443 if (textFieldSelectionStartedCallbackDelegate != null)
2445 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2448 if (textFieldSelectionClearedCallbackDelegate != null)
2450 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2453 if (textFieldSelectionChangedCallbackDelegate != null)
2455 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2458 if (textFieldTextChangedCallbackDelegate != null)
2460 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2467 /// This will not be public opened.
2468 [EditorBrowsable(EditorBrowsableState.Never)]
2469 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2471 // In order to speed up IME hide, temporarily add
2472 GetInputMethodContext()?.DestroyContext();
2473 Interop.TextField.DeleteTextField(swigCPtr);
2476 internal override LayoutItem CreateDefaultLayout()
2478 return new TextFieldLayout();
2481 internal void SetTextWithoutTextChanged(string text)
2483 invokeTextChanged = false;
2484 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2485 invokeTextChanged = true;
2488 private string SetTranslatable(string textFieldSid)
2490 string translatableText = null;
2491 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2492 if (translatableText != null)
2494 if (systemlangTextFlag == false)
2496 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2497 systemlangTextFlag = true;
2499 return translatableText;
2503 translatableText = "";
2504 return translatableText;
2508 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2510 if (textFieldTextSid != null)
2512 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2514 if (textFieldPlaceHolderTextSid != null)
2516 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2518 if (textFieldPlaceHolderTextFocusedSid != null)
2520 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2524 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2526 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2527 SetValue(FontSizeScaleProperty, newFontSizeScale);
2528 NotifyPropertyChanged();
2531 private void addFontSizeChangedCallback()
2533 if (hasFontSizeChangedCallback != true)
2537 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2538 hasFontSizeChangedCallback = true;
2542 Console.WriteLine("{0} Exception caught.", e);
2543 hasFontSizeChangedCallback = false;
2548 private void removeFontSizeChangedCallback()
2550 if (hasFontSizeChangedCallback == true)
2554 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2555 hasFontSizeChangedCallback = false;
2559 Console.WriteLine("{0} Exception caught.", e);
2560 hasFontSizeChangedCallback = true;
2565 internal new class Property
2567 internal static readonly int TEXT = Interop.TextField.TextGet();
2568 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2569 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2570 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2571 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2572 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2573 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2574 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2575 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2576 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2577 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2578 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2579 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2580 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2581 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2582 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2583 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2584 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2585 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2586 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2587 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2588 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2589 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2590 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2591 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2592 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2593 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2594 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2595 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2596 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2597 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2598 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2599 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2600 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2601 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2602 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2603 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2604 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2605 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2606 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2607 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2608 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2609 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2610 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2611 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2612 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2613 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2614 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2615 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2616 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2617 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2618 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2619 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2620 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2621 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2622 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2623 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2624 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2625 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2626 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2627 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2628 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2629 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2630 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2631 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2634 internal class InputStyle
2640 FontFamily = 0x0002,
2650 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2652 DecorationBoundingBox = new Rectangle(x, y, width, height);
2654 private void OnInputColorChanged(float x, float y, float z, float w)
2656 InputColor = new Vector4(x, y, z, w);
2658 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2660 PlaceholderTextColor = new Vector4(r, g, b, a);
2662 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2664 PrimaryCursorColor = new Vector4(x, y, z, w);
2666 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2668 SecondaryCursorColor = new Vector4(x, y, z, w);
2670 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2672 SelectionHighlightColor = new Vector4(x, y, z, w);
2674 private void OnShadowColorChanged(float x, float y, float z, float w)
2676 ShadowColor = new Vector4(x, y, z, w);
2678 private void OnShadowOffsetChanged(float x, float y)
2680 ShadowOffset = new Vector2(x, y);
2682 private void OnTextColorChanged(float r, float g, float b, float a)
2684 TextColor = new Color(r, g, b, a);
2686 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2688 GrabHandleColor = new Color(r, g, b, a);
2691 private class TextFieldLayout : LayoutItem
2693 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2695 // Padding will be automatically applied by DALi TextField.
2696 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2697 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2698 var minSize = Owner.MinimumSize;
2699 var maxSize = Owner.MaximumSize;
2700 var naturalSize = Owner.GetNaturalSize();
2702 if (((TextField)Owner).Text.Length == 0)
2704 // Calculate height of TextField by setting Text with " ".
2705 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2706 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2708 // Store original WidthSpecification to restore it after setting ResizePolicy.
2709 var widthSpecification = Owner.WidthSpecification;
2711 // In DALi's Size logic, if Width or Height is set to be 0, then
2712 // ResizePolicy is not changed to Fixed.
2713 // This causes Size changes after NUI Layout's OnMeasure is finished.
2714 // e.g. TextField's Width fills to its parent although Text is null and
2715 // WidthSpecification is WrapContent.
2716 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2717 // in advance if Text is null.
2718 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2720 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2721 Owner.WidthSpecification = widthSpecification;
2723 naturalSize = Owner.GetNaturalSize();
2725 // Restore TextField's Text after calculating height of TextField.
2726 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2727 ((TextField)Owner).SetTextWithoutTextChanged("");
2730 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2732 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2735 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2737 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2740 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2741 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2743 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2744 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2746 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2747 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));