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.
221 /// <since_tizen> 3 </since_tizen>
226 return (string)GetValue(TextProperty);
230 SetValueAndForceSendChangeSignal(TextProperty, value);
231 NotifyPropertyChanged();
236 /// The PlaceholderText property.
238 /// <since_tizen> 3 </since_tizen>
239 public string PlaceholderText
243 return (string)GetValue(PlaceholderTextProperty);
247 SetValue(PlaceholderTextProperty, value);
248 NotifyPropertyChanged();
253 /// The PlaceholderTextFocused property.
255 /// <since_tizen> 3 </since_tizen>
256 public string PlaceholderTextFocused
260 return (string)GetValue(PlaceholderTextFocusedProperty);
264 SetValue(PlaceholderTextFocusedProperty, value);
265 NotifyPropertyChanged();
270 /// The FontFamily property.
272 /// <since_tizen> 3 </since_tizen>
273 public string FontFamily
277 return (string)GetValue(FontFamilyProperty);
281 SetValue(FontFamilyProperty, value);
282 NotifyPropertyChanged();
287 /// The FontStyle property.
288 /// The fontStyle map contains the following keys :<br />
289 /// <list type="table">
290 /// <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>
291 /// <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>
292 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
295 /// <since_tizen> 3 </since_tizen>
296 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
297 public PropertyMap FontStyle
301 return (PropertyMap)GetValue(FontStyleProperty);
305 SetValue(FontStyleProperty, value);
306 NotifyPropertyChanged();
311 /// Set FontStyle to TextField. <br />
313 /// <param name="fontStyle">The FontStyle</param>
315 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
318 /// The following example demonstrates how to use the SetFontStyle method.
320 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
321 /// fontStyle.Width = FontWidthType.Expanded;
322 /// fontStyle.Weight = FontWeightType.Bold;
323 /// fontStyle.Slant = FontSlantType.Italic;
324 /// field.SetFontStyle(fontStyle);
327 [EditorBrowsable(EditorBrowsableState.Never)]
328 public void SetFontStyle(FontStyle fontStyle)
330 SetValue(FontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
334 /// Get FontStyle from TextField. <br />
336 /// <returns>The FontStyle</returns>
338 /// <see cref="Tizen.NUI.Text.FontStyle"/>
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public FontStyle GetFontStyle()
343 return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(FontStyleProperty));
347 /// The PointSize property.
349 /// <since_tizen> 3 </since_tizen>
350 public float PointSize
354 return (float)GetValue(PointSizeProperty);
358 SetValue(PointSizeProperty, value);
359 NotifyPropertyChanged();
364 /// The MaxLength property.
366 /// <since_tizen> 3 </since_tizen>
371 return (int)GetValue(MaxLengthProperty);
375 SetValue(MaxLengthProperty, value);
376 NotifyPropertyChanged();
381 /// The ExceedPolicy property.
383 /// <since_tizen> 3 </since_tizen>
384 public int ExceedPolicy
388 return (int)GetValue(ExceedPolicyProperty);
392 SetValue(ExceedPolicyProperty, value);
393 NotifyPropertyChanged();
398 /// The HorizontalAlignment property.
400 /// <since_tizen> 3 </since_tizen>
401 public HorizontalAlignment HorizontalAlignment
405 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
409 SetValue(HorizontalAlignmentProperty, value);
410 NotifyPropertyChanged();
415 /// The VerticalAlignment property.
417 /// <since_tizen> 3 </since_tizen>
418 public VerticalAlignment VerticalAlignment
422 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
426 SetValue(VerticalAlignmentProperty, value);
427 NotifyPropertyChanged();
428 NotifyPropertyChanged();
433 /// The TextColor property.
436 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
438 /// <since_tizen> 3 </since_tizen>
439 public Color TextColor
443 Color temp = (Color)GetValue(TextColorProperty);
444 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
448 SetValue(TextColorProperty, value);
449 NotifyPropertyChanged();
454 /// The PlaceholderTextColor property.
457 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
459 /// <since_tizen> 3 </since_tizen>
460 public Vector4 PlaceholderTextColor
464 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
465 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
469 SetValue(PlaceholderTextColorProperty, value);
470 NotifyPropertyChanged();
475 /// The ShadowOffset property.
477 /// <since_tizen> 3 </since_tizen>
479 /// Deprecated.(API Level 6) Use Shadow instead.
480 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
482 [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
483 public Vector2 ShadowOffset
487 PropertyMap map = new PropertyMap();
488 GetProperty(TextField.Property.SHADOW).Get(map);
489 Vector2 shadowOffset = new Vector2();
490 map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
491 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
495 PropertyMap temp = new PropertyMap();
496 temp.Insert("offset", new PropertyValue(value));
497 SetValue(ShadowProperty, temp);
498 NotifyPropertyChanged();
503 /// The ShadowColor property.
505 /// <since_tizen> 3 </since_tizen>
507 /// Deprecated.(API Level 6) Use Shadow instead.
508 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
510 [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
511 public Vector4 ShadowColor
515 PropertyMap map = new PropertyMap();
516 GetProperty(TextField.Property.SHADOW).Get(map);
517 Vector4 shadowColor = new Vector4();
518 map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
519 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
523 PropertyMap temp = new PropertyMap();
524 temp.Insert("color", new PropertyValue(value));
525 SetValue(ShadowProperty, temp);
526 NotifyPropertyChanged();
531 /// The PrimaryCursorColor property.
534 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
536 /// <since_tizen> 3 </since_tizen>
537 public Vector4 PrimaryCursorColor
541 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
542 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
546 SetValue(PrimaryCursorColorProperty, value);
547 NotifyPropertyChanged();
552 /// The SecondaryCursorColor property.
555 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
557 /// <since_tizen> 3 </since_tizen>
558 public Vector4 SecondaryCursorColor
562 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
563 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
567 SetValue(SecondaryCursorColorProperty, value);
568 NotifyPropertyChanged();
573 /// The EnableCursorBlink property.
575 /// <since_tizen> 3 </since_tizen>
576 public bool EnableCursorBlink
580 return (bool)GetValue(EnableCursorBlinkProperty);
584 SetValue(EnableCursorBlinkProperty, value);
585 NotifyPropertyChanged();
590 /// The CursorBlinkInterval property.
592 /// <since_tizen> 3 </since_tizen>
593 public float CursorBlinkInterval
597 return (float)GetValue(CursorBlinkIntervalProperty);
601 SetValue(CursorBlinkIntervalProperty, value);
602 NotifyPropertyChanged();
607 /// The CursorBlinkDuration property.
609 /// <since_tizen> 3 </since_tizen>
610 public float CursorBlinkDuration
614 return (float)GetValue(CursorBlinkDurationProperty);
618 SetValue(CursorBlinkDurationProperty, value);
619 NotifyPropertyChanged();
624 /// The CursorWidth property.
626 /// <since_tizen> 3 </since_tizen>
627 public int CursorWidth
631 return (int)GetValue(CursorWidthProperty);
635 SetValue(CursorWidthProperty, value);
636 NotifyPropertyChanged();
641 /// The GrabHandleImage property.
643 /// <since_tizen> 3 </since_tizen>
644 public string GrabHandleImage
648 return (string)GetValue(GrabHandleImageProperty);
652 SetValue(GrabHandleImageProperty, value);
653 NotifyPropertyChanged();
658 /// The GrabHandlePressedImage property.
660 /// <since_tizen> 3 </since_tizen>
661 public string GrabHandlePressedImage
665 return (string)GetValue(GrabHandlePressedImageProperty);
669 SetValue(GrabHandlePressedImageProperty, value);
670 NotifyPropertyChanged();
675 /// The ScrollThreshold property.
677 /// <since_tizen> 3 </since_tizen>
678 public float ScrollThreshold
682 return (float)GetValue(ScrollThresholdProperty);
686 SetValue(ScrollThresholdProperty, value);
687 NotifyPropertyChanged();
692 /// The ScrollSpeed property.
694 /// <since_tizen> 3 </since_tizen>
695 public float ScrollSpeed
699 return (float)GetValue(ScrollSpeedProperty);
703 SetValue(ScrollSpeedProperty, value);
704 NotifyPropertyChanged();
709 /// The SelectionHandleImageLeft property.
710 /// The selectionHandleImageLeft map contains the following key :<br />
711 /// <list type="table">
712 /// <item><term>filename (string)</term><description>The path of image file</description></item>
715 /// <since_tizen> 3 </since_tizen>
716 public PropertyMap SelectionHandleImageLeft
720 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
724 SetValue(SelectionHandleImageLeftProperty, value);
725 NotifyPropertyChanged();
730 /// The SelectionHandleImageRight property.
731 /// The selectionHandleImageRight map contains the following key :<br />
732 /// <list type="table">
733 /// <item><term>filename (string)</term><description>The path of image file</description></item>
736 /// <since_tizen> 3 </since_tizen>
737 public PropertyMap SelectionHandleImageRight
741 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
745 SetValue(SelectionHandleImageRightProperty, value);
746 NotifyPropertyChanged();
751 /// Set SelectionHandleImage to TextField. <br />
753 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
755 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
758 /// The following example demonstrates how to use the SetSelectionHandleImage method.
760 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
761 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
762 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
763 /// field.SetSelectionHandleImage(selectionHandleImage);
766 [EditorBrowsable(EditorBrowsableState.Never)]
767 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
769 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
771 SetValue(SelectionHandleImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleImage.LeftImageUrl));
774 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
776 SetValue(SelectionHandleImageRightProperty, TextUtils.GetFileNameMap(selectionHandleImage.RightImageUrl));
781 /// Get SelectionHandleImage from TextField. <br />
783 /// <returns>The SelectionHandleImage</returns>
785 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
787 [EditorBrowsable(EditorBrowsableState.Never)]
788 public SelectionHandleImage GetSelectionHandleImage()
790 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleImageLeftProperty), (PropertyMap)GetValue(SelectionHandleImageRightProperty));
794 /// The SelectionHandlePressedImageLeft property.
795 /// The selectionHandlePressedImageLeft map contains the following key :<br />
796 /// <list type="table">
797 /// <item><term>filename (string)</term><description>The path of image file</description></item>
800 /// <since_tizen> 3 </since_tizen>
801 public PropertyMap SelectionHandlePressedImageLeft
805 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
809 SetValue(SelectionHandlePressedImageLeftProperty, value);
810 NotifyPropertyChanged();
815 /// The SelectionHandlePressedImageRight property.
816 /// The selectionHandlePressedImageRight map contains the following key :<br />
817 /// <list type="table">
818 /// <item><term>filename (string)</term><description>The path of image file</description></item>
821 /// <since_tizen> 3 </since_tizen>
822 public PropertyMap SelectionHandlePressedImageRight
826 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
830 SetValue(SelectionHandlePressedImageRightProperty, value);
831 NotifyPropertyChanged();
836 /// Set SelectionHandlePressedImage to TextField. <br />
838 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
840 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
843 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
845 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
846 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
847 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
848 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
851 [EditorBrowsable(EditorBrowsableState.Never)]
852 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
854 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
856 SetValue(SelectionHandlePressedImageLeftProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl));
859 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
861 SetValue(SelectionHandlePressedImageRightProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.RightImageUrl));
866 /// Get SelectionHandlePressedImage from TextField. <br />
868 /// <returns>The SelectionHandlePressedImage</returns>
870 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
872 [EditorBrowsable(EditorBrowsableState.Never)]
873 public SelectionHandleImage GetSelectionHandlePressedImage()
875 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty), (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty));
879 /// The SelectionHandleMarkerImageLeft property.
880 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
881 /// <list type="table">
882 /// <item><term>filename (string)</term><description>The path of image file</description></item>
885 /// <since_tizen> 3 </since_tizen>
886 public PropertyMap SelectionHandleMarkerImageLeft
890 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
894 SetValue(SelectionHandleMarkerImageLeftProperty, value);
895 NotifyPropertyChanged();
900 /// The SelectionHandleMarkerImageRight property.
901 /// The selectionHandleMarkerImageRight map contains the following key :<br />
902 /// <list type="table">
903 /// <item><term>filename (string)</term><description>The path of image file</description></item>
906 /// <since_tizen> 3 </since_tizen>
907 public PropertyMap SelectionHandleMarkerImageRight
911 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
915 SetValue(SelectionHandleMarkerImageRightProperty, value);
916 NotifyPropertyChanged();
921 /// Set SelectionHandleMarkerImage to TextField. <br />
923 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
925 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
928 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
930 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
931 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
932 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
933 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
936 [EditorBrowsable(EditorBrowsableState.Never)]
937 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
939 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
941 SetValue(SelectionHandleMarkerImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl));
944 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
946 SetValue(SelectionHandleMarkerImageRightProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl));
951 /// Get SelectionHandleMarkerImage from TextField. <br />
953 /// <returns>The SelectionHandleMarkerImage</returns>
955 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
957 [EditorBrowsable(EditorBrowsableState.Never)]
958 public SelectionHandleImage GetSelectionHandleMarkerImage()
960 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty), (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty));
964 /// The SelectionHighlightColor property.
967 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
969 /// <since_tizen> 3 </since_tizen>
970 public Vector4 SelectionHighlightColor
974 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
975 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
979 SetValue(SelectionHighlightColorProperty, value);
980 NotifyPropertyChanged();
985 /// The DecorationBoundingBox property.
988 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
990 /// <since_tizen> 3 </since_tizen>
991 public Rectangle DecorationBoundingBox
995 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
996 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1000 SetValue(DecorationBoundingBoxProperty, value);
1001 NotifyPropertyChanged();
1006 /// The InputMethodSettings property.
1009 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1012 /// The following example demonstrates how to set the InputMethodSettings property.
1014 /// InputMethod method = new InputMethod();
1015 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1016 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1017 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1018 /// method.Variation = 1;
1019 /// textField.InputMethodSettings = method.OutputMap;
1022 /// <since_tizen> 3 </since_tizen>
1023 public PropertyMap InputMethodSettings
1027 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1031 SetValue(InputMethodSettingsProperty, value);
1032 NotifyPropertyChanged();
1037 /// The InputColor property.
1040 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1042 /// <since_tizen> 3 </since_tizen>
1043 public Vector4 InputColor
1047 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1048 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1052 SetValue(InputColorProperty, value);
1053 NotifyPropertyChanged();
1058 /// The EnableMarkup property.
1060 /// <since_tizen> 3 </since_tizen>
1061 public bool EnableMarkup
1065 return (bool)GetValue(EnableMarkupProperty);
1069 SetValue(EnableMarkupProperty, value);
1070 NotifyPropertyChanged();
1075 /// The InputFontFamily property.
1077 /// <since_tizen> 3 </since_tizen>
1078 public string InputFontFamily
1082 return (string)GetValue(InputFontFamilyProperty);
1086 SetValue(InputFontFamilyProperty, value);
1087 NotifyPropertyChanged();
1092 /// The InputFontStyle property.
1093 /// The inputFontStyle map contains the following keys :<br />
1094 /// <list type="table">
1095 /// <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>
1096 /// <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>
1097 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1100 /// <since_tizen> 3 </since_tizen>
1101 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1102 public PropertyMap InputFontStyle
1106 return (PropertyMap)GetValue(InputFontStyleProperty);
1110 SetValue(InputFontStyleProperty, value);
1111 NotifyPropertyChanged();
1116 /// Set InputFontStyle to TextField. <br />
1118 /// <param name="fontStyle">The FontStyle</param>
1120 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1123 /// The following example demonstrates how to use the SetInputFontStyle method.
1125 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1126 /// fontStyle.Width = FontWidthType.Expanded;
1127 /// fontStyle.Weight = FontWeightType.Bold;
1128 /// fontStyle.Slant = FontSlantType.Italic;
1129 /// field.SetInputFontStyle(fontStyle);
1132 [EditorBrowsable(EditorBrowsableState.Never)]
1133 public void SetInputFontStyle(FontStyle fontStyle)
1135 SetValue(InputFontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
1139 /// Get InputFontStyle from TextField. <br />
1141 /// <returns>The FontStyle</returns>
1143 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1145 [EditorBrowsable(EditorBrowsableState.Never)]
1146 public FontStyle GetInputFontStyle()
1148 return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(InputFontStyleProperty));
1152 /// The InputPointSize property.
1154 /// <since_tizen> 3 </since_tizen>
1155 public float InputPointSize
1159 return (float)GetValue(InputPointSizeProperty);
1163 SetValue(InputPointSizeProperty, value);
1164 NotifyPropertyChanged();
1169 /// The Underline property.
1170 /// The underline map contains the following keys :<br />
1171 /// <list type="table">
1172 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1173 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1174 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1177 /// <since_tizen> 3 </since_tizen>
1178 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1179 public PropertyMap Underline
1183 return (PropertyMap)GetValue(UnderlineProperty);
1187 SetValue(UnderlineProperty, value);
1188 NotifyPropertyChanged();
1193 /// Set Underline to TextField. <br />
1195 /// <param name="underline">The Underline</param>
1197 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1200 /// The following example demonstrates how to use the SetUnderline method.
1202 /// var underline = new Tizen.NUI.Text.Underline();
1203 /// underline.Enable = true;
1204 /// underline.Color = new Color("#3498DB");
1205 /// underline.Height = 2.0f;
1206 /// field.SetUnderline(underline);
1209 [EditorBrowsable(EditorBrowsableState.Never)]
1210 public void SetUnderline(Underline underline)
1212 SetValue(UnderlineProperty, TextUtils.GetUnderlineMap(underline));
1216 /// Get Underline from TextField. <br />
1218 /// <returns>The Underline</returns>
1220 /// <see cref="Tizen.NUI.Text.Underline"/>
1222 [EditorBrowsable(EditorBrowsableState.Never)]
1223 public Underline GetUnderline()
1225 return TextUtils.GetUnderlineStruct((PropertyMap)GetValue(UnderlineProperty));
1229 /// The InputUnderline property.
1231 /// <since_tizen> 3 </since_tizen>
1232 public string InputUnderline
1236 return (string)GetValue(InputUnderlineProperty);
1240 SetValue(InputUnderlineProperty, value);
1241 NotifyPropertyChanged();
1246 /// The Shadow property.
1247 /// The shadow map contains the following keys :<br />
1248 /// <list type="table">
1249 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1250 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1251 /// <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>
1254 /// <since_tizen> 3 </since_tizen>
1255 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1256 public PropertyMap Shadow
1260 return (PropertyMap)GetValue(ShadowProperty);
1264 SetValue(ShadowProperty, value);
1265 NotifyPropertyChanged();
1270 /// Set Shadow to TextField. <br />
1272 /// <param name="shadow">The Shadow</param>
1274 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1277 /// The following example demonstrates how to use the SetShadow method.
1279 /// var shadow = new Tizen.NUI.Text.Shadow();
1280 /// shadow.Offset = new Vector2(3, 3);
1281 /// shadow.Color = new Color("#F1C40F");
1282 /// field.SetShadow(shadow);
1285 [EditorBrowsable(EditorBrowsableState.Never)]
1286 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1288 SetValue(ShadowProperty, TextUtils.GetShadowMap(shadow));
1292 /// Get Shadow from TextField. <br />
1294 /// <returns>The Shadow</returns>
1296 /// <see cref="Tizen.NUI.Text.Shadow"/>
1298 [EditorBrowsable(EditorBrowsableState.Never)]
1299 public Tizen.NUI.Text.Shadow GetShadow()
1301 return TextUtils.GetShadowStruct((PropertyMap)GetValue(ShadowProperty));
1305 /// The InputShadow property.
1307 /// <since_tizen> 3 </since_tizen>
1308 public string InputShadow
1312 return (string)GetValue(InputShadowProperty);
1316 SetValue(InputShadowProperty, value);
1317 NotifyPropertyChanged();
1322 /// The Emboss property.
1324 /// <since_tizen> 3 </since_tizen>
1325 public string Emboss
1329 return (string)GetValue(EmbossProperty);
1333 SetValue(EmbossProperty, value);
1334 NotifyPropertyChanged();
1339 /// The InputEmboss property.
1341 /// <since_tizen> 3 </since_tizen>
1342 public string InputEmboss
1346 return (string)GetValue(InputEmbossProperty);
1350 SetValue(InputEmbossProperty, value);
1351 NotifyPropertyChanged();
1356 /// The Outline property.
1357 /// The outline map contains the following keys :<br />
1358 /// <list type="table">
1359 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1360 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1363 /// <since_tizen> 3 </since_tizen>
1364 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1365 public PropertyMap Outline
1369 return (PropertyMap)GetValue(OutlineProperty);
1373 SetValue(OutlineProperty, value);
1374 NotifyPropertyChanged();
1379 /// Set Outline to TextField. <br />
1381 /// <param name="outline">The Outline</param>
1383 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1386 /// The following example demonstrates how to use the SetOutline method.
1388 /// var outline = new Tizen.NUI.Text.Outline();
1389 /// outline.Width = 2.0f;
1390 /// outline.Color = new Color("#45B39D");
1391 /// field.SetOutline(outline);
1394 [EditorBrowsable(EditorBrowsableState.Never)]
1395 public void SetOutline(Outline outline)
1397 SetValue(OutlineProperty, TextUtils.GetOutlineMap(outline));
1401 /// Get Outline from TextField. <br />
1403 /// <returns>The Outline</returns>
1405 /// <see cref="Tizen.NUI.Text.Outline"/>
1407 [EditorBrowsable(EditorBrowsableState.Never)]
1408 public Outline GetOutline()
1410 return TextUtils.GetOutlineStruct((PropertyMap)GetValue(OutlineProperty));
1414 /// The InputOutline property.
1416 /// <since_tizen> 3 </since_tizen>
1417 public string InputOutline
1421 return (string)GetValue(InputOutlineProperty);
1425 SetValue(InputOutlineProperty, value);
1426 NotifyPropertyChanged();
1431 /// The HiddenInputSettings property.
1432 /// The hiddenInputSettings map contains the following keys :<br />
1433 /// <list type="table">
1434 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1435 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1436 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1437 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1441 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1444 /// The following example demonstrates how to set the HiddenInputSettings property.
1446 /// PropertyMap map = new PropertyMap();
1447 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1448 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1449 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1450 /// textField.HiddenInputSettings = map;
1453 /// <since_tizen> 3 </since_tizen>
1454 public Tizen.NUI.PropertyMap HiddenInputSettings
1458 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1462 SetValue(HiddenInputSettingsProperty, value);
1463 NotifyPropertyChanged();
1468 /// Set HiddenInput to TextField. <br />
1470 /// <param name="hiddenInput">The HiddenInput</param>
1472 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1475 /// The following example demonstrates how to use the SetHiddenInput method.
1477 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1478 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1479 /// hiddenInput.SubstituteCharacter = '★';
1480 /// hiddenInput.SubstituteCount = 0;
1481 /// hiddenInput.ShowLastCharacterDuration = 1000;
1482 /// field.SetHiddenInput(hiddenInput);
1485 [EditorBrowsable(EditorBrowsableState.Never)]
1486 public void SetHiddenInput(HiddenInput hiddenInput)
1488 SetValue(HiddenInputSettingsProperty, TextUtils.GetHiddenInputMap(hiddenInput));
1492 /// Get HiddenInput from TextField. <br />
1494 /// <returns>The HiddenInput</returns>
1496 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1498 [EditorBrowsable(EditorBrowsableState.Never)]
1499 public HiddenInput GetHiddenInput()
1501 return TextUtils.GetHiddenInputStruct((PropertyMap)GetValue(HiddenInputSettingsProperty));
1505 /// The PixelSize property.
1507 /// <since_tizen> 3 </since_tizen>
1508 public float PixelSize
1512 return (float)GetValue(PixelSizeProperty);
1516 SetValue(PixelSizeProperty, value);
1517 NotifyPropertyChanged();
1522 /// The Enable selection property.
1524 /// <since_tizen> 3 </since_tizen>
1525 public bool EnableSelection
1529 return (bool)GetValue(EnableSelectionProperty);
1533 SetValue(EnableSelectionProperty, value);
1534 NotifyPropertyChanged();
1539 /// The Enable selection property.
1541 /// <since_tizen> 6 </since_tizen>
1542 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1543 [EditorBrowsable(EditorBrowsableState.Never)]
1544 public bool EnableGrabHandle
1548 return (bool)GetValue(EnableGrabHandleProperty);
1552 SetValue(EnableGrabHandleProperty, value);
1553 NotifyPropertyChanged();
1558 /// The Enable selection property.
1560 /// <since_tizen> 6 </since_tizen>
1561 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1562 [EditorBrowsable(EditorBrowsableState.Never)]
1563 public bool EnableGrabHandlePopup
1567 return (bool)GetValue(EnableGrabHandlePopupProperty);
1571 SetValue(EnableGrabHandlePopupProperty, value);
1572 NotifyPropertyChanged();
1577 /// The Selected Text property.
1579 /// <since_tizen> 8 </since_tizen>
1580 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1581 [EditorBrowsable(EditorBrowsableState.Never)]
1582 public string SelectedText
1587 GetProperty(TextField.Property.SelectedText).Get(out temp);
1593 /// The start index for selection.
1595 /// <since_tizen> 8 </since_tizen>
1596 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1597 [EditorBrowsable(EditorBrowsableState.Never)]
1598 public int SelectedTextStart
1603 GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
1609 /// The end index for selection.
1611 /// <since_tizen> 8 </since_tizen>
1612 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1613 [EditorBrowsable(EditorBrowsableState.Never)]
1614 public int SelectedTextEnd
1619 GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
1625 /// Enable editing in text control.
1627 /// <since_tizen> 8 </since_tizen>
1628 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1629 [EditorBrowsable(EditorBrowsableState.Never)]
1630 public bool EnableEditing
1635 GetProperty(TextField.Property.EnableEditing).Get(out temp);
1640 SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
1641 NotifyPropertyChanged();
1646 /// Specify primary cursor (caret) position in text control.
1648 [EditorBrowsable(EditorBrowsableState.Never)]
1649 public int PrimaryCursorPosition
1654 using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1656 propertyValue.Get(out temp);
1662 using (PropertyValue propertyValue = new PropertyValue(value))
1664 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1665 NotifyPropertyChanged();
1671 /// The GrabHandleColor property.
1674 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1676 [EditorBrowsable(EditorBrowsableState.Never)]
1677 public Color GrabHandleColor
1681 Color temp = (Color)GetValue(GrabHandleColorProperty);
1682 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1686 SetValue(GrabHandleColorProperty, value);
1687 NotifyPropertyChanged();
1692 /// The ellipsis position of the text.
1693 /// The ellipsis position type when the text size over the layout size.<br />
1694 /// The ellipsis position: End, Start or Middle.<br />
1696 [EditorBrowsable(EditorBrowsableState.Never)]
1697 public EllipsisPosition EllipsisPosition
1701 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1705 SetValue(EllipsisPositionProperty, value);
1706 NotifyPropertyChanged();
1711 /// Set InputFilter to TextField. <br />
1713 /// <param name="inputFilter">The InputFilter</param>
1715 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1716 /// Users can set the Accepted or Rejected regular expression set, or both. <br />
1717 /// If both are used, Rejected has higher priority. <br />
1718 /// The character set must follow the regular expression rules. <br />
1719 /// Behaviour can not be guaranteed for incorrect grammars. <br />
1720 /// Refer the link below for detailed rules. <br />
1721 /// The functions in std::regex library use the ECMAScript grammar: <br />
1722 /// http://cplusplus.com/reference/regex/ECMAScript/ <br />
1723 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1724 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description. <br />
1727 /// The following example demonstrates how to use the SetInputFilter method.
1729 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1730 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1731 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1732 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1735 [EditorBrowsable(EditorBrowsableState.Never)]
1736 public void SetInputFilter(InputFilter inputFilter)
1738 SetProperty(TextField.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter)));
1742 /// Get InputFilter from TextField. <br />
1744 /// <returns>The InputFilter</returns>
1746 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1748 [EditorBrowsable(EditorBrowsableState.Never)]
1749 public InputFilter GetInputFilter()
1751 var map = new PropertyMap();
1752 GetProperty(TextField.Property.InputFilter).Get(map);
1753 return TextUtils.GetInputFilterStruct(map);
1757 /// The Placeholder property.
1758 /// The placeholder map contains the following keys :<br />
1759 /// <list type="table">
1760 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
1761 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1762 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1763 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1764 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1765 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1766 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1767 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1771 /// The following example demonstrates how to set the Placeholder property.
1773 /// PropertyMap propertyMap = new PropertyMap();
1774 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1775 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1776 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1777 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1778 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1780 /// PropertyMap fontStyleMap = new PropertyMap();
1781 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1782 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1783 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1784 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1786 /// TextField field = new TextField();
1787 /// field.Placeholder = propertyMap;
1790 /// <since_tizen> 3 </since_tizen>
1791 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1792 public Tizen.NUI.PropertyMap Placeholder
1796 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1797 PropertyValue value = null;
1800 value = map.Find(0);
1803 value.Get(out string text);
1804 map.Add("text", new PropertyValue(text));
1808 value = map.Find(1);
1811 value.Get(out string textFocused);
1812 map.Add("textFocused", new PropertyValue(textFocused));
1816 value = map.Find(2);
1819 Color color = new Color();
1821 map.Add("color", new PropertyValue(color));
1825 value = map.Find(3);
1828 value.Get(out string fontFamily);
1829 map.Add("fontFamily", new PropertyValue(fontFamily));
1833 value = map.Find(4);
1836 PropertyMap fontStyle = new PropertyMap();
1837 value.Get(fontStyle);
1838 map.Add("fontStyle", new PropertyValue(fontStyle));
1842 value = map.Find(5);
1845 value.Get(out float pointSize);
1846 map.Add("pointSize", new PropertyValue(pointSize));
1850 value = map.Find(6);
1853 value.Get(out float pixelSize);
1854 map.Add("pixelSize", new PropertyValue(pixelSize));
1858 value = map.Find(7);
1861 value.Get(out bool ellipsis);
1862 map.Add("ellipsis", new PropertyValue(ellipsis));
1869 SetValue(PlaceholderProperty, value);
1870 NotifyPropertyChanged();
1875 /// Set Placeholder to TextField. <br />
1877 /// <param name="placeholder">The Placeholder</param>
1879 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
1882 /// The following example demonstrates how to use the SetPlaceholder method.
1884 /// var placeholder = new Tizen.NUI.Text.Placeholder();
1885 /// placeholder.Text = "placeholder text";
1886 /// placeholder.TextFocused = "placeholder textFocused";
1887 /// placeholder.Color = new Color("#45B39D");
1888 /// placeholder.FontFamily = "BreezeSans";
1889 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
1891 /// Width = FontWidthType.Expanded,
1892 /// Weight = FontWeightType.ExtraLight,
1893 /// Slant = FontSlantType.Italic,
1895 /// placeholder.PointSize = 25.0f;
1896 /// //placeholder.PixelSize = 50.0f;
1897 /// placeholder.Ellipsis = true;
1898 /// field.SetPlaceholder(placeholder);
1901 [EditorBrowsable(EditorBrowsableState.Never)]
1902 public void SetPlaceholder(Placeholder placeholder)
1904 SetValue(PlaceholderProperty, TextUtils.GetPlaceholderMap(placeholder));
1908 /// Get Placeholder from TextField. <br />
1910 /// <returns>The Placeholder</returns>
1912 /// <see cref="Tizen.NUI.Text.Placeholder"/>
1914 [EditorBrowsable(EditorBrowsableState.Never)]
1915 public Placeholder GetPlaceholder()
1917 return TextUtils.GetPlaceholderStruct((PropertyMap)GetValue(PlaceholderProperty));
1921 /// The Ellipsis property.<br />
1922 /// Enable or disable the ellipsis.<br />
1923 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
1925 /// <since_tizen> 4 </since_tizen>
1926 public bool Ellipsis
1930 return (bool)GetValue(EllipsisProperty);
1934 SetValue(EllipsisProperty, value);
1935 NotifyPropertyChanged();
1940 /// Enables selection of the text using the Shift key.
1942 /// <since_tizen> 5 </since_tizen>
1943 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1944 [EditorBrowsable(EditorBrowsableState.Never)]
1945 public bool EnableShiftSelection
1949 return (bool)GetValue(EnableShiftSelectionProperty);
1953 SetValue(EnableShiftSelectionProperty, value);
1954 NotifyPropertyChanged();
1959 /// The text alignment to match the direction of the system language.
1961 /// <since_tizen> 6 </since_tizen>
1962 public bool MatchSystemLanguageDirection
1966 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1970 SetValue(MatchSystemLanguageDirectionProperty, value);
1971 NotifyPropertyChanged();
1976 /// The FontSizeScale property. <br />
1977 /// The default value is 1.0. <br />
1978 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1980 /// <since_tizen> 9 </since_tizen>
1981 public float FontSizeScale
1985 return fontSizeScale;
1989 float newFontSizeScale;
1991 if (fontSizeScale == value) return;
1993 fontSizeScale = value;
1994 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1996 SystemSettingsFontSize systemSettingsFontSize;
2000 systemSettingsFontSize = SystemSettings.FontSize;
2004 Console.WriteLine("{0} Exception caught.", e);
2005 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2007 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2008 addFontSizeChangedCallback();
2012 newFontSizeScale = fontSizeScale;
2013 removeFontSizeChangedCallback();
2016 SetValue(FontSizeScaleProperty, newFontSizeScale);
2017 NotifyPropertyChanged();
2021 /// Only used by the IL of xaml, will never changed to not hidden.
2022 [EditorBrowsable(EditorBrowsableState.Never)]
2023 public override bool IsCreateByXaml
2027 return base.IsCreateByXaml;
2031 base.IsCreateByXaml = value;
2035 this.TextChanged += (obj, e) =>
2037 this.Text = e.TextField.Text;
2044 /// Get the InputMethodContext instance.
2046 /// <returns>The InputMethodContext instance.</returns>
2047 /// <since_tizen> 5 </since_tizen>
2048 public InputMethodContext GetInputMethodContext()
2050 if (inputMethodCotext == null)
2052 /*Avoid raising InputMethodContext reference count.*/
2053 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2054 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2056 return inputMethodCotext;
2060 /// Select the whole text.
2062 /// <since_tizen> 6 </since_tizen>
2063 /// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
2064 [EditorBrowsable(EditorBrowsableState.Never)]
2065 public void SelectWholeText()
2067 Interop.TextField.SelectWholeText(SwigCPtr);
2068 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2072 /// Select text from start to end index. <br />
2073 /// The index is valid when 0 or positive. <br />
2075 /// <param name="start">The start index for selection.</param>
2076 /// <param name="end">The end index for selection.</param>
2077 [EditorBrowsable(EditorBrowsableState.Never)]
2078 public void SelectText(int start, int end)
2081 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2083 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2085 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2086 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2090 /// Clear selection of the text.
2092 /// <since_tizen> 8 </since_tizen>
2093 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
2094 [EditorBrowsable(EditorBrowsableState.Never)]
2095 public void SelectNone()
2097 _ = Interop.TextField.SelectNone(SwigCPtr);
2098 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2101 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2103 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));
2104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2111 /// <since_tizen> 3 </since_tizen>
2112 protected override void Dispose(DisposeTypes type)
2116 DisposeQueue.Instance.Add(this);
2120 if (systemlangTextFlag)
2122 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2125 removeFontSizeChangedCallback();
2127 if (type == DisposeTypes.Explicit)
2130 //Release your own managed resources here.
2131 //You should release all of your own disposable objects here.
2134 //Release your own unmanaged resources here.
2135 //You should not access any managed member here except static instance.
2136 //because the execution order of Finalizes is non-deterministic.
2139 if (textFieldCursorPositionChangedCallbackDelegate != null)
2141 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2144 if (textFieldMaxLengthReachedCallbackDelegate != null)
2146 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2149 if (textFieldSelectionClearedCallbackDelegate != null)
2151 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2154 if (textFieldSelectionChangedCallbackDelegate != null)
2156 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2159 if (textFieldTextChangedCallbackDelegate != null)
2161 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2168 /// This will not be public opened.
2169 [EditorBrowsable(EditorBrowsableState.Never)]
2170 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2172 // In order to speed up IME hide, temporarily add
2173 GetInputMethodContext()?.DestroyContext();
2174 Interop.TextField.DeleteTextField(swigCPtr);
2177 private string SetTranslatable(string textFieldSid)
2179 string translatableText = null;
2180 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2181 if (translatableText != null)
2183 if (systemlangTextFlag == false)
2185 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2186 systemlangTextFlag = true;
2188 return translatableText;
2192 translatableText = "";
2193 return translatableText;
2197 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2199 if (textFieldTextSid != null)
2201 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2203 if (textFieldPlaceHolderTextSid != null)
2205 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2207 if (textFieldPlaceHolderTextFocusedSid != null)
2209 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2213 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2215 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2216 SetValue(FontSizeScaleProperty, newFontSizeScale);
2217 NotifyPropertyChanged();
2220 private void addFontSizeChangedCallback()
2222 if (hasFontSizeChangedCallback != true)
2226 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2227 hasFontSizeChangedCallback = true;
2231 Console.WriteLine("{0} Exception caught.", e);
2232 hasFontSizeChangedCallback = false;
2237 private void removeFontSizeChangedCallback()
2239 if (hasFontSizeChangedCallback == true)
2243 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2244 hasFontSizeChangedCallback = false;
2248 Console.WriteLine("{0} Exception caught.", e);
2249 hasFontSizeChangedCallback = true;
2254 internal new class Property
2256 internal static readonly int TEXT = Interop.TextField.TextGet();
2257 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2258 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2259 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2260 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2261 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2262 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2263 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2264 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2265 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2266 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2267 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2268 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2269 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2270 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2271 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2272 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2273 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2274 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2275 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2276 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2277 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2278 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2279 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2280 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2281 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2282 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2283 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2284 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2285 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2286 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2287 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2288 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2289 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2290 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2291 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2292 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2293 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2294 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2295 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2296 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2297 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2298 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2299 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2300 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2301 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2302 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2303 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2304 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2305 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2306 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2307 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2308 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2309 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2310 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2311 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2312 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2313 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2314 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2315 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2316 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2317 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2320 internal class InputStyle
2326 FontFamily = 0x0002,
2336 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2338 DecorationBoundingBox = new Rectangle(x, y, width, height);
2340 private void OnInputColorChanged(float x, float y, float z, float w)
2342 InputColor = new Vector4(x, y, z, w);
2344 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2346 PlaceholderTextColor = new Vector4(r, g, b, a);
2348 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2350 PrimaryCursorColor = new Vector4(x, y, z, w);
2352 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2354 SecondaryCursorColor = new Vector4(x, y, z, w);
2356 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2358 SelectionHighlightColor = new Vector4(x, y, z, w);
2360 private void OnShadowColorChanged(float x, float y, float z, float w)
2362 ShadowColor = new Vector4(x, y, z, w);
2364 private void OnShadowOffsetChanged(float x, float y)
2366 ShadowOffset = new Vector2(x, y);
2368 private void OnTextColorChanged(float r, float g, float b, float a)
2370 TextColor = new Color(r, g, b, a);
2372 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2374 GrabHandleColor = new Color(r, g, b, a);