2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 extern alias TizenSystemSettings;
18 using TizenSystemSettings.Tizen.System;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
26 namespace Tizen.NUI.BaseComponents
29 /// A control which provides a single line editable text field.
31 /// <since_tizen> 3 </since_tizen>
32 public partial class TextField : View
34 private string textFieldTextSid = null;
35 private string textFieldPlaceHolderTextSid = null;
36 private string textFieldPlaceHolderTextFocusedSid = null;
37 private bool systemlangTextFlag = false;
38 private InputMethodContext inputMethodCotext = null;
39 private float fontSizeScale = 1.0f;
40 private bool hasFontSizeChangedCallback = false;
42 static TextField() { }
45 /// Creates the TextField control.
47 /// <since_tizen> 3 </since_tizen>
48 public TextField() : this(Interop.TextField.New(), true)
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 /// Creates the TextField with setting the status of shown or hidden.
56 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
57 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
58 [EditorBrowsable(EditorBrowsableState.Never)]
59 public TextField(bool shown) : this(Interop.TextField.New(), true)
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66 /// Get attributes, it is abstract function and must be override.
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected override ViewStyle CreateViewStyle()
71 return new TextFieldStyle();
74 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
82 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
90 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
92 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 SetValueAndForceSendChangeSignal(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 public float PixelSize
1690 return (float)GetValue(PixelSizeProperty);
1694 SetValue(PixelSizeProperty, value);
1695 NotifyPropertyChanged();
1700 /// The Enable selection property.<br />
1701 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1703 /// <since_tizen> 3 </since_tizen>
1704 public bool EnableSelection
1708 return (bool)GetValue(EnableSelectionProperty);
1712 SetValue(EnableSelectionProperty, value);
1713 NotifyPropertyChanged();
1718 /// The Enable grab handle property.<br />
1719 /// Enables the grab handles for text selection.<br />
1720 /// The default value is true, which means the grab handles are enabled by default.<br />
1722 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1723 [EditorBrowsable(EditorBrowsableState.Never)]
1724 public bool EnableGrabHandle
1728 return (bool)GetValue(EnableGrabHandleProperty);
1732 SetValue(EnableGrabHandleProperty, value);
1733 NotifyPropertyChanged();
1738 /// The Enable grab handle popup property.<br />
1739 /// Enables the grab handle popup for text selection.<br />
1740 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1742 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1743 [EditorBrowsable(EditorBrowsableState.Never)]
1744 public bool EnableGrabHandlePopup
1748 return (bool)GetValue(EnableGrabHandlePopupProperty);
1752 SetValue(EnableGrabHandlePopupProperty, value);
1753 NotifyPropertyChanged();
1758 /// The portion of the text that has been selected by the user.
1761 /// Empty string when nothing is selected.
1763 /// <since_tizen> 9 </since_tizen>
1764 public string SelectedText
1768 string selectedText;
1769 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1771 propertyValue.Get(out selectedText);
1773 return selectedText;
1778 /// The start index for selection.
1781 /// When there is no selection, the index is current cursor position.
1783 /// <since_tizen> 9 </since_tizen>
1784 public int SelectedTextStart
1788 int selectedTextStart;
1789 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1791 propertyValue.Get(out selectedTextStart);
1793 return selectedTextStart;
1798 /// The end index for selection.
1801 /// When there is no selection, the index is current cursor position.
1803 /// <since_tizen> 9 </since_tizen>
1804 public int SelectedTextEnd
1808 int selectedTextEnd;
1809 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1811 propertyValue.Get(out selectedTextEnd);
1813 return selectedTextEnd;
1818 /// Enable editing in text control.
1820 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1821 [EditorBrowsable(EditorBrowsableState.Never)]
1822 public bool EnableEditing
1826 return (bool)GetValue(EnableEditingProperty);
1830 SetValue(EnableEditingProperty, value);
1834 private bool InternalEnableEditing
1839 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1841 propertyValue.Get(out enableEditing);
1843 return enableEditing;
1847 using (var propertyValue = new PropertyValue(value))
1849 SetProperty(TextField.Property.EnableEditing, propertyValue);
1850 NotifyPropertyChanged();
1856 /// Specify primary cursor (caret) position in text control.
1858 [EditorBrowsable(EditorBrowsableState.Never)]
1859 public int PrimaryCursorPosition
1863 return (int)GetValue(PrimaryCursorPositionProperty);
1867 SetValue(PrimaryCursorPositionProperty, value);
1871 private int InternalPrimaryCursorPosition
1875 int primaryCursorPosition;
1876 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1878 propertyValue.Get(out primaryCursorPosition);
1880 return primaryCursorPosition;
1884 using (PropertyValue propertyValue = new PropertyValue(value))
1886 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1887 NotifyPropertyChanged();
1893 /// The GrabHandleColor property.
1896 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1898 [EditorBrowsable(EditorBrowsableState.Never)]
1899 public Color GrabHandleColor
1903 Color temp = (Color)GetValue(GrabHandleColorProperty);
1904 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1908 SetValue(GrabHandleColorProperty, value);
1909 NotifyPropertyChanged();
1914 /// The ellipsis position of the text.
1915 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1917 /// <since_tizen> 9 </since_tizen>
1918 public EllipsisPosition EllipsisPosition
1922 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1926 SetValue(EllipsisPositionProperty, value);
1927 NotifyPropertyChanged();
1932 /// Set InputFilter to TextField.
1934 /// <param name="inputFilter">The InputFilter</param>
1936 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1937 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1938 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1941 /// The following example demonstrates how to use the SetInputFilter method.
1943 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1944 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1945 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1946 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1949 /// <since_tizen> 9 </since_tizen>
1950 public void SetInputFilter(InputFilter inputFilter)
1952 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1953 using (var propertyValue = new PropertyValue(map))
1955 SetProperty(TextField.Property.InputFilter, propertyValue);
1960 /// Get InputFilter from TextField.
1962 /// <returns>The InputFilter</returns>
1964 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1966 /// <since_tizen> 9 </since_tizen>
1967 public InputFilter GetInputFilter()
1969 InputFilter inputFilter;
1970 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
1971 using (var map = new PropertyMap())
1973 propertyValue.Get(map);
1974 inputFilter = TextMapHelper.GetInputFilterStruct(map);
1980 /// Set Strikethrough to TextField. <br />
1982 /// <param name="strikethrough">The Strikethrough</param>
1984 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1987 /// The following example demonstrates how to use the SetStrikethrough method.
1989 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1990 /// strikethrough.Enable = true;
1991 /// strikethrough.Color = new Color("#3498DB");
1992 /// strikethrough.Height = 2.0f;
1993 /// field.SetStrikethrough(strikethrough);
1996 [EditorBrowsable(EditorBrowsableState.Never)]
1997 public void SetStrikethrough(Strikethrough strikethrough)
1999 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2000 using (var propertyValue = new PropertyValue(map))
2002 SetProperty(TextField.Property.Strikethrough, propertyValue);
2007 /// Get Strikethrough from TextField. <br />
2009 /// <returns>The Strikethrough</returns>
2011 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2013 [EditorBrowsable(EditorBrowsableState.Never)]
2014 public Strikethrough GetStrikethrough()
2016 Strikethrough strikethrough;
2017 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2018 using (var map = new PropertyMap())
2020 propertyValue.Get(map);
2021 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2023 return strikethrough;
2027 /// The Placeholder property.
2028 /// The placeholder map contains the following keys :<br />
2029 /// <list type="table">
2030 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2031 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2032 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2033 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2034 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2035 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2036 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2037 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2041 /// The following example demonstrates how to set the Placeholder property.
2043 /// PropertyMap propertyMap = new PropertyMap();
2044 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2045 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2046 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2047 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2048 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2050 /// PropertyMap fontStyleMap = new PropertyMap();
2051 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2052 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2053 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2054 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2056 /// TextField field = new TextField();
2057 /// field.Placeholder = propertyMap;
2060 /// <since_tizen> 3 </since_tizen>
2061 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2062 public Tizen.NUI.PropertyMap Placeholder
2066 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2067 string defalutText = "";
2069 if (TextMapHelper.IsValue(map, 0))
2070 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2072 if (TextMapHelper.IsValue(map, 1))
2073 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2075 if (TextMapHelper.IsValue(map, 2))
2077 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2079 map.Add("color", color);
2083 if (TextMapHelper.IsValue(map, 3))
2084 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2086 if (TextMapHelper.IsValue(map, 4))
2088 using (var properyValue = map.Find(4))
2089 using (var fontStyle = new PropertyMap())
2091 properyValue.Get(fontStyle);
2092 using (var fontStyleValue = new PropertyValue(fontStyle))
2094 map.Add("fontStyle", fontStyleValue);
2099 if (TextMapHelper.IsValue(map, 5))
2100 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2102 if (TextMapHelper.IsValue(map, 6))
2103 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2105 if (TextMapHelper.IsValue(map, 7))
2106 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2112 SetValue(PlaceholderProperty, value);
2113 NotifyPropertyChanged();
2118 /// Set Placeholder to TextField. <br />
2120 /// <param name="placeholder">The Placeholder</param>
2122 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2125 /// The following example demonstrates how to use the SetPlaceholder method.
2127 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2128 /// placeholder.Text = "placeholder text";
2129 /// placeholder.TextFocused = "placeholder textFocused";
2130 /// placeholder.Color = new Color("#45B39D");
2131 /// placeholder.FontFamily = "BreezeSans";
2132 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2134 /// Width = FontWidthType.Expanded,
2135 /// Weight = FontWeightType.ExtraLight,
2136 /// Slant = FontSlantType.Italic,
2138 /// placeholder.PointSize = 25.0f;
2139 /// //placeholder.PixelSize = 50.0f;
2140 /// placeholder.Ellipsis = true;
2141 /// field.SetPlaceholder(placeholder);
2144 [EditorBrowsable(EditorBrowsableState.Never)]
2145 public void SetPlaceholder(Placeholder placeholder)
2147 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2149 SetValue(PlaceholderProperty, placeholderMap);
2154 /// Get Placeholder from TextField. <br />
2156 /// <returns>The Placeholder</returns>
2158 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2160 [EditorBrowsable(EditorBrowsableState.Never)]
2161 public Placeholder GetPlaceholder()
2163 Placeholder placeholder;
2164 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2166 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2172 /// The Ellipsis property.<br />
2173 /// Enable or disable the ellipsis.<br />
2174 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2176 /// <since_tizen> 4 </since_tizen>
2177 public bool Ellipsis
2181 return (bool)GetValue(EllipsisProperty);
2185 SetValue(EllipsisProperty, value);
2186 NotifyPropertyChanged();
2191 /// Enables selection of the text using the Shift key.
2193 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2194 [EditorBrowsable(EditorBrowsableState.Never)]
2195 public bool EnableShiftSelection
2199 return (bool)GetValue(EnableShiftSelectionProperty);
2203 SetValue(EnableShiftSelectionProperty, value);
2204 NotifyPropertyChanged();
2209 /// The text alignment to match the direction of the system language.<br />
2210 /// The default value is true.<br />
2212 /// <since_tizen> 6 </since_tizen>
2213 public bool MatchSystemLanguageDirection
2217 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2221 SetValue(MatchSystemLanguageDirectionProperty, value);
2222 NotifyPropertyChanged();
2227 /// The FontSizeScale property. <br />
2228 /// The default value is 1.0. <br />
2229 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2230 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2232 /// <since_tizen> 9 </since_tizen>
2233 public float FontSizeScale
2237 return fontSizeScale;
2241 float newFontSizeScale;
2243 if (fontSizeScale == value) return;
2245 fontSizeScale = value;
2246 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2248 SystemSettingsFontSize systemSettingsFontSize;
2252 systemSettingsFontSize = SystemSettings.FontSize;
2256 Console.WriteLine("{0} Exception caught.", e);
2257 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2259 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2260 addFontSizeChangedCallback();
2264 newFontSizeScale = fontSizeScale;
2265 removeFontSizeChangedCallback();
2268 SetValue(FontSizeScaleProperty, newFontSizeScale);
2269 NotifyPropertyChanged();
2274 /// The EnableFontSizeScale property.<br />
2275 /// Whether the font size scale is enabled. (The default value is true)
2277 [EditorBrowsable(EditorBrowsableState.Never)]
2278 public bool EnableFontSizeScale
2282 return (bool)GetValue(EnableFontSizeScaleProperty);
2286 SetValue(EnableFontSizeScaleProperty, value);
2287 NotifyPropertyChanged();
2291 /// Only used by the IL of xaml, will never changed to not hidden.
2292 [EditorBrowsable(EditorBrowsableState.Never)]
2293 public override bool IsCreateByXaml
2297 return base.IsCreateByXaml;
2301 base.IsCreateByXaml = value;
2305 this.TextChanged += (obj, e) =>
2307 this.Text = e.TextField.Text;
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);
2443 /// This will not be public opened.
2444 [EditorBrowsable(EditorBrowsableState.Never)]
2445 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2447 // In order to speed up IME hide, temporarily add
2448 GetInputMethodContext()?.DestroyContext();
2449 Interop.TextField.DeleteTextField(swigCPtr);
2452 internal override LayoutItem CreateDefaultLayout()
2454 return new TextFieldLayout();
2457 internal void SetTextWithoutTextChanged(string text)
2459 invokeTextChanged = false;
2460 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2461 invokeTextChanged = true;
2464 private string SetTranslatable(string textFieldSid)
2466 string translatableText = null;
2467 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2468 if (translatableText != null)
2470 if (systemlangTextFlag == false)
2472 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2473 systemlangTextFlag = true;
2475 return translatableText;
2479 translatableText = "";
2480 return translatableText;
2484 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2486 if (textFieldTextSid != null)
2488 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2490 if (textFieldPlaceHolderTextSid != null)
2492 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2494 if (textFieldPlaceHolderTextFocusedSid != null)
2496 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2500 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2502 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2503 SetValue(FontSizeScaleProperty, newFontSizeScale);
2504 NotifyPropertyChanged();
2507 private void addFontSizeChangedCallback()
2509 if (hasFontSizeChangedCallback != true)
2513 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2514 hasFontSizeChangedCallback = true;
2518 Console.WriteLine("{0} Exception caught.", e);
2519 hasFontSizeChangedCallback = false;
2524 private void removeFontSizeChangedCallback()
2526 if (hasFontSizeChangedCallback == true)
2530 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2531 hasFontSizeChangedCallback = false;
2535 Console.WriteLine("{0} Exception caught.", e);
2536 hasFontSizeChangedCallback = true;
2541 internal new class Property
2543 internal static readonly int TEXT = Interop.TextField.TextGet();
2544 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2545 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2546 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2547 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2548 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2549 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2550 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2551 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2552 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2553 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2554 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2555 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2556 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2557 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2558 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2559 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2560 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2561 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2562 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2563 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2564 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2565 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2566 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2567 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2568 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2569 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2570 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2571 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2572 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2573 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2574 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2575 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2576 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2577 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2578 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2579 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2580 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2581 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2582 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2583 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2584 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2585 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2586 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2587 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2588 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2589 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2590 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2591 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2592 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2593 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2594 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2595 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2596 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2597 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2598 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2599 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2600 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2601 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2602 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2603 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2604 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2605 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2606 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2610 internal class InputStyle
2616 FontFamily = 0x0002,
2626 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2628 DecorationBoundingBox = new Rectangle(x, y, width, height);
2630 private void OnInputColorChanged(float x, float y, float z, float w)
2632 InputColor = new Vector4(x, y, z, w);
2634 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2636 PlaceholderTextColor = new Vector4(r, g, b, a);
2638 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2640 PrimaryCursorColor = new Vector4(x, y, z, w);
2642 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2644 SecondaryCursorColor = new Vector4(x, y, z, w);
2646 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2648 SelectionHighlightColor = new Vector4(x, y, z, w);
2650 private void OnShadowColorChanged(float x, float y, float z, float w)
2652 ShadowColor = new Vector4(x, y, z, w);
2654 private void OnShadowOffsetChanged(float x, float y)
2656 ShadowOffset = new Vector2(x, y);
2658 private void OnTextColorChanged(float r, float g, float b, float a)
2660 TextColor = new Color(r, g, b, a);
2662 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2664 GrabHandleColor = new Color(r, g, b, a);
2667 private class TextFieldLayout : LayoutItem
2669 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2671 // Padding will be automatically applied by DALi TextField.
2672 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2673 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2674 var minSize = Owner.MinimumSize;
2675 var maxSize = Owner.MaximumSize;
2676 var naturalSize = Owner.GetNaturalSize();
2678 if (((TextField)Owner).Text.Length == 0)
2680 // Calculate height of TextField by setting Text with " ".
2681 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2682 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2684 // Store original WidthSpecification to restore it after setting ResizePolicy.
2685 var widthSpecification = Owner.WidthSpecification;
2687 // In DALi's Size logic, if Width or Height is set to be 0, then
2688 // ResizePolicy is not changed to Fixed.
2689 // This causes Size changes after NUI Layout's OnMeasure is finished.
2690 // e.g. TextField's Width fills to its parent although Text is null and
2691 // WidthSpecification is WrapContent.
2692 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2693 // in advance if Text is null.
2694 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2696 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2697 Owner.WidthSpecification = widthSpecification;
2699 naturalSize = Owner.GetNaturalSize();
2701 // Restore TextField's Text after calculating height of TextField.
2702 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2703 ((TextField)Owner).SetTextWithoutTextChanged("");
2706 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2708 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2711 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2713 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2716 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2717 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2719 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2720 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2722 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2723 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));