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 static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
37 private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
38 private string textFieldTextSid = null;
39 private string textFieldPlaceHolderTextSid = null;
40 private string textFieldPlaceHolderTextFocusedSid = null;
41 private InputMethodContext inputMethodCotext = null;
42 private string fontFamily = defaultFontFamily;
43 private float fontSizeScale = 1.0f;
44 private bool hasSystemLanguageChanged = false;
45 private bool hasSystemFontSizeChanged = false;
46 private bool hasSystemFontTypeChanged = false;
47 private bool isSettingTextInCSharp = false;
49 private Vector4 internalPlaceholderTextColor = null;
50 private Vector4 internalPrimaryCursorColor = null;
51 private Vector4 internalSecondaryCursorColor = null;
52 private Vector4 internalSelectionHighlightColor = null;
53 private Vector4 internalInputColor = null;
54 private Color internalTextColor = null;
55 private Color internalGrabHandleColor = null;
58 static TextField() { }
61 /// Creates the TextField control.
63 /// <since_tizen> 3 </since_tizen>
64 public TextField() : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
66 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70 /// Creates the TextField with setting the status of shown or hidden.
72 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
73 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public TextField(bool shown) : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82 /// Get attributes, it is abstract function and must be override.
84 [EditorBrowsable(EditorBrowsableState.Never)]
85 protected override ViewStyle CreateViewStyle()
87 return new TextFieldStyle();
90 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
97 TextChanged += TextFieldTextChanged;
100 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
107 TextChanged += TextFieldTextChanged;
110 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 internal enum ExceedPolicyType
117 ExceedPolicyOriginal,
121 private bool HasStyle()
123 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
127 /// The TranslatableText property.<br />
128 /// The text can set the SID value.<br />
130 /// <exception cref='ArgumentNullException'>
131 /// ResourceManager about multilingual is null.
133 /// <since_tizen> 4 </since_tizen>
134 public string TranslatableText
138 return (string)GetValue(TranslatableTextProperty);
142 SetValue(TranslatableTextProperty, value);
145 private string translatableText
149 return textFieldTextSid;
153 if (NUIApplication.MultilingualResourceManager == null)
155 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
157 textFieldTextSid = value;
158 Text = SetTranslatable(textFieldTextSid);
159 NotifyPropertyChanged();
164 /// The TranslatablePlaceholderText property.<br />
165 /// The text can set the SID value.<br />
167 /// <exception cref='ArgumentNullException'>
168 /// ResourceManager about multilingual is null.
170 /// <since_tizen> 4 </since_tizen>
171 public string TranslatablePlaceholderText
175 return (string)GetValue(TranslatablePlaceholderTextProperty);
179 SetValue(TranslatablePlaceholderTextProperty, value);
182 private string translatablePlaceholderText
186 return textFieldPlaceHolderTextSid;
190 if (NUIApplication.MultilingualResourceManager == null)
192 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
194 textFieldPlaceHolderTextSid = value;
195 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
196 NotifyPropertyChanged();
201 /// The TranslatablePlaceholderTextFocused property.<br />
202 /// The text can set the SID value.<br />
204 /// <exception cref='ArgumentNullException'>
205 /// ResourceManager about multilingual is null.
207 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public string TranslatablePlaceholderTextFocused
213 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
217 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
220 private string translatablePlaceholderTextFocused
224 return textFieldPlaceHolderTextFocusedSid;
228 if (NUIApplication.MultilingualResourceManager == null)
230 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
232 textFieldPlaceHolderTextFocusedSid = value;
233 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
234 NotifyPropertyChanged();
239 /// The Text property.<br />
240 /// The text to display in the UTF-8 format.<br />
242 /// <since_tizen> 3 </since_tizen>
247 return (string)GetValue(TextProperty);
251 SetValue(TextProperty, value);
252 NotifyPropertyChanged();
257 /// The PlaceholderText property.<br />
258 /// The text to display when the TextField is empty and inactive. <br />
260 /// <since_tizen> 3 </since_tizen>
261 public string PlaceholderText
265 return (string)GetValue(PlaceholderTextProperty);
269 SetValue(PlaceholderTextProperty, value);
270 NotifyPropertyChanged();
275 /// The PlaceholderTextFocused property. <br />
276 /// The text to display when the TextField is empty with input focus. <br />
278 /// <since_tizen> 3 </since_tizen>
279 public string PlaceholderTextFocused
283 return (string)GetValue(PlaceholderTextFocusedProperty);
287 SetValue(PlaceholderTextFocusedProperty, value);
288 NotifyPropertyChanged();
293 /// The FontFamily property.<br />
294 /// The requested font family to use.<br />
296 /// <since_tizen> 3 </since_tizen>
297 public string FontFamily
301 return (string)GetValue(FontFamilyProperty);
305 SetValue(FontFamilyProperty, value);
306 NotifyPropertyChanged();
310 private string InternalFontFamily
317 return Object.InternalGetPropertyString(this.SwigCPtr, TextField.Property.FontFamily);
321 string newFontFamily;
323 if (string.Equals(fontFamily, value)) return;
326 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
330 newFontFamily = SystemSettings.FontType;
334 Console.WriteLine("{0} Exception caught.", e);
335 newFontFamily = defaultFontFamily;
337 AddSystemSettingsFontTypeChanged();
341 newFontFamily = fontFamily;
342 RemoveSystemSettingsFontTypeChanged();
345 SetInternalFontFamily(newFontFamily);
349 private void SetInternalFontFamily(string fontFamily)
351 Object.InternalSetPropertyString(this.SwigCPtr, TextField.Property.FontFamily, (string)fontFamily);
355 /// The FontStyle property.<br />
356 /// The requested font style to use.<br />
357 /// The fontStyle map contains the following keys :<br />
358 /// <list type="table">
359 /// <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>
360 /// <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>
361 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
364 /// <since_tizen> 3 </since_tizen>
365 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
366 public PropertyMap FontStyle
370 return (PropertyMap)GetValue(FontStyleProperty);
374 SetValue(FontStyleProperty, value);
375 NotifyPropertyChanged();
380 /// Set FontStyle to TextField. <br />
382 /// <param name="fontStyle">The FontStyle</param>
384 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
387 /// The following example demonstrates how to use the SetFontStyle method.
389 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
390 /// fontStyle.Width = FontWidthType.Expanded;
391 /// fontStyle.Weight = FontWeightType.Bold;
392 /// fontStyle.Slant = FontSlantType.Italic;
393 /// field.SetFontStyle(fontStyle);
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 public void SetFontStyle(FontStyle fontStyle)
399 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
401 SetValue(FontStyleProperty, fontStyleMap);
406 /// Get FontStyle from TextField. <br />
408 /// <returns>The FontStyle</returns>
410 /// <see cref="Tizen.NUI.Text.FontStyle"/>
412 [EditorBrowsable(EditorBrowsableState.Never)]
413 public FontStyle GetFontStyle()
416 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
418 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
424 /// The PointSize property.<br />
425 /// The size of font in points.<br />
427 /// <since_tizen> 3 </since_tizen>
428 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
429 public float PointSize
433 return (float)GetValue(PointSizeProperty);
437 SetValue(PointSizeProperty, value);
438 NotifyPropertyChanged();
443 /// The MaxLength property.<br />
444 /// The maximum number of characters that can be inserted.<br />
446 /// <since_tizen> 3 </since_tizen>
451 return (int)GetValue(MaxLengthProperty);
455 SetValue(MaxLengthProperty, value);
456 NotifyPropertyChanged();
461 /// The ExceedPolicy property.<br />
462 /// Specifies how the text is truncated when it does not fit.<br />
464 /// <since_tizen> 3 </since_tizen>
465 public int ExceedPolicy
469 return (int)GetValue(ExceedPolicyProperty);
473 SetValue(ExceedPolicyProperty, value);
474 NotifyPropertyChanged();
479 /// The HorizontalAlignment property.<br />
480 /// The line horizontal alignment.<br />
482 /// <since_tizen> 3 </since_tizen>
483 public HorizontalAlignment HorizontalAlignment
487 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
491 SetValue(HorizontalAlignmentProperty, value);
492 NotifyPropertyChanged();
497 /// The VerticalAlignment property.<br />
498 /// The line vertical alignment.<br />
500 /// <since_tizen> 3 </since_tizen>
501 public VerticalAlignment VerticalAlignment
505 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
509 SetValue(VerticalAlignmentProperty, value);
510 NotifyPropertyChanged();
511 NotifyPropertyChanged();
516 /// The TextColor property.<br />
517 /// The color of the text.<br />
520 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
522 /// <since_tizen> 3 </since_tizen>
523 public Color TextColor
527 Color temp = (Color)GetValue(TextColorProperty);
528 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
532 SetValue(TextColorProperty, value);
533 NotifyPropertyChanged();
538 /// The PlaceholderTextColor property.
541 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
543 /// <since_tizen> 3 </since_tizen>
544 public Vector4 PlaceholderTextColor
548 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
549 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
553 SetValue(PlaceholderTextColorProperty, value);
554 NotifyPropertyChanged();
559 /// The ShadowOffset property.
561 /// <since_tizen> 3 </since_tizen>
563 /// Deprecated.(API Level 6) Use Shadow instead.
564 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
566 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
567 public Vector2 ShadowOffset
571 return GetValue(ShadowOffsetProperty) as Vector2;
575 SetValue(ShadowOffsetProperty, value);
579 private Vector2 InternalShadowOffset
583 float x = 0.0f, y = 0.0f;
584 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
585 using (var shadowOffset = new Vector2())
587 if (null != propertyValue)
589 propertyValue.Get(shadowOffset);
594 return new Vector2(OnShadowOffsetChanged, x, y);
598 using (var map = new PropertyMap())
600 map.Add("offset", value);
601 var shadowMap = Shadow;
602 shadowMap.Merge(map);
603 SetValue(ShadowProperty, shadowMap);
604 NotifyPropertyChanged();
610 /// The ShadowColor property.
612 /// <since_tizen> 3 </since_tizen>
614 /// Deprecated.(API Level 6) Use Shadow instead.
615 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
617 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
618 public Vector4 ShadowColor
622 return GetValue(ShadowColorProperty) as Vector4;
626 SetValue(ShadowColorProperty, value);
630 private Vector4 InternalShadowColor
634 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
635 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
636 using (var shadowColor = new Vector4())
638 if (null != propertyValue)
640 propertyValue.Get(shadowColor);
647 return new Vector4(OnShadowColorChanged, x, y, z, w);
651 using (var map = new PropertyMap())
653 map.Add("color", value);
654 var shadowMap = Shadow;
655 shadowMap.Merge(map);
656 SetValue(ShadowProperty, shadowMap);
657 NotifyPropertyChanged();
663 /// The PrimaryCursorColor property.<br />
664 /// The color to apply to the primary cursor.<br />
667 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
669 /// <since_tizen> 3 </since_tizen>
670 public Vector4 PrimaryCursorColor
674 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
675 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
679 SetValue(PrimaryCursorColorProperty, value);
680 NotifyPropertyChanged();
685 /// The SecondaryCursorColor property.<br />
686 /// The color to apply to the secondary cursor.<br />
689 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
691 /// <since_tizen> 3 </since_tizen>
692 public Vector4 SecondaryCursorColor
696 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
697 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
701 SetValue(SecondaryCursorColorProperty, value);
702 NotifyPropertyChanged();
707 /// The EnableCursorBlink property.<br />
708 /// Whether the cursor should blink or not.<br />
710 /// <since_tizen> 3 </since_tizen>
711 public bool EnableCursorBlink
715 return (bool)GetValue(EnableCursorBlinkProperty);
719 SetValue(EnableCursorBlinkProperty, value);
720 NotifyPropertyChanged();
725 /// The CursorBlinkInterval property.<br />
726 /// The time interval in seconds between cursor on/off states.<br />
728 /// <since_tizen> 3 </since_tizen>
729 public float CursorBlinkInterval
733 return (float)GetValue(CursorBlinkIntervalProperty);
737 SetValue(CursorBlinkIntervalProperty, value);
738 NotifyPropertyChanged();
743 /// The CursorBlinkDuration property.<br />
744 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
746 /// <since_tizen> 3 </since_tizen>
747 public float CursorBlinkDuration
751 return (float)GetValue(CursorBlinkDurationProperty);
755 SetValue(CursorBlinkDurationProperty, value);
756 NotifyPropertyChanged();
761 /// The CursorWidth property.
763 /// <since_tizen> 3 </since_tizen>
764 public int CursorWidth
768 return (int)GetValue(CursorWidthProperty);
772 SetValue(CursorWidthProperty, value);
773 NotifyPropertyChanged();
778 /// The GrabHandleImage property.<br />
779 /// The image to display for the grab handle.<br />
781 /// <since_tizen> 3 </since_tizen>
782 public string GrabHandleImage
786 return (string)GetValue(GrabHandleImageProperty);
790 SetValue(GrabHandleImageProperty, value);
791 NotifyPropertyChanged();
796 /// The GrabHandlePressedImage property.<br />
797 /// The image to display when the grab handle is pressed.<br />
799 /// <since_tizen> 3 </since_tizen>
800 public string GrabHandlePressedImage
804 return (string)GetValue(GrabHandlePressedImageProperty);
808 SetValue(GrabHandlePressedImageProperty, value);
809 NotifyPropertyChanged();
814 /// The ScrollThreshold property.<br />
815 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
817 /// <since_tizen> 3 </since_tizen>
818 public float ScrollThreshold
822 return (float)GetValue(ScrollThresholdProperty);
826 SetValue(ScrollThresholdProperty, value);
827 NotifyPropertyChanged();
832 /// The ScrollSpeed property.<br />
833 /// The scroll speed in pixels per second.<br />
835 /// <since_tizen> 3 </since_tizen>
836 public float ScrollSpeed
840 return (float)GetValue(ScrollSpeedProperty);
844 SetValue(ScrollSpeedProperty, value);
845 NotifyPropertyChanged();
850 /// The SelectionPopupStyle property.<br />
851 /// The style of the text selection popup can be set through SelectionPopupStyle property.
853 [EditorBrowsable(EditorBrowsableState.Never)]
854 public PropertyMap SelectionPopupStyle
858 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
862 SetValue(SelectionPopupStyleProperty, value);
863 NotifyPropertyChanged();
868 /// The SelectionHandleImageLeft property.<br />
869 /// The image to display for the left selection handle.<br />
870 /// The selectionHandleImageLeft map contains the following key :<br />
871 /// <list type="table">
872 /// <item><term>filename (string)</term><description>The path of image file</description></item>
875 /// <since_tizen> 3 </since_tizen>
876 public PropertyMap SelectionHandleImageLeft
880 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
884 SetValue(SelectionHandleImageLeftProperty, value);
885 NotifyPropertyChanged();
890 /// The SelectionHandleImageRight property.<br />
891 /// The image to display for the right selection handle.<br />
892 /// The selectionHandleImageRight map contains the following key :<br />
893 /// <list type="table">
894 /// <item><term>filename (string)</term><description>The path of image file</description></item>
897 /// <since_tizen> 3 </since_tizen>
898 public PropertyMap SelectionHandleImageRight
902 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
906 SetValue(SelectionHandleImageRightProperty, value);
907 NotifyPropertyChanged();
912 /// Set SelectionHandleImage to TextField. <br />
914 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
916 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
919 /// The following example demonstrates how to use the SetSelectionHandleImage method.
921 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
922 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
923 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
924 /// field.SetSelectionHandleImage(selectionHandleImage);
927 [EditorBrowsable(EditorBrowsableState.Never)]
928 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
930 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
932 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
934 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
938 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
940 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
942 SetValue(SelectionHandleImageRightProperty, rightImageMap);
948 /// Get SelectionHandleImage from TextField. <br />
950 /// <returns>The SelectionHandleImage</returns>
952 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
954 [EditorBrowsable(EditorBrowsableState.Never)]
955 public SelectionHandleImage GetSelectionHandleImage()
957 SelectionHandleImage selectionHandleImage;
958 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
959 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
961 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
963 return selectionHandleImage;
967 /// The SelectionHandlePressedImageLeft property.<br />
968 /// The image to display when the left selection handle is pressed.<br />
969 /// The selectionHandlePressedImageLeft map contains the following key :<br />
970 /// <list type="table">
971 /// <item><term>filename (string)</term><description>The path of image file</description></item>
974 /// <since_tizen> 3 </since_tizen>
975 public PropertyMap SelectionHandlePressedImageLeft
979 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
983 SetValue(SelectionHandlePressedImageLeftProperty, value);
984 NotifyPropertyChanged();
989 /// The SelectionHandlePressedImageRight property.<br />
990 /// The image to display when the right selection handle is pressed.<br />
991 /// The selectionHandlePressedImageRight map contains the following key :<br />
992 /// <list type="table">
993 /// <item><term>filename (string)</term><description>The path of image file</description></item>
996 /// <since_tizen> 3 </since_tizen>
997 public PropertyMap SelectionHandlePressedImageRight
1001 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
1005 SetValue(SelectionHandlePressedImageRightProperty, value);
1006 NotifyPropertyChanged();
1011 /// Set SelectionHandlePressedImage to TextField. <br />
1013 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
1015 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1018 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
1020 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
1021 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
1022 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
1023 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
1026 [EditorBrowsable(EditorBrowsableState.Never)]
1027 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
1029 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
1031 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
1033 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
1037 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
1039 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
1041 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
1047 /// Get SelectionHandlePressedImage from TextField. <br />
1049 /// <returns>The SelectionHandlePressedImage</returns>
1051 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1053 [EditorBrowsable(EditorBrowsableState.Never)]
1054 public SelectionHandleImage GetSelectionHandlePressedImage()
1056 SelectionHandleImage selectionHandleImage;
1057 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
1058 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
1060 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1062 return selectionHandleImage;
1066 /// The SelectionHandleMarkerImageLeft property.<br />
1067 /// The image to display for the left selection handle marker.<br />
1068 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
1069 /// <list type="table">
1070 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1073 /// <since_tizen> 3 </since_tizen>
1074 public PropertyMap SelectionHandleMarkerImageLeft
1078 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1082 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1083 NotifyPropertyChanged();
1088 /// The SelectionHandleMarkerImageRight property.<br />
1089 /// The image to display for the right selection handle marker.<br />
1090 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1091 /// <list type="table">
1092 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1095 /// <since_tizen> 3 </since_tizen>
1096 public PropertyMap SelectionHandleMarkerImageRight
1100 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1104 SetValue(SelectionHandleMarkerImageRightProperty, value);
1105 NotifyPropertyChanged();
1110 /// Set SelectionHandleMarkerImage to TextField. <br />
1112 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1114 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1117 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1119 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1120 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1121 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1122 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1125 [EditorBrowsable(EditorBrowsableState.Never)]
1126 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1128 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1130 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1132 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1136 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1138 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1140 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1146 /// Get SelectionHandleMarkerImage from TextField. <br />
1148 /// <returns>The SelectionHandleMarkerImage</returns>
1150 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1152 [EditorBrowsable(EditorBrowsableState.Never)]
1153 public SelectionHandleImage GetSelectionHandleMarkerImage()
1155 SelectionHandleImage selectionHandleImage;
1156 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1157 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1159 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1161 return selectionHandleImage;
1165 /// The SelectionHighlightColor property.<br />
1166 /// The color of the selection highlight.<br />
1169 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1171 /// <since_tizen> 3 </since_tizen>
1172 public Vector4 SelectionHighlightColor
1176 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1177 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1181 SetValue(SelectionHighlightColorProperty, value);
1182 NotifyPropertyChanged();
1187 /// The DecorationBoundingBox property.<br />
1188 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1191 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1193 /// <since_tizen> 3 </since_tizen>
1194 public Rectangle DecorationBoundingBox
1198 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1199 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1203 SetValue(DecorationBoundingBoxProperty, value);
1204 NotifyPropertyChanged();
1209 /// The InputMethodSettings property.<br />
1210 /// The settings to relating to the System's Input Method, Key and Value.<br />
1213 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
1216 /// The following example demonstrates how to set the InputMethodSettings property.
1218 /// InputMethod method = new InputMethod();
1219 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1220 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1221 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1222 /// method.Variation = 1;
1223 /// textField.InputMethodSettings = method.OutputMap;
1226 /// <since_tizen> 3 </since_tizen>
1227 public PropertyMap InputMethodSettings
1231 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1235 SetValue(InputMethodSettingsProperty, value);
1236 NotifyPropertyChanged();
1241 /// The InputColor property.<br />
1242 /// The color of the new input text.<br />
1245 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1247 /// <since_tizen> 3 </since_tizen>
1248 public Vector4 InputColor
1252 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1253 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1257 SetValue(InputColorProperty, value);
1258 NotifyPropertyChanged();
1263 /// The EnableMarkup property.<br />
1264 /// Whether the mark-up processing is enabled.<br />
1266 /// <since_tizen> 3 </since_tizen>
1267 public bool EnableMarkup
1271 return (bool)GetValue(EnableMarkupProperty);
1275 SetValue(EnableMarkupProperty, value);
1276 NotifyPropertyChanged();
1281 /// The InputFontFamily property.<br />
1282 /// The font's family of the new input text.<br />
1284 /// <since_tizen> 3 </since_tizen>
1285 public string InputFontFamily
1289 return (string)GetValue(InputFontFamilyProperty);
1293 SetValue(InputFontFamilyProperty, value);
1294 NotifyPropertyChanged();
1299 /// The InputFontStyle property.<br />
1300 /// The font's style of the new input text.<br />
1301 /// The inputFontStyle map contains the following keys :<br />
1302 /// <list type="table">
1303 /// <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>
1304 /// <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>
1305 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1308 /// <since_tizen> 3 </since_tizen>
1309 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1310 public PropertyMap InputFontStyle
1314 return (PropertyMap)GetValue(InputFontStyleProperty);
1318 SetValue(InputFontStyleProperty, value);
1319 NotifyPropertyChanged();
1324 /// Set InputFontStyle to TextField. <br />
1326 /// <param name="fontStyle">The FontStyle</param>
1328 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1331 /// The following example demonstrates how to use the SetInputFontStyle method.
1333 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1334 /// fontStyle.Width = FontWidthType.Expanded;
1335 /// fontStyle.Weight = FontWeightType.Bold;
1336 /// fontStyle.Slant = FontSlantType.Italic;
1337 /// field.SetInputFontStyle(fontStyle);
1340 [EditorBrowsable(EditorBrowsableState.Never)]
1341 public void SetInputFontStyle(FontStyle fontStyle)
1343 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1345 SetValue(InputFontStyleProperty, fontStyleMap);
1350 /// Get InputFontStyle from TextField. <br />
1352 /// <returns>The FontStyle</returns>
1354 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1356 [EditorBrowsable(EditorBrowsableState.Never)]
1357 public FontStyle GetInputFontStyle()
1359 FontStyle fontStyle;
1360 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1362 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1368 /// The InputPointSize property.<br />
1369 /// The font's size of the new input text in points.<br />
1371 /// <since_tizen> 3 </since_tizen>
1372 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1373 public float InputPointSize
1377 return (float)GetValue(InputPointSizeProperty);
1381 SetValue(InputPointSizeProperty, value);
1382 NotifyPropertyChanged();
1387 /// The Underline property.<br />
1388 /// The default underline parameters.<br />
1389 /// The underline map contains the following keys :<br />
1390 /// <list type="table">
1391 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1392 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1393 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1396 /// <since_tizen> 3 </since_tizen>
1397 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1398 public PropertyMap Underline
1402 return (PropertyMap)GetValue(UnderlineProperty);
1406 SetValue(UnderlineProperty, value);
1407 NotifyPropertyChanged();
1412 /// Set Underline to TextField. <br />
1414 /// <param name="underline">The Underline</param>
1416 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1419 /// The following example demonstrates how to use the SetUnderline method.
1421 /// var underline = new Tizen.NUI.Text.Underline();
1422 /// underline.Enable = true;
1423 /// underline.Color = new Color("#3498DB");
1424 /// underline.Height = 2.0f;
1425 /// field.SetUnderline(underline);
1428 [EditorBrowsable(EditorBrowsableState.Never)]
1429 public void SetUnderline(Underline underline)
1431 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1433 SetValue(UnderlineProperty, underlineMap);
1438 /// Get Underline from TextField. <br />
1440 /// <returns>The Underline</returns>
1442 /// <see cref="Tizen.NUI.Text.Underline"/>
1444 [EditorBrowsable(EditorBrowsableState.Never)]
1445 public Underline GetUnderline()
1447 Underline underline;
1448 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1450 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1456 /// The InputUnderline property.<br />
1457 /// The underline parameters of the new input text.<br />
1459 /// <since_tizen> 3 </since_tizen>
1460 public string InputUnderline
1464 return (string)GetValue(InputUnderlineProperty);
1468 SetValue(InputUnderlineProperty, value);
1469 NotifyPropertyChanged();
1474 /// The Shadow property.<br />
1475 /// The default shadow parameters.<br />
1476 /// The shadow map contains the following keys :<br />
1477 /// <list type="table">
1478 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1479 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1480 /// <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>
1483 /// <since_tizen> 3 </since_tizen>
1484 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1485 public PropertyMap Shadow
1489 return (PropertyMap)GetValue(ShadowProperty);
1493 SetValue(ShadowProperty, value);
1494 NotifyPropertyChanged();
1499 /// Set Shadow to TextField. <br />
1501 /// <param name="shadow">The Shadow</param>
1503 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1506 /// The following example demonstrates how to use the SetShadow method.
1508 /// var shadow = new Tizen.NUI.Text.Shadow();
1509 /// shadow.Offset = new Vector2(3, 3);
1510 /// shadow.Color = new Color("#F1C40F");
1511 /// field.SetShadow(shadow);
1514 [EditorBrowsable(EditorBrowsableState.Never)]
1515 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1517 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1519 SetValue(ShadowProperty, shadowMap);
1524 /// Get Shadow from TextField. <br />
1526 /// <returns>The Shadow</returns>
1528 /// <see cref="Tizen.NUI.Text.Shadow"/>
1530 [EditorBrowsable(EditorBrowsableState.Never)]
1531 public Tizen.NUI.Text.Shadow GetShadow()
1533 Tizen.NUI.Text.Shadow shadow;
1534 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1536 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1542 /// The InputShadow property.<br />
1543 /// The shadow parameters of the new input text.<br />
1545 /// <since_tizen> 3 </since_tizen>
1546 public string InputShadow
1550 return (string)GetValue(InputShadowProperty);
1554 SetValue(InputShadowProperty, value);
1555 NotifyPropertyChanged();
1560 /// The Emboss property.<br />
1561 /// The default emboss parameters.<br />
1563 /// <since_tizen> 3 </since_tizen>
1564 public string Emboss
1568 return (string)GetValue(EmbossProperty);
1572 SetValue(EmbossProperty, value);
1573 NotifyPropertyChanged();
1578 /// The InputEmboss property.<br />
1579 /// The emboss parameters of the new input text.<br />
1581 /// <since_tizen> 3 </since_tizen>
1582 public string InputEmboss
1586 return (string)GetValue(InputEmbossProperty);
1590 SetValue(InputEmbossProperty, value);
1591 NotifyPropertyChanged();
1596 /// The Outline property.<br />
1597 /// The default outline parameters.<br />
1598 /// The outline map contains the following keys :<br />
1599 /// <list type="table">
1600 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1601 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1604 /// <since_tizen> 3 </since_tizen>
1605 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1606 public PropertyMap Outline
1610 return (PropertyMap)GetValue(OutlineProperty);
1614 SetValue(OutlineProperty, value);
1615 NotifyPropertyChanged();
1620 /// Set Outline to TextField. <br />
1622 /// <param name="outline">The Outline</param>
1624 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1627 /// The following example demonstrates how to use the SetOutline method.
1629 /// var outline = new Tizen.NUI.Text.Outline();
1630 /// outline.Width = 2.0f;
1631 /// outline.Color = new Color("#45B39D");
1632 /// field.SetOutline(outline);
1635 [EditorBrowsable(EditorBrowsableState.Never)]
1636 public void SetOutline(Outline outline)
1638 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1640 SetValue(OutlineProperty, outlineMap);
1645 /// Get Outline from TextField. <br />
1647 /// <returns>The Outline</returns>
1649 /// <see cref="Tizen.NUI.Text.Outline"/>
1651 [EditorBrowsable(EditorBrowsableState.Never)]
1652 public Outline GetOutline()
1655 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1657 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1663 /// The InputOutline property.<br />
1664 /// The outline parameters of the new input text.<br />
1666 /// <since_tizen> 3 </since_tizen>
1667 public string InputOutline
1671 return (string)GetValue(InputOutlineProperty);
1675 SetValue(InputOutlineProperty, value);
1676 NotifyPropertyChanged();
1681 /// The HiddenInputSettings property.<br />
1682 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1683 /// The hiddenInputSettings map contains the following keys :<br />
1684 /// <list type="table">
1685 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1686 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1687 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1688 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1692 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1695 /// The following example demonstrates how to set the HiddenInputSettings property.
1697 /// PropertyMap map = new PropertyMap();
1698 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1699 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1700 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1701 /// textField.HiddenInputSettings = map;
1704 /// <since_tizen> 3 </since_tizen>
1705 public Tizen.NUI.PropertyMap HiddenInputSettings
1709 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1713 SetValue(HiddenInputSettingsProperty, value);
1714 NotifyPropertyChanged();
1719 /// Set HiddenInput to TextField. <br />
1721 /// <param name="hiddenInput">The HiddenInput</param>
1723 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1726 /// The following example demonstrates how to use the SetHiddenInput method.
1728 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1729 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1730 /// hiddenInput.SubstituteCharacter = '★';
1731 /// hiddenInput.SubstituteCount = 0;
1732 /// hiddenInput.ShowLastCharacterDuration = 1000;
1733 /// field.SetHiddenInput(hiddenInput);
1736 [EditorBrowsable(EditorBrowsableState.Never)]
1737 public void SetHiddenInput(HiddenInput hiddenInput)
1739 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1741 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1746 /// Get HiddenInput from TextField. <br />
1748 /// <returns>The HiddenInput</returns>
1750 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1752 [EditorBrowsable(EditorBrowsableState.Never)]
1753 public HiddenInput GetHiddenInput()
1755 HiddenInput hiddenInput;
1756 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1758 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1764 /// The PixelSize property.<br />
1765 /// The size of font in pixels.<br />
1767 /// <since_tizen> 3 </since_tizen>
1768 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1769 public float PixelSize
1773 return (float)GetValue(PixelSizeProperty);
1777 SetValue(PixelSizeProperty, value);
1778 NotifyPropertyChanged();
1783 /// The Enable selection property.<br />
1784 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1786 /// <since_tizen> 3 </since_tizen>
1787 public bool EnableSelection
1791 return (bool)GetValue(EnableSelectionProperty);
1795 SetValue(EnableSelectionProperty, value);
1796 NotifyPropertyChanged();
1801 /// The Enable grab handle property.<br />
1802 /// Enables the grab handles for text selection.<br />
1803 /// The default value is true, which means the grab handles are enabled by default.<br />
1805 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1806 [EditorBrowsable(EditorBrowsableState.Never)]
1807 public bool EnableGrabHandle
1811 return (bool)GetValue(EnableGrabHandleProperty);
1815 SetValue(EnableGrabHandleProperty, value);
1816 NotifyPropertyChanged();
1821 /// The Enable grab handle popup property.<br />
1822 /// Enables the grab handle popup for text selection.<br />
1823 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1825 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1826 [EditorBrowsable(EditorBrowsableState.Never)]
1827 public bool EnableGrabHandlePopup
1831 return (bool)GetValue(EnableGrabHandlePopupProperty);
1835 SetValue(EnableGrabHandlePopupProperty, value);
1836 NotifyPropertyChanged();
1841 /// The portion of the text that has been selected by the user.
1844 /// Empty string when nothing is selected.
1846 /// <since_tizen> 9 </since_tizen>
1847 public string SelectedText
1851 string selectedText;
1852 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1854 propertyValue.Get(out selectedText);
1856 return selectedText;
1861 /// The start index for selection.
1864 /// When there is no selection, the index is current cursor position.
1866 /// <since_tizen> 9 </since_tizen>
1867 public int SelectedTextStart
1871 int selectedTextStart;
1872 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1874 propertyValue.Get(out selectedTextStart);
1876 return selectedTextStart;
1881 /// The end index for selection.
1884 /// When there is no selection, the index is current cursor position.
1886 /// <since_tizen> 9 </since_tizen>
1887 public int SelectedTextEnd
1891 int selectedTextEnd;
1892 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1894 propertyValue.Get(out selectedTextEnd);
1896 return selectedTextEnd;
1901 /// Enable editing in text control.
1903 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1904 [EditorBrowsable(EditorBrowsableState.Never)]
1905 public bool EnableEditing
1909 return (bool)GetValue(EnableEditingProperty);
1913 SetValue(EnableEditingProperty, value);
1917 private bool InternalEnableEditing
1922 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1924 propertyValue.Get(out enableEditing);
1926 return enableEditing;
1930 using (var propertyValue = new PropertyValue(value))
1932 SetProperty(TextField.Property.EnableEditing, propertyValue);
1933 NotifyPropertyChanged();
1939 /// PrimaryCursorPosition property.<br />
1940 /// Specify the position of the primary cursor (caret) in text control.
1943 /// 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).
1945 /// <since_tizen> 10 </since_tizen>
1946 public int PrimaryCursorPosition
1950 return (int)GetValue(PrimaryCursorPositionProperty);
1954 SetValue(PrimaryCursorPositionProperty, value);
1958 private int InternalPrimaryCursorPosition
1962 int primaryCursorPosition;
1963 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1965 propertyValue.Get(out primaryCursorPosition);
1967 return primaryCursorPosition;
1971 using (PropertyValue propertyValue = new PropertyValue(value))
1973 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1974 NotifyPropertyChanged();
1980 /// The GrabHandleColor property.
1983 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1985 [EditorBrowsable(EditorBrowsableState.Never)]
1986 public Color GrabHandleColor
1990 Color temp = (Color)GetValue(GrabHandleColorProperty);
1991 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1995 SetValue(GrabHandleColorProperty, value);
1996 NotifyPropertyChanged();
2001 /// The ellipsis position of the text.
2002 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2004 /// <since_tizen> 9 </since_tizen>
2005 public EllipsisPosition EllipsisPosition
2009 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2013 SetValue(EllipsisPositionProperty, value);
2014 NotifyPropertyChanged();
2019 /// The spaces between characters in Pixels.
2021 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2022 /// The default value is 0.f which does nothing.
2025 [EditorBrowsable(EditorBrowsableState.Never)]
2026 public float CharacterSpacing
2030 return (float)GetValue(CharacterSpacingProperty);
2034 SetValue(CharacterSpacingProperty, value);
2035 NotifyPropertyChanged();
2040 /// Set InputFilter to TextField.
2042 /// <param name="inputFilter">The InputFilter</param>
2044 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
2045 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
2046 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
2049 /// The following example demonstrates how to use the SetInputFilter method.
2051 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
2052 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
2053 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
2054 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
2057 /// <since_tizen> 9 </since_tizen>
2058 public void SetInputFilter(InputFilter inputFilter)
2060 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
2061 using (var propertyValue = new PropertyValue(map))
2063 SetProperty(TextField.Property.InputFilter, propertyValue);
2068 /// Get InputFilter from TextField.
2070 /// <returns>The InputFilter</returns>
2072 /// <see cref="Tizen.NUI.Text.InputFilter"/>
2074 /// <since_tizen> 9 </since_tizen>
2075 public InputFilter GetInputFilter()
2077 InputFilter inputFilter;
2078 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
2079 using (var map = new PropertyMap())
2081 propertyValue.Get(map);
2082 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2088 /// Set Strikethrough to TextField. <br />
2090 /// <param name="strikethrough">The Strikethrough</param>
2092 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2095 /// The following example demonstrates how to use the SetStrikethrough method.
2097 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2098 /// strikethrough.Enable = true;
2099 /// strikethrough.Color = new Color("#3498DB");
2100 /// strikethrough.Height = 2.0f;
2101 /// field.SetStrikethrough(strikethrough);
2104 [EditorBrowsable(EditorBrowsableState.Never)]
2105 public void SetStrikethrough(Strikethrough strikethrough)
2107 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2108 using (var propertyValue = new PropertyValue(map))
2110 SetProperty(TextField.Property.Strikethrough, propertyValue);
2115 /// Get Strikethrough from TextField. <br />
2117 /// <returns>The Strikethrough</returns>
2119 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2121 [EditorBrowsable(EditorBrowsableState.Never)]
2122 public Strikethrough GetStrikethrough()
2124 Strikethrough strikethrough;
2125 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2126 using (var map = new PropertyMap())
2128 propertyValue.Get(map);
2129 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2131 return strikethrough;
2135 /// The Placeholder property.
2136 /// The placeholder map contains the following keys :<br />
2137 /// <list type="table">
2138 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2139 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2140 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2141 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2142 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2143 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2144 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2145 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2149 /// The following example demonstrates how to set the Placeholder property.
2151 /// PropertyMap propertyMap = new PropertyMap();
2152 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2153 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2154 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2155 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2156 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2158 /// PropertyMap fontStyleMap = new PropertyMap();
2159 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2160 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2161 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2162 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2164 /// TextField field = new TextField();
2165 /// field.Placeholder = propertyMap;
2168 /// <since_tizen> 3 </since_tizen>
2169 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2170 public Tizen.NUI.PropertyMap Placeholder
2174 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2175 string defalutText = "";
2177 if (TextMapHelper.IsValue(map, 0))
2178 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2180 if (TextMapHelper.IsValue(map, 1))
2181 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2183 if (TextMapHelper.IsValue(map, 2))
2185 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2187 map.Add("color", color);
2191 if (TextMapHelper.IsValue(map, 3))
2192 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2194 if (TextMapHelper.IsValue(map, 4))
2196 using (var properyValue = map.Find(4))
2197 using (var fontStyle = new PropertyMap())
2199 properyValue.Get(fontStyle);
2200 using (var fontStyleValue = new PropertyValue(fontStyle))
2202 map.Add("fontStyle", fontStyleValue);
2207 if (TextMapHelper.IsValue(map, 5))
2208 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2210 if (TextMapHelper.IsValue(map, 6))
2211 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2213 if (TextMapHelper.IsValue(map, 7))
2214 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2220 SetValue(PlaceholderProperty, value);
2221 NotifyPropertyChanged();
2226 /// Set Placeholder to TextField. <br />
2228 /// <param name="placeholder">The Placeholder</param>
2230 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2233 /// The following example demonstrates how to use the SetPlaceholder method.
2235 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2236 /// placeholder.Text = "placeholder text";
2237 /// placeholder.TextFocused = "placeholder textFocused";
2238 /// placeholder.Color = new Color("#45B39D");
2239 /// placeholder.FontFamily = "BreezeSans";
2240 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2242 /// Width = FontWidthType.Expanded,
2243 /// Weight = FontWeightType.ExtraLight,
2244 /// Slant = FontSlantType.Italic,
2246 /// placeholder.PointSize = 25.0f;
2247 /// //placeholder.PixelSize = 50.0f;
2248 /// placeholder.Ellipsis = true;
2249 /// field.SetPlaceholder(placeholder);
2252 [EditorBrowsable(EditorBrowsableState.Never)]
2253 public void SetPlaceholder(Placeholder placeholder)
2255 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2257 SetValue(PlaceholderProperty, placeholderMap);
2262 /// Get Placeholder from TextField. <br />
2264 /// <returns>The Placeholder</returns>
2266 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2268 [EditorBrowsable(EditorBrowsableState.Never)]
2269 public Placeholder GetPlaceholder()
2271 Placeholder placeholder;
2272 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2274 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2280 /// The Ellipsis property.<br />
2281 /// Enable or disable the ellipsis.<br />
2282 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2284 /// <since_tizen> 4 </since_tizen>
2285 public bool Ellipsis
2289 return (bool)GetValue(EllipsisProperty);
2293 SetValue(EllipsisProperty, value);
2294 NotifyPropertyChanged();
2299 /// Enables selection of the text using the Shift key.
2301 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2302 [EditorBrowsable(EditorBrowsableState.Never)]
2303 public bool EnableShiftSelection
2307 return (bool)GetValue(EnableShiftSelectionProperty);
2311 SetValue(EnableShiftSelectionProperty, value);
2312 NotifyPropertyChanged();
2317 /// The text alignment to match the direction of the system language.<br />
2318 /// The default value is true.<br />
2320 /// <since_tizen> 6 </since_tizen>
2321 public bool MatchSystemLanguageDirection
2325 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2329 SetValue(MatchSystemLanguageDirectionProperty, value);
2330 NotifyPropertyChanged();
2335 /// The FontSizeScale property. <br />
2336 /// The default value is 1.0. <br />
2337 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2338 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2340 /// <since_tizen> 9 </since_tizen>
2341 public float FontSizeScale
2345 return (float)GetValue(FontSizeScaleProperty);
2349 SetValue(FontSizeScaleProperty, value);
2350 NotifyPropertyChanged();
2354 private float InternalFontSizeScale
2358 return fontSizeScale;
2362 float newFontSizeScale;
2364 if (fontSizeScale == value) return;
2366 fontSizeScale = value;
2367 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2369 SystemSettingsFontSize systemSettingsFontSize;
2373 systemSettingsFontSize = SystemSettings.FontSize;
2377 Console.WriteLine("{0} Exception caught.", e);
2378 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2380 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2381 AddSystemSettingsFontSizeChanged();
2385 newFontSizeScale = fontSizeScale;
2386 RemoveSystemSettingsFontSizeChanged();
2389 SetInternalFontSizeScale(newFontSizeScale);
2393 private void SetInternalFontSizeScale(float fontSizeScale)
2395 Object.InternalSetPropertyFloat(this.SwigCPtr, TextField.Property.FontSizeScale, (float)fontSizeScale);
2399 /// The EnableFontSizeScale property.<br />
2400 /// Whether the font size scale is enabled. (The default value is true)
2402 [EditorBrowsable(EditorBrowsableState.Never)]
2403 public bool EnableFontSizeScale
2407 return (bool)GetValue(EnableFontSizeScaleProperty);
2411 SetValue(EnableFontSizeScaleProperty, value);
2412 NotifyPropertyChanged();
2417 /// Get the InputMethodContext instance.
2419 /// <returns>The InputMethodContext instance.</returns>
2420 /// <since_tizen> 5 </since_tizen>
2421 public InputMethodContext GetInputMethodContext()
2423 if (inputMethodCotext == null)
2425 /*Avoid raising InputMethodContext reference count.*/
2426 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2427 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2429 return inputMethodCotext;
2433 /// Select the whole text.
2435 /// <since_tizen> 9 </since_tizen>
2436 public void SelectWholeText()
2438 Interop.TextField.SelectWholeText(SwigCPtr);
2439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2443 /// Select text from start to end index. <br />
2444 /// The index is valid when 0 or positive.
2446 /// <param name="start">The start index for selection.</param>
2447 /// <param name="end">The end index for selection.</param>
2449 /// If the end index exceeds the maximum value, it is set to the length of the text.
2451 /// <since_tizen> 9 </since_tizen>
2452 public void SelectText(int start, int end)
2455 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2457 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2459 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2464 /// Clear selection of the text. <br />
2465 /// Valid when selection is activate.
2467 /// <since_tizen> 9 </since_tizen>
2468 public void SelectNone()
2470 _ = Interop.TextField.SelectNone(SwigCPtr);
2471 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2474 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2476 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));
2477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2484 /// <since_tizen> 3 </since_tizen>
2485 protected override void Dispose(DisposeTypes type)
2489 DisposeQueue.Instance.Add(this);
2494 internalPlaceholderTextColor?.Dispose();
2495 internalPrimaryCursorColor?.Dispose();
2496 internalSecondaryCursorColor?.Dispose();
2497 internalSelectionHighlightColor?.Dispose();
2498 internalInputColor?.Dispose();
2499 internalTextColor?.Dispose();
2500 internalGrabHandleColor?.Dispose();
2502 if (hasSystemLanguageChanged)
2504 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
2507 RemoveSystemSettingsFontTypeChanged();
2508 RemoveSystemSettingsFontSizeChanged();
2510 if (type == DisposeTypes.Explicit)
2513 //Release your own managed resources here.
2514 //You should release all of your own disposable objects here.
2517 //Release your own unmanaged resources here.
2518 //You should not access any managed member here except static instance.
2519 //because the execution order of Finalizes is non-deterministic.
2522 if (textFieldCursorPositionChangedCallbackDelegate != null)
2524 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2527 if (textFieldMaxLengthReachedCallbackDelegate != null)
2529 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2532 if (textFieldSelectionStartedCallbackDelegate != null)
2534 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2537 if (textFieldSelectionClearedCallbackDelegate != null)
2539 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2542 if (textFieldSelectionChangedCallbackDelegate != null)
2544 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2547 if (textFieldTextChangedCallbackDelegate != null)
2549 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2553 TextChanged -= TextFieldTextChanged;
2554 GetInputMethodContext()?.DestroyContext();
2559 /// This will not be public opened.
2560 [EditorBrowsable(EditorBrowsableState.Never)]
2561 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2563 Interop.TextField.DeleteTextField(swigCPtr);
2566 internal override LayoutItem CreateDefaultLayout()
2568 return new TextFieldLayout();
2571 internal void SetTextWithoutTextChanged(string text)
2573 invokeTextChanged = false;
2574 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2575 invokeTextChanged = true;
2578 private string SetTranslatable(string textFieldSid)
2580 string translatableText = null;
2581 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2582 if (translatableText != null)
2584 if (hasSystemLanguageChanged == false)
2586 systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
2587 hasSystemLanguageChanged = true;
2589 return translatableText;
2593 translatableText = "";
2594 return translatableText;
2598 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2600 if (textFieldTextSid != null)
2602 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2604 if (textFieldPlaceHolderTextSid != null)
2606 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2608 if (textFieldPlaceHolderTextFocusedSid != null)
2610 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2614 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2616 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2617 SetInternalFontSizeScale(newFontSizeScale);
2620 private void AddSystemSettingsFontSizeChanged()
2622 if (hasSystemFontSizeChanged != true)
2626 SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
2627 hasSystemFontSizeChanged = true;
2631 Console.WriteLine("{0} Exception caught.", e);
2632 hasSystemFontSizeChanged = false;
2637 private void RemoveSystemSettingsFontSizeChanged()
2639 if (hasSystemFontSizeChanged == true)
2643 SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
2644 hasSystemFontSizeChanged = false;
2648 Console.WriteLine("{0} Exception caught.", e);
2649 hasSystemFontSizeChanged = true;
2654 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2656 SetInternalFontFamily(e.Value);
2659 private void AddSystemSettingsFontTypeChanged()
2661 if (HasStyle() && !hasSystemFontTypeChanged)
2665 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2666 hasSystemFontTypeChanged = true;
2670 Console.WriteLine("{0} Exception caught.", e);
2671 hasSystemFontTypeChanged = false;
2676 private void RemoveSystemSettingsFontTypeChanged()
2678 if (hasSystemFontTypeChanged)
2682 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2683 hasSystemFontTypeChanged = false;
2687 Console.WriteLine("{0} Exception caught.", e);
2688 hasSystemFontTypeChanged = true;
2693 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2695 if (!isSettingTextInCSharp)
2697 EnforceNotifyBindedInstance(TextProperty);
2701 internal new class Property
2703 internal static readonly int TEXT = Interop.TextField.TextGet();
2704 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2705 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2706 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2707 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2708 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2709 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2710 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2711 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2712 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2713 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2714 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2715 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2716 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2717 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2718 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2719 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2720 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2721 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2722 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2723 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2724 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2725 internal static readonly int SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet();
2726 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2727 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2728 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2729 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2730 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2731 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2732 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2733 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2734 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2735 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2736 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2737 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2738 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2739 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2740 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2741 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2742 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2743 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2744 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2745 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2746 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2747 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2748 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2749 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2750 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2751 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2752 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2753 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2754 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2755 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2756 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2757 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2758 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2759 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2760 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2761 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2762 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2763 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2764 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2765 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2766 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2767 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2768 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2771 internal class InputStyle
2777 FontFamily = 0x0002,
2787 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2789 DecorationBoundingBox = new Rectangle(x, y, width, height);
2791 private void OnInputColorChanged(float x, float y, float z, float w)
2793 InputColor = new Vector4(x, y, z, w);
2795 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2797 PlaceholderTextColor = new Vector4(r, g, b, a);
2799 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2801 PrimaryCursorColor = new Vector4(x, y, z, w);
2803 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2805 SecondaryCursorColor = new Vector4(x, y, z, w);
2807 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2809 SelectionHighlightColor = new Vector4(x, y, z, w);
2811 private void OnShadowColorChanged(float x, float y, float z, float w)
2813 ShadowColor = new Vector4(x, y, z, w);
2815 private void OnShadowOffsetChanged(float x, float y)
2817 ShadowOffset = new Vector2(x, y);
2819 private void OnTextColorChanged(float r, float g, float b, float a)
2821 TextColor = new Color(r, g, b, a);
2823 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2825 GrabHandleColor = new Color(r, g, b, a);
2828 internal class TextFieldLayout : LayoutItem
2830 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2832 // Padding will be automatically applied by DALi TextField.
2833 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2834 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2835 var minSize = Owner.MinimumSize;
2836 var maxSize = Owner.MaximumSize;
2837 var naturalSize = Owner.GetNaturalSize();
2839 if (((TextField)Owner).Text.Length == 0)
2841 // Calculate height of TextField by setting Text with " ".
2842 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2843 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2845 // Store original WidthSpecification to restore it after setting ResizePolicy.
2846 var widthSpecification = Owner.WidthSpecification;
2848 // In DALi's Size logic, if Width or Height is set to be 0, then
2849 // ResizePolicy is not changed to Fixed.
2850 // This causes Size changes after NUI Layout's OnMeasure is finished.
2851 // e.g. TextField's Width fills to its parent although Text is null and
2852 // WidthSpecification is WrapContent.
2853 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2854 // in advance if Text is null.
2855 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2857 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2858 Owner.WidthSpecification = widthSpecification;
2860 naturalSize = Owner.GetNaturalSize();
2862 // Restore TextField's Text after calculating height of TextField.
2863 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2864 ((TextField)Owner).SetTextWithoutTextChanged("");
2867 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2869 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2872 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2874 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2877 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2878 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2880 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2881 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2883 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2884 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));