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 enum ExceedPolicyType
120 ExceedPolicyOriginal,
124 private bool HasStyle()
126 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
130 /// The TranslatableText property.<br />
131 /// The text can set the SID value.<br />
133 /// <exception cref='ArgumentNullException'>
134 /// ResourceManager about multilingual is null.
136 /// <since_tizen> 4 </since_tizen>
137 public string TranslatableText
141 return (string)GetValue(TranslatableTextProperty);
145 SetValue(TranslatableTextProperty, value);
148 private string translatableText
152 return textFieldTextSid;
156 if (NUIApplication.MultilingualResourceManager == null)
158 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
160 textFieldTextSid = value;
161 Text = SetTranslatable(textFieldTextSid);
162 NotifyPropertyChanged();
167 /// The TranslatablePlaceholderText property.<br />
168 /// The text can set the SID value.<br />
170 /// <exception cref='ArgumentNullException'>
171 /// ResourceManager about multilingual is null.
173 /// <since_tizen> 4 </since_tizen>
174 public string TranslatablePlaceholderText
178 return (string)GetValue(TranslatablePlaceholderTextProperty);
182 SetValue(TranslatablePlaceholderTextProperty, value);
185 private string translatablePlaceholderText
189 return textFieldPlaceHolderTextSid;
193 if (NUIApplication.MultilingualResourceManager == null)
195 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
197 textFieldPlaceHolderTextSid = value;
198 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
199 NotifyPropertyChanged();
204 /// The TranslatablePlaceholderTextFocused property.<br />
205 /// The text can set the SID value.<br />
207 /// <exception cref='ArgumentNullException'>
208 /// ResourceManager about multilingual is null.
210 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public string TranslatablePlaceholderTextFocused
216 return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
220 SetValue(TranslatablePlaceholderTextFocusedProperty, value);
223 private string translatablePlaceholderTextFocused
227 return textFieldPlaceHolderTextFocusedSid;
231 if (NUIApplication.MultilingualResourceManager == null)
233 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
235 textFieldPlaceHolderTextFocusedSid = value;
236 PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
237 NotifyPropertyChanged();
242 /// The Text property.<br />
243 /// The text to display in the UTF-8 format.<br />
245 /// <since_tizen> 3 </since_tizen>
250 return (string)GetValue(TextProperty);
254 SetValue(TextProperty, value);
255 NotifyPropertyChanged();
260 /// The PlaceholderText property.<br />
261 /// The text to display when the TextField is empty and inactive. <br />
263 /// <since_tizen> 3 </since_tizen>
264 public string PlaceholderText
268 return (string)GetValue(PlaceholderTextProperty);
272 SetValue(PlaceholderTextProperty, value);
273 NotifyPropertyChanged();
278 /// The PlaceholderTextFocused property. <br />
279 /// The text to display when the TextField is empty with input focus. <br />
281 /// <since_tizen> 3 </since_tizen>
282 public string PlaceholderTextFocused
286 return (string)GetValue(PlaceholderTextFocusedProperty);
290 SetValue(PlaceholderTextFocusedProperty, value);
291 NotifyPropertyChanged();
296 /// The FontFamily property.<br />
297 /// The requested font family to use.<br />
299 /// <since_tizen> 3 </since_tizen>
300 public string FontFamily
304 return (string)GetValue(FontFamilyProperty);
308 SetValue(FontFamilyProperty, value);
309 NotifyPropertyChanged();
313 private string InternalFontFamily
320 return Object.InternalGetPropertyString(this.SwigCPtr, TextField.Property.FontFamily);
324 string newFontFamily;
326 if (string.Equals(fontFamily, value)) return;
329 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
333 newFontFamily = SystemSettings.FontType;
337 Console.WriteLine("{0} Exception caught.", e);
338 newFontFamily = defaultFontFamily;
340 AddSystemSettingsFontTypeChanged();
344 newFontFamily = fontFamily;
345 RemoveSystemSettingsFontTypeChanged();
348 SetInternalFontFamily(newFontFamily);
352 private void SetInternalFontFamily(string fontFamily)
354 Object.InternalSetPropertyString(this.SwigCPtr, TextField.Property.FontFamily, (string)fontFamily);
358 /// The FontStyle property.<br />
359 /// The requested font style to use.<br />
360 /// The fontStyle map contains the following keys :<br />
361 /// <list type="table">
362 /// <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>
363 /// <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>
364 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
367 /// <since_tizen> 3 </since_tizen>
368 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
369 public PropertyMap FontStyle
373 return (PropertyMap)GetValue(FontStyleProperty);
377 SetValue(FontStyleProperty, value);
378 NotifyPropertyChanged();
383 /// Set FontStyle to TextField. <br />
385 /// <param name="fontStyle">The FontStyle</param>
387 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
390 /// The following example demonstrates how to use the SetFontStyle method.
392 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
393 /// fontStyle.Width = FontWidthType.Expanded;
394 /// fontStyle.Weight = FontWeightType.Bold;
395 /// fontStyle.Slant = FontSlantType.Italic;
396 /// field.SetFontStyle(fontStyle);
399 [EditorBrowsable(EditorBrowsableState.Never)]
400 public void SetFontStyle(FontStyle fontStyle)
402 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
404 SetValue(FontStyleProperty, fontStyleMap);
409 /// Get FontStyle from TextField. <br />
411 /// <returns>The FontStyle</returns>
413 /// <see cref="Tizen.NUI.Text.FontStyle"/>
415 [EditorBrowsable(EditorBrowsableState.Never)]
416 public FontStyle GetFontStyle()
419 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
421 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
427 /// The PointSize property.<br />
428 /// The size of font in points.<br />
430 /// <since_tizen> 3 </since_tizen>
431 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
432 public float PointSize
436 return (float)GetValue(PointSizeProperty);
440 SetValue(PointSizeProperty, value);
441 NotifyPropertyChanged();
446 /// The MaxLength property.<br />
447 /// The maximum number of characters that can be inserted.<br />
449 /// <since_tizen> 3 </since_tizen>
454 return (int)GetValue(MaxLengthProperty);
458 SetValue(MaxLengthProperty, value);
459 NotifyPropertyChanged();
464 /// The ExceedPolicy property.<br />
465 /// Specifies how the text is truncated when it does not fit.<br />
467 /// <since_tizen> 3 </since_tizen>
468 public int ExceedPolicy
472 return (int)GetValue(ExceedPolicyProperty);
476 SetValue(ExceedPolicyProperty, value);
477 NotifyPropertyChanged();
482 /// The HorizontalAlignment property.<br />
483 /// The line horizontal alignment.<br />
485 /// <since_tizen> 3 </since_tizen>
486 public HorizontalAlignment HorizontalAlignment
490 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
494 SetValue(HorizontalAlignmentProperty, value);
495 NotifyPropertyChanged();
500 /// The VerticalAlignment property.<br />
501 /// The line vertical alignment.<br />
503 /// <since_tizen> 3 </since_tizen>
504 public VerticalAlignment VerticalAlignment
508 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
512 SetValue(VerticalAlignmentProperty, value);
513 NotifyPropertyChanged();
514 NotifyPropertyChanged();
519 /// The TextColor property.<br />
520 /// The color of the text.<br />
523 /// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
525 /// <since_tizen> 3 </since_tizen>
526 public Color TextColor
530 Color temp = (Color)GetValue(TextColorProperty);
531 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
535 SetValue(TextColorProperty, value);
536 NotifyPropertyChanged();
541 /// The PlaceholderTextColor property.
544 /// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
546 /// <since_tizen> 3 </since_tizen>
547 public Vector4 PlaceholderTextColor
551 Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
552 return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
556 SetValue(PlaceholderTextColorProperty, value);
557 NotifyPropertyChanged();
562 /// The ShadowOffset property.
564 /// <since_tizen> 3 </since_tizen>
566 /// Deprecated.(API Level 6) Use Shadow instead.
567 /// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
569 [Obsolete("Do not use this ShadowOffset(Deprecated). Use Shadow instead.")]
570 public Vector2 ShadowOffset
574 return GetValue(ShadowOffsetProperty) as Vector2;
578 SetValue(ShadowOffsetProperty, value);
582 private Vector2 InternalShadowOffset
586 float x = 0.0f, y = 0.0f;
587 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "offset"))
588 using (var shadowOffset = new Vector2())
590 if (null != propertyValue)
592 propertyValue.Get(shadowOffset);
597 return new Vector2(OnShadowOffsetChanged, x, y);
601 using (var map = new PropertyMap())
603 map.Add("offset", value);
604 var shadowMap = Shadow;
605 shadowMap.Merge(map);
606 SetValue(ShadowProperty, shadowMap);
607 NotifyPropertyChanged();
613 /// The ShadowColor property.
615 /// <since_tizen> 3 </since_tizen>
617 /// Deprecated.(API Level 6) Use Shadow instead.
618 /// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
620 [Obsolete("Do not use this ShadowColor(Deprecated). Use Shadow instead.")]
621 public Vector4 ShadowColor
625 return GetValue(ShadowColorProperty) as Vector4;
629 SetValue(ShadowColorProperty, value);
633 private Vector4 InternalShadowColor
637 float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
638 using (var propertyValue = Shadow.Find(TextField.Property.SHADOW, "color"))
639 using (var shadowColor = new Vector4())
641 if (null != propertyValue)
643 propertyValue.Get(shadowColor);
650 return new Vector4(OnShadowColorChanged, x, y, z, w);
654 using (var map = new PropertyMap())
656 map.Add("color", value);
657 var shadowMap = Shadow;
658 shadowMap.Merge(map);
659 SetValue(ShadowProperty, shadowMap);
660 NotifyPropertyChanged();
666 /// The PrimaryCursorColor property.<br />
667 /// The color to apply to the primary cursor.<br />
670 /// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
672 /// <since_tizen> 3 </since_tizen>
673 public Vector4 PrimaryCursorColor
677 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
678 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
682 SetValue(PrimaryCursorColorProperty, value);
683 NotifyPropertyChanged();
688 /// The SecondaryCursorColor property.<br />
689 /// The color to apply to the secondary cursor.<br />
692 /// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
694 /// <since_tizen> 3 </since_tizen>
695 public Vector4 SecondaryCursorColor
699 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
700 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
704 SetValue(SecondaryCursorColorProperty, value);
705 NotifyPropertyChanged();
710 /// The EnableCursorBlink property.<br />
711 /// Whether the cursor should blink or not.<br />
713 /// <since_tizen> 3 </since_tizen>
714 public bool EnableCursorBlink
718 return (bool)GetValue(EnableCursorBlinkProperty);
722 SetValue(EnableCursorBlinkProperty, value);
723 NotifyPropertyChanged();
728 /// The CursorBlinkInterval property.<br />
729 /// The time interval in seconds between cursor on/off states.<br />
731 /// <since_tizen> 3 </since_tizen>
732 public float CursorBlinkInterval
736 return (float)GetValue(CursorBlinkIntervalProperty);
740 SetValue(CursorBlinkIntervalProperty, value);
741 NotifyPropertyChanged();
746 /// The CursorBlinkDuration property.<br />
747 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
749 /// <since_tizen> 3 </since_tizen>
750 public float CursorBlinkDuration
754 return (float)GetValue(CursorBlinkDurationProperty);
758 SetValue(CursorBlinkDurationProperty, value);
759 NotifyPropertyChanged();
764 /// The CursorWidth property.
766 /// <since_tizen> 3 </since_tizen>
767 public int CursorWidth
771 return (int)GetValue(CursorWidthProperty);
775 SetValue(CursorWidthProperty, value);
776 NotifyPropertyChanged();
781 /// The GrabHandleImage property.<br />
782 /// The image to display for the grab handle.<br />
784 /// <since_tizen> 3 </since_tizen>
785 public string GrabHandleImage
789 return (string)GetValue(GrabHandleImageProperty);
793 SetValue(GrabHandleImageProperty, value);
794 NotifyPropertyChanged();
799 /// The GrabHandlePressedImage property.<br />
800 /// The image to display when the grab handle is pressed.<br />
802 /// <since_tizen> 3 </since_tizen>
803 public string GrabHandlePressedImage
807 return (string)GetValue(GrabHandlePressedImageProperty);
811 SetValue(GrabHandlePressedImageProperty, value);
812 NotifyPropertyChanged();
817 /// The ScrollThreshold property.<br />
818 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
820 /// <since_tizen> 3 </since_tizen>
821 public float ScrollThreshold
825 return (float)GetValue(ScrollThresholdProperty);
829 SetValue(ScrollThresholdProperty, value);
830 NotifyPropertyChanged();
835 /// The ScrollSpeed property.<br />
836 /// The scroll speed in pixels per second.<br />
838 /// <since_tizen> 3 </since_tizen>
839 public float ScrollSpeed
843 return (float)GetValue(ScrollSpeedProperty);
847 SetValue(ScrollSpeedProperty, value);
848 NotifyPropertyChanged();
853 /// The SelectionPopupStyle property.<br />
854 /// The style of the text selection popup can be set through SelectionPopupStyle property.
856 [EditorBrowsable(EditorBrowsableState.Never)]
857 public PropertyMap SelectionPopupStyle
861 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
865 SetValue(SelectionPopupStyleProperty, value);
866 NotifyPropertyChanged();
871 /// The SelectionHandleImageLeft property.<br />
872 /// The image to display for the left selection handle.<br />
873 /// The selectionHandleImageLeft map contains the following key :<br />
874 /// <list type="table">
875 /// <item><term>filename (string)</term><description>The path of image file</description></item>
878 /// <since_tizen> 3 </since_tizen>
879 public PropertyMap SelectionHandleImageLeft
883 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
887 SetValue(SelectionHandleImageLeftProperty, value);
888 NotifyPropertyChanged();
893 /// The SelectionHandleImageRight property.<br />
894 /// The image to display for the right selection handle.<br />
895 /// The selectionHandleImageRight map contains the following key :<br />
896 /// <list type="table">
897 /// <item><term>filename (string)</term><description>The path of image file</description></item>
900 /// <since_tizen> 3 </since_tizen>
901 public PropertyMap SelectionHandleImageRight
905 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
909 SetValue(SelectionHandleImageRightProperty, value);
910 NotifyPropertyChanged();
915 /// Set SelectionHandleImage to TextField. <br />
917 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
919 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
922 /// The following example demonstrates how to use the SetSelectionHandleImage method.
924 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
925 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
926 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
927 /// field.SetSelectionHandleImage(selectionHandleImage);
930 [EditorBrowsable(EditorBrowsableState.Never)]
931 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
933 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
935 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
937 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
941 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
943 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
945 SetValue(SelectionHandleImageRightProperty, rightImageMap);
951 /// Get SelectionHandleImage from TextField. <br />
953 /// <returns>The SelectionHandleImage</returns>
955 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
957 [EditorBrowsable(EditorBrowsableState.Never)]
958 public SelectionHandleImage GetSelectionHandleImage()
960 SelectionHandleImage selectionHandleImage;
961 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
962 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
964 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
966 return selectionHandleImage;
970 /// The SelectionHandlePressedImageLeft property.<br />
971 /// The image to display when the left selection handle is pressed.<br />
972 /// The selectionHandlePressedImageLeft map contains the following key :<br />
973 /// <list type="table">
974 /// <item><term>filename (string)</term><description>The path of image file</description></item>
977 /// <since_tizen> 3 </since_tizen>
978 public PropertyMap SelectionHandlePressedImageLeft
982 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
986 SetValue(SelectionHandlePressedImageLeftProperty, value);
987 NotifyPropertyChanged();
992 /// The SelectionHandlePressedImageRight property.<br />
993 /// The image to display when the right selection handle is pressed.<br />
994 /// The selectionHandlePressedImageRight map contains the following key :<br />
995 /// <list type="table">
996 /// <item><term>filename (string)</term><description>The path of image file</description></item>
999 /// <since_tizen> 3 </since_tizen>
1000 public PropertyMap SelectionHandlePressedImageRight
1004 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
1008 SetValue(SelectionHandlePressedImageRightProperty, value);
1009 NotifyPropertyChanged();
1014 /// Set SelectionHandlePressedImage to TextField. <br />
1016 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
1018 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1021 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
1023 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
1024 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
1025 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
1026 /// field.SetSelectionHandlePressedImage(selectionHandlePressedImage);
1029 [EditorBrowsable(EditorBrowsableState.Never)]
1030 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
1032 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
1034 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
1036 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
1040 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
1042 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
1044 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
1050 /// Get SelectionHandlePressedImage from TextField. <br />
1052 /// <returns>The SelectionHandlePressedImage</returns>
1054 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1056 [EditorBrowsable(EditorBrowsableState.Never)]
1057 public SelectionHandleImage GetSelectionHandlePressedImage()
1059 SelectionHandleImage selectionHandleImage;
1060 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
1061 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
1063 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1065 return selectionHandleImage;
1069 /// The SelectionHandleMarkerImageLeft property.<br />
1070 /// The image to display for the left selection handle marker.<br />
1071 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
1072 /// <list type="table">
1073 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1076 /// <since_tizen> 3 </since_tizen>
1077 public PropertyMap SelectionHandleMarkerImageLeft
1081 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
1085 SetValue(SelectionHandleMarkerImageLeftProperty, value);
1086 NotifyPropertyChanged();
1091 /// The SelectionHandleMarkerImageRight property.<br />
1092 /// The image to display for the right selection handle marker.<br />
1093 /// The selectionHandleMarkerImageRight map contains the following key :<br />
1094 /// <list type="table">
1095 /// <item><term>filename (string)</term><description>The path of image file</description></item>
1098 /// <since_tizen> 3 </since_tizen>
1099 public PropertyMap SelectionHandleMarkerImageRight
1103 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
1107 SetValue(SelectionHandleMarkerImageRightProperty, value);
1108 NotifyPropertyChanged();
1113 /// Set SelectionHandleMarkerImage to TextField. <br />
1115 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
1117 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
1120 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
1122 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
1123 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
1124 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
1125 /// field.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
1128 [EditorBrowsable(EditorBrowsableState.Never)]
1129 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
1131 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
1133 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
1135 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
1139 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
1141 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
1143 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
1149 /// Get SelectionHandleMarkerImage from TextField. <br />
1151 /// <returns>The SelectionHandleMarkerImage</returns>
1153 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
1155 [EditorBrowsable(EditorBrowsableState.Never)]
1156 public SelectionHandleImage GetSelectionHandleMarkerImage()
1158 SelectionHandleImage selectionHandleImage;
1159 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
1160 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
1162 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
1164 return selectionHandleImage;
1168 /// The SelectionHighlightColor property.<br />
1169 /// The color of the selection highlight.<br />
1172 /// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
1174 /// <since_tizen> 3 </since_tizen>
1175 public Vector4 SelectionHighlightColor
1179 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
1180 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1184 SetValue(SelectionHighlightColorProperty, value);
1185 NotifyPropertyChanged();
1190 /// The DecorationBoundingBox property.<br />
1191 /// The decorations (handles etc) will positioned within this area on-screen.<br />
1194 /// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
1196 /// <since_tizen> 3 </since_tizen>
1197 public Rectangle DecorationBoundingBox
1201 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
1202 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
1206 SetValue(DecorationBoundingBoxProperty, value);
1207 NotifyPropertyChanged();
1212 /// The InputMethodSettings property.<br />
1213 /// The settings to relating to the System's Input Method, Key and Value.<br />
1216 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
1219 /// The following example demonstrates how to set the InputMethodSettings property.
1221 /// InputMethod method = new InputMethod();
1222 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1223 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1224 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1225 /// method.Variation = 1;
1226 /// textField.InputMethodSettings = method.OutputMap;
1229 /// <since_tizen> 3 </since_tizen>
1230 public PropertyMap InputMethodSettings
1234 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1238 SetValue(InputMethodSettingsProperty, value);
1239 NotifyPropertyChanged();
1244 /// The InputColor property.<br />
1245 /// The color of the new input text.<br />
1248 /// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
1250 /// <since_tizen> 3 </since_tizen>
1251 public Vector4 InputColor
1255 Vector4 temp = (Vector4)GetValue(InputColorProperty);
1256 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
1260 SetValue(InputColorProperty, value);
1261 NotifyPropertyChanged();
1266 /// The EnableMarkup property.<br />
1267 /// Whether the mark-up processing is enabled.<br />
1269 /// <since_tizen> 3 </since_tizen>
1270 public bool EnableMarkup
1274 return (bool)GetValue(EnableMarkupProperty);
1278 SetValue(EnableMarkupProperty, value);
1279 NotifyPropertyChanged();
1284 /// The InputFontFamily property.<br />
1285 /// The font's family of the new input text.<br />
1287 /// <since_tizen> 3 </since_tizen>
1288 public string InputFontFamily
1292 return (string)GetValue(InputFontFamilyProperty);
1296 SetValue(InputFontFamilyProperty, value);
1297 NotifyPropertyChanged();
1302 /// The InputFontStyle property.<br />
1303 /// The font's style of the new input text.<br />
1304 /// The inputFontStyle map contains the following keys :<br />
1305 /// <list type="table">
1306 /// <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>
1307 /// <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>
1308 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1311 /// <since_tizen> 3 </since_tizen>
1312 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1313 public PropertyMap InputFontStyle
1317 return (PropertyMap)GetValue(InputFontStyleProperty);
1321 SetValue(InputFontStyleProperty, value);
1322 NotifyPropertyChanged();
1327 /// Set InputFontStyle to TextField. <br />
1329 /// <param name="fontStyle">The FontStyle</param>
1331 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1334 /// The following example demonstrates how to use the SetInputFontStyle method.
1336 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1337 /// fontStyle.Width = FontWidthType.Expanded;
1338 /// fontStyle.Weight = FontWeightType.Bold;
1339 /// fontStyle.Slant = FontSlantType.Italic;
1340 /// field.SetInputFontStyle(fontStyle);
1343 [EditorBrowsable(EditorBrowsableState.Never)]
1344 public void SetInputFontStyle(FontStyle fontStyle)
1346 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1348 SetValue(InputFontStyleProperty, fontStyleMap);
1353 /// Get InputFontStyle from TextField. <br />
1355 /// <returns>The FontStyle</returns>
1357 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1359 [EditorBrowsable(EditorBrowsableState.Never)]
1360 public FontStyle GetInputFontStyle()
1362 FontStyle fontStyle;
1363 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1365 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1371 /// The InputPointSize property.<br />
1372 /// The font's size of the new input text in points.<br />
1374 /// <since_tizen> 3 </since_tizen>
1375 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1376 public float InputPointSize
1380 return (float)GetValue(InputPointSizeProperty);
1384 SetValue(InputPointSizeProperty, value);
1385 NotifyPropertyChanged();
1390 /// The Underline property.<br />
1391 /// The default underline parameters.<br />
1392 /// The underline map contains the following keys :<br />
1393 /// <list type="table">
1394 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1395 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1396 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1399 /// <since_tizen> 3 </since_tizen>
1400 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1401 public PropertyMap Underline
1405 return (PropertyMap)GetValue(UnderlineProperty);
1409 SetValue(UnderlineProperty, value);
1410 NotifyPropertyChanged();
1415 /// Set Underline to TextField. <br />
1417 /// <param name="underline">The Underline</param>
1419 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1422 /// The following example demonstrates how to use the SetUnderline method.
1424 /// var underline = new Tizen.NUI.Text.Underline();
1425 /// underline.Enable = true;
1426 /// underline.Color = new Color("#3498DB");
1427 /// underline.Height = 2.0f;
1428 /// field.SetUnderline(underline);
1431 [EditorBrowsable(EditorBrowsableState.Never)]
1432 public void SetUnderline(Underline underline)
1434 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1436 SetValue(UnderlineProperty, underlineMap);
1441 /// Get Underline from TextField. <br />
1443 /// <returns>The Underline</returns>
1445 /// <see cref="Tizen.NUI.Text.Underline"/>
1447 [EditorBrowsable(EditorBrowsableState.Never)]
1448 public Underline GetUnderline()
1450 Underline underline;
1451 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1453 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1459 /// The InputUnderline property.<br />
1460 /// The underline parameters of the new input text.<br />
1462 /// <since_tizen> 3 </since_tizen>
1463 public string InputUnderline
1467 return (string)GetValue(InputUnderlineProperty);
1471 SetValue(InputUnderlineProperty, value);
1472 NotifyPropertyChanged();
1477 /// The Shadow property.<br />
1478 /// The default shadow parameters.<br />
1479 /// The shadow map contains the following keys :<br />
1480 /// <list type="table">
1481 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1482 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1483 /// <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>
1486 /// <since_tizen> 3 </since_tizen>
1487 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1488 public PropertyMap Shadow
1492 return (PropertyMap)GetValue(ShadowProperty);
1496 SetValue(ShadowProperty, value);
1497 NotifyPropertyChanged();
1502 /// Set Shadow to TextField. <br />
1504 /// <param name="shadow">The Shadow</param>
1506 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1509 /// The following example demonstrates how to use the SetShadow method.
1511 /// var shadow = new Tizen.NUI.Text.Shadow();
1512 /// shadow.Offset = new Vector2(3, 3);
1513 /// shadow.Color = new Color("#F1C40F");
1514 /// field.SetShadow(shadow);
1517 [EditorBrowsable(EditorBrowsableState.Never)]
1518 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1520 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1522 SetValue(ShadowProperty, shadowMap);
1527 /// Get Shadow from TextField. <br />
1529 /// <returns>The Shadow</returns>
1531 /// <see cref="Tizen.NUI.Text.Shadow"/>
1533 [EditorBrowsable(EditorBrowsableState.Never)]
1534 public Tizen.NUI.Text.Shadow GetShadow()
1536 Tizen.NUI.Text.Shadow shadow;
1537 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1539 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1545 /// The InputShadow property.<br />
1546 /// The shadow parameters of the new input text.<br />
1548 /// <since_tizen> 3 </since_tizen>
1549 public string InputShadow
1553 return (string)GetValue(InputShadowProperty);
1557 SetValue(InputShadowProperty, value);
1558 NotifyPropertyChanged();
1563 /// The Emboss property.<br />
1564 /// The default emboss parameters.<br />
1566 /// <since_tizen> 3 </since_tizen>
1567 public string Emboss
1571 return (string)GetValue(EmbossProperty);
1575 SetValue(EmbossProperty, value);
1576 NotifyPropertyChanged();
1581 /// The InputEmboss property.<br />
1582 /// The emboss parameters of the new input text.<br />
1584 /// <since_tizen> 3 </since_tizen>
1585 public string InputEmboss
1589 return (string)GetValue(InputEmbossProperty);
1593 SetValue(InputEmbossProperty, value);
1594 NotifyPropertyChanged();
1599 /// The Outline property.<br />
1600 /// The default outline parameters.<br />
1601 /// The outline map contains the following keys :<br />
1602 /// <list type="table">
1603 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1604 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1607 /// <since_tizen> 3 </since_tizen>
1608 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1609 public PropertyMap Outline
1613 return (PropertyMap)GetValue(OutlineProperty);
1617 SetValue(OutlineProperty, value);
1618 NotifyPropertyChanged();
1623 /// Set Outline to TextField. <br />
1625 /// <param name="outline">The Outline</param>
1627 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1630 /// The following example demonstrates how to use the SetOutline method.
1632 /// var outline = new Tizen.NUI.Text.Outline();
1633 /// outline.Width = 2.0f;
1634 /// outline.Color = new Color("#45B39D");
1635 /// field.SetOutline(outline);
1638 [EditorBrowsable(EditorBrowsableState.Never)]
1639 public void SetOutline(Outline outline)
1641 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1643 SetValue(OutlineProperty, outlineMap);
1648 /// Get Outline from TextField. <br />
1650 /// <returns>The Outline</returns>
1652 /// <see cref="Tizen.NUI.Text.Outline"/>
1654 [EditorBrowsable(EditorBrowsableState.Never)]
1655 public Outline GetOutline()
1658 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1660 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1666 /// The InputOutline property.<br />
1667 /// The outline parameters of the new input text.<br />
1669 /// <since_tizen> 3 </since_tizen>
1670 public string InputOutline
1674 return (string)GetValue(InputOutlineProperty);
1678 SetValue(InputOutlineProperty, value);
1679 NotifyPropertyChanged();
1684 /// The HiddenInputSettings property.<br />
1685 /// Hides the input characters and instead shows a default character for password or pin entry.<br />
1686 /// The hiddenInputSettings map contains the following keys :<br />
1687 /// <list type="table">
1688 /// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
1689 /// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
1690 /// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
1691 /// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
1695 /// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
1698 /// The following example demonstrates how to set the HiddenInputSettings property.
1700 /// PropertyMap map = new PropertyMap();
1701 /// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
1702 /// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
1703 /// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
1704 /// textField.HiddenInputSettings = map;
1707 /// <since_tizen> 3 </since_tizen>
1708 public Tizen.NUI.PropertyMap HiddenInputSettings
1712 return (PropertyMap)GetValue(HiddenInputSettingsProperty);
1716 SetValue(HiddenInputSettingsProperty, value);
1717 NotifyPropertyChanged();
1722 /// Set HiddenInput to TextField. <br />
1724 /// <param name="hiddenInput">The HiddenInput</param>
1726 /// SetHiddenInput specifies the requested font style through <see cref="Tizen.NUI.Text.HiddenInput"/>. <br />
1729 /// The following example demonstrates how to use the SetHiddenInput method.
1731 /// var hiddenInput = new Tizen.NUI.Text.HiddenInput();
1732 /// hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
1733 /// hiddenInput.SubstituteCharacter = '★';
1734 /// hiddenInput.SubstituteCount = 0;
1735 /// hiddenInput.ShowLastCharacterDuration = 1000;
1736 /// field.SetHiddenInput(hiddenInput);
1739 [EditorBrowsable(EditorBrowsableState.Never)]
1740 public void SetHiddenInput(HiddenInput hiddenInput)
1742 using (var hiddenInputMap = TextMapHelper.GetHiddenInputMap(hiddenInput))
1744 SetValue(HiddenInputSettingsProperty, hiddenInputMap);
1749 /// Get HiddenInput from TextField. <br />
1751 /// <returns>The HiddenInput</returns>
1753 /// <see cref="Tizen.NUI.Text.HiddenInput"/>
1755 [EditorBrowsable(EditorBrowsableState.Never)]
1756 public HiddenInput GetHiddenInput()
1758 HiddenInput hiddenInput;
1759 using (var hiddenInputMap = (PropertyMap)GetValue(HiddenInputSettingsProperty))
1761 hiddenInput = TextMapHelper.GetHiddenInputStruct(hiddenInputMap);
1767 /// The PixelSize property.<br />
1768 /// The size of font in pixels.<br />
1770 /// <since_tizen> 3 </since_tizen>
1771 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1772 public float PixelSize
1776 return (float)GetValue(PixelSizeProperty);
1780 SetValue(PixelSizeProperty, value);
1781 NotifyPropertyChanged();
1786 /// The Enable selection property.<br />
1787 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1789 /// <since_tizen> 3 </since_tizen>
1790 public bool EnableSelection
1794 return (bool)GetValue(EnableSelectionProperty);
1798 SetValue(EnableSelectionProperty, value);
1799 NotifyPropertyChanged();
1804 /// The Enable grab handle property.<br />
1805 /// Enables the grab handles for text selection.<br />
1806 /// The default value is true, which means the grab handles are enabled by default.<br />
1808 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1809 [EditorBrowsable(EditorBrowsableState.Never)]
1810 public bool EnableGrabHandle
1814 return (bool)GetValue(EnableGrabHandleProperty);
1818 SetValue(EnableGrabHandleProperty, value);
1819 NotifyPropertyChanged();
1824 /// The Enable grab handle popup property.<br />
1825 /// Enables the grab handle popup for text selection.<br />
1826 /// The default value is true, which means the grab handle popup is enabled by default.<br />
1828 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1829 [EditorBrowsable(EditorBrowsableState.Never)]
1830 public bool EnableGrabHandlePopup
1834 return (bool)GetValue(EnableGrabHandlePopupProperty);
1838 SetValue(EnableGrabHandlePopupProperty, value);
1839 NotifyPropertyChanged();
1844 /// The portion of the text that has been selected by the user.
1847 /// Empty string when nothing is selected.
1849 /// <since_tizen> 9 </since_tizen>
1850 public string SelectedText
1854 string selectedText;
1855 using (var propertyValue = GetProperty(TextField.Property.SelectedText))
1857 propertyValue.Get(out selectedText);
1859 return selectedText;
1864 /// The start index for selection.
1867 /// When there is no selection, the index is current cursor position.
1869 /// <since_tizen> 9 </since_tizen>
1870 public int SelectedTextStart
1874 int selectedTextStart;
1875 using (var propertyValue = GetProperty(TextField.Property.SelectedTextStart))
1877 propertyValue.Get(out selectedTextStart);
1879 return selectedTextStart;
1884 /// The end index for selection.
1887 /// When there is no selection, the index is current cursor position.
1889 /// <since_tizen> 9 </since_tizen>
1890 public int SelectedTextEnd
1894 int selectedTextEnd;
1895 using (var propertyValue = GetProperty(TextField.Property.SelectedTextEnd))
1897 propertyValue.Get(out selectedTextEnd);
1899 return selectedTextEnd;
1904 /// Enable editing in text control.
1906 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1907 [EditorBrowsable(EditorBrowsableState.Never)]
1908 public bool EnableEditing
1912 return (bool)GetValue(EnableEditingProperty);
1916 SetValue(EnableEditingProperty, value);
1920 private bool InternalEnableEditing
1925 using (var propertyValue = GetProperty(TextField.Property.EnableEditing))
1927 propertyValue.Get(out enableEditing);
1929 return enableEditing;
1933 using (var propertyValue = new PropertyValue(value))
1935 SetProperty(TextField.Property.EnableEditing, propertyValue);
1936 NotifyPropertyChanged();
1942 /// PrimaryCursorPosition property.<br />
1943 /// Specify the position of the primary cursor (caret) in text control.
1946 /// 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).
1948 /// <since_tizen> 10 </since_tizen>
1949 public int PrimaryCursorPosition
1953 return (int)GetValue(PrimaryCursorPositionProperty);
1957 SetValue(PrimaryCursorPositionProperty, value);
1961 private int InternalPrimaryCursorPosition
1965 int primaryCursorPosition;
1966 using (var propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
1968 propertyValue.Get(out primaryCursorPosition);
1970 return primaryCursorPosition;
1974 using (PropertyValue propertyValue = new PropertyValue(value))
1976 SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
1977 NotifyPropertyChanged();
1983 /// The GrabHandleColor property.
1986 /// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
1988 [EditorBrowsable(EditorBrowsableState.Never)]
1989 public Color GrabHandleColor
1993 Color temp = (Color)GetValue(GrabHandleColorProperty);
1994 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1998 SetValue(GrabHandleColorProperty, value);
1999 NotifyPropertyChanged();
2004 /// The ellipsis position of the text.
2005 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2007 /// <since_tizen> 9 </since_tizen>
2008 public EllipsisPosition EllipsisPosition
2012 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2016 SetValue(EllipsisPositionProperty, value);
2017 NotifyPropertyChanged();
2022 /// The spaces between characters in Pixels.
2024 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2025 /// The default value is 0.f which does nothing.
2028 [EditorBrowsable(EditorBrowsableState.Never)]
2029 public float CharacterSpacing
2033 return (float)GetValue(CharacterSpacingProperty);
2037 SetValue(CharacterSpacingProperty, value);
2038 NotifyPropertyChanged();
2043 /// Set InputFilter to TextField.
2045 /// <param name="inputFilter">The InputFilter</param>
2047 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
2048 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
2049 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
2052 /// The following example demonstrates how to use the SetInputFilter method.
2054 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
2055 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
2056 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
2057 /// field.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
2060 /// <since_tizen> 9 </since_tizen>
2061 public void SetInputFilter(InputFilter inputFilter)
2063 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
2064 using (var propertyValue = new PropertyValue(map))
2066 SetProperty(TextField.Property.InputFilter, propertyValue);
2071 /// Get InputFilter from TextField.
2073 /// <returns>The InputFilter</returns>
2075 /// <see cref="Tizen.NUI.Text.InputFilter"/>
2077 /// <since_tizen> 9 </since_tizen>
2078 public InputFilter GetInputFilter()
2080 InputFilter inputFilter;
2081 using (var propertyValue = GetProperty(TextField.Property.InputFilter))
2082 using (var map = new PropertyMap())
2084 propertyValue.Get(map);
2085 inputFilter = TextMapHelper.GetInputFilterStruct(map);
2091 /// Set Strikethrough to TextField. <br />
2093 /// <param name="strikethrough">The Strikethrough</param>
2095 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
2098 /// The following example demonstrates how to use the SetStrikethrough method.
2100 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
2101 /// strikethrough.Enable = true;
2102 /// strikethrough.Color = new Color("#3498DB");
2103 /// strikethrough.Height = 2.0f;
2104 /// field.SetStrikethrough(strikethrough);
2107 [EditorBrowsable(EditorBrowsableState.Never)]
2108 public void SetStrikethrough(Strikethrough strikethrough)
2110 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
2111 using (var propertyValue = new PropertyValue(map))
2113 SetProperty(TextField.Property.Strikethrough, propertyValue);
2118 /// Get Strikethrough from TextField. <br />
2120 /// <returns>The Strikethrough</returns>
2122 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
2124 [EditorBrowsable(EditorBrowsableState.Never)]
2125 public Strikethrough GetStrikethrough()
2127 Strikethrough strikethrough;
2128 using (var propertyValue = GetProperty(TextField.Property.Strikethrough))
2129 using (var map = new PropertyMap())
2131 propertyValue.Get(map);
2132 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
2134 return strikethrough;
2138 /// The Placeholder property.
2139 /// The placeholder map contains the following keys :<br />
2140 /// <list type="table">
2141 /// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
2142 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
2143 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
2144 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
2145 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
2146 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
2147 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
2148 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
2152 /// The following example demonstrates how to set the Placeholder property.
2154 /// PropertyMap propertyMap = new PropertyMap();
2155 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
2156 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
2157 /// propertyMap.Add("color", new PropertyValue(Color.Red));
2158 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
2159 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
2161 /// PropertyMap fontStyleMap = new PropertyMap();
2162 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
2163 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
2164 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
2165 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
2167 /// TextField field = new TextField();
2168 /// field.Placeholder = propertyMap;
2171 /// <since_tizen> 3 </since_tizen>
2172 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
2173 public Tizen.NUI.PropertyMap Placeholder
2177 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2178 string defalutText = "";
2180 if (TextMapHelper.IsValue(map, 0))
2181 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2183 if (TextMapHelper.IsValue(map, 1))
2184 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2186 if (TextMapHelper.IsValue(map, 2))
2188 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2190 map.Add("color", color);
2194 if (TextMapHelper.IsValue(map, 3))
2195 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2197 if (TextMapHelper.IsValue(map, 4))
2199 using (var properyValue = map.Find(4))
2200 using (var fontStyle = new PropertyMap())
2202 properyValue.Get(fontStyle);
2203 using (var fontStyleValue = new PropertyValue(fontStyle))
2205 map.Add("fontStyle", fontStyleValue);
2210 if (TextMapHelper.IsValue(map, 5))
2211 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2213 if (TextMapHelper.IsValue(map, 6))
2214 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2216 if (TextMapHelper.IsValue(map, 7))
2217 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2223 SetValue(PlaceholderProperty, value);
2224 NotifyPropertyChanged();
2229 /// Set Placeholder to TextField. <br />
2231 /// <param name="placeholder">The Placeholder</param>
2233 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2236 /// The following example demonstrates how to use the SetPlaceholder method.
2238 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2239 /// placeholder.Text = "placeholder text";
2240 /// placeholder.TextFocused = "placeholder textFocused";
2241 /// placeholder.Color = new Color("#45B39D");
2242 /// placeholder.FontFamily = "BreezeSans";
2243 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2245 /// Width = FontWidthType.Expanded,
2246 /// Weight = FontWeightType.ExtraLight,
2247 /// Slant = FontSlantType.Italic,
2249 /// placeholder.PointSize = 25.0f;
2250 /// //placeholder.PixelSize = 50.0f;
2251 /// placeholder.Ellipsis = true;
2252 /// field.SetPlaceholder(placeholder);
2255 [EditorBrowsable(EditorBrowsableState.Never)]
2256 public void SetPlaceholder(Placeholder placeholder)
2258 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2260 SetValue(PlaceholderProperty, placeholderMap);
2265 /// Get Placeholder from TextField. <br />
2267 /// <returns>The Placeholder</returns>
2269 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2271 [EditorBrowsable(EditorBrowsableState.Never)]
2272 public Placeholder GetPlaceholder()
2274 Placeholder placeholder;
2275 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2277 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2283 /// The Ellipsis property.<br />
2284 /// Enable or disable the ellipsis.<br />
2285 /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
2287 /// <since_tizen> 4 </since_tizen>
2288 public bool Ellipsis
2292 return (bool)GetValue(EllipsisProperty);
2296 SetValue(EllipsisProperty, value);
2297 NotifyPropertyChanged();
2302 /// Enables selection of the text using the Shift key.
2304 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2305 [EditorBrowsable(EditorBrowsableState.Never)]
2306 public bool EnableShiftSelection
2310 return (bool)GetValue(EnableShiftSelectionProperty);
2314 SetValue(EnableShiftSelectionProperty, value);
2315 NotifyPropertyChanged();
2320 /// The text alignment to match the direction of the system language.<br />
2321 /// The default value is true.<br />
2323 /// <since_tizen> 6 </since_tizen>
2324 public bool MatchSystemLanguageDirection
2328 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2332 SetValue(MatchSystemLanguageDirectionProperty, value);
2333 NotifyPropertyChanged();
2338 /// The FontSizeScale property. <br />
2339 /// The default value is 1.0. <br />
2340 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2341 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2343 /// <since_tizen> 9 </since_tizen>
2344 public float FontSizeScale
2348 return (float)GetValue(FontSizeScaleProperty);
2352 SetValue(FontSizeScaleProperty, value);
2353 NotifyPropertyChanged();
2357 private float InternalFontSizeScale
2361 return fontSizeScale;
2365 float newFontSizeScale;
2367 if (fontSizeScale == value) return;
2369 fontSizeScale = value;
2370 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2372 SystemSettingsFontSize systemSettingsFontSize;
2376 systemSettingsFontSize = SystemSettings.FontSize;
2380 Console.WriteLine("{0} Exception caught.", e);
2381 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2383 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2384 AddSystemSettingsFontSizeChanged();
2388 newFontSizeScale = fontSizeScale;
2389 RemoveSystemSettingsFontSizeChanged();
2392 SetInternalFontSizeScale(newFontSizeScale);
2396 private void SetInternalFontSizeScale(float fontSizeScale)
2399 Object.InternalSetPropertyFloat(this.SwigCPtr, TextField.Property.FontSizeScale, (float)fontSizeScale);
2403 /// The EnableFontSizeScale property.<br />
2404 /// Whether the font size scale is enabled. (The default value is true)
2406 [EditorBrowsable(EditorBrowsableState.Never)]
2407 public bool EnableFontSizeScale
2411 return (bool)GetValue(EnableFontSizeScaleProperty);
2415 SetValue(EnableFontSizeScaleProperty, value);
2416 NotifyPropertyChanged();
2421 /// Get the InputMethodContext instance.
2423 /// <returns>The InputMethodContext instance.</returns>
2424 /// <since_tizen> 5 </since_tizen>
2425 public InputMethodContext GetInputMethodContext()
2427 if (inputMethodCotext == null)
2429 /*Avoid raising InputMethodContext reference count.*/
2430 inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
2431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2433 return inputMethodCotext;
2437 /// Select the whole text.
2439 /// <since_tizen> 9 </since_tizen>
2440 public void SelectWholeText()
2442 Interop.TextField.SelectWholeText(SwigCPtr);
2443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2447 /// Select text from start to end index. <br />
2448 /// The index is valid when 0 or positive.
2450 /// <param name="start">The start index for selection.</param>
2451 /// <param name="end">The end index for selection.</param>
2453 /// If the end index exceeds the maximum value, it is set to the length of the text.
2455 /// <since_tizen> 9 </since_tizen>
2456 public void SelectText(int start, int end)
2459 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2461 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2463 Interop.TextField.SelectText(SwigCPtr, (uint)start, (uint)end);
2464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2468 /// Clear selection of the text. <br />
2469 /// Valid when selection is activate.
2471 /// <since_tizen> 9 </since_tizen>
2472 public void SelectNone()
2474 _ = Interop.TextField.SelectNone(SwigCPtr);
2475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2478 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
2480 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));
2481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2488 /// <since_tizen> 3 </since_tizen>
2489 protected override void Dispose(DisposeTypes type)
2496 internalPlaceholderTextColor?.Dispose();
2497 internalPrimaryCursorColor?.Dispose();
2498 internalSecondaryCursorColor?.Dispose();
2499 internalSelectionHighlightColor?.Dispose();
2500 internalInputColor?.Dispose();
2501 internalTextColor?.Dispose();
2502 internalGrabHandleColor?.Dispose();
2504 if (hasSystemLanguageChanged)
2506 systemLocaleLanguageChanged.Remove(SystemSettingsLocaleLanguageChanged);
2509 RemoveSystemSettingsFontTypeChanged();
2510 RemoveSystemSettingsFontSizeChanged();
2512 if (type == DisposeTypes.Explicit)
2515 //Release your own managed resources here.
2516 //You should release all of your own disposable objects here.
2519 //Release your own unmanaged resources here.
2520 //You should not access any managed member here except static instance.
2521 //because the execution order of Finalizes is non-deterministic.
2524 if (textFieldCursorPositionChangedCallbackDelegate != null)
2526 this.CursorPositionChangedSignal().Disconnect(textFieldCursorPositionChangedCallbackDelegate);
2529 if (textFieldMaxLengthReachedCallbackDelegate != null)
2531 this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
2534 if (textFieldSelectionStartedCallbackDelegate != null)
2536 this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
2539 if (textFieldSelectionClearedCallbackDelegate != null)
2541 this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
2544 if (textFieldSelectionChangedCallbackDelegate != null)
2546 this.SelectionChangedSignal().Disconnect(textFieldSelectionChangedCallbackDelegate);
2549 if (textFieldTextChangedCallbackDelegate != null)
2551 TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
2555 TextChanged -= TextFieldTextChanged;
2556 GetInputMethodContext()?.DestroyContext();
2561 /// This will not be public opened.
2562 [EditorBrowsable(EditorBrowsableState.Never)]
2563 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2565 Interop.TextField.DeleteTextField(swigCPtr);
2568 internal override LayoutItem CreateDefaultLayout()
2570 return new TextFieldLayout();
2573 internal void SetTextWithoutTextChanged(string text)
2575 invokeTextChanged = false;
2576 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextField.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2577 invokeTextChanged = true;
2580 private string SetTranslatable(string textFieldSid)
2582 string translatableText = null;
2583 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2584 if (translatableText != null)
2586 if (hasSystemLanguageChanged == false)
2588 systemLocaleLanguageChanged.Add(SystemSettingsLocaleLanguageChanged);
2589 hasSystemLanguageChanged = true;
2591 return translatableText;
2595 translatableText = "";
2596 return translatableText;
2600 private void SystemSettingsLocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2602 if (textFieldTextSid != null)
2604 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2606 if (textFieldPlaceHolderTextSid != null)
2608 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2610 if (textFieldPlaceHolderTextFocusedSid != null)
2612 PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
2616 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2618 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2619 SetInternalFontSizeScale(newFontSizeScale);
2622 private void AddSystemSettingsFontSizeChanged()
2624 if (hasSystemFontSizeChanged != true)
2628 SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
2629 hasSystemFontSizeChanged = true;
2633 Console.WriteLine("{0} Exception caught.", e);
2634 hasSystemFontSizeChanged = false;
2639 private void RemoveSystemSettingsFontSizeChanged()
2641 if (hasSystemFontSizeChanged == true)
2645 SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
2646 hasSystemFontSizeChanged = false;
2650 Console.WriteLine("{0} Exception caught.", e);
2651 hasSystemFontSizeChanged = true;
2656 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2658 SetInternalFontFamily(e.Value);
2661 private void AddSystemSettingsFontTypeChanged()
2663 if (HasStyle() && !hasSystemFontTypeChanged)
2667 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2668 hasSystemFontTypeChanged = true;
2672 Console.WriteLine("{0} Exception caught.", e);
2673 hasSystemFontTypeChanged = false;
2678 private void RemoveSystemSettingsFontTypeChanged()
2680 if (hasSystemFontTypeChanged)
2684 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2685 hasSystemFontTypeChanged = false;
2689 Console.WriteLine("{0} Exception caught.", e);
2690 hasSystemFontTypeChanged = true;
2695 private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
2697 if (!isSettingTextInCSharp)
2699 EnforceNotifyBindedInstance(TextProperty);
2703 internal new class Property
2705 internal static readonly int TEXT = Interop.TextField.TextGet();
2706 internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
2707 internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
2708 internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
2709 internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
2710 internal static readonly int PointSize = Interop.TextField.PointSizeGet();
2711 internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
2712 internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
2713 internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
2714 internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
2715 internal static readonly int TextColor = Interop.TextField.TextColorGet();
2716 internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
2717 internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
2718 internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
2719 internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
2720 internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
2721 internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
2722 internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
2723 internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
2724 internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
2725 internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
2726 internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
2727 internal static readonly int SelectionPopupStyle = Interop.TextField.SelectionPopupStyleGet();
2728 internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
2729 internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
2730 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
2731 internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
2732 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
2733 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
2734 internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
2735 internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
2736 internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
2737 internal static readonly int InputColor = Interop.TextField.InputColorGet();
2738 internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
2739 internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
2740 internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
2741 internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
2742 internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
2743 internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
2744 internal static readonly int SHADOW = Interop.TextField.ShadowGet();
2745 internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
2746 internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
2747 internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
2748 internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
2749 internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
2750 internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
2751 internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
2752 internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
2753 internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
2754 internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
2755 internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
2756 internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
2757 internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
2758 internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
2759 internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
2760 internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
2761 internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
2762 internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
2763 internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
2764 internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
2765 internal static readonly int EnableFontSizeScale = Interop.TextField.EnableFontSizeScaleGet();
2766 internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
2767 internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
2768 internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
2769 internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
2770 internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
2772 internal static void Preload()
2774 // Do nothing. Just call for load static values.
2778 internal class InputStyle
2784 FontFamily = 0x0002,
2794 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2796 DecorationBoundingBox = new Rectangle(x, y, width, height);
2798 private void OnInputColorChanged(float x, float y, float z, float w)
2800 InputColor = new Vector4(x, y, z, w);
2802 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2804 PlaceholderTextColor = new Vector4(r, g, b, a);
2806 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2808 PrimaryCursorColor = new Vector4(x, y, z, w);
2810 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2812 SecondaryCursorColor = new Vector4(x, y, z, w);
2814 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2816 SelectionHighlightColor = new Vector4(x, y, z, w);
2818 private void OnShadowColorChanged(float x, float y, float z, float w)
2820 ShadowColor = new Vector4(x, y, z, w);
2822 private void OnShadowOffsetChanged(float x, float y)
2824 ShadowOffset = new Vector2(x, y);
2826 private void OnTextColorChanged(float r, float g, float b, float a)
2828 TextColor = new Color(r, g, b, a);
2830 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2832 GrabHandleColor = new Color(r, g, b, a);
2835 private class TextFieldLayout : LayoutItem
2837 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2839 // Padding will be automatically applied by DALi TextField.
2840 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2841 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2842 var minSize = Owner.MinimumSize;
2843 var maxSize = Owner.MaximumSize;
2844 var naturalSize = Owner.GetNaturalSize();
2846 if (((TextField)Owner).Text.Length == 0)
2848 // Calculate height of TextField by setting Text with " ".
2849 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2850 ((TextField)Owner).SetTextWithoutTextChanged(" ");
2852 // Store original WidthSpecification to restore it after setting ResizePolicy.
2853 var widthSpecification = Owner.WidthSpecification;
2855 // In DALi's Size logic, if Width or Height is set to be 0, then
2856 // ResizePolicy is not changed to Fixed.
2857 // This causes Size changes after NUI Layout's OnMeasure is finished.
2858 // e.g. TextField's Width fills to its parent although Text is null and
2859 // WidthSpecification is WrapContent.
2860 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2861 // in advance if Text is null.
2862 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2864 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2865 Owner.WidthSpecification = widthSpecification;
2867 naturalSize = Owner.GetNaturalSize();
2869 // Restore TextField's Text after calculating height of TextField.
2870 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2871 ((TextField)Owner).SetTextWithoutTextChanged("");
2874 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2876 float width = naturalSize != null ? naturalSize.Width : 0;
2877 totalWidth = Math.Min(Math.Max(width, minSize.Width), maxSize.Width);
2880 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2882 float height = naturalSize != null ? naturalSize.Height : 0;
2883 totalHeight = Math.Min(Math.Max(height, minSize.Height), maxSize.Height);
2886 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2887 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2889 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2890 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2892 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2893 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));