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("Do not use this ShadowOffset(Deprecated). 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("Do not use this ShadowColor(Deprecated). 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 SelectionPopupStyle property.<br />
787 /// The style of the text selection popup can be set through SelectionPopupStyle property.
789 [EditorBrowsable(EditorBrowsableState.Never)]
790 public PropertyMap SelectionPopupStyle
794 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
798 SetValue(SelectionPopupStyleProperty, value);
799 NotifyPropertyChanged();
804 /// The SelectionHandleImageLeft property.<br />
805 /// The image to display for the left selection handle.<br />
806 /// The selectionHandleImageLeft map contains the following key :<br />
807 /// <list type="table">
808 /// <item><term>filename (string)</term><description>The path of image file</description></item>
811 /// <since_tizen> 3 </since_tizen>
812 public PropertyMap SelectionHandleImageLeft
816 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
820 SetValue(SelectionHandleImageLeftProperty, value);
821 NotifyPropertyChanged();
826 /// The SelectionHandleImageRight property.<br />
827 /// The image to display for the right selection handle.<br />
828 /// The selectionHandleImageRight map contains the following key :<br />
829 /// <list type="table">
830 /// <item><term>filename (string)</term><description>The path of image file</description></item>
833 /// <since_tizen> 3 </since_tizen>
834 public PropertyMap SelectionHandleImageRight
838 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
842 SetValue(SelectionHandleImageRightProperty, value);
843 NotifyPropertyChanged();
848 /// Set SelectionHandleImage to TextField. <br />
850 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
852 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
855 /// The following example demonstrates how to use the SetSelectionHandleImage method.
857 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
858 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
859 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
860 /// field.SetSelectionHandleImage(selectionHandleImage);
863 [EditorBrowsable(EditorBrowsableState.Never)]
864 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
866 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
868 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
870 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
874 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
876 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
878 SetValue(SelectionHandleImageRightProperty, rightImageMap);
884 /// Get SelectionHandleImage from TextField. <br />
886 /// <returns>The SelectionHandleImage</returns>
888 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
890 [EditorBrowsable(EditorBrowsableState.Never)]
891 public SelectionHandleImage GetSelectionHandleImage()
893 SelectionHandleImage selectionHandleImage;
894 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
895 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
897 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
899 return selectionHandleImage;
903 /// The SelectionHandlePressedImageLeft property.<br />
904 /// The image to display when the left selection handle is pressed.<br />
905 /// The selectionHandlePressedImageLeft map contains the following key :<br />
906 /// <list type="table">
907 /// <item><term>filename (string)</term><description>The path of image file</description></item>
910 /// <since_tizen> 3 </since_tizen>
911 public PropertyMap SelectionHandlePressedImageLeft
915 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
919 SetValue(SelectionHandlePressedImageLeftProperty, value);
920 NotifyPropertyChanged();
925 /// The SelectionHandlePressedImageRight property.<br />
926 /// The image to display when the right selection handle is pressed.<br />
927 /// The selectionHandlePressedImageRight map contains the following key :<br />
928 /// <list type="table">
929 /// <item><term>filename (string)</term><description>The path of image file</description></item>
932 /// <since_tizen> 3 </since_tizen>
933 public PropertyMap SelectionHandlePressedImageRight
937 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
941 SetValue(SelectionHandlePressedImageRightProperty, value);
942 NotifyPropertyChanged();
947 /// Set SelectionHandlePressedImage to TextField. <br />
949 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
951 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
954 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
956 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
957 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
958 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
959 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
962 [EditorBrowsable(EditorBrowsableState.Never)]
963 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
965 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
967 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
969 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
973 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
975 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
977 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
983 /// Get SelectionHandlePressedImage from TextField. <br />
985 /// <returns>The SelectionHandlePressedImage</returns>
987 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
989 [EditorBrowsable(EditorBrowsableState.Never)]
990 public SelectionHandleImage GetSelectionHandlePressedImage()
992 SelectionHandleImage selectionHandleImage;
993 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
994 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
996 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
998 return selectionHandleImage;
1002 /// The SelectionHandleMarkerImageLeft property.<br />
1003 /// The image to display for the left selection handle marker.<br />
1004 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
1005 /// <list type="table">
1006 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1009 /// <since_tizen> 3 </since_tizen>
1010 public PropertyMap SelectionHandleMarkerImageLeft
1014 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1018 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1019 NotifyPropertyChanged();
1024 /// The SelectionHandleMarkerImageRight property.<br />
1025 /// The image to display for the right selection handle marker.<br />
1026 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1027 /// <list type="table">
1028 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1031 /// <since_tizen> 3 </since_tizen>
1032 public PropertyMap SelectionHandleMarkerImageRight
1036 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1040 SetValue(SelectionHandleMarkerImageRightProperty, value);
1041 NotifyPropertyChanged();
1046 /// Set SelectionHandleMarkerImage to TextField. <br />
1048 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1050 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1053 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1055 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1056 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1057 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1058 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1061 [EditorBrowsable(EditorBrowsableState.Never)]
1062 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1064 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1066 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1068 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1072 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1074 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1076 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1082 /// Get SelectionHandleMarkerImage from TextField. <br />
1084 /// <returns>The SelectionHandleMarkerImage</returns>
1086 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1088 [EditorBrowsable(EditorBrowsableState.Never)]
1089 public SelectionHandleImage GetSelectionHandleMarkerImage()
1091 SelectionHandleImage selectionHandleImage;
1092 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1093 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1095 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1097 return selectionHandleImage;
1101 /// The SelectionHighlightColor property.<br />
1102 /// The color of the selection highlight.<br />
1105 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1107 /// <since_tizen> 3 </since_tizen>
1108 public Vector4 SelectionHighlightColor
1112 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1113 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1117 SetValue(SelectionHighlightColorProperty, value);
1118 NotifyPropertyChanged();
1123 /// The DecorationBoundingBox property.<br />
1124 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1127 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1129 /// <since_tizen> 3 </since_tizen>
1130 public Rectangle DecorationBoundingBox
1134 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1135 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1139 SetValue(DecorationBoundingBoxProperty, value);
1140 NotifyPropertyChanged();
1145 /// The InputMethodSettings property.<br />
1146 /// The settings to relating to the System's Input Method, Key and Value.<br />
1149 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
1152 /// The following example demonstrates how to set the InputMethodSettings property.
1154 /// InputMethod method = new InputMethod();
1155 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1156 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1157 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1158 /// method.Variation = 1;
1159 /// textField.InputMethodSettings = method.OutputMap;
1162 /// <since_tizen> 3 </since_tizen>
1163 public PropertyMap InputMethodSettings
1167 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1171 SetValue(InputMethodSettingsProperty, value);
1172 NotifyPropertyChanged();
1177 /// The InputColor property.<br />
1178 /// The color of the new input text.<br />
1181 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1183 /// <since_tizen> 3 </since_tizen>
1184 public Vector4 InputColor
1188 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1189 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1193 SetValue(InputColorProperty, value);
1194 NotifyPropertyChanged();
1199 /// The EnableMarkup property.<br />
1200 /// Whether the mark-up processing is enabled.<br />
1202 /// <since_tizen> 3 </since_tizen>
1203 public bool EnableMarkup
1207 return (bool)GetValue(EnableMarkupProperty);
1211 SetValue(EnableMarkupProperty, value);
1212 NotifyPropertyChanged();
1217 /// The InputFontFamily property.<br />
1218 /// The font's family of the new input text.<br />
1220 /// <since_tizen> 3 </since_tizen>
1221 public string InputFontFamily
1225 return (string)GetValue(InputFontFamilyProperty);
1229 SetValue(InputFontFamilyProperty, value);
1230 NotifyPropertyChanged();
1235 /// The InputFontStyle property.<br />
1236 /// The font's style of the new input text.<br />
1237 /// The inputFontStyle map contains the following keys :<br />
1238 /// <list type="table">
1239 /// <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>
1240 /// <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>
1241 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1244 /// <since_tizen> 3 </since_tizen>
1245 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1246 public PropertyMap InputFontStyle
1250 return (PropertyMap)GetValue(InputFontStyleProperty);
1254 SetValue(InputFontStyleProperty, value);
1255 NotifyPropertyChanged();
1260 /// Set InputFontStyle to TextField. <br />
1262 /// <param name="fontStyle">The FontStyle</param>
1264 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1267 /// The following example demonstrates how to use the SetInputFontStyle method.
1269 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1270 /// fontStyle.Width = FontWidthType.Expanded;
1271 /// fontStyle.Weight = FontWeightType.Bold;
1272 /// fontStyle.Slant = FontSlantType.Italic;
1273 /// field.SetInputFontStyle(fontStyle);
1276 [EditorBrowsable(EditorBrowsableState.Never)]
1277 public void SetInputFontStyle(FontStyle fontStyle)
1279 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1281 SetValue(InputFontStyleProperty, fontStyleMap);
1286 /// Get InputFontStyle from TextField. <br />
1288 /// <returns>The FontStyle</returns>
1290 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1292 [EditorBrowsable(EditorBrowsableState.Never)]
1293 public FontStyle GetInputFontStyle()
1295 FontStyle fontStyle;
1296 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1298 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1304 /// The InputPointSize property.<br />
1305 /// The font's size of the new input text in points.<br />
1307 /// <since_tizen> 3 </since_tizen>
1308 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1309 public float InputPointSize
1313 return (float)GetValue(InputPointSizeProperty);
1317 SetValue(InputPointSizeProperty, value);
1318 NotifyPropertyChanged();
1323 /// The Underline property.<br />
1324 /// The default underline parameters.<br />
1325 /// The underline map contains the following keys :<br />
1326 /// <list type="table">
1327 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1328 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1329 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1332 /// <since_tizen> 3 </since_tizen>
1333 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1334 public PropertyMap Underline
1338 return (PropertyMap)GetValue(UnderlineProperty);
1342 SetValue(UnderlineProperty, value);
1343 NotifyPropertyChanged();
1348 /// Set Underline to TextField. <br />
1350 /// <param name="underline">The Underline</param>
1352 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1355 /// The following example demonstrates how to use the SetUnderline method.
1357 /// var underline = new Tizen.NUI.Text.Underline();
1358 /// underline.Enable = true;
1359 /// underline.Color = new Color("#3498DB");
1360 /// underline.Height = 2.0f;
1361 /// field.SetUnderline(underline);
1364 [EditorBrowsable(EditorBrowsableState.Never)]
1365 public void SetUnderline(Underline underline)
1367 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1369 SetValue(UnderlineProperty, underlineMap);
1374 /// Get Underline from TextField. <br />
1376 /// <returns>The Underline</returns>
1378 /// <see cref="Tizen.NUI.Text.Underline"/>
1380 [EditorBrowsable(EditorBrowsableState.Never)]
1381 public Underline GetUnderline()
1383 Underline underline;
1384 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1386 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1392 /// The InputUnderline property.<br />
1393 /// The underline parameters of the new input text.<br />
1395 /// <since_tizen> 3 </since_tizen>
1396 public string InputUnderline
1400 return (string)GetValue(InputUnderlineProperty);
1404 SetValue(InputUnderlineProperty, value);
1405 NotifyPropertyChanged();
1410 /// The Shadow property.<br />
1411 /// The default shadow parameters.<br />
1412 /// The shadow map contains the following keys :<br />
1413 /// <list type="table">
1414 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1415 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1416 /// <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>
1419 /// <since_tizen> 3 </since_tizen>
1420 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1421 public PropertyMap Shadow
1425 return (PropertyMap)GetValue(ShadowProperty);
1429 SetValue(ShadowProperty, value);
1430 NotifyPropertyChanged();
1435 /// Set Shadow to TextField. <br />
1437 /// <param name="shadow">The Shadow</param>
1439 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1442 /// The following example demonstrates how to use the SetShadow method.
1444 /// var shadow = new Tizen.NUI.Text.Shadow();
1445 /// shadow.Offset = new Vector2(3, 3);
1446 /// shadow.Color = new Color("#F1C40F");
1447 /// field.SetShadow(shadow);
1450 [EditorBrowsable(EditorBrowsableState.Never)]
1451 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1453 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1455 SetValue(ShadowProperty, shadowMap);
1460 /// Get Shadow from TextField. <br />
1462 /// <returns>The Shadow</returns>
1464 /// <see cref="Tizen.NUI.Text.Shadow"/>
1466 [EditorBrowsable(EditorBrowsableState.Never)]
1467 public Tizen.NUI.Text.Shadow GetShadow()
1469 Tizen.NUI.Text.Shadow shadow;
1470 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1472 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1478 /// The InputShadow property.<br />
1479 /// The shadow parameters of the new input text.<br />
1481 /// <since_tizen> 3 </since_tizen>
1482 public string InputShadow
1486 return (string)GetValue(InputShadowProperty);
1490 SetValue(InputShadowProperty, value);
1491 NotifyPropertyChanged();
1496 /// The Emboss property.<br />
1497 /// The default emboss parameters.<br />
1499 /// <since_tizen> 3 </since_tizen>
1500 public string Emboss
1504 return (string)GetValue(EmbossProperty);
1508 SetValue(EmbossProperty, value);
1509 NotifyPropertyChanged();
1514 /// The InputEmboss property.<br />
1515 /// The emboss parameters of the new input text.<br />
1517 /// <since_tizen> 3 </since_tizen>
1518 public string InputEmboss
1522 return (string)GetValue(InputEmbossProperty);
1526 SetValue(InputEmbossProperty, value);
1527 NotifyPropertyChanged();
1532 /// The Outline property.<br />
1533 /// The default outline parameters.<br />
1534 /// The outline map contains the following keys :<br />
1535 /// <list type="table">
1536 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1537 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1540 /// <since_tizen> 3 </since_tizen>
1541 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1542 public PropertyMap Outline
1546 return (PropertyMap)GetValue(OutlineProperty);
1550 SetValue(OutlineProperty, value);
1551 NotifyPropertyChanged();
1556 /// Set Outline to TextField. <br />
1558 /// <param name="outline">The Outline</param>
1560 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1563 /// The following example demonstrates how to use the SetOutline method.
1565 /// var outline = new Tizen.NUI.Text.Outline();
1566 /// outline.Width = 2.0f;
1567 /// outline.Color = new Color("#45B39D");
1568 /// field.SetOutline(outline);
1571 [EditorBrowsable(EditorBrowsableState.Never)]
1572 public void SetOutline(Outline outline)
1574 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1576 SetValue(OutlineProperty, outlineMap);
1581 /// Get Outline from TextField. <br />
1583 /// <returns>The Outline</returns>
1585 /// <see cref="Tizen.NUI.Text.Outline"/>
1587 [EditorBrowsable(EditorBrowsableState.Never)]
1588 public Outline GetOutline()
1591 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1593 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1599 /// The InputOutline property.<br />
1600 /// The outline parameters of the new input text.<br />
1602 /// <since_tizen> 3 </since_tizen>
1603 public string InputOutline
1607 return (string)GetValue(InputOutlineProperty);
1611 SetValue(InputOutlineProperty, value);
1612 NotifyPropertyChanged();
1617 /// The HiddenInputSettings property.<br />
1618 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1619 /// The hiddenInputSettings map contains the following keys :<br />
1620 /// <list type="table">
1621 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1622 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1623 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1624 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1628 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1631 /// The following example demonstrates how to set the HiddenInputSettings property.
1633 /// PropertyMap map = new PropertyMap();
1634 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1635 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1636 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1637 /// textField.HiddenInputSettings = map;
1640 /// <since_tizen> 3 </since_tizen>
1641 public Tizen.NUI.PropertyMap HiddenInputSettings
1645 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1649 SetValue(HiddenInputSettingsProperty, value);
1650 NotifyPropertyChanged();
1655 /// Set HiddenInput to TextField. <br />
1657 /// <param name="hiddenInput">The HiddenInput</param>
1659 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1662 /// The following example demonstrates how to use the SetHiddenInput method.
1664 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1665 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1666 /// hiddenInput.SubstituteCharacter = '★';
1667 /// hiddenInput.SubstituteCount = 0;
1668 /// hiddenInput.ShowLastCharacterDuration = 1000;
1669 /// field.SetHiddenInput(hiddenInput);
1672 [EditorBrowsable(EditorBrowsableState.Never)]
1673 public void SetHiddenInput(HiddenInput hiddenInput)
1675 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1677 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1682 /// Get HiddenInput from TextField. <br />
1684 /// <returns>The HiddenInput</returns>
1686 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1688 [EditorBrowsable(EditorBrowsableState.Never)]
1689 public HiddenInput GetHiddenInput()
1691 HiddenInput hiddenInput;
1692 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1694 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1700 /// The PixelSize property.<br />
1701 /// The size of font in pixels.<br />
1703 /// <since_tizen> 3 </since_tizen>
1704 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1705 public float PixelSize
1709 return (float)GetValue(PixelSizeProperty);
1713 SetValue(PixelSizeProperty, value);
1714 NotifyPropertyChanged();
1719 /// The Enable selection property.<br />
1720 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1722 /// <since_tizen> 3 </since_tizen>
1723 public bool EnableSelection
1727 return (bool)GetValue(EnableSelectionProperty);
1731 SetValue(EnableSelectionProperty, value);
1732 NotifyPropertyChanged();
1737 /// The Enable grab handle property.<br />
1738 /// Enables the grab handles for text selection.<br />
1739 /// The default value is true, which means the grab handles are enabled by default.<br />
1741 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1742 [EditorBrowsable(EditorBrowsableState.Never)]
1743 public bool EnableGrabHandle
1747 return (bool)GetValue(EnableGrabHandleProperty);
1751 SetValue(EnableGrabHandleProperty, value);
1752 NotifyPropertyChanged();
1757 /// The Enable grab handle popup property.<br />
1758 /// Enables the grab handle popup for text selection.<br />
1759 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1761 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1762 [EditorBrowsable(EditorBrowsableState.Never)]
1763 public bool EnableGrabHandlePopup
1767 return (bool)GetValue(EnableGrabHandlePopupProperty);
1771 SetValue(EnableGrabHandlePopupProperty, value);
1772 NotifyPropertyChanged();
1777 /// The portion of the text that has been selected by the user.
1780 /// Empty string when nothing is selected.
1782 /// <since_tizen> 9 </since_tizen>
1783 public string SelectedText
1787 string selectedText;
1788 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1790 propertyValue.Get(out selectedText);
1792 return selectedText;
1797 /// The start index for selection.
1800 /// When there is no selection, the index is current cursor position.
1802 /// <since_tizen> 9 </since_tizen>
1803 public int SelectedTextStart
1807 int selectedTextStart;
1808 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1810 propertyValue.Get(out selectedTextStart);
1812 return selectedTextStart;
1817 /// The end index for selection.
1820 /// When there is no selection, the index is current cursor position.
1822 /// <since_tizen> 9 </since_tizen>
1823 public int SelectedTextEnd
1827 int selectedTextEnd;
1828 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1830 propertyValue.Get(out selectedTextEnd);
1832 return selectedTextEnd;
1837 /// Enable editing in text control.
1839 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1840 [EditorBrowsable(EditorBrowsableState.Never)]
1841 public bool EnableEditing
1845 return (bool)GetValue(EnableEditingProperty);
1849 SetValue(EnableEditingProperty, value);
1853 private bool InternalEnableEditing
1858 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1860 propertyValue.Get(out enableEditing);
1862 return enableEditing;
1866 using (var propertyValue = new PropertyValue(value))
1868 SetProperty(TextField.Property.EnableEditing, propertyValue);
1869 NotifyPropertyChanged();
1875 /// Specify primary cursor (caret) position in text control.
1877 [EditorBrowsable(EditorBrowsableState.Never)]
1878 public int PrimaryCursorPosition
1882 return (int)GetValue(PrimaryCursorPositionProperty);
1886 SetValue(PrimaryCursorPositionProperty, value);
1890 private int InternalPrimaryCursorPosition
1894 int primaryCursorPosition;
1895 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1897 propertyValue.Get(out primaryCursorPosition);
1899 return primaryCursorPosition;
1903 using (PropertyValue propertyValue = new PropertyValue(value))
1905 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1906 NotifyPropertyChanged();
1912 /// The GrabHandleColor property.
1915 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1917 [EditorBrowsable(EditorBrowsableState.Never)]
1918 public Color GrabHandleColor
1922 Color temp = (Color)GetValue(GrabHandleColorProperty);
1923 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1927 SetValue(GrabHandleColorProperty, value);
1928 NotifyPropertyChanged();
1933 /// The ellipsis position of the text.
1934 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1936 /// <since_tizen> 9 </since_tizen>
1937 public EllipsisPosition EllipsisPosition
1941 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1945 SetValue(EllipsisPositionProperty, value);
1946 NotifyPropertyChanged();
1951 /// The spaces between characters in Pixels.
1953 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
1954 /// The default value is 0.f which does nothing.
1957 [EditorBrowsable(EditorBrowsableState.Never)]
1958 public float CharacterSpacing
1962 return (float)GetValue(CharacterSpacingProperty);
1966 SetValue(CharacterSpacingProperty, value);
1967 NotifyPropertyChanged();
1972 /// Set InputFilter to TextField.
1974 /// <param name="inputFilter">The InputFilter</param>
1976 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1977 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1978 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1981 /// The following example demonstrates how to use the SetInputFilter method.
1983 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1984 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1985 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1986 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1989 /// <since_tizen> 9 </since_tizen>
1990 public void SetInputFilter(InputFilter inputFilter)
1992 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1993 using (var propertyValue = new PropertyValue(map))
1995 SetProperty(TextField.Property.InputFilter, propertyValue);
2000 /// Get InputFilter from TextField.
2002 /// <returns>The InputFilter</returns>
2004 /// <see cref="Tizen.NUI.Text.InputFilter"/>
2006 /// <since_tizen> 9 </since_tizen>
2007 public InputFilter GetInputFilter()
2009 InputFilter inputFilter;
2010 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
2011 using (var map = new PropertyMap())
2013 propertyValue.Get(map);
2014 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2020 /// Set Strikethrough to TextField. <br />
2022 /// <param name="strikethrough">The Strikethrough</param>
2024 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2027 /// The following example demonstrates how to use the SetStrikethrough method.
2029 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2030 /// strikethrough.Enable = true;
2031 /// strikethrough.Color = new Color("#3498DB");
2032 /// strikethrough.Height = 2.0f;
2033 /// field.SetStrikethrough(strikethrough);
2036 [EditorBrowsable(EditorBrowsableState.Never)]
2037 public void SetStrikethrough(Strikethrough strikethrough)
2039 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2040 using (var propertyValue = new PropertyValue(map))
2042 SetProperty(TextField.Property.Strikethrough, propertyValue);
2047 /// Get Strikethrough from TextField. <br />
2049 /// <returns>The Strikethrough</returns>
2051 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2053 [EditorBrowsable(EditorBrowsableState.Never)]
2054 public Strikethrough GetStrikethrough()
2056 Strikethrough strikethrough;
2057 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2058 using (var map = new PropertyMap())
2060 propertyValue.Get(map);
2061 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2063 return strikethrough;
2067 /// The Placeholder property.
2068 /// The placeholder map contains the following keys :<br />
2069 /// <list type="table">
2070 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2071 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2072 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2073 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2074 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2075 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2076 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2077 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2081 /// The following example demonstrates how to set the Placeholder property.
2083 /// PropertyMap propertyMap = new PropertyMap();
2084 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2085 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2086 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2087 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2088 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2090 /// PropertyMap fontStyleMap = new PropertyMap();
2091 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2092 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2093 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2094 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2096 /// TextField field = new TextField();
2097 /// field.Placeholder = propertyMap;
2100 /// <since_tizen> 3 </since_tizen>
2101 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2102 public Tizen.NUI.PropertyMap Placeholder
2106 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2107 string defalutText = "";
2109 if (TextMapHelper.IsValue(map, 0))
2110 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2112 if (TextMapHelper.IsValue(map, 1))
2113 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2115 if (TextMapHelper.IsValue(map, 2))
2117 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2119 map.Add("color", color);
2123 if (TextMapHelper.IsValue(map, 3))
2124 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2126 if (TextMapHelper.IsValue(map, 4))
2128 using (var properyValue = map.Find(4))
2129 using (var fontStyle = new PropertyMap())
2131 properyValue.Get(fontStyle);
2132 using (var fontStyleValue = new PropertyValue(fontStyle))
2134 map.Add("fontStyle", fontStyleValue);
2139 if (TextMapHelper.IsValue(map, 5))
2140 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2142 if (TextMapHelper.IsValue(map, 6))
2143 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2145 if (TextMapHelper.IsValue(map, 7))
2146 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2152 SetValue(PlaceholderProperty, value);
2153 NotifyPropertyChanged();
2158 /// Set Placeholder to TextField. <br />
2160 /// <param name="placeholder">The Placeholder</param>
2162 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2165 /// The following example demonstrates how to use the SetPlaceholder method.
2167 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2168 /// placeholder.Text = "placeholder text";
2169 /// placeholder.TextFocused = "placeholder textFocused";
2170 /// placeholder.Color = new Color("#45B39D");
2171 /// placeholder.FontFamily = "BreezeSans";
2172 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2174 /// Width = FontWidthType.Expanded,
2175 /// Weight = FontWeightType.ExtraLight,
2176 /// Slant = FontSlantType.Italic,
2178 /// placeholder.PointSize = 25.0f;
2179 /// //placeholder.PixelSize = 50.0f;
2180 /// placeholder.Ellipsis = true;
2181 /// field.SetPlaceholder(placeholder);
2184 [EditorBrowsable(EditorBrowsableState.Never)]
2185 public void SetPlaceholder(Placeholder placeholder)
2187 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2189 SetValue(PlaceholderProperty, placeholderMap);
2194 /// Get Placeholder from TextField. <br />
2196 /// <returns>The Placeholder</returns>
2198 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2200 [EditorBrowsable(EditorBrowsableState.Never)]
2201 public Placeholder GetPlaceholder()
2203 Placeholder placeholder;
2204 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2206 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2212 /// The Ellipsis property.<br />
2213 /// Enable or disable the ellipsis.<br />
2214 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2216 /// <since_tizen> 4 </since_tizen>
2217 public bool Ellipsis
2221 return (bool)GetValue(EllipsisProperty);
2225 SetValue(EllipsisProperty, value);
2226 NotifyPropertyChanged();
2231 /// Enables selection of the text using the Shift key.
2233 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2234 [EditorBrowsable(EditorBrowsableState.Never)]
2235 public bool EnableShiftSelection
2239 return (bool)GetValue(EnableShiftSelectionProperty);
2243 SetValue(EnableShiftSelectionProperty, value);
2244 NotifyPropertyChanged();
2249 /// The text alignment to match the direction of the system language.<br />
2250 /// The default value is true.<br />
2252 /// <since_tizen> 6 </since_tizen>
2253 public bool MatchSystemLanguageDirection
2257 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2261 SetValue(MatchSystemLanguageDirectionProperty, value);
2262 NotifyPropertyChanged();
2267 /// The FontSizeScale property. <br />
2268 /// The default value is 1.0. <br />
2269 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2270 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2272 /// <since_tizen> 9 </since_tizen>
2273 public float FontSizeScale
2277 return fontSizeScale;
2281 float newFontSizeScale;
2283 if (fontSizeScale == value) return;
2285 fontSizeScale = value;
2286 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2288 SystemSettingsFontSize systemSettingsFontSize;
2292 systemSettingsFontSize = SystemSettings.FontSize;
2296 Console.WriteLine("{0} Exception caught.", e);
2297 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2299 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2300 addFontSizeChangedCallback();
2304 newFontSizeScale = fontSizeScale;
2305 removeFontSizeChangedCallback();
2308 SetValue(FontSizeScaleProperty, newFontSizeScale);
2309 NotifyPropertyChanged();
2314 /// The EnableFontSizeScale property.<br />
2315 /// Whether the font size scale is enabled. (The default value is true)
2317 [EditorBrowsable(EditorBrowsableState.Never)]
2318 public bool EnableFontSizeScale
2322 return (bool)GetValue(EnableFontSizeScaleProperty);
2326 SetValue(EnableFontSizeScaleProperty, value);
2327 NotifyPropertyChanged();
2332 /// Get the InputMethodContext instance.
2334 /// <returns>The InputMethodContext instance.</returns>
2335 /// <since_tizen> 5 </since_tizen>
2336 public InputMethodContext GetInputMethodContext()
2338 if (inputMethodCotext == null)
2340 /*Avoid raising InputMethodContext reference count.*/
2341 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2342 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2344 return inputMethodCotext;
2348 /// Select the whole text.
2350 /// <since_tizen> 9 </since_tizen>
2351 public void SelectWholeText()
2353 Interop.TextField.SelectWholeText(SwigCPtr);
2354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2358 /// Select text from start to end index. <br />
2359 /// The index is valid when 0 or positive.
2361 /// <param name="start">The start index for selection.</param>
2362 /// <param name="end">The end index for selection.</param>
2364 /// If the end index exceeds the maximum value, it is set to the length of the text.
2366 /// <since_tizen> 9 </since_tizen>
2367 public void SelectText(int start, int end)
2370 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2372 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2374 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2379 /// Clear selection of the text. <br />
2380 /// Valid when selection is activate.
2382 /// <since_tizen> 9 </since_tizen>
2383 public void SelectNone()
2385 _ = Interop.TextField.SelectNone(SwigCPtr);
2386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2389 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2391 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));
2392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2399 /// <since_tizen> 3 </since_tizen>
2400 protected override void Dispose(DisposeTypes type)
2404 DisposeQueue.Instance.Add(this);
2408 if (systemlangTextFlag)
2410 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2413 removeFontSizeChangedCallback();
2415 if (type == DisposeTypes.Explicit)
2418 //Release your own managed resources here.
2419 //You should release all of your own disposable objects here.
2422 //Release your own unmanaged resources here.
2423 //You should not access any managed member here except static instance.
2424 //because the execution order of Finalizes is non-deterministic.
2427 if (textFieldCursorPositionChangedCallbackDelegate != null)
2429 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2432 if (textFieldMaxLengthReachedCallbackDelegate != null)
2434 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2437 if (textFieldSelectionStartedCallbackDelegate != null)
2439 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2442 if (textFieldSelectionClearedCallbackDelegate != null)
2444 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2447 if (textFieldSelectionChangedCallbackDelegate != null)
2449 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2452 if (textFieldTextChangedCallbackDelegate != null)
2454 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2458 TextChanged -= TextFieldTextChanged;
2463 /// This will not be public opened.
2464 [EditorBrowsable(EditorBrowsableState.Never)]
2465 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2467 // In order to speed up IME hide, temporarily add
2468 GetInputMethodContext()?.DestroyContext();
2469 Interop.TextField.DeleteTextField(swigCPtr);
2472 internal override LayoutItem CreateDefaultLayout()
2474 return new TextFieldLayout();
2477 internal void SetTextWithoutTextChanged(string text)
2479 invokeTextChanged = false;
2480 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2481 invokeTextChanged = true;
2484 private string SetTranslatable(string textFieldSid)
2486 string translatableText = null;
2487 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2488 if (translatableText != null)
2490 if (systemlangTextFlag == false)
2492 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2493 systemlangTextFlag = true;
2495 return translatableText;
2499 translatableText = "";
2500 return translatableText;
2504 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2506 if (textFieldTextSid != null)
2508 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2510 if (textFieldPlaceHolderTextSid != null)
2512 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2514 if (textFieldPlaceHolderTextFocusedSid != null)
2516 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2520 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2522 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2523 SetValue(FontSizeScaleProperty, newFontSizeScale);
2524 NotifyPropertyChanged();
2527 private void addFontSizeChangedCallback()
2529 if (hasFontSizeChangedCallback != true)
2533 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2534 hasFontSizeChangedCallback = true;
2538 Console.WriteLine("{0} Exception caught.", e);
2539 hasFontSizeChangedCallback = false;
2544 private void removeFontSizeChangedCallback()
2546 if (hasFontSizeChangedCallback == true)
2550 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2551 hasFontSizeChangedCallback = false;
2555 Console.WriteLine("{0} Exception caught.", e);
2556 hasFontSizeChangedCallback = true;
2561 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2563 if (!isSettingTextInCSharp)
2565 EnforceNotifyBindedInstance(TextProperty);
2569 internal new class Property
2571 internal static readonly int TEXT = Interop.TextField.TextGet();
2572 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2573 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2574 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2575 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2576 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2577 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2578 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2579 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2580 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2581 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2582 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2583 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2584 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2585 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2586 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2587 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2588 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2589 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2590 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2591 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2592 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2593 internal static readonly int SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet();
2594 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2595 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2596 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2597 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2598 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2599 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2600 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2601 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2602 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2603 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2604 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2605 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2606 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2607 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2608 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2609 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2610 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2611 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2612 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2613 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2614 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2615 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2616 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2617 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2618 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2619 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2620 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2621 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2622 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2623 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2624 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2625 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2626 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2627 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2628 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2629 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2630 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2631 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2632 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2633 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2634 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2635 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2636 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2639 internal class InputStyle
2645 FontFamily = 0x0002,
2655 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2657 DecorationBoundingBox = new Rectangle(x, y, width, height);
2659 private void OnInputColorChanged(float x, float y, float z, float w)
2661 InputColor = new Vector4(x, y, z, w);
2663 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2665 PlaceholderTextColor = new Vector4(r, g, b, a);
2667 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2669 PrimaryCursorColor = new Vector4(x, y, z, w);
2671 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2673 SecondaryCursorColor = new Vector4(x, y, z, w);
2675 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2677 SelectionHighlightColor = new Vector4(x, y, z, w);
2679 private void OnShadowColorChanged(float x, float y, float z, float w)
2681 ShadowColor = new Vector4(x, y, z, w);
2683 private void OnShadowOffsetChanged(float x, float y)
2685 ShadowOffset = new Vector2(x, y);
2687 private void OnTextColorChanged(float r, float g, float b, float a)
2689 TextColor = new Color(r, g, b, a);
2691 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2693 GrabHandleColor = new Color(r, g, b, a);
2696 private class TextFieldLayout : LayoutItem
2698 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2700 // Padding will be automatically applied by DALi TextField.
2701 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2702 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2703 var minSize = Owner.MinimumSize;
2704 var maxSize = Owner.MaximumSize;
2705 var naturalSize = Owner.GetNaturalSize();
2707 if (((TextField)Owner).Text.Length == 0)
2709 // Calculate height of TextField by setting Text with " ".
2710 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2711 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2713 // Store original WidthSpecification to restore it after setting ResizePolicy.
2714 var widthSpecification = Owner.WidthSpecification;
2716 // In DALi's Size logic, if Width or Height is set to be 0, then
2717 // ResizePolicy is not changed to Fixed.
2718 // This causes Size changes after NUI Layout's OnMeasure is finished.
2719 // e.g. TextField's Width fills to its parent although Text is null and
2720 // WidthSpecification is WrapContent.
2721 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2722 // in advance if Text is null.
2723 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2725 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2726 Owner.WidthSpecification = widthSpecification;
2728 naturalSize = Owner.GetNaturalSize();
2730 // Restore TextField's Text after calculating height of TextField.
2731 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2732 ((TextField)Owner).SetTextWithoutTextChanged("");
2735 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2737 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2740 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2742 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2745 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2746 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2748 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2749 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2751 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2752 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));