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() { }
60 static internal new void Preload()
62 // Do not call View.Preload(), since we already call it
65 // Do nothing. Just call for load static values.
69 /// Creates the TextField control.
71 /// <since_tizen> 3 </since_tizen>
72 public TextField() : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
74 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 /// Creates the TextField with setting the status of shown or hidden.
80 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
81 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 public TextField(bool shown) : this(Interop.TextField.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 /// Get attributes, it is abstract function and must be override.
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 protected override ViewStyle CreateViewStyle()
95 return new TextFieldStyle();
98 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
105 TextChanged += TextFieldTextChanged;
108 internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
115 TextChanged += TextFieldTextChanged;
118 internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 internal enum ExceedPolicyType
125 ExceedPolicyOriginal,
129 private bool HasStyle()
131 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
135 /// The TranslatableText property.<br />
136 /// The text can set the SID value.<br />
138 /// <exception cref='ArgumentNullException'>
139 /// ResourceManager about multilingual is null.
141 /// <since_tizen> 4 </since_tizen>
142 public string TranslatableText
146 return (string)GetValue(TranslatableTextProperty);
150 SetValue(TranslatableTextProperty, value);
153 private string translatableText
157 return textFieldTextSid;
161 if (NUIApplication.MultilingualResourceManager == null)
163 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
165 textFieldTextSid = value;
166 Text = SetTranslatable(textFieldTextSid);
167 NotifyPropertyChanged();
172 /// The TranslatablePlaceholderText property.<br />
173 /// The text can set the SID value.<br />
175 /// <exception cref='ArgumentNullException'>
176 /// ResourceManager about multilingual is null.
178 /// <since_tizen> 4 </since_tizen>
179 public string TranslatablePlaceholderText
183 return (string)GetValue(TranslatablePlaceholderTextProperty);
187 SetValue(TranslatablePlaceholderTextProperty, value);
190 private string translatablePlaceholderText
194 return textFieldPlaceHolderTextSid;
198 if (NUIApplication.MultilingualResourceManager == null)
200 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
202 textFieldPlaceHolderTextSid = value;
203 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
204 NotifyPropertyChanged();
209 /// The TranslatablePlaceholderTextFocused property.<br />
210 /// The text can set the SID value.<br />
212 /// <exception cref='ArgumentNullException'>
213 /// ResourceManager about multilingual is null.
215 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
216 [EditorBrowsable(EditorBrowsableState.Never)]
217 public string TranslatablePlaceholderTextFocused
221 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
225 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
228 private string translatablePlaceholderTextFocused
232 return textFieldPlaceHolderTextFocusedSid;
236 if (NUIApplication.MultilingualResourceManager == null)
238 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
240 textFieldPlaceHolderTextFocusedSid = value;
241 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
242 NotifyPropertyChanged();
247 /// The Text property.<br />
248 /// The text to display in the UTF-8 format.<br />
250 /// <since_tizen> 3 </since_tizen>
255 return (string)GetValue(TextProperty);
259 SetValue(TextProperty, value);
260 NotifyPropertyChanged();
265 /// The PlaceholderText property.<br />
266 /// The text to display when the TextField is empty and inactive. <br />
268 /// <since_tizen> 3 </since_tizen>
269 public string PlaceholderText
273 return (string)GetValue(PlaceholderTextProperty);
277 SetValue(PlaceholderTextProperty, value);
278 NotifyPropertyChanged();
283 /// The PlaceholderTextFocused property. <br />
284 /// The text to display when the TextField is empty with input focus. <br />
286 /// <since_tizen> 3 </since_tizen>
287 public string PlaceholderTextFocused
291 return (string)GetValue(PlaceholderTextFocusedProperty);
295 SetValue(PlaceholderTextFocusedProperty, value);
296 NotifyPropertyChanged();
301 /// The FontFamily property.<br />
302 /// The requested font family to use.<br />
304 /// <since_tizen> 3 </since_tizen>
305 public string FontFamily
309 return (string)GetValue(FontFamilyProperty);
313 SetValue(FontFamilyProperty, value);
314 NotifyPropertyChanged();
318 private string InternalFontFamily
325 return Object.InternalGetPropertyString(this.SwigCPtr, TextField.Property.FontFamily);
329 string newFontFamily;
331 if (string.Equals(fontFamily, value)) return;
334 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
338 newFontFamily = SystemSettings.FontType;
342 Console.WriteLine("{0} Exception caught.", e);
343 newFontFamily = defaultFontFamily;
345 AddSystemSettingsFontTypeChanged();
349 newFontFamily = fontFamily;
350 RemoveSystemSettingsFontTypeChanged();
353 SetInternalFontFamily(newFontFamily);
357 private void SetInternalFontFamily(string fontFamily)
359 Object.InternalSetPropertyString(this.SwigCPtr, TextField.Property.FontFamily, (string)fontFamily);
363 /// The FontStyle property.<br />
364 /// The requested font style to use.<br />
365 /// The fontStyle map contains the following keys :<br />
366 /// <list type="table">
367 /// <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>
368 /// <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>
369 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
372 /// <since_tizen> 3 </since_tizen>
373 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
374 public PropertyMap FontStyle
378 return (PropertyMap)GetValue(FontStyleProperty);
382 SetValue(FontStyleProperty, value);
383 NotifyPropertyChanged();
388 /// Set FontStyle to TextField. <br />
390 /// <param name="fontStyle">The FontStyle</param>
392 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
395 /// The following example demonstrates how to use the SetFontStyle method.
397 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
398 /// fontStyle.Width = FontWidthType.Expanded;
399 /// fontStyle.Weight = FontWeightType.Bold;
400 /// fontStyle.Slant = FontSlantType.Italic;
401 /// field.SetFontStyle(fontStyle);
404 [EditorBrowsable(EditorBrowsableState.Never)]
405 public void SetFontStyle(FontStyle fontStyle)
407 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
409 SetValue(FontStyleProperty, fontStyleMap);
414 /// Get FontStyle from TextField. <br />
416 /// <returns>The FontStyle</returns>
418 /// <see cref="Tizen.NUI.Text.FontStyle"/>
420 [EditorBrowsable(EditorBrowsableState.Never)]
421 public FontStyle GetFontStyle()
424 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
426 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
432 /// The PointSize property.<br />
433 /// The size of font in points.<br />
435 /// <since_tizen> 3 </since_tizen>
436 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
437 public float PointSize
441 return (float)GetValue(PointSizeProperty);
445 SetValue(PointSizeProperty, value);
446 NotifyPropertyChanged();
451 /// The MaxLength property.<br />
452 /// The maximum number of characters that can be inserted.<br />
454 /// <since_tizen> 3 </since_tizen>
459 return (int)GetValue(MaxLengthProperty);
463 SetValue(MaxLengthProperty, value);
464 NotifyPropertyChanged();
469 /// The ExceedPolicy property.<br />
470 /// Specifies how the text is truncated when it does not fit.<br />
472 /// <since_tizen> 3 </since_tizen>
473 public int ExceedPolicy
477 return (int)GetValue(ExceedPolicyProperty);
481 SetValue(ExceedPolicyProperty, value);
482 NotifyPropertyChanged();
487 /// The HorizontalAlignment property.<br />
488 /// The line horizontal alignment.<br />
490 /// <since_tizen> 3 </since_tizen>
491 public HorizontalAlignment HorizontalAlignment
495 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
499 SetValue(HorizontalAlignmentProperty, value);
500 NotifyPropertyChanged();
505 /// The VerticalAlignment property.<br />
506 /// The line vertical alignment.<br />
508 /// <since_tizen> 3 </since_tizen>
509 public VerticalAlignment VerticalAlignment
513 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
517 SetValue(VerticalAlignmentProperty, value);
518 NotifyPropertyChanged();
519 NotifyPropertyChanged();
524 /// The TextColor property.<br />
525 /// The color of the text.<br />
528 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
530 /// <since_tizen> 3 </since_tizen>
531 public Color TextColor
535 Color temp = (Color)GetValue(TextColorProperty);
536 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
540 SetValue(TextColorProperty, value);
541 NotifyPropertyChanged();
546 /// The PlaceholderTextColor property.
549 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
551 /// <since_tizen> 3 </since_tizen>
552 public Vector4 PlaceholderTextColor
556 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
557 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
561 SetValue(PlaceholderTextColorProperty, value);
562 NotifyPropertyChanged();
567 /// The ShadowOffset property.
569 /// <since_tizen> 3 </since_tizen>
571 /// Deprecated.(API Level 6) Use Shadow instead.
572 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
574 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
575 public Vector2 ShadowOffset
579 return GetValue(ShadowOffsetProperty) as Vector2;
583 SetValue(ShadowOffsetProperty, value);
587 private Vector2 InternalShadowOffset
591 float x = 0.0f, y = 0.0f;
592 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
593 using (var shadowOffset = new Vector2())
595 if (null != propertyValue)
597 propertyValue.Get(shadowOffset);
602 return new Vector2(OnShadowOffsetChanged, x, y);
606 using (var map = new PropertyMap())
608 map.Add("offset", value);
609 var shadowMap = Shadow;
610 shadowMap.Merge(map);
611 SetValue(ShadowProperty, shadowMap);
612 NotifyPropertyChanged();
618 /// The ShadowColor property.
620 /// <since_tizen> 3 </since_tizen>
622 /// Deprecated.(API Level 6) Use Shadow instead.
623 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
625 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
626 public Vector4 ShadowColor
630 return GetValue(ShadowColorProperty) as Vector4;
634 SetValue(ShadowColorProperty, value);
638 private Vector4 InternalShadowColor
642 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
643 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
644 using (var shadowColor = new Vector4())
646 if (null != propertyValue)
648 propertyValue.Get(shadowColor);
655 return new Vector4(OnShadowColorChanged, x, y, z, w);
659 using (var map = new PropertyMap())
661 map.Add("color", value);
662 var shadowMap = Shadow;
663 shadowMap.Merge(map);
664 SetValue(ShadowProperty, shadowMap);
665 NotifyPropertyChanged();
671 /// The PrimaryCursorColor property.<br />
672 /// The color to apply to the primary cursor.<br />
675 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
677 /// <since_tizen> 3 </since_tizen>
678 public Vector4 PrimaryCursorColor
682 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
683 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
687 SetValue(PrimaryCursorColorProperty, value);
688 NotifyPropertyChanged();
693 /// The SecondaryCursorColor property.<br />
694 /// The color to apply to the secondary cursor.<br />
697 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
699 /// <since_tizen> 3 </since_tizen>
700 public Vector4 SecondaryCursorColor
704 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
705 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
709 SetValue(SecondaryCursorColorProperty, value);
710 NotifyPropertyChanged();
715 /// The EnableCursorBlink property.<br />
716 /// Whether the cursor should blink or not.<br />
718 /// <since_tizen> 3 </since_tizen>
719 public bool EnableCursorBlink
723 return (bool)GetValue(EnableCursorBlinkProperty);
727 SetValue(EnableCursorBlinkProperty, value);
728 NotifyPropertyChanged();
733 /// The CursorBlinkInterval property.<br />
734 /// The time interval in seconds between cursor on/off states.<br />
736 /// <since_tizen> 3 </since_tizen>
737 public float CursorBlinkInterval
741 return (float)GetValue(CursorBlinkIntervalProperty);
745 SetValue(CursorBlinkIntervalProperty, value);
746 NotifyPropertyChanged();
751 /// The CursorBlinkDuration property.<br />
752 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
754 /// <since_tizen> 3 </since_tizen>
755 public float CursorBlinkDuration
759 return (float)GetValue(CursorBlinkDurationProperty);
763 SetValue(CursorBlinkDurationProperty, value);
764 NotifyPropertyChanged();
769 /// The CursorWidth property.
771 /// <since_tizen> 3 </since_tizen>
772 public int CursorWidth
776 return (int)GetValue(CursorWidthProperty);
780 SetValue(CursorWidthProperty, value);
781 NotifyPropertyChanged();
786 /// The GrabHandleImage property.<br />
787 /// The image to display for the grab handle.<br />
789 /// <since_tizen> 3 </since_tizen>
790 public string GrabHandleImage
794 return (string)GetValue(GrabHandleImageProperty);
798 SetValue(GrabHandleImageProperty, value);
799 NotifyPropertyChanged();
804 /// The GrabHandlePressedImage property.<br />
805 /// The image to display when the grab handle is pressed.<br />
807 /// <since_tizen> 3 </since_tizen>
808 public string GrabHandlePressedImage
812 return (string)GetValue(GrabHandlePressedImageProperty);
816 SetValue(GrabHandlePressedImageProperty, value);
817 NotifyPropertyChanged();
822 /// The ScrollThreshold property.<br />
823 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
825 /// <since_tizen> 3 </since_tizen>
826 public float ScrollThreshold
830 return (float)GetValue(ScrollThresholdProperty);
834 SetValue(ScrollThresholdProperty, value);
835 NotifyPropertyChanged();
840 /// The ScrollSpeed property.<br />
841 /// The scroll speed in pixels per second.<br />
843 /// <since_tizen> 3 </since_tizen>
844 public float ScrollSpeed
848 return (float)GetValue(ScrollSpeedProperty);
852 SetValue(ScrollSpeedProperty, value);
853 NotifyPropertyChanged();
858 /// The SelectionPopupStyle property.<br />
859 /// The style of the text selection popup can be set through SelectionPopupStyle property.
861 [EditorBrowsable(EditorBrowsableState.Never)]
862 public PropertyMap SelectionPopupStyle
866 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
870 SetValue(SelectionPopupStyleProperty, value);
871 NotifyPropertyChanged();
876 /// The SelectionHandleImageLeft property.<br />
877 /// The image to display for the left selection handle.<br />
878 /// The selectionHandleImageLeft map contains the following key :<br />
879 /// <list type="table">
880 /// <item><term>filename (string)</term><description>The path of image file</description></item>
883 /// <since_tizen> 3 </since_tizen>
884 public PropertyMap SelectionHandleImageLeft
888 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
892 SetValue(SelectionHandleImageLeftProperty, value);
893 NotifyPropertyChanged();
898 /// The SelectionHandleImageRight property.<br />
899 /// The image to display for the right selection handle.<br />
900 /// The selectionHandleImageRight map contains the following key :<br />
901 /// <list type="table">
902 /// <item><term>filename (string)</term><description>The path of image file</description></item>
905 /// <since_tizen> 3 </since_tizen>
906 public PropertyMap SelectionHandleImageRight
910 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
914 SetValue(SelectionHandleImageRightProperty, value);
915 NotifyPropertyChanged();
920 /// Set SelectionHandleImage to TextField. <br />
922 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
924 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
927 /// The following example demonstrates how to use the SetSelectionHandleImage method.
929 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
930 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
931 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
932 /// field.SetSelectionHandleImage(selectionHandleImage);
935 [EditorBrowsable(EditorBrowsableState.Never)]
936 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
938 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
940 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
942 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
946 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
948 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
950 SetValue(SelectionHandleImageRightProperty, rightImageMap);
956 /// Get SelectionHandleImage from TextField. <br />
958 /// <returns>The SelectionHandleImage</returns>
960 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
962 [EditorBrowsable(EditorBrowsableState.Never)]
963 public SelectionHandleImage GetSelectionHandleImage()
965 SelectionHandleImage selectionHandleImage;
966 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
967 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
969 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
971 return selectionHandleImage;
975 /// The SelectionHandlePressedImageLeft property.<br />
976 /// The image to display when the left selection handle is pressed.<br />
977 /// The selectionHandlePressedImageLeft map contains the following key :<br />
978 /// <list type="table">
979 /// <item><term>filename (string)</term><description>The path of image file</description></item>
982 /// <since_tizen> 3 </since_tizen>
983 public PropertyMap SelectionHandlePressedImageLeft
987 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
991 SetValue(SelectionHandlePressedImageLeftProperty, value);
992 NotifyPropertyChanged();
997 /// The SelectionHandlePressedImageRight property.<br />
998 /// The image to display when the right selection handle is pressed.<br />
999 /// The selectionHandlePressedImageRight map contains the following key :<br />
1000 /// <list type="table">
1001 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1004 /// <since_tizen> 3 </since_tizen>
1005 public PropertyMap SelectionHandlePressedImageRight
1009 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
1013 SetValue(SelectionHandlePressedImageRightProperty, value);
1014 NotifyPropertyChanged();
1019 /// Set SelectionHandlePressedImage to TextField. <br />
1021 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
1023 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1026 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
1028 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
1029 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
1030 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
1031 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
1034 [EditorBrowsable(EditorBrowsableState.Never)]
1035 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
1037 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
1039 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
1041 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
1045 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
1047 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
1049 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
1055 /// Get SelectionHandlePressedImage from TextField. <br />
1057 /// <returns>The SelectionHandlePressedImage</returns>
1059 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1061 [EditorBrowsable(EditorBrowsableState.Never)]
1062 public SelectionHandleImage GetSelectionHandlePressedImage()
1064 SelectionHandleImage selectionHandleImage;
1065 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
1066 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
1068 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1070 return selectionHandleImage;
1074 /// The SelectionHandleMarkerImageLeft property.<br />
1075 /// The image to display for the left selection handle marker.<br />
1076 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
1077 /// <list type="table">
1078 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1081 /// <since_tizen> 3 </since_tizen>
1082 public PropertyMap SelectionHandleMarkerImageLeft
1086 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1090 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1091 NotifyPropertyChanged();
1096 /// The SelectionHandleMarkerImageRight property.<br />
1097 /// The image to display for the right selection handle marker.<br />
1098 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1099 /// <list type="table">
1100 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1103 /// <since_tizen> 3 </since_tizen>
1104 public PropertyMap SelectionHandleMarkerImageRight
1108 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1112 SetValue(SelectionHandleMarkerImageRightProperty, value);
1113 NotifyPropertyChanged();
1118 /// Set SelectionHandleMarkerImage to TextField. <br />
1120 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1122 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1125 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1127 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1128 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1129 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1130 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1133 [EditorBrowsable(EditorBrowsableState.Never)]
1134 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1136 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1138 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1140 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1144 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1146 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1148 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1154 /// Get SelectionHandleMarkerImage from TextField. <br />
1156 /// <returns>The SelectionHandleMarkerImage</returns>
1158 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1160 [EditorBrowsable(EditorBrowsableState.Never)]
1161 public SelectionHandleImage GetSelectionHandleMarkerImage()
1163 SelectionHandleImage selectionHandleImage;
1164 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1165 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1167 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1169 return selectionHandleImage;
1173 /// The SelectionHighlightColor property.<br />
1174 /// The color of the selection highlight.<br />
1177 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1179 /// <since_tizen> 3 </since_tizen>
1180 public Vector4 SelectionHighlightColor
1184 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1185 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1189 SetValue(SelectionHighlightColorProperty, value);
1190 NotifyPropertyChanged();
1195 /// The DecorationBoundingBox property.<br />
1196 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1199 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1201 /// <since_tizen> 3 </since_tizen>
1202 public Rectangle DecorationBoundingBox
1206 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1207 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1211 SetValue(DecorationBoundingBoxProperty, value);
1212 NotifyPropertyChanged();
1217 /// The InputMethodSettings property.<br />
1218 /// The settings to relating to the System's Input Method, Key and Value.<br />
1221 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
1224 /// The following example demonstrates how to set the InputMethodSettings property.
1226 /// InputMethod method = new InputMethod();
1227 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1228 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1229 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1230 /// method.Variation = 1;
1231 /// textField.InputMethodSettings = method.OutputMap;
1234 /// <since_tizen> 3 </since_tizen>
1235 public PropertyMap InputMethodSettings
1239 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1243 SetValue(InputMethodSettingsProperty, value);
1244 NotifyPropertyChanged();
1249 /// The InputColor property.<br />
1250 /// The color of the new input text.<br />
1253 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1255 /// <since_tizen> 3 </since_tizen>
1256 public Vector4 InputColor
1260 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1261 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1265 SetValue(InputColorProperty, value);
1266 NotifyPropertyChanged();
1271 /// The EnableMarkup property.<br />
1272 /// Whether the mark-up processing is enabled.<br />
1274 /// <since_tizen> 3 </since_tizen>
1275 public bool EnableMarkup
1279 return (bool)GetValue(EnableMarkupProperty);
1283 SetValue(EnableMarkupProperty, value);
1284 NotifyPropertyChanged();
1289 /// The InputFontFamily property.<br />
1290 /// The font's family of the new input text.<br />
1292 /// <since_tizen> 3 </since_tizen>
1293 public string InputFontFamily
1297 return (string)GetValue(InputFontFamilyProperty);
1301 SetValue(InputFontFamilyProperty, value);
1302 NotifyPropertyChanged();
1307 /// The InputFontStyle property.<br />
1308 /// The font's style of the new input text.<br />
1309 /// The inputFontStyle map contains the following keys :<br />
1310 /// <list type="table">
1311 /// <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>
1312 /// <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>
1313 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1316 /// <since_tizen> 3 </since_tizen>
1317 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1318 public PropertyMap InputFontStyle
1322 return (PropertyMap)GetValue(InputFontStyleProperty);
1326 SetValue(InputFontStyleProperty, value);
1327 NotifyPropertyChanged();
1332 /// Set InputFontStyle to TextField. <br />
1334 /// <param name="fontStyle">The FontStyle</param>
1336 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1339 /// The following example demonstrates how to use the SetInputFontStyle method.
1341 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1342 /// fontStyle.Width = FontWidthType.Expanded;
1343 /// fontStyle.Weight = FontWeightType.Bold;
1344 /// fontStyle.Slant = FontSlantType.Italic;
1345 /// field.SetInputFontStyle(fontStyle);
1348 [EditorBrowsable(EditorBrowsableState.Never)]
1349 public void SetInputFontStyle(FontStyle fontStyle)
1351 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1353 SetValue(InputFontStyleProperty, fontStyleMap);
1358 /// Get InputFontStyle from TextField. <br />
1360 /// <returns>The FontStyle</returns>
1362 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1364 [EditorBrowsable(EditorBrowsableState.Never)]
1365 public FontStyle GetInputFontStyle()
1367 FontStyle fontStyle;
1368 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1370 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1376 /// The InputPointSize property.<br />
1377 /// The font's size of the new input text in points.<br />
1379 /// <since_tizen> 3 </since_tizen>
1380 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1381 public float InputPointSize
1385 return (float)GetValue(InputPointSizeProperty);
1389 SetValue(InputPointSizeProperty, value);
1390 NotifyPropertyChanged();
1395 /// The Underline property.<br />
1396 /// The default underline parameters.<br />
1397 /// The underline map contains the following keys :<br />
1398 /// <list type="table">
1399 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1400 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1401 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1404 /// <since_tizen> 3 </since_tizen>
1405 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1406 public PropertyMap Underline
1410 return (PropertyMap)GetValue(UnderlineProperty);
1414 SetValue(UnderlineProperty, value);
1415 NotifyPropertyChanged();
1420 /// Set Underline to TextField. <br />
1422 /// <param name="underline">The Underline</param>
1424 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1427 /// The following example demonstrates how to use the SetUnderline method.
1429 /// var underline = new Tizen.NUI.Text.Underline();
1430 /// underline.Enable = true;
1431 /// underline.Color = new Color("#3498DB");
1432 /// underline.Height = 2.0f;
1433 /// field.SetUnderline(underline);
1436 [EditorBrowsable(EditorBrowsableState.Never)]
1437 public void SetUnderline(Underline underline)
1439 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1441 SetValue(UnderlineProperty, underlineMap);
1446 /// Get Underline from TextField. <br />
1448 /// <returns>The Underline</returns>
1450 /// <see cref="Tizen.NUI.Text.Underline"/>
1452 [EditorBrowsable(EditorBrowsableState.Never)]
1453 public Underline GetUnderline()
1455 Underline underline;
1456 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1458 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1464 /// The InputUnderline property.<br />
1465 /// The underline parameters of the new input text.<br />
1467 /// <since_tizen> 3 </since_tizen>
1468 public string InputUnderline
1472 return (string)GetValue(InputUnderlineProperty);
1476 SetValue(InputUnderlineProperty, value);
1477 NotifyPropertyChanged();
1482 /// The Shadow property.<br />
1483 /// The default shadow parameters.<br />
1484 /// The shadow map contains the following keys :<br />
1485 /// <list type="table">
1486 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1487 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1488 /// <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>
1491 /// <since_tizen> 3 </since_tizen>
1492 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1493 public PropertyMap Shadow
1497 return (PropertyMap)GetValue(ShadowProperty);
1501 SetValue(ShadowProperty, value);
1502 NotifyPropertyChanged();
1507 /// Set Shadow to TextField. <br />
1509 /// <param name="shadow">The Shadow</param>
1511 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1514 /// The following example demonstrates how to use the SetShadow method.
1516 /// var shadow = new Tizen.NUI.Text.Shadow();
1517 /// shadow.Offset = new Vector2(3, 3);
1518 /// shadow.Color = new Color("#F1C40F");
1519 /// field.SetShadow(shadow);
1522 [EditorBrowsable(EditorBrowsableState.Never)]
1523 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1525 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1527 SetValue(ShadowProperty, shadowMap);
1532 /// Get Shadow from TextField. <br />
1534 /// <returns>The Shadow</returns>
1536 /// <see cref="Tizen.NUI.Text.Shadow"/>
1538 [EditorBrowsable(EditorBrowsableState.Never)]
1539 public Tizen.NUI.Text.Shadow GetShadow()
1541 Tizen.NUI.Text.Shadow shadow;
1542 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1544 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1550 /// The InputShadow property.<br />
1551 /// The shadow parameters of the new input text.<br />
1553 /// <since_tizen> 3 </since_tizen>
1554 public string InputShadow
1558 return (string)GetValue(InputShadowProperty);
1562 SetValue(InputShadowProperty, value);
1563 NotifyPropertyChanged();
1568 /// The Emboss property.<br />
1569 /// The default emboss parameters.<br />
1571 /// <since_tizen> 3 </since_tizen>
1572 public string Emboss
1576 return (string)GetValue(EmbossProperty);
1580 SetValue(EmbossProperty, value);
1581 NotifyPropertyChanged();
1586 /// The InputEmboss property.<br />
1587 /// The emboss parameters of the new input text.<br />
1589 /// <since_tizen> 3 </since_tizen>
1590 public string InputEmboss
1594 return (string)GetValue(InputEmbossProperty);
1598 SetValue(InputEmbossProperty, value);
1599 NotifyPropertyChanged();
1604 /// The Outline property.<br />
1605 /// The default outline parameters.<br />
1606 /// The outline map contains the following keys :<br />
1607 /// <list type="table">
1608 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1609 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1612 /// <since_tizen> 3 </since_tizen>
1613 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1614 public PropertyMap Outline
1618 return (PropertyMap)GetValue(OutlineProperty);
1622 SetValue(OutlineProperty, value);
1623 NotifyPropertyChanged();
1628 /// Set Outline to TextField. <br />
1630 /// <param name="outline">The Outline</param>
1632 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1635 /// The following example demonstrates how to use the SetOutline method.
1637 /// var outline = new Tizen.NUI.Text.Outline();
1638 /// outline.Width = 2.0f;
1639 /// outline.Color = new Color("#45B39D");
1640 /// field.SetOutline(outline);
1643 [EditorBrowsable(EditorBrowsableState.Never)]
1644 public void SetOutline(Outline outline)
1646 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1648 SetValue(OutlineProperty, outlineMap);
1653 /// Get Outline from TextField. <br />
1655 /// <returns>The Outline</returns>
1657 /// <see cref="Tizen.NUI.Text.Outline"/>
1659 [EditorBrowsable(EditorBrowsableState.Never)]
1660 public Outline GetOutline()
1663 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1665 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1671 /// The InputOutline property.<br />
1672 /// The outline parameters of the new input text.<br />
1674 /// <since_tizen> 3 </since_tizen>
1675 public string InputOutline
1679 return (string)GetValue(InputOutlineProperty);
1683 SetValue(InputOutlineProperty, value);
1684 NotifyPropertyChanged();
1689 /// The HiddenInputSettings property.<br />
1690 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1691 /// The hiddenInputSettings map contains the following keys :<br />
1692 /// <list type="table">
1693 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1694 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1695 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1696 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1700 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1703 /// The following example demonstrates how to set the HiddenInputSettings property.
1705 /// PropertyMap map = new PropertyMap();
1706 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1707 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1708 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1709 /// textField.HiddenInputSettings = map;
1712 /// <since_tizen> 3 </since_tizen>
1713 public Tizen.NUI.PropertyMap HiddenInputSettings
1717 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1721 SetValue(HiddenInputSettingsProperty, value);
1722 NotifyPropertyChanged();
1727 /// Set HiddenInput to TextField. <br />
1729 /// <param name="hiddenInput">The HiddenInput</param>
1731 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1734 /// The following example demonstrates how to use the SetHiddenInput method.
1736 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1737 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1738 /// hiddenInput.SubstituteCharacter = '★';
1739 /// hiddenInput.SubstituteCount = 0;
1740 /// hiddenInput.ShowLastCharacterDuration = 1000;
1741 /// field.SetHiddenInput(hiddenInput);
1744 [EditorBrowsable(EditorBrowsableState.Never)]
1745 public void SetHiddenInput(HiddenInput hiddenInput)
1747 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1749 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1754 /// Get HiddenInput from TextField. <br />
1756 /// <returns>The HiddenInput</returns>
1758 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1760 [EditorBrowsable(EditorBrowsableState.Never)]
1761 public HiddenInput GetHiddenInput()
1763 HiddenInput hiddenInput;
1764 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1766 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1772 /// The PixelSize property.<br />
1773 /// The size of font in pixels.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1777 public float PixelSize
1781 return (float)GetValue(PixelSizeProperty);
1785 SetValue(PixelSizeProperty, value);
1786 NotifyPropertyChanged();
1791 /// The Enable selection property.<br />
1792 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1794 /// <since_tizen> 3 </since_tizen>
1795 public bool EnableSelection
1799 return (bool)GetValue(EnableSelectionProperty);
1803 SetValue(EnableSelectionProperty, value);
1804 NotifyPropertyChanged();
1809 /// The Enable grab handle property.<br />
1810 /// Enables the grab handles for text selection.<br />
1811 /// The default value is true, which means the grab handles are enabled by default.<br />
1813 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1814 [EditorBrowsable(EditorBrowsableState.Never)]
1815 public bool EnableGrabHandle
1819 return (bool)GetValue(EnableGrabHandleProperty);
1823 SetValue(EnableGrabHandleProperty, value);
1824 NotifyPropertyChanged();
1829 /// The Enable grab handle popup property.<br />
1830 /// Enables the grab handle popup for text selection.<br />
1831 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1833 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1834 [EditorBrowsable(EditorBrowsableState.Never)]
1835 public bool EnableGrabHandlePopup
1839 return (bool)GetValue(EnableGrabHandlePopupProperty);
1843 SetValue(EnableGrabHandlePopupProperty, value);
1844 NotifyPropertyChanged();
1849 /// The portion of the text that has been selected by the user.
1852 /// Empty string when nothing is selected.
1854 /// <since_tizen> 9 </since_tizen>
1855 public string SelectedText
1859 string selectedText;
1860 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1862 propertyValue.Get(out selectedText);
1864 return selectedText;
1869 /// The start index for selection.
1872 /// When there is no selection, the index is current cursor position.
1874 /// <since_tizen> 9 </since_tizen>
1875 public int SelectedTextStart
1879 int selectedTextStart;
1880 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1882 propertyValue.Get(out selectedTextStart);
1884 return selectedTextStart;
1889 /// The end index for selection.
1892 /// When there is no selection, the index is current cursor position.
1894 /// <since_tizen> 9 </since_tizen>
1895 public int SelectedTextEnd
1899 int selectedTextEnd;
1900 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1902 propertyValue.Get(out selectedTextEnd);
1904 return selectedTextEnd;
1909 /// Enable editing in text control.
1911 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1912 [EditorBrowsable(EditorBrowsableState.Never)]
1913 public bool EnableEditing
1917 return (bool)GetValue(EnableEditingProperty);
1921 SetValue(EnableEditingProperty, value);
1925 private bool InternalEnableEditing
1930 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1932 propertyValue.Get(out enableEditing);
1934 return enableEditing;
1938 using (var propertyValue = new PropertyValue(value))
1940 SetProperty(TextField.Property.EnableEditing, propertyValue);
1941 NotifyPropertyChanged();
1947 /// PrimaryCursorPosition property.<br />
1948 /// Specify the position of the primary cursor (caret) in text control.
1951 /// 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).
1953 /// <since_tizen> 10 </since_tizen>
1954 public int PrimaryCursorPosition
1958 return (int)GetValue(PrimaryCursorPositionProperty);
1962 SetValue(PrimaryCursorPositionProperty, value);
1966 private int InternalPrimaryCursorPosition
1970 int primaryCursorPosition;
1971 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1973 propertyValue.Get(out primaryCursorPosition);
1975 return primaryCursorPosition;
1979 using (PropertyValue propertyValue = new PropertyValue(value))
1981 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1982 NotifyPropertyChanged();
1988 /// The GrabHandleColor property.
1991 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1993 [EditorBrowsable(EditorBrowsableState.Never)]
1994 public Color GrabHandleColor
1998 Color temp = (Color)GetValue(GrabHandleColorProperty);
1999 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
2003 SetValue(GrabHandleColorProperty, value);
2004 NotifyPropertyChanged();
2009 /// The ellipsis position of the text.
2010 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2012 /// <since_tizen> 9 </since_tizen>
2013 public EllipsisPosition EllipsisPosition
2017 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2021 SetValue(EllipsisPositionProperty, value);
2022 NotifyPropertyChanged();
2027 /// The spaces between characters in Pixels.
2029 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2030 /// The default value is 0.f which does nothing.
2033 [EditorBrowsable(EditorBrowsableState.Never)]
2034 public float CharacterSpacing
2038 return (float)GetValue(CharacterSpacingProperty);
2042 SetValue(CharacterSpacingProperty, value);
2043 NotifyPropertyChanged();
2048 /// Set InputFilter to TextField.
2050 /// <param name="inputFilter">The InputFilter</param>
2052 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
2053 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
2054 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
2057 /// The following example demonstrates how to use the SetInputFilter method.
2059 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
2060 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
2061 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
2062 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
2065 /// <since_tizen> 9 </since_tizen>
2066 public void SetInputFilter(InputFilter inputFilter)
2068 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
2069 using (var propertyValue = new PropertyValue(map))
2071 SetProperty(TextField.Property.InputFilter, propertyValue);
2076 /// Get InputFilter from TextField.
2078 /// <returns>The InputFilter</returns>
2080 /// <see cref="Tizen.NUI.Text.InputFilter"/>
2082 /// <since_tizen> 9 </since_tizen>
2083 public InputFilter GetInputFilter()
2085 InputFilter inputFilter;
2086 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
2087 using (var map = new PropertyMap())
2089 propertyValue.Get(map);
2090 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2096 /// Set Strikethrough to TextField. <br />
2098 /// <param name="strikethrough">The Strikethrough</param>
2100 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2103 /// The following example demonstrates how to use the SetStrikethrough method.
2105 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2106 /// strikethrough.Enable = true;
2107 /// strikethrough.Color = new Color("#3498DB");
2108 /// strikethrough.Height = 2.0f;
2109 /// field.SetStrikethrough(strikethrough);
2112 [EditorBrowsable(EditorBrowsableState.Never)]
2113 public void SetStrikethrough(Strikethrough strikethrough)
2115 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2116 using (var propertyValue = new PropertyValue(map))
2118 SetProperty(TextField.Property.Strikethrough, propertyValue);
2123 /// Get Strikethrough from TextField. <br />
2125 /// <returns>The Strikethrough</returns>
2127 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2129 [EditorBrowsable(EditorBrowsableState.Never)]
2130 public Strikethrough GetStrikethrough()
2132 Strikethrough strikethrough;
2133 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2134 using (var map = new PropertyMap())
2136 propertyValue.Get(map);
2137 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2139 return strikethrough;
2143 /// The Placeholder property.
2144 /// The placeholder map contains the following keys :<br />
2145 /// <list type="table">
2146 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2147 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2148 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2149 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2150 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2151 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2152 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2153 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2157 /// The following example demonstrates how to set the Placeholder property.
2159 /// PropertyMap propertyMap = new PropertyMap();
2160 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2161 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2162 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2163 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2164 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2166 /// PropertyMap fontStyleMap = new PropertyMap();
2167 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2168 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2169 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2170 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2172 /// TextField field = new TextField();
2173 /// field.Placeholder = propertyMap;
2176 /// <since_tizen> 3 </since_tizen>
2177 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2178 public Tizen.NUI.PropertyMap Placeholder
2182 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2183 string defalutText = "";
2185 if (TextMapHelper.IsValue(map, 0))
2186 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2188 if (TextMapHelper.IsValue(map, 1))
2189 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2191 if (TextMapHelper.IsValue(map, 2))
2193 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2195 map.Add("color", color);
2199 if (TextMapHelper.IsValue(map, 3))
2200 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2202 if (TextMapHelper.IsValue(map, 4))
2204 using (var properyValue = map.Find(4))
2205 using (var fontStyle = new PropertyMap())
2207 properyValue.Get(fontStyle);
2208 using (var fontStyleValue = new PropertyValue(fontStyle))
2210 map.Add("fontStyle", fontStyleValue);
2215 if (TextMapHelper.IsValue(map, 5))
2216 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2218 if (TextMapHelper.IsValue(map, 6))
2219 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2221 if (TextMapHelper.IsValue(map, 7))
2222 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2228 SetValue(PlaceholderProperty, value);
2229 NotifyPropertyChanged();
2234 /// Set Placeholder to TextField. <br />
2236 /// <param name="placeholder">The Placeholder</param>
2238 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2241 /// The following example demonstrates how to use the SetPlaceholder method.
2243 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2244 /// placeholder.Text = "placeholder text";
2245 /// placeholder.TextFocused = "placeholder textFocused";
2246 /// placeholder.Color = new Color("#45B39D");
2247 /// placeholder.FontFamily = "BreezeSans";
2248 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2250 /// Width = FontWidthType.Expanded,
2251 /// Weight = FontWeightType.ExtraLight,
2252 /// Slant = FontSlantType.Italic,
2254 /// placeholder.PointSize = 25.0f;
2255 /// //placeholder.PixelSize = 50.0f;
2256 /// placeholder.Ellipsis = true;
2257 /// field.SetPlaceholder(placeholder);
2260 [EditorBrowsable(EditorBrowsableState.Never)]
2261 public void SetPlaceholder(Placeholder placeholder)
2263 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2265 SetValue(PlaceholderProperty, placeholderMap);
2270 /// Get Placeholder from TextField. <br />
2272 /// <returns>The Placeholder</returns>
2274 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2276 [EditorBrowsable(EditorBrowsableState.Never)]
2277 public Placeholder GetPlaceholder()
2279 Placeholder placeholder;
2280 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2282 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2288 /// The Ellipsis property.<br />
2289 /// Enable or disable the ellipsis.<br />
2290 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2292 /// <since_tizen> 4 </since_tizen>
2293 public bool Ellipsis
2297 return (bool)GetValue(EllipsisProperty);
2301 SetValue(EllipsisProperty, value);
2302 NotifyPropertyChanged();
2307 /// Enables selection of the text using the Shift key.
2309 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2310 [EditorBrowsable(EditorBrowsableState.Never)]
2311 public bool EnableShiftSelection
2315 return (bool)GetValue(EnableShiftSelectionProperty);
2319 SetValue(EnableShiftSelectionProperty, value);
2320 NotifyPropertyChanged();
2325 /// The text alignment to match the direction of the system language.<br />
2326 /// The default value is true.<br />
2328 /// <since_tizen> 6 </since_tizen>
2329 public bool MatchSystemLanguageDirection
2333 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2337 SetValue(MatchSystemLanguageDirectionProperty, value);
2338 NotifyPropertyChanged();
2343 /// The FontSizeScale property. <br />
2344 /// The default value is 1.0. <br />
2345 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2346 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2348 /// <since_tizen> 9 </since_tizen>
2349 public float FontSizeScale
2353 return (float)GetValue(FontSizeScaleProperty);
2357 SetValue(FontSizeScaleProperty, value);
2358 NotifyPropertyChanged();
2362 private float InternalFontSizeScale
2366 return fontSizeScale;
2370 float newFontSizeScale;
2372 if (fontSizeScale == value) return;
2374 fontSizeScale = value;
2375 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2377 SystemSettingsFontSize systemSettingsFontSize;
2381 systemSettingsFontSize = SystemSettings.FontSize;
2385 Console.WriteLine("{0} Exception caught.", e);
2386 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2388 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2389 AddSystemSettingsFontSizeChanged();
2393 newFontSizeScale = fontSizeScale;
2394 RemoveSystemSettingsFontSizeChanged();
2397 SetInternalFontSizeScale(newFontSizeScale);
2401 private void SetInternalFontSizeScale(float fontSizeScale)
2404 Object.InternalSetPropertyFloat(this.SwigCPtr, TextField.Property.FontSizeScale, (float)fontSizeScale);
2408 /// The EnableFontSizeScale property.<br />
2409 /// Whether the font size scale is enabled. (The default value is true)
2411 [EditorBrowsable(EditorBrowsableState.Never)]
2412 public bool EnableFontSizeScale
2416 return (bool)GetValue(EnableFontSizeScaleProperty);
2420 SetValue(EnableFontSizeScaleProperty, value);
2421 NotifyPropertyChanged();
2426 /// Get the InputMethodContext instance.
2428 /// <returns>The InputMethodContext instance.</returns>
2429 /// <since_tizen> 5 </since_tizen>
2430 public InputMethodContext GetInputMethodContext()
2432 if (inputMethodCotext == null)
2434 /*Avoid raising InputMethodContext reference count.*/
2435 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2438 return inputMethodCotext;
2442 /// Select the whole text.
2444 /// <since_tizen> 9 </since_tizen>
2445 public void SelectWholeText()
2447 Interop.TextField.SelectWholeText(SwigCPtr);
2448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2452 /// Select text from start to end index. <br />
2453 /// The index is valid when 0 or positive.
2455 /// <param name="start">The start index for selection.</param>
2456 /// <param name="end">The end index for selection.</param>
2458 /// If the end index exceeds the maximum value, it is set to the length of the text.
2460 /// <since_tizen> 9 </since_tizen>
2461 public void SelectText(int start, int end)
2464 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2466 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2468 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2473 /// Clear selection of the text. <br />
2474 /// Valid when selection is activate.
2476 /// <since_tizen> 9 </since_tizen>
2477 public void SelectNone()
2479 _ = Interop.TextField.SelectNone(SwigCPtr);
2480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2483 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2485 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));
2486 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2493 /// <since_tizen> 3 </since_tizen>
2494 protected override void Dispose(DisposeTypes type)
2501 internalPlaceholderTextColor?.Dispose();
2502 internalPrimaryCursorColor?.Dispose();
2503 internalSecondaryCursorColor?.Dispose();
2504 internalSelectionHighlightColor?.Dispose();
2505 internalInputColor?.Dispose();
2506 internalTextColor?.Dispose();
2507 internalGrabHandleColor?.Dispose();
2509 if (hasSystemLanguageChanged)
2511 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
2514 RemoveSystemSettingsFontTypeChanged();
2515 RemoveSystemSettingsFontSizeChanged();
2517 if (type == DisposeTypes.Explicit)
2520 //Release your own managed resources here.
2521 //You should release all of your own disposable objects here.
2524 //Release your own unmanaged resources here.
2525 //You should not access any managed member here except static instance.
2526 //because the execution order of Finalizes is non-deterministic.
2529 if (textFieldCursorPositionChangedCallbackDelegate != null)
2531 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2534 if (textFieldMaxLengthReachedCallbackDelegate != null)
2536 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2539 if (textFieldSelectionStartedCallbackDelegate != null)
2541 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2544 if (textFieldSelectionClearedCallbackDelegate != null)
2546 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2549 if (textFieldSelectionChangedCallbackDelegate != null)
2551 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2554 if (textFieldTextChangedCallbackDelegate != null)
2556 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2560 TextChanged -= TextFieldTextChanged;
2561 GetInputMethodContext()?.DestroyContext();
2566 /// This will not be public opened.
2567 [EditorBrowsable(EditorBrowsableState.Never)]
2568 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2570 Interop.TextField.DeleteTextField(swigCPtr);
2573 internal override LayoutItem CreateDefaultLayout()
2575 return new TextFieldLayout();
2578 internal void SetTextWithoutTextChanged(string text)
2580 invokeTextChanged = false;
2581 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2582 invokeTextChanged = true;
2585 private string SetTranslatable(string textFieldSid)
2587 string translatableText = null;
2588 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2589 if (translatableText != null)
2591 if (hasSystemLanguageChanged == false)
2593 systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
2594 hasSystemLanguageChanged = true;
2596 return translatableText;
2600 translatableText = "";
2601 return translatableText;
2605 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2607 if (textFieldTextSid != null)
2609 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2611 if (textFieldPlaceHolderTextSid != null)
2613 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2615 if (textFieldPlaceHolderTextFocusedSid != null)
2617 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2621 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2623 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2624 SetInternalFontSizeScale(newFontSizeScale);
2627 private void AddSystemSettingsFontSizeChanged()
2629 if (hasSystemFontSizeChanged != true)
2633 SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
2634 hasSystemFontSizeChanged = true;
2638 Console.WriteLine("{0} Exception caught.", e);
2639 hasSystemFontSizeChanged = false;
2644 private void RemoveSystemSettingsFontSizeChanged()
2646 if (hasSystemFontSizeChanged == true)
2650 SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
2651 hasSystemFontSizeChanged = false;
2655 Console.WriteLine("{0} Exception caught.", e);
2656 hasSystemFontSizeChanged = true;
2661 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2663 SetInternalFontFamily(e.Value);
2666 private void AddSystemSettingsFontTypeChanged()
2668 if (HasStyle() && !hasSystemFontTypeChanged)
2672 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2673 hasSystemFontTypeChanged = true;
2677 Console.WriteLine("{0} Exception caught.", e);
2678 hasSystemFontTypeChanged = false;
2683 private void RemoveSystemSettingsFontTypeChanged()
2685 if (hasSystemFontTypeChanged)
2689 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2690 hasSystemFontTypeChanged = false;
2694 Console.WriteLine("{0} Exception caught.", e);
2695 hasSystemFontTypeChanged = true;
2700 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2702 if (!isSettingTextInCSharp)
2704 EnforceNotifyBindedInstance(TextProperty);
2708 internal new class Property
2710 internal static readonly int TEXT = Interop.TextField.TextGet();
2711 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2712 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2713 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2714 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2715 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2716 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2717 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2718 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2719 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2720 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2721 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2722 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2723 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2724 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2725 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2726 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2727 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2728 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2729 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2730 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2731 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2732 internal static readonly int SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet();
2733 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2734 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2735 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2736 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2737 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2738 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2739 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2740 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2741 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2742 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2743 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2744 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2745 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2746 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2747 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2748 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2749 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2750 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2751 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2752 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2753 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2754 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2755 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2756 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2757 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2758 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2759 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2760 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2761 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2762 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2763 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2764 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2765 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2766 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2767 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2768 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2769 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2770 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2771 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2772 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2773 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2774 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2775 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2777 internal static void Preload()
2779 // Do nothing. Just call for load static values.
2783 internal class InputStyle
2789 FontFamily = 0x0002,
2799 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2801 DecorationBoundingBox = new Rectangle(x, y, width, height);
2803 private void OnInputColorChanged(float x, float y, float z, float w)
2805 InputColor = new Vector4(x, y, z, w);
2807 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2809 PlaceholderTextColor = new Vector4(r, g, b, a);
2811 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2813 PrimaryCursorColor = new Vector4(x, y, z, w);
2815 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2817 SecondaryCursorColor = new Vector4(x, y, z, w);
2819 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2821 SelectionHighlightColor = new Vector4(x, y, z, w);
2823 private void OnShadowColorChanged(float x, float y, float z, float w)
2825 ShadowColor = new Vector4(x, y, z, w);
2827 private void OnShadowOffsetChanged(float x, float y)
2829 ShadowOffset = new Vector2(x, y);
2831 private void OnTextColorChanged(float r, float g, float b, float a)
2833 TextColor = new Color(r, g, b, a);
2835 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2837 GrabHandleColor = new Color(r, g, b, a);
2840 private class TextFieldLayout : LayoutItem
2842 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2844 // Padding will be automatically applied by DALi TextField.
2845 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2846 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2847 var minSize = Owner.MinimumSize;
2848 var maxSize = Owner.MaximumSize;
2849 var naturalSize = Owner.GetNaturalSize();
2851 if (((TextField)Owner).Text.Length == 0)
2853 // Calculate height of TextField by setting Text with " ".
2854 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2855 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2857 // Store original WidthSpecification to restore it after setting ResizePolicy.
2858 var widthSpecification = Owner.WidthSpecification;
2860 // In DALi's Size logic, if Width or Height is set to be 0, then
2861 // ResizePolicy is not changed to Fixed.
2862 // This causes Size changes after NUI Layout's OnMeasure is finished.
2863 // e.g. TextField's Width fills to its parent although Text is null and
2864 // WidthSpecification is WrapContent.
2865 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2866 // in advance if Text is null.
2867 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2869 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2870 Owner.WidthSpecification = widthSpecification;
2872 naturalSize = Owner.GetNaturalSize();
2874 // Restore TextField's Text after calculating height of TextField.
2875 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2876 ((TextField)Owner).SetTextWithoutTextChanged("");
2879 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2881 float width = naturalSize != null ? naturalSize.Width : 0;
2882 totalWidth = Math.Min(Math.Max(width, minSize.Width), maxSize.Width);
2885 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2887 float height = naturalSize != null ? naturalSize.Height : 0;
2888 totalHeight = Math.Min(Math.Max(height, minSize.Height), maxSize.Height);
2891 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2892 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2894 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2895 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2897 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2898 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));