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 static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextField";
35 static private string defaultFontFamily = "TizenSans";
36 private string textFieldTextSid = null;
37 private string textFieldPlaceHolderTextSid = null;
38 private string textFieldPlaceHolderTextFocusedSid = null;
39 private InputMethodContext inputMethodCotext = null;
40 private string fontFamily = defaultFontFamily;
41 private float fontSizeScale = 1.0f;
42 private bool hasSystemLanguageChanged = false;
43 private bool hasSystemFontSizeChanged = false;
44 private bool hasSystemFontTypeChanged = false;
45 private bool isSettingTextInCSharp = false;
47 private Vector4 internalPlaceholderTextColor = null;
48 private Vector4 internalPrimaryCursorColor = null;
49 private Vector4 internalSecondaryCursorColor = null;
50 private Vector4 internalSelectionHighlightColor = null;
51 private Vector4 internalInputColor = null;
52 private Color internalTextColor = null;
53 private Color internalGrabHandleColor = null;
56 static TextField() { }
59 /// Creates the TextField control.
61 /// <since_tizen> 3 </since_tizen>
62 public TextField() : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
64 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68 /// Creates the TextField with setting the status of shown or hidden.
70 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
71 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public TextField(bool shown) : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 /// Get attributes, it is abstract function and must be override.
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 protected override ViewStyle CreateViewStyle()
85 return new TextFieldStyle();
88 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
95 TextChanged += TextFieldTextChanged;
98 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
105 TextChanged += TextFieldTextChanged;
108 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal enum ExceedPolicyType
115 ExceedPolicyOriginal,
119 private bool HasStyle()
121 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
125 /// The TranslatableText property.<br />
126 /// The text can set the SID value.<br />
128 /// <exception cref='ArgumentNullException'>
129 /// ResourceManager about multilingual is null.
131 /// <since_tizen> 4 </since_tizen>
132 public string TranslatableText
136 return (string)GetValue(TranslatableTextProperty);
140 SetValue(TranslatableTextProperty, value);
143 private string translatableText
147 return textFieldTextSid;
151 if (NUIApplication.MultilingualResourceManager == null)
153 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
155 textFieldTextSid = value;
156 Text = SetTranslatable(textFieldTextSid);
157 NotifyPropertyChanged();
162 /// The TranslatablePlaceholderText property.<br />
163 /// The text can set the SID value.<br />
165 /// <exception cref='ArgumentNullException'>
166 /// ResourceManager about multilingual is null.
168 /// <since_tizen> 4 </since_tizen>
169 public string TranslatablePlaceholderText
173 return (string)GetValue(TranslatablePlaceholderTextProperty);
177 SetValue(TranslatablePlaceholderTextProperty, value);
180 private string translatablePlaceholderText
184 return textFieldPlaceHolderTextSid;
188 if (NUIApplication.MultilingualResourceManager == null)
190 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
192 textFieldPlaceHolderTextSid = value;
193 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
194 NotifyPropertyChanged();
199 /// The TranslatablePlaceholderTextFocused property.<br />
200 /// The text can set the SID value.<br />
202 /// <exception cref='ArgumentNullException'>
203 /// ResourceManager about multilingual is null.
205 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
206 [EditorBrowsable(EditorBrowsableState.Never)]
207 public string TranslatablePlaceholderTextFocused
211 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
215 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
218 private string translatablePlaceholderTextFocused
222 return textFieldPlaceHolderTextFocusedSid;
226 if (NUIApplication.MultilingualResourceManager == null)
228 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
230 textFieldPlaceHolderTextFocusedSid = value;
231 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
232 NotifyPropertyChanged();
237 /// The Text property.<br />
238 /// The text to display in the UTF-8 format.<br />
240 /// <since_tizen> 3 </since_tizen>
245 return (string)GetValue(TextProperty);
249 SetValue(TextProperty, value);
250 NotifyPropertyChanged();
255 /// The PlaceholderText property.<br />
256 /// The text to display when the TextField is empty and inactive. <br />
258 /// <since_tizen> 3 </since_tizen>
259 public string PlaceholderText
263 return (string)GetValue(PlaceholderTextProperty);
267 SetValue(PlaceholderTextProperty, value);
268 NotifyPropertyChanged();
273 /// The PlaceholderTextFocused property. <br />
274 /// The text to display when the TextField is empty with input focus. <br />
276 /// <since_tizen> 3 </since_tizen>
277 public string PlaceholderTextFocused
281 return (string)GetValue(PlaceholderTextFocusedProperty);
285 SetValue(PlaceholderTextFocusedProperty, value);
286 NotifyPropertyChanged();
291 /// The FontFamily property.<br />
292 /// The requested font family to use.<br />
294 /// <since_tizen> 3 </since_tizen>
295 public string FontFamily
299 return (string)GetValue(FontFamilyProperty);
303 SetValue(FontFamilyProperty, value);
304 NotifyPropertyChanged();
308 private string InternalFontFamily
315 return Object.InternalGetPropertyString(this.SwigCPtr, TextField.Property.FontFamily);
319 string newFontFamily;
321 if (string.Equals(fontFamily, value)) return;
324 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
328 newFontFamily = SystemSettings.FontType;
332 Console.WriteLine("{0} Exception caught.", e);
333 newFontFamily = defaultFontFamily;
335 AddSystemSettingsFontTypeChanged();
339 newFontFamily = fontFamily;
340 RemoveSystemSettingsFontTypeChanged();
343 SetInternalFontFamily(newFontFamily);
347 private void SetInternalFontFamily(string fontFamily)
349 Object.InternalSetPropertyString(this.SwigCPtr, TextField.Property.FontFamily, (string)fontFamily);
353 /// The FontStyle property.<br />
354 /// The requested font style to use.<br />
355 /// The fontStyle map contains the following keys :<br />
356 /// <list type="table">
357 /// <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>
358 /// <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>
359 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
362 /// <since_tizen> 3 </since_tizen>
363 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
364 public PropertyMap FontStyle
368 return (PropertyMap)GetValue(FontStyleProperty);
372 SetValue(FontStyleProperty, value);
373 NotifyPropertyChanged();
378 /// Set FontStyle to TextField. <br />
380 /// <param name="fontStyle">The FontStyle</param>
382 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
385 /// The following example demonstrates how to use the SetFontStyle method.
387 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
388 /// fontStyle.Width = FontWidthType.Expanded;
389 /// fontStyle.Weight = FontWeightType.Bold;
390 /// fontStyle.Slant = FontSlantType.Italic;
391 /// field.SetFontStyle(fontStyle);
394 [EditorBrowsable(EditorBrowsableState.Never)]
395 public void SetFontStyle(FontStyle fontStyle)
397 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
399 SetValue(FontStyleProperty, fontStyleMap);
404 /// Get FontStyle from TextField. <br />
406 /// <returns>The FontStyle</returns>
408 /// <see cref="Tizen.NUI.Text.FontStyle"/>
410 [EditorBrowsable(EditorBrowsableState.Never)]
411 public FontStyle GetFontStyle()
414 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
416 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
422 /// The PointSize property.<br />
423 /// The size of font in points.<br />
425 /// <since_tizen> 3 </since_tizen>
426 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
427 public float PointSize
431 return (float)GetValue(PointSizeProperty);
435 SetValue(PointSizeProperty, value);
436 NotifyPropertyChanged();
441 /// The MaxLength property.<br />
442 /// The maximum number of characters that can be inserted.<br />
444 /// <since_tizen> 3 </since_tizen>
449 return (int)GetValue(MaxLengthProperty);
453 SetValue(MaxLengthProperty, value);
454 NotifyPropertyChanged();
459 /// The ExceedPolicy property.<br />
460 /// Specifies how the text is truncated when it does not fit.<br />
462 /// <since_tizen> 3 </since_tizen>
463 public int ExceedPolicy
467 return (int)GetValue(ExceedPolicyProperty);
471 SetValue(ExceedPolicyProperty, value);
472 NotifyPropertyChanged();
477 /// The HorizontalAlignment property.<br />
478 /// The line horizontal alignment.<br />
480 /// <since_tizen> 3 </since_tizen>
481 public HorizontalAlignment HorizontalAlignment
485 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
489 SetValue(HorizontalAlignmentProperty, value);
490 NotifyPropertyChanged();
495 /// The VerticalAlignment property.<br />
496 /// The line vertical alignment.<br />
498 /// <since_tizen> 3 </since_tizen>
499 public VerticalAlignment VerticalAlignment
503 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
507 SetValue(VerticalAlignmentProperty, value);
508 NotifyPropertyChanged();
509 NotifyPropertyChanged();
514 /// The TextColor property.<br />
515 /// The color of the text.<br />
518 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
520 /// <since_tizen> 3 </since_tizen>
521 public Color TextColor
525 Color temp = (Color)GetValue(TextColorProperty);
526 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
530 SetValue(TextColorProperty, value);
531 NotifyPropertyChanged();
536 /// The PlaceholderTextColor property.
539 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
541 /// <since_tizen> 3 </since_tizen>
542 public Vector4 PlaceholderTextColor
546 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
547 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
551 SetValue(PlaceholderTextColorProperty, value);
552 NotifyPropertyChanged();
557 /// The ShadowOffset property.
559 /// <since_tizen> 3 </since_tizen>
561 /// Deprecated.(API Level 6) Use Shadow instead.
562 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
564 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
565 public Vector2 ShadowOffset
569 return GetValue(ShadowOffsetProperty) as Vector2;
573 SetValue(ShadowOffsetProperty, value);
577 private Vector2 InternalShadowOffset
581 float x = 0.0f, y = 0.0f;
582 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
583 using (var shadowOffset = new Vector2())
585 if (null != propertyValue)
587 propertyValue.Get(shadowOffset);
592 return new Vector2(OnShadowOffsetChanged, x, y);
596 using (var map = new PropertyMap())
598 map.Add("offset", value);
599 var shadowMap = Shadow;
600 shadowMap.Merge(map);
601 SetValue(ShadowProperty, shadowMap);
602 NotifyPropertyChanged();
608 /// The ShadowColor property.
610 /// <since_tizen> 3 </since_tizen>
612 /// Deprecated.(API Level 6) Use Shadow instead.
613 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
615 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
616 public Vector4 ShadowColor
620 return GetValue(ShadowColorProperty) as Vector4;
624 SetValue(ShadowColorProperty, value);
628 private Vector4 InternalShadowColor
632 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
633 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
634 using (var shadowColor = new Vector4())
636 if (null != propertyValue)
638 propertyValue.Get(shadowColor);
645 return new Vector4(OnShadowColorChanged, x, y, z, w);
649 using (var map = new PropertyMap())
651 map.Add("color", value);
652 var shadowMap = Shadow;
653 shadowMap.Merge(map);
654 SetValue(ShadowProperty, shadowMap);
655 NotifyPropertyChanged();
661 /// The PrimaryCursorColor property.<br />
662 /// The color to apply to the primary cursor.<br />
665 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
667 /// <since_tizen> 3 </since_tizen>
668 public Vector4 PrimaryCursorColor
672 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
673 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
677 SetValue(PrimaryCursorColorProperty, value);
678 NotifyPropertyChanged();
683 /// The SecondaryCursorColor property.<br />
684 /// The color to apply to the secondary cursor.<br />
687 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
689 /// <since_tizen> 3 </since_tizen>
690 public Vector4 SecondaryCursorColor
694 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
695 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
699 SetValue(SecondaryCursorColorProperty, value);
700 NotifyPropertyChanged();
705 /// The EnableCursorBlink property.<br />
706 /// Whether the cursor should blink or not.<br />
708 /// <since_tizen> 3 </since_tizen>
709 public bool EnableCursorBlink
713 return (bool)GetValue(EnableCursorBlinkProperty);
717 SetValue(EnableCursorBlinkProperty, value);
718 NotifyPropertyChanged();
723 /// The CursorBlinkInterval property.<br />
724 /// The time interval in seconds between cursor on/off states.<br />
726 /// <since_tizen> 3 </since_tizen>
727 public float CursorBlinkInterval
731 return (float)GetValue(CursorBlinkIntervalProperty);
735 SetValue(CursorBlinkIntervalProperty, value);
736 NotifyPropertyChanged();
741 /// The CursorBlinkDuration property.<br />
742 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
744 /// <since_tizen> 3 </since_tizen>
745 public float CursorBlinkDuration
749 return (float)GetValue(CursorBlinkDurationProperty);
753 SetValue(CursorBlinkDurationProperty, value);
754 NotifyPropertyChanged();
759 /// The CursorWidth property.
761 /// <since_tizen> 3 </since_tizen>
762 public int CursorWidth
766 return (int)GetValue(CursorWidthProperty);
770 SetValue(CursorWidthProperty, value);
771 NotifyPropertyChanged();
776 /// The GrabHandleImage property.<br />
777 /// The image to display for the grab handle.<br />
779 /// <since_tizen> 3 </since_tizen>
780 public string GrabHandleImage
784 return (string)GetValue(GrabHandleImageProperty);
788 SetValue(GrabHandleImageProperty, value);
789 NotifyPropertyChanged();
794 /// The GrabHandlePressedImage property.<br />
795 /// The image to display when the grab handle is pressed.<br />
797 /// <since_tizen> 3 </since_tizen>
798 public string GrabHandlePressedImage
802 return (string)GetValue(GrabHandlePressedImageProperty);
806 SetValue(GrabHandlePressedImageProperty, value);
807 NotifyPropertyChanged();
812 /// The ScrollThreshold property.<br />
813 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
815 /// <since_tizen> 3 </since_tizen>
816 public float ScrollThreshold
820 return (float)GetValue(ScrollThresholdProperty);
824 SetValue(ScrollThresholdProperty, value);
825 NotifyPropertyChanged();
830 /// The ScrollSpeed property.<br />
831 /// The scroll speed in pixels per second.<br />
833 /// <since_tizen> 3 </since_tizen>
834 public float ScrollSpeed
838 return (float)GetValue(ScrollSpeedProperty);
842 SetValue(ScrollSpeedProperty, value);
843 NotifyPropertyChanged();
848 /// The SelectionPopupStyle property.<br />
849 /// The style of the text selection popup can be set through SelectionPopupStyle property.
851 [EditorBrowsable(EditorBrowsableState.Never)]
852 public PropertyMap SelectionPopupStyle
856 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
860 SetValue(SelectionPopupStyleProperty, value);
861 NotifyPropertyChanged();
866 /// The SelectionHandleImageLeft property.<br />
867 /// The image to display for the left selection handle.<br />
868 /// The selectionHandleImageLeft map contains the following key :<br />
869 /// <list type="table">
870 /// <item><term>filename (string)</term><description>The path of image file</description></item>
873 /// <since_tizen> 3 </since_tizen>
874 public PropertyMap SelectionHandleImageLeft
878 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
882 SetValue(SelectionHandleImageLeftProperty, value);
883 NotifyPropertyChanged();
888 /// The SelectionHandleImageRight property.<br />
889 /// The image to display for the right selection handle.<br />
890 /// The selectionHandleImageRight map contains the following key :<br />
891 /// <list type="table">
892 /// <item><term>filename (string)</term><description>The path of image file</description></item>
895 /// <since_tizen> 3 </since_tizen>
896 public PropertyMap SelectionHandleImageRight
900 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
904 SetValue(SelectionHandleImageRightProperty, value);
905 NotifyPropertyChanged();
910 /// Set SelectionHandleImage to TextField. <br />
912 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
914 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
917 /// The following example demonstrates how to use the SetSelectionHandleImage method.
919 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
920 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
921 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
922 /// field.SetSelectionHandleImage(selectionHandleImage);
925 [EditorBrowsable(EditorBrowsableState.Never)]
926 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
928 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
930 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
932 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
936 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
938 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
940 SetValue(SelectionHandleImageRightProperty, rightImageMap);
946 /// Get SelectionHandleImage from TextField. <br />
948 /// <returns>The SelectionHandleImage</returns>
950 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
952 [EditorBrowsable(EditorBrowsableState.Never)]
953 public SelectionHandleImage GetSelectionHandleImage()
955 SelectionHandleImage selectionHandleImage;
956 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
957 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
959 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
961 return selectionHandleImage;
965 /// The SelectionHandlePressedImageLeft property.<br />
966 /// The image to display when the left selection handle is pressed.<br />
967 /// The selectionHandlePressedImageLeft map contains the following key :<br />
968 /// <list type="table">
969 /// <item><term>filename (string)</term><description>The path of image file</description></item>
972 /// <since_tizen> 3 </since_tizen>
973 public PropertyMap SelectionHandlePressedImageLeft
977 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
981 SetValue(SelectionHandlePressedImageLeftProperty, value);
982 NotifyPropertyChanged();
987 /// The SelectionHandlePressedImageRight property.<br />
988 /// The image to display when the right selection handle is pressed.<br />
989 /// The selectionHandlePressedImageRight map contains the following key :<br />
990 /// <list type="table">
991 /// <item><term>filename (string)</term><description>The path of image file</description></item>
994 /// <since_tizen> 3 </since_tizen>
995 public PropertyMap SelectionHandlePressedImageRight
999 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
1003 SetValue(SelectionHandlePressedImageRightProperty, value);
1004 NotifyPropertyChanged();
1009 /// Set SelectionHandlePressedImage to TextField. <br />
1011 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
1013 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1016 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
1018 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
1019 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
1020 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
1021 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
1024 [EditorBrowsable(EditorBrowsableState.Never)]
1025 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
1027 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
1029 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
1031 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
1035 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
1037 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
1039 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
1045 /// Get SelectionHandlePressedImage from TextField. <br />
1047 /// <returns>The SelectionHandlePressedImage</returns>
1049 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1051 [EditorBrowsable(EditorBrowsableState.Never)]
1052 public SelectionHandleImage GetSelectionHandlePressedImage()
1054 SelectionHandleImage selectionHandleImage;
1055 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
1056 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
1058 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1060 return selectionHandleImage;
1064 /// The SelectionHandleMarkerImageLeft property.<br />
1065 /// The image to display for the left selection handle marker.<br />
1066 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
1067 /// <list type="table">
1068 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1071 /// <since_tizen> 3 </since_tizen>
1072 public PropertyMap SelectionHandleMarkerImageLeft
1076 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1080 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1081 NotifyPropertyChanged();
1086 /// The SelectionHandleMarkerImageRight property.<br />
1087 /// The image to display for the right selection handle marker.<br />
1088 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1089 /// <list type="table">
1090 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1093 /// <since_tizen> 3 </since_tizen>
1094 public PropertyMap SelectionHandleMarkerImageRight
1098 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1102 SetValue(SelectionHandleMarkerImageRightProperty, value);
1103 NotifyPropertyChanged();
1108 /// Set SelectionHandleMarkerImage to TextField. <br />
1110 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1112 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1115 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1117 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1118 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1119 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1120 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1123 [EditorBrowsable(EditorBrowsableState.Never)]
1124 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1126 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1128 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1130 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1134 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1136 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1138 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1144 /// Get SelectionHandleMarkerImage from TextField. <br />
1146 /// <returns>The SelectionHandleMarkerImage</returns>
1148 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1150 [EditorBrowsable(EditorBrowsableState.Never)]
1151 public SelectionHandleImage GetSelectionHandleMarkerImage()
1153 SelectionHandleImage selectionHandleImage;
1154 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1155 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1157 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1159 return selectionHandleImage;
1163 /// The SelectionHighlightColor property.<br />
1164 /// The color of the selection highlight.<br />
1167 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1169 /// <since_tizen> 3 </since_tizen>
1170 public Vector4 SelectionHighlightColor
1174 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1175 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1179 SetValue(SelectionHighlightColorProperty, value);
1180 NotifyPropertyChanged();
1185 /// The DecorationBoundingBox property.<br />
1186 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1189 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1191 /// <since_tizen> 3 </since_tizen>
1192 public Rectangle DecorationBoundingBox
1196 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1197 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1201 SetValue(DecorationBoundingBoxProperty, value);
1202 NotifyPropertyChanged();
1207 /// The InputMethodSettings property.<br />
1208 /// The settings to relating to the System's Input Method, Key and Value.<br />
1211 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
1214 /// The following example demonstrates how to set the InputMethodSettings property.
1216 /// InputMethod method = new InputMethod();
1217 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1218 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1219 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1220 /// method.Variation = 1;
1221 /// textField.InputMethodSettings = method.OutputMap;
1224 /// <since_tizen> 3 </since_tizen>
1225 public PropertyMap InputMethodSettings
1229 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1233 SetValue(InputMethodSettingsProperty, value);
1234 NotifyPropertyChanged();
1239 /// The InputColor property.<br />
1240 /// The color of the new input text.<br />
1243 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1245 /// <since_tizen> 3 </since_tizen>
1246 public Vector4 InputColor
1250 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1251 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1255 SetValue(InputColorProperty, value);
1256 NotifyPropertyChanged();
1261 /// The EnableMarkup property.<br />
1262 /// Whether the mark-up processing is enabled.<br />
1264 /// <since_tizen> 3 </since_tizen>
1265 public bool EnableMarkup
1269 return (bool)GetValue(EnableMarkupProperty);
1273 SetValue(EnableMarkupProperty, value);
1274 NotifyPropertyChanged();
1279 /// The InputFontFamily property.<br />
1280 /// The font's family of the new input text.<br />
1282 /// <since_tizen> 3 </since_tizen>
1283 public string InputFontFamily
1287 return (string)GetValue(InputFontFamilyProperty);
1291 SetValue(InputFontFamilyProperty, value);
1292 NotifyPropertyChanged();
1297 /// The InputFontStyle property.<br />
1298 /// The font's style of the new input text.<br />
1299 /// The inputFontStyle map contains the following keys :<br />
1300 /// <list type="table">
1301 /// <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>
1302 /// <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>
1303 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1306 /// <since_tizen> 3 </since_tizen>
1307 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1308 public PropertyMap InputFontStyle
1312 return (PropertyMap)GetValue(InputFontStyleProperty);
1316 SetValue(InputFontStyleProperty, value);
1317 NotifyPropertyChanged();
1322 /// Set InputFontStyle to TextField. <br />
1324 /// <param name="fontStyle">The FontStyle</param>
1326 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1329 /// The following example demonstrates how to use the SetInputFontStyle method.
1331 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1332 /// fontStyle.Width = FontWidthType.Expanded;
1333 /// fontStyle.Weight = FontWeightType.Bold;
1334 /// fontStyle.Slant = FontSlantType.Italic;
1335 /// field.SetInputFontStyle(fontStyle);
1338 [EditorBrowsable(EditorBrowsableState.Never)]
1339 public void SetInputFontStyle(FontStyle fontStyle)
1341 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1343 SetValue(InputFontStyleProperty, fontStyleMap);
1348 /// Get InputFontStyle from TextField. <br />
1350 /// <returns>The FontStyle</returns>
1352 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1354 [EditorBrowsable(EditorBrowsableState.Never)]
1355 public FontStyle GetInputFontStyle()
1357 FontStyle fontStyle;
1358 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1360 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1366 /// The InputPointSize property.<br />
1367 /// The font's size of the new input text in points.<br />
1369 /// <since_tizen> 3 </since_tizen>
1370 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1371 public float InputPointSize
1375 return (float)GetValue(InputPointSizeProperty);
1379 SetValue(InputPointSizeProperty, value);
1380 NotifyPropertyChanged();
1385 /// The Underline property.<br />
1386 /// The default underline parameters.<br />
1387 /// The underline map contains the following keys :<br />
1388 /// <list type="table">
1389 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1390 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1391 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1394 /// <since_tizen> 3 </since_tizen>
1395 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1396 public PropertyMap Underline
1400 return (PropertyMap)GetValue(UnderlineProperty);
1404 SetValue(UnderlineProperty, value);
1405 NotifyPropertyChanged();
1410 /// Set Underline to TextField. <br />
1412 /// <param name="underline">The Underline</param>
1414 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1417 /// The following example demonstrates how to use the SetUnderline method.
1419 /// var underline = new Tizen.NUI.Text.Underline();
1420 /// underline.Enable = true;
1421 /// underline.Color = new Color("#3498DB");
1422 /// underline.Height = 2.0f;
1423 /// field.SetUnderline(underline);
1426 [EditorBrowsable(EditorBrowsableState.Never)]
1427 public void SetUnderline(Underline underline)
1429 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1431 SetValue(UnderlineProperty, underlineMap);
1436 /// Get Underline from TextField. <br />
1438 /// <returns>The Underline</returns>
1440 /// <see cref="Tizen.NUI.Text.Underline"/>
1442 [EditorBrowsable(EditorBrowsableState.Never)]
1443 public Underline GetUnderline()
1445 Underline underline;
1446 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1448 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1454 /// The InputUnderline property.<br />
1455 /// The underline parameters of the new input text.<br />
1457 /// <since_tizen> 3 </since_tizen>
1458 public string InputUnderline
1462 return (string)GetValue(InputUnderlineProperty);
1466 SetValue(InputUnderlineProperty, value);
1467 NotifyPropertyChanged();
1472 /// The Shadow property.<br />
1473 /// The default shadow parameters.<br />
1474 /// The shadow map contains the following keys :<br />
1475 /// <list type="table">
1476 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1477 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1478 /// <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>
1481 /// <since_tizen> 3 </since_tizen>
1482 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1483 public PropertyMap Shadow
1487 return (PropertyMap)GetValue(ShadowProperty);
1491 SetValue(ShadowProperty, value);
1492 NotifyPropertyChanged();
1497 /// Set Shadow to TextField. <br />
1499 /// <param name="shadow">The Shadow</param>
1501 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1504 /// The following example demonstrates how to use the SetShadow method.
1506 /// var shadow = new Tizen.NUI.Text.Shadow();
1507 /// shadow.Offset = new Vector2(3, 3);
1508 /// shadow.Color = new Color("#F1C40F");
1509 /// field.SetShadow(shadow);
1512 [EditorBrowsable(EditorBrowsableState.Never)]
1513 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1515 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1517 SetValue(ShadowProperty, shadowMap);
1522 /// Get Shadow from TextField. <br />
1524 /// <returns>The Shadow</returns>
1526 /// <see cref="Tizen.NUI.Text.Shadow"/>
1528 [EditorBrowsable(EditorBrowsableState.Never)]
1529 public Tizen.NUI.Text.Shadow GetShadow()
1531 Tizen.NUI.Text.Shadow shadow;
1532 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1534 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1540 /// The InputShadow property.<br />
1541 /// The shadow parameters of the new input text.<br />
1543 /// <since_tizen> 3 </since_tizen>
1544 public string InputShadow
1548 return (string)GetValue(InputShadowProperty);
1552 SetValue(InputShadowProperty, value);
1553 NotifyPropertyChanged();
1558 /// The Emboss property.<br />
1559 /// The default emboss parameters.<br />
1561 /// <since_tizen> 3 </since_tizen>
1562 public string Emboss
1566 return (string)GetValue(EmbossProperty);
1570 SetValue(EmbossProperty, value);
1571 NotifyPropertyChanged();
1576 /// The InputEmboss property.<br />
1577 /// The emboss parameters of the new input text.<br />
1579 /// <since_tizen> 3 </since_tizen>
1580 public string InputEmboss
1584 return (string)GetValue(InputEmbossProperty);
1588 SetValue(InputEmbossProperty, value);
1589 NotifyPropertyChanged();
1594 /// The Outline property.<br />
1595 /// The default outline parameters.<br />
1596 /// The outline map contains the following keys :<br />
1597 /// <list type="table">
1598 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1599 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1602 /// <since_tizen> 3 </since_tizen>
1603 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1604 public PropertyMap Outline
1608 return (PropertyMap)GetValue(OutlineProperty);
1612 SetValue(OutlineProperty, value);
1613 NotifyPropertyChanged();
1618 /// Set Outline to TextField. <br />
1620 /// <param name="outline">The Outline</param>
1622 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1625 /// The following example demonstrates how to use the SetOutline method.
1627 /// var outline = new Tizen.NUI.Text.Outline();
1628 /// outline.Width = 2.0f;
1629 /// outline.Color = new Color("#45B39D");
1630 /// field.SetOutline(outline);
1633 [EditorBrowsable(EditorBrowsableState.Never)]
1634 public void SetOutline(Outline outline)
1636 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1638 SetValue(OutlineProperty, outlineMap);
1643 /// Get Outline from TextField. <br />
1645 /// <returns>The Outline</returns>
1647 /// <see cref="Tizen.NUI.Text.Outline"/>
1649 [EditorBrowsable(EditorBrowsableState.Never)]
1650 public Outline GetOutline()
1653 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1655 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1661 /// The InputOutline property.<br />
1662 /// The outline parameters of the new input text.<br />
1664 /// <since_tizen> 3 </since_tizen>
1665 public string InputOutline
1669 return (string)GetValue(InputOutlineProperty);
1673 SetValue(InputOutlineProperty, value);
1674 NotifyPropertyChanged();
1679 /// The HiddenInputSettings property.<br />
1680 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1681 /// The hiddenInputSettings map contains the following keys :<br />
1682 /// <list type="table">
1683 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1684 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1685 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1686 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1690 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1693 /// The following example demonstrates how to set the HiddenInputSettings property.
1695 /// PropertyMap map = new PropertyMap();
1696 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1697 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1698 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1699 /// textField.HiddenInputSettings = map;
1702 /// <since_tizen> 3 </since_tizen>
1703 public Tizen.NUI.PropertyMap HiddenInputSettings
1707 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1711 SetValue(HiddenInputSettingsProperty, value);
1712 NotifyPropertyChanged();
1717 /// Set HiddenInput to TextField. <br />
1719 /// <param name="hiddenInput">The HiddenInput</param>
1721 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1724 /// The following example demonstrates how to use the SetHiddenInput method.
1726 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1727 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1728 /// hiddenInput.SubstituteCharacter = '★';
1729 /// hiddenInput.SubstituteCount = 0;
1730 /// hiddenInput.ShowLastCharacterDuration = 1000;
1731 /// field.SetHiddenInput(hiddenInput);
1734 [EditorBrowsable(EditorBrowsableState.Never)]
1735 public void SetHiddenInput(HiddenInput hiddenInput)
1737 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1739 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1744 /// Get HiddenInput from TextField. <br />
1746 /// <returns>The HiddenInput</returns>
1748 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1750 [EditorBrowsable(EditorBrowsableState.Never)]
1751 public HiddenInput GetHiddenInput()
1753 HiddenInput hiddenInput;
1754 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1756 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1762 /// The PixelSize property.<br />
1763 /// The size of font in pixels.<br />
1765 /// <since_tizen> 3 </since_tizen>
1766 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1767 public float PixelSize
1771 return (float)GetValue(PixelSizeProperty);
1775 SetValue(PixelSizeProperty, value);
1776 NotifyPropertyChanged();
1781 /// The Enable selection property.<br />
1782 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1784 /// <since_tizen> 3 </since_tizen>
1785 public bool EnableSelection
1789 return (bool)GetValue(EnableSelectionProperty);
1793 SetValue(EnableSelectionProperty, value);
1794 NotifyPropertyChanged();
1799 /// The Enable grab handle property.<br />
1800 /// Enables the grab handles for text selection.<br />
1801 /// The default value is true, which means the grab handles are enabled by default.<br />
1803 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1804 [EditorBrowsable(EditorBrowsableState.Never)]
1805 public bool EnableGrabHandle
1809 return (bool)GetValue(EnableGrabHandleProperty);
1813 SetValue(EnableGrabHandleProperty, value);
1814 NotifyPropertyChanged();
1819 /// The Enable grab handle popup property.<br />
1820 /// Enables the grab handle popup for text selection.<br />
1821 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1823 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1824 [EditorBrowsable(EditorBrowsableState.Never)]
1825 public bool EnableGrabHandlePopup
1829 return (bool)GetValue(EnableGrabHandlePopupProperty);
1833 SetValue(EnableGrabHandlePopupProperty, value);
1834 NotifyPropertyChanged();
1839 /// The portion of the text that has been selected by the user.
1842 /// Empty string when nothing is selected.
1844 /// <since_tizen> 9 </since_tizen>
1845 public string SelectedText
1849 string selectedText;
1850 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1852 propertyValue.Get(out selectedText);
1854 return selectedText;
1859 /// The start index for selection.
1862 /// When there is no selection, the index is current cursor position.
1864 /// <since_tizen> 9 </since_tizen>
1865 public int SelectedTextStart
1869 int selectedTextStart;
1870 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1872 propertyValue.Get(out selectedTextStart);
1874 return selectedTextStart;
1879 /// The end index for selection.
1882 /// When there is no selection, the index is current cursor position.
1884 /// <since_tizen> 9 </since_tizen>
1885 public int SelectedTextEnd
1889 int selectedTextEnd;
1890 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1892 propertyValue.Get(out selectedTextEnd);
1894 return selectedTextEnd;
1899 /// Enable editing in text control.
1901 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1902 [EditorBrowsable(EditorBrowsableState.Never)]
1903 public bool EnableEditing
1907 return (bool)GetValue(EnableEditingProperty);
1911 SetValue(EnableEditingProperty, value);
1915 private bool InternalEnableEditing
1920 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1922 propertyValue.Get(out enableEditing);
1924 return enableEditing;
1928 using (var propertyValue = new PropertyValue(value))
1930 SetProperty(TextField.Property.EnableEditing, propertyValue);
1931 NotifyPropertyChanged();
1937 /// PrimaryCursorPosition property.<br />
1938 /// Specify the position of the primary cursor (caret) in text control.
1941 /// If the value set is out of range (negative or greater than or equal the number of characters in Text) then the PrimaryCursorPosition is moved to the end of Text (the number of characters in Text).
1943 /// <since_tizen> 10 </since_tizen>
1944 public int PrimaryCursorPosition
1948 return (int)GetValue(PrimaryCursorPositionProperty);
1952 SetValue(PrimaryCursorPositionProperty, value);
1956 private int InternalPrimaryCursorPosition
1960 int primaryCursorPosition;
1961 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1963 propertyValue.Get(out primaryCursorPosition);
1965 return primaryCursorPosition;
1969 using (PropertyValue propertyValue = new PropertyValue(value))
1971 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1972 NotifyPropertyChanged();
1978 /// The GrabHandleColor property.
1981 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1983 [EditorBrowsable(EditorBrowsableState.Never)]
1984 public Color GrabHandleColor
1988 Color temp = (Color)GetValue(GrabHandleColorProperty);
1989 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1993 SetValue(GrabHandleColorProperty, value);
1994 NotifyPropertyChanged();
1999 /// The ellipsis position of the text.
2000 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2002 /// <since_tizen> 9 </since_tizen>
2003 public EllipsisPosition EllipsisPosition
2007 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2011 SetValue(EllipsisPositionProperty, value);
2012 NotifyPropertyChanged();
2017 /// The spaces between characters in Pixels.
2019 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2020 /// The default value is 0.f which does nothing.
2023 [EditorBrowsable(EditorBrowsableState.Never)]
2024 public float CharacterSpacing
2028 return (float)GetValue(CharacterSpacingProperty);
2032 SetValue(CharacterSpacingProperty, value);
2033 NotifyPropertyChanged();
2038 /// Set InputFilter to TextField.
2040 /// <param name="inputFilter">The InputFilter</param>
2042 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
2043 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
2044 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
2047 /// The following example demonstrates how to use the SetInputFilter method.
2049 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
2050 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
2051 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
2052 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
2055 /// <since_tizen> 9 </since_tizen>
2056 public void SetInputFilter(InputFilter inputFilter)
2058 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
2059 using (var propertyValue = new PropertyValue(map))
2061 SetProperty(TextField.Property.InputFilter, propertyValue);
2066 /// Get InputFilter from TextField.
2068 /// <returns>The InputFilter</returns>
2070 /// <see cref="Tizen.NUI.Text.InputFilter"/>
2072 /// <since_tizen> 9 </since_tizen>
2073 public InputFilter GetInputFilter()
2075 InputFilter inputFilter;
2076 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
2077 using (var map = new PropertyMap())
2079 propertyValue.Get(map);
2080 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2086 /// Set Strikethrough to TextField. <br />
2088 /// <param name="strikethrough">The Strikethrough</param>
2090 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2093 /// The following example demonstrates how to use the SetStrikethrough method.
2095 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2096 /// strikethrough.Enable = true;
2097 /// strikethrough.Color = new Color("#3498DB");
2098 /// strikethrough.Height = 2.0f;
2099 /// field.SetStrikethrough(strikethrough);
2102 [EditorBrowsable(EditorBrowsableState.Never)]
2103 public void SetStrikethrough(Strikethrough strikethrough)
2105 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2106 using (var propertyValue = new PropertyValue(map))
2108 SetProperty(TextField.Property.Strikethrough, propertyValue);
2113 /// Get Strikethrough from TextField. <br />
2115 /// <returns>The Strikethrough</returns>
2117 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2119 [EditorBrowsable(EditorBrowsableState.Never)]
2120 public Strikethrough GetStrikethrough()
2122 Strikethrough strikethrough;
2123 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2124 using (var map = new PropertyMap())
2126 propertyValue.Get(map);
2127 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2129 return strikethrough;
2133 /// The Placeholder property.
2134 /// The placeholder map contains the following keys :<br />
2135 /// <list type="table">
2136 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2137 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2138 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2139 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2140 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2141 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2142 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2143 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2147 /// The following example demonstrates how to set the Placeholder property.
2149 /// PropertyMap propertyMap = new PropertyMap();
2150 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2151 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2152 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2153 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2154 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2156 /// PropertyMap fontStyleMap = new PropertyMap();
2157 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2158 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2159 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2160 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2162 /// TextField field = new TextField();
2163 /// field.Placeholder = propertyMap;
2166 /// <since_tizen> 3 </since_tizen>
2167 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2168 public Tizen.NUI.PropertyMap Placeholder
2172 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2173 string defalutText = "";
2175 if (TextMapHelper.IsValue(map, 0))
2176 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2178 if (TextMapHelper.IsValue(map, 1))
2179 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2181 if (TextMapHelper.IsValue(map, 2))
2183 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2185 map.Add("color", color);
2189 if (TextMapHelper.IsValue(map, 3))
2190 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2192 if (TextMapHelper.IsValue(map, 4))
2194 using (var properyValue = map.Find(4))
2195 using (var fontStyle = new PropertyMap())
2197 properyValue.Get(fontStyle);
2198 using (var fontStyleValue = new PropertyValue(fontStyle))
2200 map.Add("fontStyle", fontStyleValue);
2205 if (TextMapHelper.IsValue(map, 5))
2206 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2208 if (TextMapHelper.IsValue(map, 6))
2209 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2211 if (TextMapHelper.IsValue(map, 7))
2212 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2218 SetValue(PlaceholderProperty, value);
2219 NotifyPropertyChanged();
2224 /// Set Placeholder to TextField. <br />
2226 /// <param name="placeholder">The Placeholder</param>
2228 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2231 /// The following example demonstrates how to use the SetPlaceholder method.
2233 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2234 /// placeholder.Text = "placeholder text";
2235 /// placeholder.TextFocused = "placeholder textFocused";
2236 /// placeholder.Color = new Color("#45B39D");
2237 /// placeholder.FontFamily = "BreezeSans";
2238 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2240 /// Width = FontWidthType.Expanded,
2241 /// Weight = FontWeightType.ExtraLight,
2242 /// Slant = FontSlantType.Italic,
2244 /// placeholder.PointSize = 25.0f;
2245 /// //placeholder.PixelSize = 50.0f;
2246 /// placeholder.Ellipsis = true;
2247 /// field.SetPlaceholder(placeholder);
2250 [EditorBrowsable(EditorBrowsableState.Never)]
2251 public void SetPlaceholder(Placeholder placeholder)
2253 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2255 SetValue(PlaceholderProperty, placeholderMap);
2260 /// Get Placeholder from TextField. <br />
2262 /// <returns>The Placeholder</returns>
2264 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2266 [EditorBrowsable(EditorBrowsableState.Never)]
2267 public Placeholder GetPlaceholder()
2269 Placeholder placeholder;
2270 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2272 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2278 /// The Ellipsis property.<br />
2279 /// Enable or disable the ellipsis.<br />
2280 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2282 /// <since_tizen> 4 </since_tizen>
2283 public bool Ellipsis
2287 return (bool)GetValue(EllipsisProperty);
2291 SetValue(EllipsisProperty, value);
2292 NotifyPropertyChanged();
2297 /// Enables selection of the text using the Shift key.
2299 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2300 [EditorBrowsable(EditorBrowsableState.Never)]
2301 public bool EnableShiftSelection
2305 return (bool)GetValue(EnableShiftSelectionProperty);
2309 SetValue(EnableShiftSelectionProperty, value);
2310 NotifyPropertyChanged();
2315 /// The text alignment to match the direction of the system language.<br />
2316 /// The default value is true.<br />
2318 /// <since_tizen> 6 </since_tizen>
2319 public bool MatchSystemLanguageDirection
2323 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2327 SetValue(MatchSystemLanguageDirectionProperty, value);
2328 NotifyPropertyChanged();
2333 /// The FontSizeScale property. <br />
2334 /// The default value is 1.0. <br />
2335 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2336 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2338 /// <since_tizen> 9 </since_tizen>
2339 public float FontSizeScale
2343 return (float)GetValue(FontSizeScaleProperty);
2347 SetValue(FontSizeScaleProperty, value);
2348 NotifyPropertyChanged();
2352 private float InternalFontSizeScale
2356 return fontSizeScale;
2360 float newFontSizeScale;
2362 if (fontSizeScale == value) return;
2364 fontSizeScale = value;
2365 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2367 SystemSettingsFontSize systemSettingsFontSize;
2371 systemSettingsFontSize = SystemSettings.FontSize;
2375 Console.WriteLine("{0} Exception caught.", e);
2376 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2378 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2379 AddSystemSettingsFontSizeChanged();
2383 newFontSizeScale = fontSizeScale;
2384 RemoveSystemSettingsFontSizeChanged();
2387 SetInternalFontSizeScale(newFontSizeScale);
2391 private void SetInternalFontSizeScale(float fontSizeScale)
2394 Object.InternalSetPropertyFloat(this.SwigCPtr, TextField.Property.FontSizeScale, (float)fontSizeScale);
2398 /// The EnableFontSizeScale property.<br />
2399 /// Whether the font size scale is enabled. (The default value is true)
2401 [EditorBrowsable(EditorBrowsableState.Never)]
2402 public bool EnableFontSizeScale
2406 return (bool)GetValue(EnableFontSizeScaleProperty);
2410 SetValue(EnableFontSizeScaleProperty, value);
2411 NotifyPropertyChanged();
2416 /// Get the InputMethodContext instance.
2418 /// <returns>The InputMethodContext instance.</returns>
2419 /// <since_tizen> 5 </since_tizen>
2420 public InputMethodContext GetInputMethodContext()
2422 if (inputMethodCotext == null)
2424 /*Avoid raising InputMethodContext reference count.*/
2425 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2426 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2428 return inputMethodCotext;
2432 /// Select the whole text.
2434 /// <since_tizen> 9 </since_tizen>
2435 public void SelectWholeText()
2437 Interop.TextField.SelectWholeText(SwigCPtr);
2438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2442 /// Select text from start to end index. <br />
2443 /// The index is valid when 0 or positive.
2445 /// <param name="start">The start index for selection.</param>
2446 /// <param name="end">The end index for selection.</param>
2448 /// If the end index exceeds the maximum value, it is set to the length of the text.
2450 /// <since_tizen> 9 </since_tizen>
2451 public void SelectText(int start, int end)
2454 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2456 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2458 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2463 /// Clear selection of the text. <br />
2464 /// Valid when selection is activate.
2466 /// <since_tizen> 9 </since_tizen>
2467 public void SelectNone()
2469 _ = Interop.TextField.SelectNone(SwigCPtr);
2470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2473 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2475 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));
2476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2483 /// <since_tizen> 3 </since_tizen>
2484 protected override void Dispose(DisposeTypes type)
2488 DisposeQueue.Instance.Add(this);
2493 internalPlaceholderTextColor?.Dispose();
2494 internalPrimaryCursorColor?.Dispose();
2495 internalSecondaryCursorColor?.Dispose();
2496 internalSelectionHighlightColor?.Dispose();
2497 internalInputColor?.Dispose();
2498 internalTextColor?.Dispose();
2499 internalGrabHandleColor?.Dispose();
2501 if (hasSystemLanguageChanged)
2503 SystemSettings.LocaleLanguageChanged -= SystemSettingsLocaleLanguageChanged;
2506 RemoveSystemSettingsFontTypeChanged();
2507 RemoveSystemSettingsFontSizeChanged();
2509 if (type == DisposeTypes.Explicit)
2512 //Release your own managed resources here.
2513 //You should release all of your own disposable objects here.
2516 //Release your own unmanaged resources here.
2517 //You should not access any managed member here except static instance.
2518 //because the execution order of Finalizes is non-deterministic.
2521 if (textFieldCursorPositionChangedCallbackDelegate != null)
2523 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2526 if (textFieldMaxLengthReachedCallbackDelegate != null)
2528 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2531 if (textFieldSelectionStartedCallbackDelegate != null)
2533 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2536 if (textFieldSelectionClearedCallbackDelegate != null)
2538 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2541 if (textFieldSelectionChangedCallbackDelegate != null)
2543 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2546 if (textFieldTextChangedCallbackDelegate != null)
2548 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2552 TextChanged -= TextFieldTextChanged;
2553 GetInputMethodContext()?.DestroyContext();
2558 /// This will not be public opened.
2559 [EditorBrowsable(EditorBrowsableState.Never)]
2560 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2562 Interop.TextField.DeleteTextField(swigCPtr);
2565 internal override LayoutItem CreateDefaultLayout()
2567 return new TextFieldLayout();
2570 internal void SetTextWithoutTextChanged(string text)
2572 invokeTextChanged = false;
2573 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2574 invokeTextChanged = true;
2577 private string SetTranslatable(string textFieldSid)
2579 string translatableText = null;
2580 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2581 if (translatableText != null)
2583 if (hasSystemLanguageChanged == false)
2585 SystemSettings.LocaleLanguageChanged += SystemSettingsLocaleLanguageChanged;
2586 hasSystemLanguageChanged = true;
2588 return translatableText;
2592 translatableText = "";
2593 return translatableText;
2597 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2599 if (textFieldTextSid != null)
2601 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2603 if (textFieldPlaceHolderTextSid != null)
2605 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2607 if (textFieldPlaceHolderTextFocusedSid != null)
2609 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2613 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2615 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2616 SetInternalFontSizeScale(newFontSizeScale);
2619 private void AddSystemSettingsFontSizeChanged()
2621 if (hasSystemFontSizeChanged != true)
2625 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2626 hasSystemFontSizeChanged = true;
2630 Console.WriteLine("{0} Exception caught.", e);
2631 hasSystemFontSizeChanged = false;
2636 private void RemoveSystemSettingsFontSizeChanged()
2638 if (hasSystemFontSizeChanged == true)
2642 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2643 hasSystemFontSizeChanged = false;
2647 Console.WriteLine("{0} Exception caught.", e);
2648 hasSystemFontSizeChanged = true;
2653 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2655 SetInternalFontFamily(e.Value);
2658 private void AddSystemSettingsFontTypeChanged()
2660 if (HasStyle() && !hasSystemFontTypeChanged)
2664 SystemSettings.FontTypeChanged += SystemSettingsFontTypeChanged;
2665 hasSystemFontTypeChanged = true;
2669 Console.WriteLine("{0} Exception caught.", e);
2670 hasSystemFontTypeChanged = false;
2675 private void RemoveSystemSettingsFontTypeChanged()
2677 if (hasSystemFontTypeChanged)
2681 SystemSettings.FontTypeChanged -= SystemSettingsFontTypeChanged;
2682 hasSystemFontTypeChanged = false;
2686 Console.WriteLine("{0} Exception caught.", e);
2687 hasSystemFontTypeChanged = true;
2692 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2694 if (!isSettingTextInCSharp)
2696 EnforceNotifyBindedInstance(TextProperty);
2700 internal new class Property
2702 internal static readonly int TEXT = Interop.TextField.TextGet();
2703 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2704 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2705 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2706 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2707 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2708 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2709 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2710 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2711 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2712 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2713 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2714 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2715 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2716 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2717 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2718 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2719 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2720 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2721 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2722 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2723 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2724 internal static readonly int SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet();
2725 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2726 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2727 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2728 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2729 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2730 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2731 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2732 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2733 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2734 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2735 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2736 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2737 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2738 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2739 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2740 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2741 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2742 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2743 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2744 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2745 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2746 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2747 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2748 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2749 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2750 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2751 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2752 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2753 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2754 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2755 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2756 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2757 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2758 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2759 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2760 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2761 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2762 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2763 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2764 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2765 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2766 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2767 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2770 internal class InputStyle
2776 FontFamily = 0x0002,
2786 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2788 DecorationBoundingBox = new Rectangle(x, y, width, height);
2790 private void OnInputColorChanged(float x, float y, float z, float w)
2792 InputColor = new Vector4(x, y, z, w);
2794 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2796 PlaceholderTextColor = new Vector4(r, g, b, a);
2798 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2800 PrimaryCursorColor = new Vector4(x, y, z, w);
2802 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2804 SecondaryCursorColor = new Vector4(x, y, z, w);
2806 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2808 SelectionHighlightColor = new Vector4(x, y, z, w);
2810 private void OnShadowColorChanged(float x, float y, float z, float w)
2812 ShadowColor = new Vector4(x, y, z, w);
2814 private void OnShadowOffsetChanged(float x, float y)
2816 ShadowOffset = new Vector2(x, y);
2818 private void OnTextColorChanged(float r, float g, float b, float a)
2820 TextColor = new Color(r, g, b, a);
2822 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2824 GrabHandleColor = new Color(r, g, b, a);
2827 private class TextFieldLayout : LayoutItem
2829 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2831 // Padding will be automatically applied by DALi TextField.
2832 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2833 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2834 var minSize = Owner.MinimumSize;
2835 var maxSize = Owner.MaximumSize;
2836 var naturalSize = Owner.GetNaturalSize();
2838 if (((TextField)Owner).Text.Length == 0)
2840 // Calculate height of TextField by setting Text with " ".
2841 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2842 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2844 // Store original WidthSpecification to restore it after setting ResizePolicy.
2845 var widthSpecification = Owner.WidthSpecification;
2847 // In DALi's Size logic, if Width or Height is set to be 0, then
2848 // ResizePolicy is not changed to Fixed.
2849 // This causes Size changes after NUI Layout's OnMeasure is finished.
2850 // e.g. TextField's Width fills to its parent although Text is null and
2851 // WidthSpecification is WrapContent.
2852 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2853 // in advance if Text is null.
2854 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2856 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2857 Owner.WidthSpecification = widthSpecification;
2859 naturalSize = Owner.GetNaturalSize();
2861 // Restore TextField's Text after calculating height of TextField.
2862 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2863 ((TextField)Owner).SetTextWithoutTextChanged("");
2866 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2868 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2871 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2873 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2876 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2877 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2879 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2880 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2882 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2883 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));