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;
41 private bool isSettingTextInCSharp = false;
43 static TextField() { }
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 attributes, it is abstract function and must be override.
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 protected override ViewStyle CreateViewStyle()
72 return new TextFieldStyle();
75 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
82 TextChanged += TextFieldTextChanged;
85 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
92 TextChanged += TextFieldTextChanged;
95 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 internal enum ExceedPolicyType
102 ExceedPolicyOriginal,
107 /// The TranslatableText property.<br />
108 /// The text can set the SID value.<br />
110 /// <exception cref='ArgumentNullException'>
111 /// ResourceManager about multilingual is null.
113 /// <since_tizen> 4 </since_tizen>
114 public string TranslatableText
118 return (string)GetValue(TranslatableTextProperty);
122 SetValue(TranslatableTextProperty, value);
125 private string translatableText
129 return textFieldTextSid;
133 if (NUIApplication.MultilingualResourceManager == null)
135 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
137 textFieldTextSid = value;
138 Text = SetTranslatable(textFieldTextSid);
139 NotifyPropertyChanged();
144 /// The TranslatablePlaceholderText property.<br />
145 /// The text can set the SID value.<br />
147 /// <exception cref='ArgumentNullException'>
148 /// ResourceManager about multilingual is null.
150 /// <since_tizen> 4 </since_tizen>
151 public string TranslatablePlaceholderText
155 return (string)GetValue(TranslatablePlaceholderTextProperty);
159 SetValue(TranslatablePlaceholderTextProperty, value);
162 private string translatablePlaceholderText
166 return textFieldPlaceHolderTextSid;
170 if (NUIApplication.MultilingualResourceManager == null)
172 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
174 textFieldPlaceHolderTextSid = value;
175 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
176 NotifyPropertyChanged();
181 /// The TranslatablePlaceholderTextFocused property.<br />
182 /// The text can set the SID value.<br />
184 /// <exception cref='ArgumentNullException'>
185 /// ResourceManager about multilingual is null.
187 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
188 [EditorBrowsable(EditorBrowsableState.Never)]
189 public string TranslatablePlaceholderTextFocused
193 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
197 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
200 private string translatablePlaceholderTextFocused
204 return textFieldPlaceHolderTextFocusedSid;
208 if (NUIApplication.MultilingualResourceManager == null)
210 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
212 textFieldPlaceHolderTextFocusedSid = value;
213 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
214 NotifyPropertyChanged();
219 /// The Text property.<br />
220 /// The text to display in the UTF-8 format.<br />
222 /// <since_tizen> 3 </since_tizen>
227 return (string)GetValue(TextProperty);
231 SetValue(TextProperty, value);
232 NotifyPropertyChanged();
237 /// The PlaceholderText property.<br />
238 /// The text to display when the TextField is empty and inactive. <br />
240 /// <since_tizen> 3 </since_tizen>
241 public string PlaceholderText
245 return (string)GetValue(PlaceholderTextProperty);
249 SetValue(PlaceholderTextProperty, value);
250 NotifyPropertyChanged();
255 /// The PlaceholderTextFocused property. <br />
256 /// The text to display when the TextField is empty with input focus. <br />
258 /// <since_tizen> 3 </since_tizen>
259 public string PlaceholderTextFocused
263 return (string)GetValue(PlaceholderTextFocusedProperty);
267 SetValue(PlaceholderTextFocusedProperty, value);
268 NotifyPropertyChanged();
273 /// The FontFamily property.<br />
274 /// The requested font family to use.<br />
276 /// <since_tizen> 3 </since_tizen>
277 public string FontFamily
281 return (string)GetValue(FontFamilyProperty);
285 SetValue(FontFamilyProperty, value);
286 NotifyPropertyChanged();
291 /// The FontStyle property.<br />
292 /// The requested font style to use.<br />
293 /// The fontStyle map contains the following keys :<br />
294 /// <list type="table">
295 /// <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>
296 /// <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>
297 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
300 /// <since_tizen> 3 </since_tizen>
301 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
302 public PropertyMap FontStyle
306 return (PropertyMap)GetValue(FontStyleProperty);
310 SetValue(FontStyleProperty, value);
311 NotifyPropertyChanged();
316 /// Set FontStyle to TextField. <br />
318 /// <param name="fontStyle">The FontStyle</param>
320 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
323 /// The following example demonstrates how to use the SetFontStyle method.
325 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
326 /// fontStyle.Width = FontWidthType.Expanded;
327 /// fontStyle.Weight = FontWeightType.Bold;
328 /// fontStyle.Slant = FontSlantType.Italic;
329 /// field.SetFontStyle(fontStyle);
332 [EditorBrowsable(EditorBrowsableState.Never)]
333 public void SetFontStyle(FontStyle fontStyle)
335 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
337 SetValue(FontStyleProperty, fontStyleMap);
342 /// Get FontStyle from TextField. <br />
344 /// <returns>The FontStyle</returns>
346 /// <see cref="Tizen.NUI.Text.FontStyle"/>
348 [EditorBrowsable(EditorBrowsableState.Never)]
349 public FontStyle GetFontStyle()
352 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
354 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
360 /// The PointSize property.<br />
361 /// The size of font in points.<br />
363 /// <since_tizen> 3 </since_tizen>
364 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
365 public float PointSize
369 return (float)GetValue(PointSizeProperty);
373 SetValue(PointSizeProperty, value);
374 NotifyPropertyChanged();
379 /// The MaxLength property.<br />
380 /// The maximum number of characters that can be inserted.<br />
382 /// <since_tizen> 3 </since_tizen>
387 return (int)GetValue(MaxLengthProperty);
391 SetValue(MaxLengthProperty, value);
392 NotifyPropertyChanged();
397 /// The ExceedPolicy property.<br />
398 /// Specifies how the text is truncated when it does not fit.<br />
400 /// <since_tizen> 3 </since_tizen>
401 public int ExceedPolicy
405 return (int)GetValue(ExceedPolicyProperty);
409 SetValue(ExceedPolicyProperty, value);
410 NotifyPropertyChanged();
415 /// The HorizontalAlignment property.<br />
416 /// The line horizontal alignment.<br />
418 /// <since_tizen> 3 </since_tizen>
419 public HorizontalAlignment HorizontalAlignment
423 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
427 SetValue(HorizontalAlignmentProperty, value);
428 NotifyPropertyChanged();
433 /// The VerticalAlignment property.<br />
434 /// The line vertical alignment.<br />
436 /// <since_tizen> 3 </since_tizen>
437 public VerticalAlignment VerticalAlignment
441 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
445 SetValue(VerticalAlignmentProperty, value);
446 NotifyPropertyChanged();
447 NotifyPropertyChanged();
452 /// The TextColor property.<br />
453 /// The color of the text.<br />
456 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
458 /// <since_tizen> 3 </since_tizen>
459 public Color TextColor
463 Color temp = (Color)GetValue(TextColorProperty);
464 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
468 SetValue(TextColorProperty, value);
469 NotifyPropertyChanged();
474 /// The PlaceholderTextColor property.
477 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
479 /// <since_tizen> 3 </since_tizen>
480 public Vector4 PlaceholderTextColor
484 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
485 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
489 SetValue(PlaceholderTextColorProperty, value);
490 NotifyPropertyChanged();
495 /// The ShadowOffset property.
497 /// <since_tizen> 3 </since_tizen>
499 /// Deprecated.(API Level 6) Use Shadow instead.
500 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
502 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
503 public Vector2 ShadowOffset
507 return GetValue(ShadowOffsetProperty) as Vector2;
511 SetValue(ShadowOffsetProperty, value);
515 private Vector2 InternalShadowOffset
519 float x = 0.0f, y = 0.0f;
520 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
521 using (var shadowOffset = new Vector2())
523 if (null != propertyValue)
525 propertyValue.Get(shadowOffset);
530 return new Vector2(OnShadowOffsetChanged, x, y);
534 using (var map = new PropertyMap())
536 map.Add("offset", value);
537 var shadowMap = Shadow;
538 shadowMap.Merge(map);
539 SetValue(ShadowProperty, shadowMap);
540 NotifyPropertyChanged();
546 /// The ShadowColor property.
548 /// <since_tizen> 3 </since_tizen>
550 /// Deprecated.(API Level 6) Use Shadow instead.
551 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
553 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
554 public Vector4 ShadowColor
558 return GetValue(ShadowColorProperty) as Vector4;
562 SetValue(ShadowColorProperty, value);
566 private Vector4 InternalShadowColor
570 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
571 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
572 using (var shadowColor = new Vector4())
574 if (null != propertyValue)
576 propertyValue.Get(shadowColor);
583 return new Vector4(OnShadowColorChanged, x, y, z, w);
587 using (var map = new PropertyMap())
589 map.Add("color", value);
590 var shadowMap = Shadow;
591 shadowMap.Merge(map);
592 SetValue(ShadowProperty, shadowMap);
593 NotifyPropertyChanged();
599 /// The PrimaryCursorColor property.<br />
600 /// The color to apply to the primary cursor.<br />
603 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
605 /// <since_tizen> 3 </since_tizen>
606 public Vector4 PrimaryCursorColor
610 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
611 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
615 SetValue(PrimaryCursorColorProperty, value);
616 NotifyPropertyChanged();
621 /// The SecondaryCursorColor property.<br />
622 /// The color to apply to the secondary cursor.<br />
625 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
627 /// <since_tizen> 3 </since_tizen>
628 public Vector4 SecondaryCursorColor
632 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
633 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
637 SetValue(SecondaryCursorColorProperty, value);
638 NotifyPropertyChanged();
643 /// The EnableCursorBlink property.<br />
644 /// Whether the cursor should blink or not.<br />
646 /// <since_tizen> 3 </since_tizen>
647 public bool EnableCursorBlink
651 return (bool)GetValue(EnableCursorBlinkProperty);
655 SetValue(EnableCursorBlinkProperty, value);
656 NotifyPropertyChanged();
661 /// The CursorBlinkInterval property.<br />
662 /// The time interval in seconds between cursor on/off states.<br />
664 /// <since_tizen> 3 </since_tizen>
665 public float CursorBlinkInterval
669 return (float)GetValue(CursorBlinkIntervalProperty);
673 SetValue(CursorBlinkIntervalProperty, value);
674 NotifyPropertyChanged();
679 /// The CursorBlinkDuration property.<br />
680 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
682 /// <since_tizen> 3 </since_tizen>
683 public float CursorBlinkDuration
687 return (float)GetValue(CursorBlinkDurationProperty);
691 SetValue(CursorBlinkDurationProperty, value);
692 NotifyPropertyChanged();
697 /// The CursorWidth property.
699 /// <since_tizen> 3 </since_tizen>
700 public int CursorWidth
704 return (int)GetValue(CursorWidthProperty);
708 SetValue(CursorWidthProperty, value);
709 NotifyPropertyChanged();
714 /// The GrabHandleImage property.<br />
715 /// The image to display for the grab handle.<br />
717 /// <since_tizen> 3 </since_tizen>
718 public string GrabHandleImage
722 return (string)GetValue(GrabHandleImageProperty);
726 SetValue(GrabHandleImageProperty, value);
727 NotifyPropertyChanged();
732 /// The GrabHandlePressedImage property.<br />
733 /// The image to display when the grab handle is pressed.<br />
735 /// <since_tizen> 3 </since_tizen>
736 public string GrabHandlePressedImage
740 return (string)GetValue(GrabHandlePressedImageProperty);
744 SetValue(GrabHandlePressedImageProperty, value);
745 NotifyPropertyChanged();
750 /// The ScrollThreshold property.<br />
751 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
753 /// <since_tizen> 3 </since_tizen>
754 public float ScrollThreshold
758 return (float)GetValue(ScrollThresholdProperty);
762 SetValue(ScrollThresholdProperty, value);
763 NotifyPropertyChanged();
768 /// The ScrollSpeed property.<br />
769 /// The scroll speed in pixels per second.<br />
771 /// <since_tizen> 3 </since_tizen>
772 public float ScrollSpeed
776 return (float)GetValue(ScrollSpeedProperty);
780 SetValue(ScrollSpeedProperty, value);
781 NotifyPropertyChanged();
786 /// The SelectionHandleImageLeft property.<br />
787 /// The image to display for the left selection handle.<br />
788 /// The selectionHandleImageLeft map contains the following key :<br />
789 /// <list type="table">
790 /// <item><term>filename (string)</term><description>The path of image file</description></item>
793 /// <since_tizen> 3 </since_tizen>
794 public PropertyMap SelectionHandleImageLeft
798 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
802 SetValue(SelectionHandleImageLeftProperty, value);
803 NotifyPropertyChanged();
808 /// The SelectionHandleImageRight property.<br />
809 /// The image to display for the right selection handle.<br />
810 /// The selectionHandleImageRight map contains the following key :<br />
811 /// <list type="table">
812 /// <item><term>filename (string)</term><description>The path of image file</description></item>
815 /// <since_tizen> 3 </since_tizen>
816 public PropertyMap SelectionHandleImageRight
820 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
824 SetValue(SelectionHandleImageRightProperty, value);
825 NotifyPropertyChanged();
830 /// Set SelectionHandleImage to TextField. <br />
832 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
834 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
837 /// The following example demonstrates how to use the SetSelectionHandleImage method.
839 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
840 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
841 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
842 /// field.SetSelectionHandleImage(selectionHandleImage);
845 [EditorBrowsable(EditorBrowsableState.Never)]
846 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
848 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
850 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
852 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
856 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
858 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
860 SetValue(SelectionHandleImageRightProperty, rightImageMap);
866 /// Get SelectionHandleImage from TextField. <br />
868 /// <returns>The SelectionHandleImage</returns>
870 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
872 [EditorBrowsable(EditorBrowsableState.Never)]
873 public SelectionHandleImage GetSelectionHandleImage()
875 SelectionHandleImage selectionHandleImage;
876 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
877 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
879 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
881 return selectionHandleImage;
885 /// The SelectionHandlePressedImageLeft property.<br />
886 /// The image to display when the left selection handle is pressed.<br />
887 /// The selectionHandlePressedImageLeft map contains the following key :<br />
888 /// <list type="table">
889 /// <item><term>filename (string)</term><description>The path of image file</description></item>
892 /// <since_tizen> 3 </since_tizen>
893 public PropertyMap SelectionHandlePressedImageLeft
897 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
901 SetValue(SelectionHandlePressedImageLeftProperty, value);
902 NotifyPropertyChanged();
907 /// The SelectionHandlePressedImageRight property.<br />
908 /// The image to display when the right selection handle is pressed.<br />
909 /// The selectionHandlePressedImageRight map contains the following key :<br />
910 /// <list type="table">
911 /// <item><term>filename (string)</term><description>The path of image file</description></item>
914 /// <since_tizen> 3 </since_tizen>
915 public PropertyMap SelectionHandlePressedImageRight
919 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
923 SetValue(SelectionHandlePressedImageRightProperty, value);
924 NotifyPropertyChanged();
929 /// Set SelectionHandlePressedImage to TextField. <br />
931 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
933 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
936 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
938 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
939 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
940 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
941 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
944 [EditorBrowsable(EditorBrowsableState.Never)]
945 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
947 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
949 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
951 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
955 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
957 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
959 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
965 /// Get SelectionHandlePressedImage from TextField. <br />
967 /// <returns>The SelectionHandlePressedImage</returns>
969 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
971 [EditorBrowsable(EditorBrowsableState.Never)]
972 public SelectionHandleImage GetSelectionHandlePressedImage()
974 SelectionHandleImage selectionHandleImage;
975 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
976 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
978 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
980 return selectionHandleImage;
984 /// The SelectionHandleMarkerImageLeft property.<br />
985 /// The image to display for the left selection handle marker.<br />
986 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
987 /// <list type="table">
988 /// <item><term>filename (string)</term><description>The path of image file</description></item>
991 /// <since_tizen> 3 </since_tizen>
992 public PropertyMap SelectionHandleMarkerImageLeft
996 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1000 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1001 NotifyPropertyChanged();
1006 /// The SelectionHandleMarkerImageRight property.<br />
1007 /// The image to display for the right selection handle marker.<br />
1008 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1009 /// <list type="table">
1010 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1013 /// <since_tizen> 3 </since_tizen>
1014 public PropertyMap SelectionHandleMarkerImageRight
1018 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1022 SetValue(SelectionHandleMarkerImageRightProperty, value);
1023 NotifyPropertyChanged();
1028 /// Set SelectionHandleMarkerImage to TextField. <br />
1030 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1032 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1035 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1037 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1038 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1039 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1040 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1043 [EditorBrowsable(EditorBrowsableState.Never)]
1044 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1046 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1048 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1050 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1054 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1056 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1058 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1064 /// Get SelectionHandleMarkerImage from TextField. <br />
1066 /// <returns>The SelectionHandleMarkerImage</returns>
1068 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1070 [EditorBrowsable(EditorBrowsableState.Never)]
1071 public SelectionHandleImage GetSelectionHandleMarkerImage()
1073 SelectionHandleImage selectionHandleImage;
1074 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1075 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1077 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1079 return selectionHandleImage;
1083 /// The SelectionHighlightColor property.<br />
1084 /// The color of the selection highlight.<br />
1087 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1089 /// <since_tizen> 3 </since_tizen>
1090 public Vector4 SelectionHighlightColor
1094 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1095 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1099 SetValue(SelectionHighlightColorProperty, value);
1100 NotifyPropertyChanged();
1105 /// The DecorationBoundingBox property.<br />
1106 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1109 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1111 /// <since_tizen> 3 </since_tizen>
1112 public Rectangle DecorationBoundingBox
1116 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1117 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1121 SetValue(DecorationBoundingBoxProperty, value);
1122 NotifyPropertyChanged();
1127 /// The InputMethodSettings property.<br />
1128 /// The settings to relating to the System's Input Method, Key and Value.<br />
1131 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1134 /// The following example demonstrates how to set the InputMethodSettings property.
1136 /// InputMethod method = new InputMethod();
1137 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1138 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1139 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1140 /// method.Variation = 1;
1141 /// textField.InputMethodSettings = method.OutputMap;
1144 /// <since_tizen> 3 </since_tizen>
1145 public PropertyMap InputMethodSettings
1149 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1153 SetValue(InputMethodSettingsProperty, value);
1154 NotifyPropertyChanged();
1159 /// The InputColor property.<br />
1160 /// The color of the new input text.<br />
1163 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1165 /// <since_tizen> 3 </since_tizen>
1166 public Vector4 InputColor
1170 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1171 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1175 SetValue(InputColorProperty, value);
1176 NotifyPropertyChanged();
1181 /// The EnableMarkup property.<br />
1182 /// Whether the mark-up processing is enabled.<br />
1184 /// <since_tizen> 3 </since_tizen>
1185 public bool EnableMarkup
1189 return (bool)GetValue(EnableMarkupProperty);
1193 SetValue(EnableMarkupProperty, value);
1194 NotifyPropertyChanged();
1199 /// The InputFontFamily property.<br />
1200 /// The font's family of the new input text.<br />
1202 /// <since_tizen> 3 </since_tizen>
1203 public string InputFontFamily
1207 return (string)GetValue(InputFontFamilyProperty);
1211 SetValue(InputFontFamilyProperty, value);
1212 NotifyPropertyChanged();
1217 /// The InputFontStyle property.<br />
1218 /// The font's style of the new input text.<br />
1219 /// The inputFontStyle map contains the following keys :<br />
1220 /// <list type="table">
1221 /// <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>
1222 /// <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>
1223 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1226 /// <since_tizen> 3 </since_tizen>
1227 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1228 public PropertyMap InputFontStyle
1232 return (PropertyMap)GetValue(InputFontStyleProperty);
1236 SetValue(InputFontStyleProperty, value);
1237 NotifyPropertyChanged();
1242 /// Set InputFontStyle to TextField. <br />
1244 /// <param name="fontStyle">The FontStyle</param>
1246 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1249 /// The following example demonstrates how to use the SetInputFontStyle method.
1251 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1252 /// fontStyle.Width = FontWidthType.Expanded;
1253 /// fontStyle.Weight = FontWeightType.Bold;
1254 /// fontStyle.Slant = FontSlantType.Italic;
1255 /// field.SetInputFontStyle(fontStyle);
1258 [EditorBrowsable(EditorBrowsableState.Never)]
1259 public void SetInputFontStyle(FontStyle fontStyle)
1261 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1263 SetValue(InputFontStyleProperty, fontStyleMap);
1268 /// Get InputFontStyle from TextField. <br />
1270 /// <returns>The FontStyle</returns>
1272 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1274 [EditorBrowsable(EditorBrowsableState.Never)]
1275 public FontStyle GetInputFontStyle()
1277 FontStyle fontStyle;
1278 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1280 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1286 /// The InputPointSize property.<br />
1287 /// The font's size of the new input text in points.<br />
1289 /// <since_tizen> 3 </since_tizen>
1290 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1291 public float InputPointSize
1295 return (float)GetValue(InputPointSizeProperty);
1299 SetValue(InputPointSizeProperty, value);
1300 NotifyPropertyChanged();
1305 /// The Underline property.<br />
1306 /// The default underline parameters.<br />
1307 /// The underline map contains the following keys :<br />
1308 /// <list type="table">
1309 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1310 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1311 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1314 /// <since_tizen> 3 </since_tizen>
1315 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1316 public PropertyMap Underline
1320 return (PropertyMap)GetValue(UnderlineProperty);
1324 SetValue(UnderlineProperty, value);
1325 NotifyPropertyChanged();
1330 /// Set Underline to TextField. <br />
1332 /// <param name="underline">The Underline</param>
1334 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1337 /// The following example demonstrates how to use the SetUnderline method.
1339 /// var underline = new Tizen.NUI.Text.Underline();
1340 /// underline.Enable = true;
1341 /// underline.Color = new Color("#3498DB");
1342 /// underline.Height = 2.0f;
1343 /// field.SetUnderline(underline);
1346 [EditorBrowsable(EditorBrowsableState.Never)]
1347 public void SetUnderline(Underline underline)
1349 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1351 SetValue(UnderlineProperty, underlineMap);
1356 /// Get Underline from TextField. <br />
1358 /// <returns>The Underline</returns>
1360 /// <see cref="Tizen.NUI.Text.Underline"/>
1362 [EditorBrowsable(EditorBrowsableState.Never)]
1363 public Underline GetUnderline()
1365 Underline underline;
1366 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1368 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1374 /// The InputUnderline property.<br />
1375 /// The underline parameters of the new input text.<br />
1377 /// <since_tizen> 3 </since_tizen>
1378 public string InputUnderline
1382 return (string)GetValue(InputUnderlineProperty);
1386 SetValue(InputUnderlineProperty, value);
1387 NotifyPropertyChanged();
1392 /// The Shadow property.<br />
1393 /// The default shadow parameters.<br />
1394 /// The shadow map contains the following keys :<br />
1395 /// <list type="table">
1396 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1397 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1398 /// <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>
1401 /// <since_tizen> 3 </since_tizen>
1402 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1403 public PropertyMap Shadow
1407 return (PropertyMap)GetValue(ShadowProperty);
1411 SetValue(ShadowProperty, value);
1412 NotifyPropertyChanged();
1417 /// Set Shadow to TextField. <br />
1419 /// <param name="shadow">The Shadow</param>
1421 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1424 /// The following example demonstrates how to use the SetShadow method.
1426 /// var shadow = new Tizen.NUI.Text.Shadow();
1427 /// shadow.Offset = new Vector2(3, 3);
1428 /// shadow.Color = new Color("#F1C40F");
1429 /// field.SetShadow(shadow);
1432 [EditorBrowsable(EditorBrowsableState.Never)]
1433 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1435 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1437 SetValue(ShadowProperty, shadowMap);
1442 /// Get Shadow from TextField. <br />
1444 /// <returns>The Shadow</returns>
1446 /// <see cref="Tizen.NUI.Text.Shadow"/>
1448 [EditorBrowsable(EditorBrowsableState.Never)]
1449 public Tizen.NUI.Text.Shadow GetShadow()
1451 Tizen.NUI.Text.Shadow shadow;
1452 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1454 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1460 /// The InputShadow property.<br />
1461 /// The shadow parameters of the new input text.<br />
1463 /// <since_tizen> 3 </since_tizen>
1464 public string InputShadow
1468 return (string)GetValue(InputShadowProperty);
1472 SetValue(InputShadowProperty, value);
1473 NotifyPropertyChanged();
1478 /// The Emboss property.<br />
1479 /// The default emboss parameters.<br />
1481 /// <since_tizen> 3 </since_tizen>
1482 public string Emboss
1486 return (string)GetValue(EmbossProperty);
1490 SetValue(EmbossProperty, value);
1491 NotifyPropertyChanged();
1496 /// The InputEmboss property.<br />
1497 /// The emboss parameters of the new input text.<br />
1499 /// <since_tizen> 3 </since_tizen>
1500 public string InputEmboss
1504 return (string)GetValue(InputEmbossProperty);
1508 SetValue(InputEmbossProperty, value);
1509 NotifyPropertyChanged();
1514 /// The Outline property.<br />
1515 /// The default outline parameters.<br />
1516 /// The outline map contains the following keys :<br />
1517 /// <list type="table">
1518 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1519 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1522 /// <since_tizen> 3 </since_tizen>
1523 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1524 public PropertyMap Outline
1528 return (PropertyMap)GetValue(OutlineProperty);
1532 SetValue(OutlineProperty, value);
1533 NotifyPropertyChanged();
1538 /// Set Outline to TextField. <br />
1540 /// <param name="outline">The Outline</param>
1542 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1545 /// The following example demonstrates how to use the SetOutline method.
1547 /// var outline = new Tizen.NUI.Text.Outline();
1548 /// outline.Width = 2.0f;
1549 /// outline.Color = new Color("#45B39D");
1550 /// field.SetOutline(outline);
1553 [EditorBrowsable(EditorBrowsableState.Never)]
1554 public void SetOutline(Outline outline)
1556 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1558 SetValue(OutlineProperty, outlineMap);
1563 /// Get Outline from TextField. <br />
1565 /// <returns>The Outline</returns>
1567 /// <see cref="Tizen.NUI.Text.Outline"/>
1569 [EditorBrowsable(EditorBrowsableState.Never)]
1570 public Outline GetOutline()
1573 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1575 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1581 /// The InputOutline property.<br />
1582 /// The outline parameters of the new input text.<br />
1584 /// <since_tizen> 3 </since_tizen>
1585 public string InputOutline
1589 return (string)GetValue(InputOutlineProperty);
1593 SetValue(InputOutlineProperty, value);
1594 NotifyPropertyChanged();
1599 /// The HiddenInputSettings property.<br />
1600 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1601 /// The hiddenInputSettings map contains the following keys :<br />
1602 /// <list type="table">
1603 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1604 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1605 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1606 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1610 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1613 /// The following example demonstrates how to set the HiddenInputSettings property.
1615 /// PropertyMap map = new PropertyMap();
1616 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1617 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1618 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1619 /// textField.HiddenInputSettings = map;
1622 /// <since_tizen> 3 </since_tizen>
1623 public Tizen.NUI.PropertyMap HiddenInputSettings
1627 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1631 SetValue(HiddenInputSettingsProperty, value);
1632 NotifyPropertyChanged();
1637 /// Set HiddenInput to TextField. <br />
1639 /// <param name="hiddenInput">The HiddenInput</param>
1641 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1644 /// The following example demonstrates how to use the SetHiddenInput method.
1646 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1647 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1648 /// hiddenInput.SubstituteCharacter = '★';
1649 /// hiddenInput.SubstituteCount = 0;
1650 /// hiddenInput.ShowLastCharacterDuration = 1000;
1651 /// field.SetHiddenInput(hiddenInput);
1654 [EditorBrowsable(EditorBrowsableState.Never)]
1655 public void SetHiddenInput(HiddenInput hiddenInput)
1657 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1659 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1664 /// Get HiddenInput from TextField. <br />
1666 /// <returns>The HiddenInput</returns>
1668 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1670 [EditorBrowsable(EditorBrowsableState.Never)]
1671 public HiddenInput GetHiddenInput()
1673 HiddenInput hiddenInput;
1674 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1676 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1682 /// The PixelSize property.<br />
1683 /// The size of font in pixels.<br />
1685 /// <since_tizen> 3 </since_tizen>
1686 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1687 public float PixelSize
1691 return (float)GetValue(PixelSizeProperty);
1695 SetValue(PixelSizeProperty, value);
1696 NotifyPropertyChanged();
1701 /// The Enable selection property.<br />
1702 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1704 /// <since_tizen> 3 </since_tizen>
1705 public bool EnableSelection
1709 return (bool)GetValue(EnableSelectionProperty);
1713 SetValue(EnableSelectionProperty, value);
1714 NotifyPropertyChanged();
1719 /// The Enable grab handle property.<br />
1720 /// Enables the grab handles for text selection.<br />
1721 /// The default value is true, which means the grab handles are enabled by default.<br />
1723 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1724 [EditorBrowsable(EditorBrowsableState.Never)]
1725 public bool EnableGrabHandle
1729 return (bool)GetValue(EnableGrabHandleProperty);
1733 SetValue(EnableGrabHandleProperty, value);
1734 NotifyPropertyChanged();
1739 /// The Enable grab handle popup property.<br />
1740 /// Enables the grab handle popup for text selection.<br />
1741 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1743 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1744 [EditorBrowsable(EditorBrowsableState.Never)]
1745 public bool EnableGrabHandlePopup
1749 return (bool)GetValue(EnableGrabHandlePopupProperty);
1753 SetValue(EnableGrabHandlePopupProperty, value);
1754 NotifyPropertyChanged();
1759 /// The portion of the text that has been selected by the user.
1762 /// Empty string when nothing is selected.
1764 /// <since_tizen> 9 </since_tizen>
1765 public string SelectedText
1769 string selectedText;
1770 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1772 propertyValue.Get(out selectedText);
1774 return selectedText;
1779 /// The start index for selection.
1782 /// When there is no selection, the index is current cursor position.
1784 /// <since_tizen> 9 </since_tizen>
1785 public int SelectedTextStart
1789 int selectedTextStart;
1790 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1792 propertyValue.Get(out selectedTextStart);
1794 return selectedTextStart;
1799 /// The end index for selection.
1802 /// When there is no selection, the index is current cursor position.
1804 /// <since_tizen> 9 </since_tizen>
1805 public int SelectedTextEnd
1809 int selectedTextEnd;
1810 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1812 propertyValue.Get(out selectedTextEnd);
1814 return selectedTextEnd;
1819 /// Enable editing in text control.
1821 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1822 [EditorBrowsable(EditorBrowsableState.Never)]
1823 public bool EnableEditing
1827 return (bool)GetValue(EnableEditingProperty);
1831 SetValue(EnableEditingProperty, value);
1835 private bool InternalEnableEditing
1840 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1842 propertyValue.Get(out enableEditing);
1844 return enableEditing;
1848 using (var propertyValue = new PropertyValue(value))
1850 SetProperty(TextField.Property.EnableEditing, propertyValue);
1851 NotifyPropertyChanged();
1857 /// Specify primary cursor (caret) position in text control.
1859 [EditorBrowsable(EditorBrowsableState.Never)]
1860 public int PrimaryCursorPosition
1864 return (int)GetValue(PrimaryCursorPositionProperty);
1868 SetValue(PrimaryCursorPositionProperty, value);
1872 private int InternalPrimaryCursorPosition
1876 int primaryCursorPosition;
1877 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1879 propertyValue.Get(out primaryCursorPosition);
1881 return primaryCursorPosition;
1885 using (PropertyValue propertyValue = new PropertyValue(value))
1887 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1888 NotifyPropertyChanged();
1894 /// The GrabHandleColor property.
1897 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1899 [EditorBrowsable(EditorBrowsableState.Never)]
1900 public Color GrabHandleColor
1904 Color temp = (Color)GetValue(GrabHandleColorProperty);
1905 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1909 SetValue(GrabHandleColorProperty, value);
1910 NotifyPropertyChanged();
1915 /// The ellipsis position of the text.
1916 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1918 /// <since_tizen> 9 </since_tizen>
1919 public EllipsisPosition EllipsisPosition
1923 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1927 SetValue(EllipsisPositionProperty, value);
1928 NotifyPropertyChanged();
1933 /// The spaces between characters in Pixels.
1935 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1936 /// The default value is 0.f which does nothing.
1939 [EditorBrowsable(EditorBrowsableState.Never)]
1940 public float CharacterSpacing
1944 return (float)GetValue(CharacterSpacingProperty);
1948 SetValue(CharacterSpacingProperty, value);
1949 NotifyPropertyChanged();
1954 /// Set InputFilter to TextField.
1956 /// <param name="inputFilter">The InputFilter</param>
1958 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1959 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1960 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1963 /// The following example demonstrates how to use the SetInputFilter method.
1965 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1966 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1967 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1968 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1971 /// <since_tizen> 9 </since_tizen>
1972 public void SetInputFilter(InputFilter inputFilter)
1974 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1975 using (var propertyValue = new PropertyValue(map))
1977 SetProperty(TextField.Property.InputFilter, propertyValue);
1982 /// Get InputFilter from TextField.
1984 /// <returns>The InputFilter</returns>
1986 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1988 /// <since_tizen> 9 </since_tizen>
1989 public InputFilter GetInputFilter()
1991 InputFilter inputFilter;
1992 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
1993 using (var map = new PropertyMap())
1995 propertyValue.Get(map);
1996 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2002 /// Set Strikethrough to TextField. <br />
2004 /// <param name="strikethrough">The Strikethrough</param>
2006 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2009 /// The following example demonstrates how to use the SetStrikethrough method.
2011 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2012 /// strikethrough.Enable = true;
2013 /// strikethrough.Color = new Color("#3498DB");
2014 /// strikethrough.Height = 2.0f;
2015 /// field.SetStrikethrough(strikethrough);
2018 [EditorBrowsable(EditorBrowsableState.Never)]
2019 public void SetStrikethrough(Strikethrough strikethrough)
2021 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2022 using (var propertyValue = new PropertyValue(map))
2024 SetProperty(TextField.Property.Strikethrough, propertyValue);
2029 /// Get Strikethrough from TextField. <br />
2031 /// <returns>The Strikethrough</returns>
2033 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2035 [EditorBrowsable(EditorBrowsableState.Never)]
2036 public Strikethrough GetStrikethrough()
2038 Strikethrough strikethrough;
2039 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2040 using (var map = new PropertyMap())
2042 propertyValue.Get(map);
2043 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2045 return strikethrough;
2049 /// The Placeholder property.
2050 /// The placeholder map contains the following keys :<br />
2051 /// <list type="table">
2052 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2053 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2054 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2055 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2056 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2057 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2058 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2059 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2063 /// The following example demonstrates how to set the Placeholder property.
2065 /// PropertyMap propertyMap = new PropertyMap();
2066 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2067 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2068 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2069 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2070 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2072 /// PropertyMap fontStyleMap = new PropertyMap();
2073 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2074 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2075 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2076 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2078 /// TextField field = new TextField();
2079 /// field.Placeholder = propertyMap;
2082 /// <since_tizen> 3 </since_tizen>
2083 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2084 public Tizen.NUI.PropertyMap Placeholder
2088 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2089 string defalutText = "";
2091 if (TextMapHelper.IsValue(map, 0))
2092 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2094 if (TextMapHelper.IsValue(map, 1))
2095 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2097 if (TextMapHelper.IsValue(map, 2))
2099 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2101 map.Add("color", color);
2105 if (TextMapHelper.IsValue(map, 3))
2106 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2108 if (TextMapHelper.IsValue(map, 4))
2110 using (var properyValue = map.Find(4))
2111 using (var fontStyle = new PropertyMap())
2113 properyValue.Get(fontStyle);
2114 using (var fontStyleValue = new PropertyValue(fontStyle))
2116 map.Add("fontStyle", fontStyleValue);
2121 if (TextMapHelper.IsValue(map, 5))
2122 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2124 if (TextMapHelper.IsValue(map, 6))
2125 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2127 if (TextMapHelper.IsValue(map, 7))
2128 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2134 SetValue(PlaceholderProperty, value);
2135 NotifyPropertyChanged();
2140 /// Set Placeholder to TextField. <br />
2142 /// <param name="placeholder">The Placeholder</param>
2144 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2147 /// The following example demonstrates how to use the SetPlaceholder method.
2149 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2150 /// placeholder.Text = "placeholder text";
2151 /// placeholder.TextFocused = "placeholder textFocused";
2152 /// placeholder.Color = new Color("#45B39D");
2153 /// placeholder.FontFamily = "BreezeSans";
2154 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2156 /// Width = FontWidthType.Expanded,
2157 /// Weight = FontWeightType.ExtraLight,
2158 /// Slant = FontSlantType.Italic,
2160 /// placeholder.PointSize = 25.0f;
2161 /// //placeholder.PixelSize = 50.0f;
2162 /// placeholder.Ellipsis = true;
2163 /// field.SetPlaceholder(placeholder);
2166 [EditorBrowsable(EditorBrowsableState.Never)]
2167 public void SetPlaceholder(Placeholder placeholder)
2169 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2171 SetValue(PlaceholderProperty, placeholderMap);
2176 /// Get Placeholder from TextField. <br />
2178 /// <returns>The Placeholder</returns>
2180 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2182 [EditorBrowsable(EditorBrowsableState.Never)]
2183 public Placeholder GetPlaceholder()
2185 Placeholder placeholder;
2186 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2188 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2194 /// The Ellipsis property.<br />
2195 /// Enable or disable the ellipsis.<br />
2196 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2198 /// <since_tizen> 4 </since_tizen>
2199 public bool Ellipsis
2203 return (bool)GetValue(EllipsisProperty);
2207 SetValue(EllipsisProperty, value);
2208 NotifyPropertyChanged();
2213 /// Enables selection of the text using the Shift key.
2215 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2216 [EditorBrowsable(EditorBrowsableState.Never)]
2217 public bool EnableShiftSelection
2221 return (bool)GetValue(EnableShiftSelectionProperty);
2225 SetValue(EnableShiftSelectionProperty, value);
2226 NotifyPropertyChanged();
2231 /// The text alignment to match the direction of the system language.<br />
2232 /// The default value is true.<br />
2234 /// <since_tizen> 6 </since_tizen>
2235 public bool MatchSystemLanguageDirection
2239 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2243 SetValue(MatchSystemLanguageDirectionProperty, value);
2244 NotifyPropertyChanged();
2249 /// The FontSizeScale property. <br />
2250 /// The default value is 1.0. <br />
2251 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2252 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2254 /// <since_tizen> 9 </since_tizen>
2255 public float FontSizeScale
2259 return fontSizeScale;
2263 float newFontSizeScale;
2265 if (fontSizeScale == value) return;
2267 fontSizeScale = value;
2268 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2270 SystemSettingsFontSize systemSettingsFontSize;
2274 systemSettingsFontSize = SystemSettings.FontSize;
2278 Console.WriteLine("{0} Exception caught.", e);
2279 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2281 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2282 addFontSizeChangedCallback();
2286 newFontSizeScale = fontSizeScale;
2287 removeFontSizeChangedCallback();
2290 SetValue(FontSizeScaleProperty, newFontSizeScale);
2291 NotifyPropertyChanged();
2296 /// The EnableFontSizeScale property.<br />
2297 /// Whether the font size scale is enabled. (The default value is true)
2299 [EditorBrowsable(EditorBrowsableState.Never)]
2300 public bool EnableFontSizeScale
2304 return (bool)GetValue(EnableFontSizeScaleProperty);
2308 SetValue(EnableFontSizeScaleProperty, value);
2309 NotifyPropertyChanged();
2314 /// Get the InputMethodContext instance.
2316 /// <returns>The InputMethodContext instance.</returns>
2317 /// <since_tizen> 5 </since_tizen>
2318 public InputMethodContext GetInputMethodContext()
2320 if (inputMethodCotext == null)
2322 /*Avoid raising InputMethodContext reference count.*/
2323 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2326 return inputMethodCotext;
2330 /// Select the whole text.
2332 /// <since_tizen> 9 </since_tizen>
2333 public void SelectWholeText()
2335 Interop.TextField.SelectWholeText(SwigCPtr);
2336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2340 /// Select text from start to end index. <br />
2341 /// The index is valid when 0 or positive.
2343 /// <param name="start">The start index for selection.</param>
2344 /// <param name="end">The end index for selection.</param>
2346 /// If the end index exceeds the maximum value, it is set to the length of the text.
2348 /// <since_tizen> 9 </since_tizen>
2349 public void SelectText(int start, int end)
2352 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2354 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2356 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2361 /// Clear selection of the text. <br />
2362 /// Valid when selection is activate.
2364 /// <since_tizen> 9 </since_tizen>
2365 public void SelectNone()
2367 _ = Interop.TextField.SelectNone(SwigCPtr);
2368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2371 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2373 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));
2374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2381 /// <since_tizen> 3 </since_tizen>
2382 protected override void Dispose(DisposeTypes type)
2386 DisposeQueue.Instance.Add(this);
2390 if (systemlangTextFlag)
2392 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2395 removeFontSizeChangedCallback();
2397 if (type == DisposeTypes.Explicit)
2400 //Release your own managed resources here.
2401 //You should release all of your own disposable objects here.
2404 //Release your own unmanaged resources here.
2405 //You should not access any managed member here except static instance.
2406 //because the execution order of Finalizes is non-deterministic.
2409 if (textFieldCursorPositionChangedCallbackDelegate != null)
2411 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2414 if (textFieldMaxLengthReachedCallbackDelegate != null)
2416 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2419 if (textFieldSelectionStartedCallbackDelegate != null)
2421 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2424 if (textFieldSelectionClearedCallbackDelegate != null)
2426 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2429 if (textFieldSelectionChangedCallbackDelegate != null)
2431 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2434 if (textFieldTextChangedCallbackDelegate != null)
2436 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2440 TextChanged -= TextFieldTextChanged;
2445 /// This will not be public opened.
2446 [EditorBrowsable(EditorBrowsableState.Never)]
2447 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2449 // In order to speed up IME hide, temporarily add
2450 GetInputMethodContext()?.DestroyContext();
2451 Interop.TextField.DeleteTextField(swigCPtr);
2454 internal override LayoutItem CreateDefaultLayout()
2456 return new TextFieldLayout();
2459 internal void SetTextWithoutTextChanged(string text)
2461 invokeTextChanged = false;
2462 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2463 invokeTextChanged = true;
2466 private string SetTranslatable(string textFieldSid)
2468 string translatableText = null;
2469 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2470 if (translatableText != null)
2472 if (systemlangTextFlag == false)
2474 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2475 systemlangTextFlag = true;
2477 return translatableText;
2481 translatableText = "";
2482 return translatableText;
2486 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2488 if (textFieldTextSid != null)
2490 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2492 if (textFieldPlaceHolderTextSid != null)
2494 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2496 if (textFieldPlaceHolderTextFocusedSid != null)
2498 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2502 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2504 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2505 SetValue(FontSizeScaleProperty, newFontSizeScale);
2506 NotifyPropertyChanged();
2509 private void addFontSizeChangedCallback()
2511 if (hasFontSizeChangedCallback != true)
2515 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2516 hasFontSizeChangedCallback = true;
2520 Console.WriteLine("{0} Exception caught.", e);
2521 hasFontSizeChangedCallback = false;
2526 private void removeFontSizeChangedCallback()
2528 if (hasFontSizeChangedCallback == true)
2532 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2533 hasFontSizeChangedCallback = false;
2537 Console.WriteLine("{0} Exception caught.", e);
2538 hasFontSizeChangedCallback = true;
2543 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2545 if (!isSettingTextInCSharp)
2547 EnforceNotifyBindedInstance(TextProperty);
2551 internal new class Property
2553 internal static readonly int TEXT = Interop.TextField.TextGet();
2554 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2555 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2556 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2557 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2558 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2559 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2560 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2561 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2562 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2563 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2564 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2565 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2566 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2567 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2568 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2569 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2570 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2571 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2572 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2573 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2574 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2575 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2576 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2577 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2578 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2579 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2580 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2581 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2582 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2583 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2584 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2585 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2586 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2587 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2588 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2589 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2590 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2591 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2592 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2593 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2594 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2595 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2596 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2597 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2598 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2599 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2600 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2601 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2602 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2603 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2604 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2605 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2606 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2607 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2608 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2609 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2610 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2611 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2612 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2613 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2614 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2615 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2616 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2617 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2620 internal class InputStyle
2626 FontFamily = 0x0002,
2636 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2638 DecorationBoundingBox = new Rectangle(x, y, width, height);
2640 private void OnInputColorChanged(float x, float y, float z, float w)
2642 InputColor = new Vector4(x, y, z, w);
2644 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2646 PlaceholderTextColor = new Vector4(r, g, b, a);
2648 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2650 PrimaryCursorColor = new Vector4(x, y, z, w);
2652 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2654 SecondaryCursorColor = new Vector4(x, y, z, w);
2656 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2658 SelectionHighlightColor = new Vector4(x, y, z, w);
2660 private void OnShadowColorChanged(float x, float y, float z, float w)
2662 ShadowColor = new Vector4(x, y, z, w);
2664 private void OnShadowOffsetChanged(float x, float y)
2666 ShadowOffset = new Vector2(x, y);
2668 private void OnTextColorChanged(float r, float g, float b, float a)
2670 TextColor = new Color(r, g, b, a);
2672 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2674 GrabHandleColor = new Color(r, g, b, a);
2677 private class TextFieldLayout : LayoutItem
2679 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2681 // Padding will be automatically applied by DALi TextField.
2682 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2683 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2684 var minSize = Owner.MinimumSize;
2685 var maxSize = Owner.MaximumSize;
2686 var naturalSize = Owner.GetNaturalSize();
2688 if (((TextField)Owner).Text.Length == 0)
2690 // Calculate height of TextField by setting Text with " ".
2691 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2692 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2694 // Store original WidthSpecification to restore it after setting ResizePolicy.
2695 var widthSpecification = Owner.WidthSpecification;
2697 // In DALi's Size logic, if Width or Height is set to be 0, then
2698 // ResizePolicy is not changed to Fixed.
2699 // This causes Size changes after NUI Layout's OnMeasure is finished.
2700 // e.g. TextField's Width fills to its parent although Text is null and
2701 // WidthSpecification is WrapContent.
2702 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2703 // in advance if Text is null.
2704 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2706 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2707 Owner.WidthSpecification = widthSpecification;
2709 naturalSize = Owner.GetNaturalSize();
2711 // Restore TextField's Text after calculating height of TextField.
2712 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2713 ((TextField)Owner).SetTextWithoutTextChanged("");
2716 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2718 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2721 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2723 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2726 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2727 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2729 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2730 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2732 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2733 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));