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.
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
22 using System.Globalization;
23 using System.ComponentModel;
25 using Tizen.NUI.Binding;
27 namespace Tizen.NUI.BaseComponents
30 /// A control which provides a multi-line editable text editor.
32 /// <since_tizen> 3 </since_tizen>
33 public partial class TextEditor : View
35 static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextEditor";
36 static private string defaultFontFamily = "TizenSans";
37 private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
38 private static SystemFontSizeChanged systemFontSizeChanged = new SystemFontSizeChanged();
39 private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
40 private string textEditorTextSid = null;
41 private string textEditorPlaceHolderTextSid = null;
42 private InputMethodContext inputMethodContext = null;
43 private string fontFamily = defaultFontFamily;
44 private float fontSizeScale = 1.0f;
45 private bool hasSystemLanguageChanged = false;
46 private bool hasSystemFontSizeChanged = false;
47 private bool hasSystemFontTypeChanged = false;
48 private bool isSettingTextInCSharp = false;
50 private Color internalPlaceholderTextColor = null;
51 private Vector4 internalPrimaryCursorColor = null;
52 private Vector4 internalSecondaryCursorColor = null;
53 private Vector4 internalSelectionHighlightColor = null;
54 private Vector4 internalInputColor = null;
55 private Vector4 internalTextColor = null;
56 private Color internalGrabHandleColor = null;
59 static TextEditor() { }
62 /// Creates the TextEditor control.
64 /// <since_tizen> 3 </since_tizen>
65 public TextEditor() : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 /// Creates the TextEditor with specified style.
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public TextEditor(TextEditorStyle style) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, style: style)
79 /// Creates the TextEditor with setting the status of shown or hidden.
81 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
82 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
83 [EditorBrowsable(EditorBrowsableState.Never)]
84 public TextEditor(bool shown) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
102 TextChanged += TextEditorTextChanged;
105 private bool HasStyle()
107 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
111 /// The TranslatableText property.<br />
112 /// The text can set the SID value.<br />
114 /// <exception cref='ArgumentNullException'>
115 /// ResourceManager about multilingual is null.
117 /// <since_tizen> 4 </since_tizen>
118 public string TranslatableText
122 return GetValue(TranslatableTextProperty) as string;
126 SetValue(TranslatableTextProperty, value);
130 private string InternalTranslatableText
134 return textEditorTextSid;
138 if (NUIApplication.MultilingualResourceManager == null)
140 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
142 textEditorTextSid = value;
143 Text = SetTranslatable(textEditorTextSid);
144 NotifyPropertyChanged();
148 /// The TranslatablePlaceholderText property.<br />
149 /// The text can set the SID value.<br />
151 /// <exception cref='ArgumentNullException'>
152 /// ResourceManager about multilingual is null.
154 /// <since_tizen> 4 </since_tizen>
155 public string TranslatablePlaceholderText
159 return GetValue(TranslatablePlaceholderTextProperty) as string;
163 SetValue(TranslatablePlaceholderTextProperty, value);
167 private string InternalTranslatablePlaceholderText
171 return textEditorPlaceHolderTextSid;
175 if (NUIApplication.MultilingualResourceManager == null)
177 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
179 textEditorPlaceHolderTextSid = value;
180 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
181 NotifyPropertyChanged();
186 /// The Text property.<br />
187 /// The text to display in the UTF-8 format.<br />
189 /// <since_tizen> 3 </since_tizen>
194 return (string)GetValue(TextProperty);
198 SetValue(TextProperty, value);
199 NotifyPropertyChanged();
204 /// The TextColor property.<br />
205 /// The color of the text.<br />
208 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
210 /// <since_tizen> 3 </since_tizen>
211 public Vector4 TextColor
215 Vector4 temp = (Vector4)GetValue(TextColorProperty);
216 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
220 SetValue(TextColorProperty, value);
221 NotifyPropertyChanged();
226 /// The FontFamily property.<br />
227 /// The requested font family to use.<br />
229 /// <since_tizen> 3 </since_tizen>
230 public string FontFamily
234 return (string)GetValue(FontFamilyProperty);
238 SetValue(FontFamilyProperty, value);
239 NotifyPropertyChanged();
243 private string InternalFontFamily
250 return Object.InternalGetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily);
254 string newFontFamily;
256 if (string.Equals(fontFamily, value)) return;
259 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
263 newFontFamily = SystemSettings.FontType;
267 Console.WriteLine("{0} Exception caught.", e);
268 newFontFamily = defaultFontFamily;
270 AddSystemSettingsFontTypeChanged();
274 newFontFamily = fontFamily;
275 RemoveSystemSettingsFontTypeChanged();
278 SetInternalFontFamily(newFontFamily);
282 private void SetInternalFontFamily(string fontFamily)
284 Object.InternalSetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily, (string)fontFamily);
288 /// The FontStyle property.<br />
289 /// The requested font style to use.<br />
290 /// The fontStyle map contains the following keys :<br />
291 /// <list type="table">
292 /// <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>
293 /// <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>
294 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
297 /// <since_tizen> 3 </since_tizen>
298 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
299 public PropertyMap FontStyle
303 return (PropertyMap)GetValue(FontStyleProperty);
307 SetValue(FontStyleProperty, value);
308 NotifyPropertyChanged();
313 /// Set FontStyle to TextEditor. <br />
315 /// <param name="fontStyle">The FontStyle</param>
317 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
320 /// The following example demonstrates how to use the SetFontStyle method.
322 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
323 /// fontStyle.Width = FontWidthType.Expanded;
324 /// fontStyle.Weight = FontWeightType.Bold;
325 /// fontStyle.Slant = FontSlantType.Italic;
326 /// editor.SetFontStyle(fontStyle);
329 [EditorBrowsable(EditorBrowsableState.Never)]
330 public void SetFontStyle(FontStyle fontStyle)
332 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
334 SetValue(FontStyleProperty, fontStyleMap);
339 /// Get FontStyle from TextEditor. <br />
341 /// <returns>The FontStyle</returns>
343 /// <see cref="Tizen.NUI.Text.FontStyle"/>
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public FontStyle GetFontStyle()
349 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
351 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
357 /// The PointSize property.<br />
358 /// The size of font in points.<br />
360 /// <since_tizen> 3 </since_tizen>
361 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
362 public float PointSize
366 return (float)GetValue(PointSizeProperty);
370 SetValue(PointSizeProperty, value);
371 NotifyPropertyChanged();
376 /// The HorizontalAlignment property.<br />
377 /// The line horizontal alignment.<br />
379 /// <since_tizen> 3 </since_tizen>
380 public HorizontalAlignment HorizontalAlignment
384 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
388 SetValue(HorizontalAlignmentProperty, value);
389 NotifyPropertyChanged();
394 /// The VerticalAlignment property.<br />
395 /// The line vertical alignment.
397 [EditorBrowsable(EditorBrowsableState.Never)]
398 public VerticalAlignment VerticalAlignment
402 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
406 SetValue(VerticalAlignmentProperty, value);
407 NotifyPropertyChanged();
412 /// The ScrollThreshold property.<br />
413 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
415 /// <since_tizen> 3 </since_tizen>
416 public float ScrollThreshold
420 return (float)GetValue(ScrollThresholdProperty);
424 SetValue(ScrollThresholdProperty, value);
425 NotifyPropertyChanged();
430 /// The ScrollSpeed property.<br />
431 /// The scroll speed in pixels per second.<br />
433 /// <since_tizen> 3 </since_tizen>
434 public float ScrollSpeed
438 return (float)GetValue(ScrollSpeedProperty);
442 SetValue(ScrollSpeedProperty, value);
443 NotifyPropertyChanged();
448 /// The PrimaryCursorColor property.<br />
449 /// The color to apply to the primary cursor.<br />
452 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
454 /// <since_tizen> 3 </since_tizen>
455 public Vector4 PrimaryCursorColor
459 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
460 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
464 SetValue(PrimaryCursorColorProperty, value);
465 NotifyPropertyChanged();
470 /// The SecondaryCursorColor property.<br />
471 /// The color to apply to the secondary cursor.<br />
474 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
476 /// <since_tizen> 3 </since_tizen>
477 public Vector4 SecondaryCursorColor
481 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
482 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
486 SetValue(SecondaryCursorColorProperty, value);
487 NotifyPropertyChanged();
492 /// The EnableCursorBlink property.<br />
493 /// Whether the cursor should blink or not.<br />
495 /// <since_tizen> 3 </since_tizen>
496 public bool EnableCursorBlink
500 return (bool)GetValue(EnableCursorBlinkProperty);
504 SetValue(EnableCursorBlinkProperty, value);
505 NotifyPropertyChanged();
510 /// The CursorBlinkInterval property.<br />
511 /// The time interval in seconds between cursor on/off states.<br />
513 /// <since_tizen> 3 </since_tizen>
514 public float CursorBlinkInterval
518 return (float)GetValue(CursorBlinkIntervalProperty);
522 SetValue(CursorBlinkIntervalProperty, value);
523 NotifyPropertyChanged();
528 /// The CursorBlinkDuration property.<br />
529 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
531 /// <since_tizen> 3 </since_tizen>
532 public float CursorBlinkDuration
536 return (float)GetValue(CursorBlinkDurationProperty);
540 SetValue(CursorBlinkDurationProperty, value);
541 NotifyPropertyChanged();
546 /// The CursorWidth property.
548 /// <since_tizen> 3 </since_tizen>
549 public int CursorWidth
553 return (int)GetValue(CursorWidthProperty);
557 SetValue(CursorWidthProperty, value);
558 NotifyPropertyChanged();
563 /// The GrabHandleImage property.<br />
564 /// The image to display for the grab handle.<br />
566 /// <since_tizen> 3 </since_tizen>
567 public string GrabHandleImage
571 return (string)GetValue(GrabHandleImageProperty);
575 SetValue(GrabHandleImageProperty, value);
576 NotifyPropertyChanged();
581 /// The GrabHandlePressedImage property.<br />
582 /// The image to display when the grab handle is pressed.<br />
584 /// <since_tizen> 3 </since_tizen>
585 public string GrabHandlePressedImage
589 return (string)GetValue(GrabHandlePressedImageProperty);
593 SetValue(GrabHandlePressedImageProperty, value);
594 NotifyPropertyChanged();
599 /// The SelectionPopupStyle property.<br />
600 /// The style of the text selection popup can be set through SelectionPopupStyle property.
602 [EditorBrowsable(EditorBrowsableState.Never)]
603 public PropertyMap SelectionPopupStyle
607 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
611 SetValue(SelectionPopupStyleProperty, value);
612 NotifyPropertyChanged();
617 /// The SelectionHandleImageLeft property.<br />
618 /// The image to display for the left selection handle.<br />
619 /// The selectionHandleImageLeft map contains the following key :<br />
620 /// <list type="table">
621 /// <item><term>filename (string)</term><description>The path of image file</description></item>
624 /// <since_tizen> 3 </since_tizen>
625 public PropertyMap SelectionHandleImageLeft
629 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
633 SetValue(SelectionHandleImageLeftProperty, value);
634 NotifyPropertyChanged();
639 /// The SelectionHandleImageRight property.<br />
640 /// The image to display for the right selection handle.<br />
641 /// The selectionHandleImageRight map contains the following key :<br />
642 /// <list type="table">
643 /// <item><term>filename (string)</term><description>The path of image file</description></item>
646 /// <since_tizen> 3 </since_tizen>
647 public PropertyMap SelectionHandleImageRight
651 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
655 SetValue(SelectionHandleImageRightProperty, value);
656 NotifyPropertyChanged();
661 /// Set SelectionHandleImage to TextEditor. <br />
663 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
665 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
668 /// The following example demonstrates how to use the SetSelectionHandleImage method.
670 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
671 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
672 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
673 /// editor.SetSelectionHandleImage(selectionHandleImage);
676 [EditorBrowsable(EditorBrowsableState.Never)]
677 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
679 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
681 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
683 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
687 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
689 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
691 SetValue(SelectionHandleImageRightProperty, rightImageMap);
697 /// Get SelectionHandleImage from TextEditor. <br />
699 /// <returns>The SelectionHandleImage</returns>
701 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
703 [EditorBrowsable(EditorBrowsableState.Never)]
704 public SelectionHandleImage GetSelectionHandleImage()
706 SelectionHandleImage selectionHandleImage;
707 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
708 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
710 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
712 return selectionHandleImage;
716 /// The SelectionHandlePressedImageLeft property.<br />
717 /// The image to display when the left selection handle is pressed.<br />
718 /// The selectionHandlePressedImageLeft map contains the following key :<br />
719 /// <list type="table">
720 /// <item><term>filename (string)</term><description>The path of image file</description></item>
723 /// <since_tizen> 3 </since_tizen>
724 public PropertyMap SelectionHandlePressedImageLeft
728 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
732 SetValue(SelectionHandlePressedImageLeftProperty, value);
733 NotifyPropertyChanged();
738 /// The SelectionHandlePressedImageRight property.<br />
739 /// The image to display when the right selection handle is pressed.<br />
740 /// The selectionHandlePressedImageRight map contains the following key :<br />
741 /// <list type="table">
742 /// <item><term>filename (string)</term><description>The path of image file</description></item>
745 /// <since_tizen> 3 </since_tizen>
746 public PropertyMap SelectionHandlePressedImageRight
750 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
754 SetValue(SelectionHandlePressedImageRightProperty, value);
755 NotifyPropertyChanged();
760 /// Set SelectionHandlePressedImage to TextEditor. <br />
762 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
764 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
767 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
769 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
770 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
771 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
772 /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
775 [EditorBrowsable(EditorBrowsableState.Never)]
776 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
778 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
780 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
782 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
786 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
788 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
790 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
796 /// Get SelectionHandlePressedImage from TextEditor. <br />
798 /// <returns>The SelectionHandlePressedImage</returns>
800 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
802 [EditorBrowsable(EditorBrowsableState.Never)]
803 public SelectionHandleImage GetSelectionHandlePressedImage()
805 SelectionHandleImage selectionHandleImage;
806 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
807 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
809 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
811 return selectionHandleImage;
815 /// The SelectionHandleMarkerImageLeft property.<br />
816 /// The image to display for the left selection handle marker.<br />
817 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
818 /// <list type="table">
819 /// <item><term>filename (string)</term><description>The path of image file</description></item>
822 /// <since_tizen> 3 </since_tizen>
823 public PropertyMap SelectionHandleMarkerImageLeft
827 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
831 SetValue(SelectionHandleMarkerImageLeftProperty, value);
832 NotifyPropertyChanged();
837 /// The SelectionHandleMarkerImageRight property.<br />
838 /// The image to display for the right selection handle marker.<br />
839 /// The selectionHandleMarkerImageRight map contains the following key :<br />
840 /// <list type="table">
841 /// <item><term>filename (string)</term><description>The path of image file</description></item>
844 /// <since_tizen> 3 </since_tizen>
845 public PropertyMap SelectionHandleMarkerImageRight
849 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
853 SetValue(SelectionHandleMarkerImageRightProperty, value);
854 NotifyPropertyChanged();
859 /// Set SelectionHandleMarkerImage to TextEditor. <br />
861 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
863 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
866 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
868 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
869 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
870 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
871 /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
874 [EditorBrowsable(EditorBrowsableState.Never)]
875 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
877 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
879 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
881 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
885 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
887 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
889 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
895 /// Get SelectionHandleMarkerImage from TextEditor. <br />
897 /// <returns>The SelectionHandleMarkerImage</returns>
899 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
901 [EditorBrowsable(EditorBrowsableState.Never)]
902 public SelectionHandleImage GetSelectionHandleMarkerImage()
904 SelectionHandleImage selectionHandleImage;
905 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
906 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
908 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
910 return selectionHandleImage;
914 /// The SelectionHighlightColor property.<br />
915 /// The color of the selection highlight.<br />
918 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
920 /// <since_tizen> 3 </since_tizen>
921 public Vector4 SelectionHighlightColor
925 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
926 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
930 SetValue(SelectionHighlightColorProperty, value);
931 NotifyPropertyChanged();
936 /// The DecorationBoundingBox property.<br />
937 /// The decorations (handles etc) will positioned within this area on-screen.<br />
940 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
942 /// <since_tizen> 3 </since_tizen>
943 public Rectangle DecorationBoundingBox
947 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
948 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
952 SetValue(DecorationBoundingBoxProperty, value);
953 NotifyPropertyChanged();
958 /// The EnableMarkup property.<br />
959 /// Whether the mark-up processing is enabled.<br />
961 /// <since_tizen> 3 </since_tizen>
962 public bool EnableMarkup
966 return (bool)GetValue(EnableMarkupProperty);
970 SetValue(EnableMarkupProperty, value);
971 NotifyPropertyChanged();
976 /// The InputColor property.<br />
977 /// The color of the new input text.<br />
980 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
982 /// <since_tizen> 3 </since_tizen>
983 public Vector4 InputColor
987 Vector4 temp = (Vector4)GetValue(InputColorProperty);
988 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
992 SetValue(InputColorProperty, value);
993 NotifyPropertyChanged();
998 /// The InputFontFamily property.<br />
999 /// The font's family of the new input text.<br />
1001 /// <since_tizen> 3 </since_tizen>
1002 public string InputFontFamily
1006 return (string)GetValue(InputFontFamilyProperty);
1010 SetValue(InputFontFamilyProperty, value);
1011 NotifyPropertyChanged();
1016 /// The InputFontStyle property.<br />
1017 /// The font's style of the new input text.<br />
1018 /// The inputFontStyle map contains the following keys :<br />
1019 /// <list type="table">
1020 /// <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>
1021 /// <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>
1022 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1025 /// <since_tizen> 3 </since_tizen>
1026 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1027 public PropertyMap InputFontStyle
1031 return (PropertyMap)GetValue(InputFontStyleProperty);
1035 SetValue(InputFontStyleProperty, value);
1036 NotifyPropertyChanged();
1041 /// Set InputFontStyle to TextEditor. <br />
1043 /// <param name="fontStyle">The FontStyle</param>
1045 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1048 /// The following example demonstrates how to use the SetInputFontStyle method.
1050 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1051 /// fontStyle.Width = FontWidthType.Expanded;
1052 /// fontStyle.Weight = FontWeightType.Bold;
1053 /// fontStyle.Slant = FontSlantType.Italic;
1054 /// editor.SetInputFontStyle(fontStyle);
1057 [EditorBrowsable(EditorBrowsableState.Never)]
1058 public void SetInputFontStyle(FontStyle fontStyle)
1060 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1062 SetValue(InputFontStyleProperty, fontStyleMap);
1067 /// Get InputFontStyle from TextEditor. <br />
1069 /// <returns>The FontStyle</returns>
1071 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1073 [EditorBrowsable(EditorBrowsableState.Never)]
1074 public FontStyle GetInputFontStyle()
1076 FontStyle fontStyle;
1077 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1079 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1085 /// The InputPointSize property.<br />
1086 /// The font's size of the new input text in points.<br />
1088 /// <since_tizen> 3 </since_tizen>
1089 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1090 public float InputPointSize
1094 return (float)GetValue(InputPointSizeProperty);
1098 SetValue(InputPointSizeProperty, value);
1099 NotifyPropertyChanged();
1104 /// The LineSpacing property.<br />
1105 /// The default extra space between lines in points.<br />
1107 /// <since_tizen> 3 </since_tizen>
1108 public float LineSpacing
1112 return (float)GetValue(LineSpacingProperty);
1116 SetValue(LineSpacingProperty, value);
1117 NotifyPropertyChanged();
1122 /// The InputLineSpacing property.<br />
1123 /// The extra space between lines in points.<br />
1125 /// <since_tizen> 3 </since_tizen>
1126 public float InputLineSpacing
1130 return (float)GetValue(InputLineSpacingProperty);
1134 SetValue(InputLineSpacingProperty, value);
1135 NotifyPropertyChanged();
1140 /// The relative height of the line (a factor that will be multiplied by text height). <br />
1141 /// If the value is less than 1, the lines could to be overlapped.
1143 [EditorBrowsable(EditorBrowsableState.Never)]
1144 public float RelativeLineHeight
1148 return (float)GetValue(RelativeLineHeightProperty);
1152 SetValue(RelativeLineHeightProperty, value);
1153 NotifyPropertyChanged();
1158 /// The Underline property.<br />
1159 /// The default underline parameters.<br />
1160 /// The underline map contains the following keys :<br />
1161 /// <list type="table">
1162 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1163 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1164 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1167 /// <since_tizen> 3 </since_tizen>
1168 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1169 public PropertyMap Underline
1173 return (PropertyMap)GetValue(UnderlineProperty);
1177 SetValue(UnderlineProperty, value);
1178 NotifyPropertyChanged();
1183 /// Set Underline to TextEditor. <br />
1185 /// <param name="underline">The Underline</param>
1187 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1190 /// The following example demonstrates how to use the SetUnderline method.
1192 /// var underline = new Tizen.NUI.Text.Underline();
1193 /// underline.Enable = true;
1194 /// underline.Color = new Color("#3498DB");
1195 /// underline.Height = 2.0f;
1196 /// editor.SetUnderline(underline);
1199 [EditorBrowsable(EditorBrowsableState.Never)]
1200 public void SetUnderline(Underline underline)
1202 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1204 SetValue(UnderlineProperty, underlineMap);
1209 /// Get Underline from TextEditor. <br />
1211 /// <returns>The Underline</returns>
1213 /// <see cref="Tizen.NUI.Text.Underline"/>
1215 [EditorBrowsable(EditorBrowsableState.Never)]
1216 public Underline GetUnderline()
1218 Underline underline;
1219 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1221 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1227 /// The InputUnderline property.<br />
1228 /// The underline parameters of the new input text.<br />
1230 /// <since_tizen> 3 </since_tizen>
1231 public string InputUnderline
1235 return (string)GetValue(InputUnderlineProperty);
1239 SetValue(InputUnderlineProperty, value);
1240 NotifyPropertyChanged();
1245 /// The Shadow property.<br />
1246 /// The default shadow parameters.<br />
1247 /// The shadow map contains the following keys :<br />
1248 /// <list type="table">
1249 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1250 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1251 /// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
1254 /// <since_tizen> 3 </since_tizen>
1255 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1256 public PropertyMap Shadow
1260 return (PropertyMap)GetValue(ShadowProperty);
1264 SetValue(ShadowProperty, value);
1265 NotifyPropertyChanged();
1270 /// Set Shadow to TextEditor. <br />
1272 /// <param name="shadow">The Shadow</param>
1274 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1277 /// The following example demonstrates how to use the SetShadow method.
1279 /// var shadow = new Tizen.NUI.Text.Shadow();
1280 /// shadow.Offset = new Vector2(3, 3);
1281 /// shadow.Color = new Color("#F1C40F");
1282 /// editor.SetShadow(shadow);
1285 [EditorBrowsable(EditorBrowsableState.Never)]
1286 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1288 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1290 SetValue(ShadowProperty, shadowMap);
1295 /// Get Shadow from TextEditor. <br />
1297 /// <returns>The Shadow</returns>
1299 /// <see cref="Tizen.NUI.Text.Shadow"/>
1301 [EditorBrowsable(EditorBrowsableState.Never)]
1302 public Tizen.NUI.Text.Shadow GetShadow()
1304 Tizen.NUI.Text.Shadow shadow;
1305 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1307 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1313 /// The InputShadow property.<br />
1314 /// The shadow parameters of the new input text.<br />
1316 /// <since_tizen> 3 </since_tizen>
1317 public string InputShadow
1321 return (string)GetValue(InputShadowProperty);
1325 SetValue(InputShadowProperty, value);
1326 NotifyPropertyChanged();
1331 /// The Emboss property.<br />
1332 /// The default emboss parameters.<br />
1334 /// <since_tizen> 3 </since_tizen>
1335 public string Emboss
1339 return (string)GetValue(EmbossProperty);
1343 SetValue(EmbossProperty, value);
1344 NotifyPropertyChanged();
1349 /// The InputEmboss property.<br />
1350 /// The emboss parameters of the new input text.<br />
1352 /// <since_tizen> 3 </since_tizen>
1353 public string InputEmboss
1357 return (string)GetValue(InputEmbossProperty);
1361 SetValue(InputEmbossProperty, value);
1362 NotifyPropertyChanged();
1367 /// The Outline property.<br />
1368 /// The default outline parameters.<br />
1369 /// The outline map contains the following keys :<br />
1370 /// <list type="table">
1371 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1372 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1375 /// <since_tizen> 3 </since_tizen>
1376 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1377 public PropertyMap Outline
1381 return (PropertyMap)GetValue(OutlineProperty);
1385 SetValue(OutlineProperty, value);
1386 NotifyPropertyChanged();
1391 /// Set Outline to TextEditor. <br />
1393 /// <param name="outline">The Outline</param>
1395 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1398 /// The following example demonstrates how to use the SetOutline method.
1400 /// var outline = new Tizen.NUI.Text.Outline();
1401 /// outline.Width = 2.0f;
1402 /// outline.Color = new Color("#45B39D");
1403 /// editor.SetOutline(outline);
1406 [EditorBrowsable(EditorBrowsableState.Never)]
1407 public void SetOutline(Outline outline)
1409 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1411 SetValue(OutlineProperty, outlineMap);
1416 /// Get Outline from TextEditor. <br />
1418 /// <returns>The Outline</returns>
1420 /// <see cref="Tizen.NUI.Text.Outline"/>
1422 [EditorBrowsable(EditorBrowsableState.Never)]
1423 public Outline GetOutline()
1426 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1428 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1434 /// The InputOutline property.<br />
1435 /// The outline parameters of the new input text.<br />
1437 /// <since_tizen> 3 </since_tizen>
1438 public string InputOutline
1442 return (string)GetValue(InputOutlineProperty);
1446 SetValue(InputOutlineProperty, value);
1447 NotifyPropertyChanged();
1452 /// The SmoothScroll property.<br />
1453 /// Enable or disable the smooth scroll animation.<br />
1455 /// <since_tizen> 3 </since_tizen>
1456 public bool SmoothScroll
1460 return (bool)GetValue(SmoothScrollProperty);
1464 SetValue(SmoothScrollProperty, value);
1465 NotifyPropertyChanged();
1470 /// The SmoothScrollDuration property.<br />
1471 /// Sets the duration of smooth scroll animation.<br />
1473 /// <since_tizen> 3 </since_tizen>
1474 public float SmoothScrollDuration
1478 return (float)GetValue(SmoothScrollDurationProperty);
1482 SetValue(SmoothScrollDurationProperty, value);
1483 NotifyPropertyChanged();
1488 /// The EnableScrollBar property.<br />
1489 /// Enable or disable the scroll bar.<br />
1491 /// <since_tizen> 3 </since_tizen>
1492 public bool EnableScrollBar
1496 return (bool)GetValue(EnableScrollBarProperty);
1500 SetValue(EnableScrollBarProperty, value);
1501 NotifyPropertyChanged();
1506 /// The ScrollBarShowDuration property.<br />
1507 /// Sets the duration of scroll bar to show.<br />
1509 /// <since_tizen> 3 </since_tizen>
1510 public float ScrollBarShowDuration
1514 return (float)GetValue(ScrollBarShowDurationProperty);
1518 SetValue(ScrollBarShowDurationProperty, value);
1519 NotifyPropertyChanged();
1524 /// The ScrollBarFadeDuration property.<br />
1525 /// Sets the duration of scroll bar to fade out.<br />
1527 /// <since_tizen> 3 </since_tizen>
1528 public float ScrollBarFadeDuration
1532 return (float)GetValue(ScrollBarFadeDurationProperty);
1536 SetValue(ScrollBarFadeDurationProperty, value);
1537 NotifyPropertyChanged();
1542 /// The PixelSize property.<br />
1543 /// The size of font in pixels.<br />
1545 /// <since_tizen> 3 </since_tizen>
1546 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1547 public float PixelSize
1551 return (float)GetValue(PixelSizeProperty);
1555 SetValue(PixelSizeProperty, value);
1556 NotifyPropertyChanged();
1561 /// The line count of the text.
1563 /// <since_tizen> 3 </since_tizen>
1564 public int LineCount
1569 using (var propertyValue = GetProperty(TextEditor.Property.LineCount))
1571 propertyValue.Get(out lineCount);
1578 /// The text to display when the TextEditor is empty and inactive.
1580 /// <since_tizen> 3 </since_tizen>
1581 public string PlaceholderText
1585 return (string)GetValue(PlaceholderTextProperty);
1589 SetValue(PlaceholderTextProperty, value);
1590 NotifyPropertyChanged();
1595 /// The portion of the text that has been selected by the user.
1598 /// Empty string when nothing is selected.
1600 /// <since_tizen> 9 </since_tizen>
1601 public string SelectedText
1605 string selectedText;
1606 using (var propertyValue = GetProperty(TextEditor.Property.SelectedText))
1608 propertyValue.Get(out selectedText);
1610 return selectedText;
1615 /// The Placeholder text color.
1618 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1620 /// <since_tizen> 3 </since_tizen>
1621 public Color PlaceholderTextColor
1625 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1626 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1630 SetValue(PlaceholderTextColorProperty, value);
1631 NotifyPropertyChanged();
1636 /// The Enable selection property.<br />
1637 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1639 /// <since_tizen> 3 </since_tizen>
1640 public bool EnableSelection
1644 return (bool)GetValue(EnableSelectionProperty);
1648 SetValue(EnableSelectionProperty, value);
1649 NotifyPropertyChanged();
1654 /// The start index for selection.
1657 /// When there is no selection, the index is current cursor position.
1659 /// <since_tizen> 9 </since_tizen>
1660 public int SelectedTextStart
1664 int selectedTextStart;
1665 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextStart))
1667 propertyValue.Get(out selectedTextStart);
1669 return selectedTextStart;
1674 /// The end index for selection.
1677 /// When there is no selection, the index is current cursor position.
1679 /// <since_tizen> 9 </since_tizen>
1680 public int SelectedTextEnd
1684 int selectedTextEnd;
1685 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextEnd))
1687 propertyValue.Get(out selectedTextEnd);
1689 return selectedTextEnd;
1694 /// Enable editing in text control.
1696 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1697 [EditorBrowsable(EditorBrowsableState.Never)]
1698 public bool EnableEditing
1702 return (bool)GetValue(EnableEditingProperty);
1706 SetValue(EnableEditingProperty, value);
1710 private bool InternalEnableEditing
1715 using (var propertyValue = GetProperty(TextEditor.Property.EnableEditing))
1717 propertyValue.Get(out enableEditing);
1719 return enableEditing;
1723 using (var propertyValue = new PropertyValue(value))
1725 SetProperty(TextEditor.Property.EnableEditing, propertyValue);
1726 NotifyPropertyChanged();
1732 /// Specify horizontal scroll position in text control.
1734 [EditorBrowsable(EditorBrowsableState.Never)]
1735 public int HorizontalScrollPosition
1739 return (int)GetValue(HorizontalScrollPositionProperty);
1743 SetValue(HorizontalScrollPositionProperty, value);
1747 private int InternalHorizontalScrollPosition
1751 int horizontalScrollPosition;
1752 using (var propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1754 propertyValue.Get(out horizontalScrollPosition);
1756 return horizontalScrollPosition;
1760 using (var propertyValue = new PropertyValue(value))
1762 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1763 NotifyPropertyChanged();
1769 /// Specify vertical scroll position in text control.
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public int VerticalScrollPosition
1776 return (int)GetValue(VerticalScrollPositionProperty);
1780 SetValue(VerticalScrollPositionProperty, value);
1784 private int InternalVerticalScrollPosition
1788 int verticalScrollPosition;
1789 using (var propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1791 propertyValue.Get(out verticalScrollPosition);
1793 return verticalScrollPosition;
1797 using (var propertyValue = new PropertyValue(value))
1799 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1800 NotifyPropertyChanged();
1806 /// PrimaryCursorPosition property.<br />
1807 /// Specify the position of the primary cursor (caret) in text control.
1810 /// 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).
1812 /// <since_tizen> 10 </since_tizen>
1813 public int PrimaryCursorPosition
1817 return (int)GetValue(PrimaryCursorPositionProperty);
1821 SetValue(PrimaryCursorPositionProperty, value);
1825 private int InternalPrimaryCursorPosition
1829 int primaryCursorPosition;
1830 using (var propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1832 propertyValue.Get(out primaryCursorPosition);
1834 return primaryCursorPosition;
1838 using (var propertyValue = new PropertyValue(value))
1840 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1841 NotifyPropertyChanged();
1847 /// The GrabHandleColor property.
1850 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1852 [EditorBrowsable(EditorBrowsableState.Never)]
1853 public Color GrabHandleColor
1857 Color temp = (Color)GetValue(GrabHandleColorProperty);
1858 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1862 SetValue(GrabHandleColorProperty, value);
1863 NotifyPropertyChanged();
1868 /// Set InputFilter to TextEditor.
1870 /// <param name="inputFilter">The InputFilter</param>
1872 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1873 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1874 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1877 /// The following example demonstrates how to use the SetInputFilter method.
1879 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1880 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1881 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1882 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1885 /// <since_tizen> 9 </since_tizen>
1886 public void SetInputFilter(InputFilter inputFilter)
1888 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1889 using (var propertyValue = new PropertyValue(map))
1891 SetProperty(TextEditor.Property.InputFilter, propertyValue);
1896 /// Get InputFilter from TextEditor. <br />
1898 /// <returns>The InputFilter</returns>
1900 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1902 /// <since_tizen> 9 </since_tizen>
1903 public InputFilter GetInputFilter()
1905 InputFilter inputFilter;
1906 using (var propertyValue = GetProperty(TextEditor.Property.InputFilter))
1907 using (var map = new PropertyMap())
1909 propertyValue.Get(map);
1910 inputFilter = TextMapHelper.GetInputFilterStruct(map);
1916 /// Set Strikethrough to TextEditor. <br />
1918 /// <param name="strikethrough">The Strikethrough</param>
1920 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1923 /// The following example demonstrates how to use the SetStrikethrough method.
1925 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1926 /// strikethrough.Enable = true;
1927 /// strikethrough.Color = new Color("#3498DB");
1928 /// strikethrough.Height = 2.0f;
1929 /// editor.SetStrikethrough(strikethrough);
1932 [EditorBrowsable(EditorBrowsableState.Never)]
1933 public void SetStrikethrough(Strikethrough strikethrough)
1935 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1936 using (var propertyValue = new PropertyValue(map))
1938 SetProperty(TextEditor.Property.Strikethrough, propertyValue);
1943 /// Get Strikethrough from TextEditor. <br />
1945 /// <returns>The Strikethrough</returns>
1947 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1949 [EditorBrowsable(EditorBrowsableState.Never)]
1950 public Strikethrough GetStrikethrough()
1952 Strikethrough strikethrough;
1953 using (var propertyValue = GetProperty(TextEditor.Property.Strikethrough))
1954 using (var map = new PropertyMap())
1956 propertyValue.Get(map);
1957 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1959 return strikethrough;
1963 /// The Placeholder property.
1964 /// The placeholder map contains the following keys :<br />
1965 /// <list type="table">
1966 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1967 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1968 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1969 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1970 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1971 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1972 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1973 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1977 /// The following example demonstrates how to set the placeholder property.
1979 /// PropertyMap propertyMap = new PropertyMap();
1980 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1981 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1982 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1983 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1984 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1986 /// PropertyMap fontStyleMap = new PropertyMap();
1987 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1988 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1989 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1990 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1992 /// TextEditor editor = new TextEditor();
1993 /// editor.Placeholder = propertyMap;
1996 /// <since_tizen> 3 </since_tizen>
1997 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1998 public Tizen.NUI.PropertyMap Placeholder
2002 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2003 string defalutText = "";
2005 if (TextMapHelper.IsValue(map, 0))
2006 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2008 if (TextMapHelper.IsValue(map, 1))
2009 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2011 if (TextMapHelper.IsValue(map, 2))
2013 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2015 map.Add("color", color);
2019 if (TextMapHelper.IsValue(map, 3))
2020 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2022 if (TextMapHelper.IsValue(map, 4))
2024 using (var properyValue = map.Find(4))
2025 using (var fontStyle = new PropertyMap())
2027 properyValue.Get(fontStyle);
2028 using (var fontStyleValue = new PropertyValue(fontStyle))
2030 map.Add("fontStyle", fontStyleValue);
2035 if (TextMapHelper.IsValue(map, 5))
2036 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2038 if (TextMapHelper.IsValue(map, 6))
2039 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2041 if (TextMapHelper.IsValue(map, 7))
2042 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2048 SetValue(PlaceholderProperty, value);
2049 NotifyPropertyChanged();
2054 /// Set Placeholder to TextEditor. <br />
2056 /// <param name="placeholder">The Placeholder</param>
2058 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2061 /// The following example demonstrates how to use the SetPlaceholder method.
2063 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2064 /// placeholder.Text = "placeholder text";
2065 /// placeholder.TextFocused = "placeholder textFocused";
2066 /// placeholder.Color = new Color("#45B39D");
2067 /// placeholder.FontFamily = "BreezeSans";
2068 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2070 /// Width = FontWidthType.Expanded,
2071 /// Weight = FontWeightType.ExtraLight,
2072 /// Slant = FontSlantType.Italic,
2074 /// placeholder.PointSize = 25.0f;
2075 /// //placeholder.PixelSize = 50.0f;
2076 /// placeholder.Ellipsis = true;
2077 /// editor.SetPlaceholder(placeholder);
2080 [EditorBrowsable(EditorBrowsableState.Never)]
2081 public void SetPlaceholder(Placeholder placeholder)
2083 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2085 SetValue(PlaceholderProperty, placeholderMap);
2090 /// Get Placeholder from TextEditor. <br />
2092 /// <returns>The Placeholder</returns>
2094 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2096 [EditorBrowsable(EditorBrowsableState.Never)]
2097 public Placeholder GetPlaceholder()
2099 Placeholder placeholder;
2100 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2102 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2108 /// The Ellipsis property.<br />
2109 /// Enable or disable the ellipsis.<br />
2111 /// <since_tizen> 9 </since_tizen>
2112 public bool Ellipsis
2116 return (bool)GetValue(EllipsisProperty);
2120 SetValue(EllipsisProperty, value);
2121 NotifyPropertyChanged();
2127 /// The ellipsis position of the text.
2128 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2130 /// <since_tizen> 9 </since_tizen>
2131 public EllipsisPosition EllipsisPosition
2135 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2139 SetValue(EllipsisPositionProperty, value);
2140 NotifyPropertyChanged();
2145 /// The LineWrapMode property.<br />
2146 /// The line wrap mode when the text lines over the layout width.<br />
2148 /// <since_tizen> 4 </since_tizen>
2149 public LineWrapMode LineWrapMode
2153 return (LineWrapMode)GetValue(LineWrapModeProperty);
2157 SetValue(LineWrapModeProperty, value);
2158 NotifyPropertyChanged();
2163 /// Enables Text selection using Shift key.
2165 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2166 [EditorBrowsable(EditorBrowsableState.Never)]
2167 public bool EnableShiftSelection
2171 return (bool)GetValue(EnableShiftSelectionProperty);
2175 SetValue(EnableShiftSelectionProperty, value);
2176 NotifyPropertyChanged();
2181 /// The text alignment to match the direction of the system language.
2183 /// <since_tizen> 6 </since_tizen>
2184 public bool MatchSystemLanguageDirection
2188 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2192 SetValue(MatchSystemLanguageDirectionProperty, value);
2193 NotifyPropertyChanged();
2198 /// The MaxLength property.<br />
2199 /// The maximum number of characters that can be inserted.<br />
2201 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2202 [EditorBrowsable(EditorBrowsableState.Never)]
2203 public int MaxLength
2207 return (int)GetValue(MaxLengthProperty);
2211 SetValue(MaxLengthProperty, value);
2212 NotifyPropertyChanged();
2217 /// The FontSizeScale property. <br />
2218 /// The default value is 1.0. <br />
2219 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2220 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2222 /// <since_tizen> 9 </since_tizen>
2223 public float FontSizeScale
2227 return (float)GetValue(FontSizeScaleProperty);
2231 SetValue(FontSizeScaleProperty, value);
2232 NotifyPropertyChanged();
2236 private float InternalFontSizeScale
2240 return fontSizeScale;
2244 float newFontSizeScale;
2246 if (fontSizeScale == value) return;
2248 fontSizeScale = value;
2249 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2251 SystemSettingsFontSize systemSettingsFontSize;
2255 systemSettingsFontSize = SystemSettings.FontSize;
2259 Console.WriteLine("{0} Exception caught.", e);
2260 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2262 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2263 AddSystemSettingsFontSizeChanged();
2267 newFontSizeScale = fontSizeScale;
2268 RemoveSystemSettingsFontSizeChanged();
2271 SetInternalFontSizeScale(newFontSizeScale);
2275 private void SetInternalFontSizeScale(float fontSizeScale)
2278 Object.InternalSetPropertyFloat(this.SwigCPtr, TextEditor.Property.FontSizeScale, (float)fontSizeScale);
2282 /// The EnableFontSizeScale property.<br />
2283 /// Whether the font size scale is enabled. (The default value is true)
2285 [EditorBrowsable(EditorBrowsableState.Never)]
2286 public bool EnableFontSizeScale
2290 return (bool)GetValue(EnableFontSizeScaleProperty);
2294 SetValue(EnableFontSizeScaleProperty, value);
2295 NotifyPropertyChanged();
2300 /// The InputMethodSettings property.<br />
2301 /// The settings to relating to the System's Input Method, Key and Value.<br />
2304 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
2307 /// The following example demonstrates how to set the InputMethodSettings property.
2309 /// InputMethod method = new InputMethod();
2310 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
2311 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
2312 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
2313 /// method.Variation = 1;
2314 /// textEditor.InputMethodSettings = method.OutputMap;
2317 [EditorBrowsable(EditorBrowsableState.Never)]
2318 public PropertyMap InputMethodSettings
2322 return (PropertyMap)GetValue(InputMethodSettingsProperty);
2326 SetValue(InputMethodSettingsProperty, value);
2327 NotifyPropertyChanged();
2332 /// Scroll the text control by specific amount..
2334 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
2335 [EditorBrowsable(EditorBrowsableState.Never)]
2336 public void ScrollBy(Vector2 scroll)
2338 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
2339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2343 /// Get the InputMethodContext instance.
2345 /// <returns>The InputMethodContext instance.</returns>
2346 /// <since_tizen> 5 </since_tizen>
2347 public InputMethodContext GetInputMethodContext()
2349 if (inputMethodContext == null)
2351 /*Avoid raising InputMethodContext reference count.*/
2352 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
2353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2355 return inputMethodContext;
2359 /// Select the whole text.
2361 /// <since_tizen> 9 </since_tizen>
2362 public void SelectWholeText()
2364 Interop.TextEditor.SelectWholeText(SwigCPtr);
2365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2369 /// Select text from start to end index. <br />
2370 /// The index is valid when 0 or positive.
2372 /// <param name="start">The start index for selection.</param>
2373 /// <param name="end">The end index for selection.</param>
2375 /// If the end index exceeds the maximum value, it is set to the length of the text.
2377 /// <since_tizen> 9 </since_tizen>
2378 public void SelectText(int start, int end)
2381 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2383 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2385 Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
2386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2390 /// Clear selection of the text. <br />
2391 /// Valid when selection is activate.
2393 /// <since_tizen> 9 </since_tizen>
2394 public void SelectNone()
2396 _ = Interop.TextEditor.SelectNone(SwigCPtr);
2397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2401 /// The Enable grab handle property.<br />
2402 /// Enables the grab handles for text selection.<br />
2403 /// The default value is true, which means the grab handles are enabled by default.<br />
2405 [EditorBrowsable(EditorBrowsableState.Never)]
2406 public bool EnableGrabHandle
2410 return (bool)GetValue(EnableGrabHandleProperty);
2414 SetValue(EnableGrabHandleProperty, value);
2415 NotifyPropertyChanged();
2420 /// The Enable grab handle popup property.<br />
2421 /// Enables the grab handle popup for text selection.<br />
2422 /// The default value is true, which means the grab handle popup is enabled by default.<br />
2424 [EditorBrowsable(EditorBrowsableState.Never)]
2425 public bool EnableGrabHandlePopup
2429 return (bool)GetValue(EnableGrabHandlePopupProperty);
2433 SetValue(EnableGrabHandlePopupProperty, value);
2434 NotifyPropertyChanged();
2439 /// Minimum line size to be used.<br />
2440 /// The height of the line in points. <br />
2441 /// If the font size is larger than the line size, it works with the font size. <br />
2443 [EditorBrowsable(EditorBrowsableState.Never)]
2444 public float MinLineSize
2448 return (float)GetValue(MinLineSizeProperty);
2452 SetValue(MinLineSizeProperty, value);
2453 NotifyPropertyChanged();
2457 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2459 SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t(Interop.TextEditor.InputStyleChangedSignal(SwigCPtr));
2460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2465 /// The spaces between characters in Pixels.
2467 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2468 /// The default value is 0.f which does nothing.
2471 [EditorBrowsable(EditorBrowsableState.Never)]
2472 public float CharacterSpacing
2476 return (float)GetValue(CharacterSpacingProperty);
2480 SetValue(CharacterSpacingProperty, value);
2481 NotifyPropertyChanged();
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(SystemSettings_LocaleLanguageChanged);
2509 RemoveSystemSettingsFontTypeChanged();
2510 RemoveSystemSettingsFontSizeChanged();
2512 //Release your own unmanaged resources here.
2513 //You should not access any managed member here except static instance.
2514 //because the execution order of Finalizes is non-deterministic.
2518 if (textEditorTextChangedCallbackDelegate != null)
2520 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2523 if (textEditorMaxLengthReachedCallbackDelegate != null)
2525 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2528 if (textEditorSelectionStartedCallbackDelegate != null)
2530 this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
2533 if (textEditorSelectionClearedCallbackDelegate != null)
2535 this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2538 if (textEditorCursorPositionChangedCallbackDelegate != null)
2540 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2543 if (textEditorSelectionChangedCallbackDelegate != null)
2545 this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2549 TextChanged -= TextEditorTextChanged;
2550 GetInputMethodContext()?.DestroyContext();
2555 /// This will not be public opened.
2556 [EditorBrowsable(EditorBrowsableState.Never)]
2557 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2559 Interop.TextEditor.DeleteTextEditor(swigCPtr);
2562 internal override LayoutItem CreateDefaultLayout()
2564 return new TextEditorLayout();
2567 internal void SetTextWithoutTextChanged(string text)
2569 invokeTextChanged = false;
2570 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2571 invokeTextChanged = true;
2574 private string SetTranslatable(string textEditorSid)
2576 string translatableText = null;
2577 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2578 if (translatableText != null)
2580 if (hasSystemLanguageChanged == false)
2582 systemLocaleLanguageChanged.Add(SystemSettings_LocaleLanguageChanged);
2583 hasSystemLanguageChanged = true;
2585 return translatableText;
2589 translatableText = "";
2590 return translatableText;
2594 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2596 if (textEditorTextSid != null)
2598 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2600 if (textEditorPlaceHolderTextSid != null)
2602 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2606 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2608 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2609 SetInternalFontSizeScale(newFontSizeScale);
2612 private void AddSystemSettingsFontSizeChanged()
2614 if (hasSystemFontSizeChanged != true)
2618 systemFontSizeChanged.Add(SystemSettingsFontSizeChanged);
2619 hasSystemFontSizeChanged = true;
2623 Console.WriteLine("{0} Exception caught.", e);
2624 hasSystemFontSizeChanged = false;
2629 private void RemoveSystemSettingsFontSizeChanged()
2631 if (hasSystemFontSizeChanged == true)
2635 systemFontSizeChanged.Remove(SystemSettingsFontSizeChanged);
2636 hasSystemFontSizeChanged = false;
2640 Console.WriteLine("{0} Exception caught.", e);
2641 hasSystemFontSizeChanged = true;
2646 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2648 SetInternalFontFamily(e.Value);
2651 private void AddSystemSettingsFontTypeChanged()
2653 if (HasStyle() && !hasSystemFontTypeChanged)
2657 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2658 hasSystemFontTypeChanged = true;
2662 Console.WriteLine("{0} Exception caught.", e);
2663 hasSystemFontTypeChanged = false;
2668 private void RemoveSystemSettingsFontTypeChanged()
2670 if (hasSystemFontTypeChanged)
2674 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2675 hasSystemFontTypeChanged = false;
2679 Console.WriteLine("{0} Exception caught.", e);
2680 hasSystemFontTypeChanged = true;
2685 private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
2687 if (!isSettingTextInCSharp)
2689 EnforceNotifyBindedInstance(TextProperty);
2693 internal new class Property
2695 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2696 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2697 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2698 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2699 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2700 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2701 internal static readonly int VerticalAlignment = Interop.TextEditor.VerticalAlignmentGet();
2702 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2703 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2704 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2705 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2706 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2707 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2708 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2709 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2710 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2711 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2712 internal static readonly int SelectionPopupStyle = Interop.TextEditor.SelectionPopupStyleGet();
2713 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2714 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2715 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2716 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2717 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2718 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2719 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2720 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2721 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2722 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2723 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2724 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2725 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2726 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2727 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2728 internal static readonly int RelativeLineHeight = Interop.TextEditor.RelativeLineHeightGet();
2729 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2730 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2731 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2732 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2733 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2734 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2735 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2736 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2737 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2738 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2739 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2740 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2741 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2742 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2743 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2744 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2745 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2746 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2747 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2748 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2749 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2750 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2751 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2752 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2753 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2754 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2755 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2756 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2757 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2758 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2759 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2760 internal static readonly int EnableFontSizeScale = Interop.TextEditor.EnableFontSizeScaleGet();
2761 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2762 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2763 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2764 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2765 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2766 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2767 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2768 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2769 internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
2770 internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
2773 internal class InputStyle
2779 FontFamily = 0x0002,
2782 LineSpacing = 0x0010,
2790 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2792 DecorationBoundingBox = new Rectangle(x, y, width, height);
2794 private void OnInputColorChanged(float x, float y, float z, float w)
2796 InputColor = new Vector4(x, y, z, w);
2798 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2800 PlaceholderTextColor = new Color(r, g, b, a);
2802 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2804 PrimaryCursorColor = new Vector4(x, y, z, w);
2806 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2808 SecondaryCursorColor = new Vector4(x, y, z, w);
2810 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2812 SelectionHighlightColor = new Vector4(x, y, z, w);
2814 private void OnTextColorChanged(float x, float y, float z, float w)
2816 TextColor = new Vector4(x, y, z, w);
2818 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2820 GrabHandleColor = new Color(r, g, b, a);
2823 private class TextEditorLayout : LayoutItem
2825 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2827 // Padding will be automatically applied by DALi TextEditor.
2828 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2829 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2830 var minSize = Owner.MinimumSize;
2831 var maxSize = Owner.MaximumSize;
2832 var naturalSize = Owner.GetNaturalSize();
2834 if (((TextEditor)Owner).Text.Length == 0)
2836 // Calculate height of TextEditor by setting Text with " ".
2837 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2838 ((TextEditor)Owner).SetTextWithoutTextChanged(" ");
2840 // Store original WidthSpecification to restore it after setting ResizePolicy.
2841 var widthSpecification = Owner.WidthSpecification;
2843 // In DALi's Size logic, if Width or Height is set to be 0, then
2844 // ResizePolicy is not changed to Fixed.
2845 // This causes Size changes after NUI Layout's OnMeasure is finished.
2846 // e.g. TextEditor's Width fills to its parent although Text is null and
2847 // WidthSpecification is WrapContent.
2848 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2849 // in advance if Text is null.
2850 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2852 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2853 Owner.WidthSpecification = widthSpecification;
2855 naturalSize = Owner.GetNaturalSize();
2857 // Restore TextEditor's Text after calculating height of TextEditor.
2858 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2859 ((TextEditor)Owner).SetTextWithoutTextChanged("");
2862 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2864 float width = naturalSize != null ? naturalSize.Width : 0;
2865 totalWidth = Math.Min(Math.Max(width, minSize.Width), maxSize.Width);
2868 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2870 float height = naturalSize != null ? naturalSize.Height : 0;
2871 totalHeight = Math.Min(Math.Max(height, minSize.Height), maxSize.Height);
2874 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2875 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2877 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2878 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2880 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2881 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));