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 string textEditorTextSid = null;
38 private string textEditorPlaceHolderTextSid = null;
39 private InputMethodContext inputMethodContext = null;
40 private string fontFamily = defaultFontFamily;
41 private float fontSizeScale = 1.0f;
42 private bool hasSystemLanguageChanged = false;
43 private bool hasSystemFontSizeChanged = false;
44 private bool hasSystemFontTypeChanged = false;
45 private bool isSettingTextInCSharp = false;
47 private Color internalPlaceholderTextColor = null;
48 private Vector4 internalPrimaryCursorColor = null;
49 private Vector4 internalSecondaryCursorColor = null;
50 private Vector4 internalSelectionHighlightColor = null;
51 private Vector4 internalInputColor = null;
52 private Vector4 internalTextColor = null;
53 private Color internalGrabHandleColor = null;
56 static TextEditor() { }
59 /// Creates the TextEditor control.
61 /// <since_tizen> 3 </since_tizen>
62 public TextEditor() : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
64 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68 /// Creates the TextEditor with specified style.
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public TextEditor(TextEditorStyle style) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, style: style)
76 /// Creates the TextEditor with setting the status of shown or hidden.
78 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
79 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public TextEditor(bool shown) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
99 TextChanged += TextEditorTextChanged;
102 private bool HasStyle()
104 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
108 /// The TranslatableText property.<br />
109 /// The text can set the SID value.<br />
111 /// <exception cref='ArgumentNullException'>
112 /// ResourceManager about multilingual is null.
114 /// <since_tizen> 4 </since_tizen>
115 public string TranslatableText
119 return GetValue(TranslatableTextProperty) as string;
123 SetValue(TranslatableTextProperty, value);
127 private string InternalTranslatableText
131 return textEditorTextSid;
135 if (NUIApplication.MultilingualResourceManager == null)
137 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
139 textEditorTextSid = value;
140 Text = SetTranslatable(textEditorTextSid);
141 NotifyPropertyChanged();
145 /// The TranslatablePlaceholderText property.<br />
146 /// The text can set the SID value.<br />
148 /// <exception cref='ArgumentNullException'>
149 /// ResourceManager about multilingual is null.
151 /// <since_tizen> 4 </since_tizen>
152 public string TranslatablePlaceholderText
156 return GetValue(TranslatablePlaceholderTextProperty) as string;
160 SetValue(TranslatablePlaceholderTextProperty, value);
164 private string InternalTranslatablePlaceholderText
168 return textEditorPlaceHolderTextSid;
172 if (NUIApplication.MultilingualResourceManager == null)
174 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
176 textEditorPlaceHolderTextSid = value;
177 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
178 NotifyPropertyChanged();
183 /// The Text property.<br />
184 /// The text to display in the UTF-8 format.<br />
186 /// <since_tizen> 3 </since_tizen>
191 return (string)GetValue(TextProperty);
195 SetValue(TextProperty, value);
196 NotifyPropertyChanged();
201 /// The TextColor property.<br />
202 /// The color of the text.<br />
205 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
207 /// <since_tizen> 3 </since_tizen>
208 public Vector4 TextColor
212 Vector4 temp = (Vector4)GetValue(TextColorProperty);
213 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
217 SetValue(TextColorProperty, value);
218 NotifyPropertyChanged();
223 /// The FontFamily property.<br />
224 /// The requested font family to use.<br />
226 /// <since_tizen> 3 </since_tizen>
227 public string FontFamily
231 return (string)GetValue(FontFamilyProperty);
235 SetValue(FontFamilyProperty, value);
236 NotifyPropertyChanged();
240 private string InternalFontFamily
247 return Object.InternalGetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily);
251 string newFontFamily;
253 if (string.Equals(fontFamily, value)) return;
256 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
260 newFontFamily = SystemSettings.FontType;
264 Console.WriteLine("{0} Exception caught.", e);
265 newFontFamily = defaultFontFamily;
267 AddSystemSettingsFontTypeChanged();
271 newFontFamily = fontFamily;
272 RemoveSystemSettingsFontTypeChanged();
275 SetInternalFontFamily(newFontFamily);
279 private void SetInternalFontFamily(string fontFamily)
281 Object.InternalSetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily, (string)fontFamily);
285 /// The FontStyle property.<br />
286 /// The requested font style to use.<br />
287 /// The fontStyle map contains the following keys :<br />
288 /// <list type="table">
289 /// <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>
290 /// <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>
291 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
294 /// <since_tizen> 3 </since_tizen>
295 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
296 public PropertyMap FontStyle
300 return (PropertyMap)GetValue(FontStyleProperty);
304 SetValue(FontStyleProperty, value);
305 NotifyPropertyChanged();
310 /// Set FontStyle to TextEditor. <br />
312 /// <param name="fontStyle">The FontStyle</param>
314 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
317 /// The following example demonstrates how to use the SetFontStyle method.
319 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
320 /// fontStyle.Width = FontWidthType.Expanded;
321 /// fontStyle.Weight = FontWeightType.Bold;
322 /// fontStyle.Slant = FontSlantType.Italic;
323 /// editor.SetFontStyle(fontStyle);
326 [EditorBrowsable(EditorBrowsableState.Never)]
327 public void SetFontStyle(FontStyle fontStyle)
329 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
331 SetValue(FontStyleProperty, fontStyleMap);
336 /// Get FontStyle from TextEditor. <br />
338 /// <returns>The FontStyle</returns>
340 /// <see cref="Tizen.NUI.Text.FontStyle"/>
342 [EditorBrowsable(EditorBrowsableState.Never)]
343 public FontStyle GetFontStyle()
346 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
348 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
354 /// The PointSize property.<br />
355 /// The size of font in points.<br />
357 /// <since_tizen> 3 </since_tizen>
358 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
359 public float PointSize
363 return (float)GetValue(PointSizeProperty);
367 SetValue(PointSizeProperty, value);
368 NotifyPropertyChanged();
373 /// The HorizontalAlignment property.<br />
374 /// The line horizontal alignment.<br />
376 /// <since_tizen> 3 </since_tizen>
377 public HorizontalAlignment HorizontalAlignment
381 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
385 SetValue(HorizontalAlignmentProperty, value);
386 NotifyPropertyChanged();
391 /// The VerticalAlignment property.<br />
392 /// The line vertical alignment.
394 [EditorBrowsable(EditorBrowsableState.Never)]
395 public VerticalAlignment VerticalAlignment
399 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
403 SetValue(VerticalAlignmentProperty, value);
404 NotifyPropertyChanged();
409 /// The ScrollThreshold property.<br />
410 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
412 /// <since_tizen> 3 </since_tizen>
413 public float ScrollThreshold
417 return (float)GetValue(ScrollThresholdProperty);
421 SetValue(ScrollThresholdProperty, value);
422 NotifyPropertyChanged();
427 /// The ScrollSpeed property.<br />
428 /// The scroll speed in pixels per second.<br />
430 /// <since_tizen> 3 </since_tizen>
431 public float ScrollSpeed
435 return (float)GetValue(ScrollSpeedProperty);
439 SetValue(ScrollSpeedProperty, value);
440 NotifyPropertyChanged();
445 /// The PrimaryCursorColor property.<br />
446 /// The color to apply to the primary cursor.<br />
449 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
451 /// <since_tizen> 3 </since_tizen>
452 public Vector4 PrimaryCursorColor
456 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
457 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
461 SetValue(PrimaryCursorColorProperty, value);
462 NotifyPropertyChanged();
467 /// The SecondaryCursorColor property.<br />
468 /// The color to apply to the secondary cursor.<br />
471 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
473 /// <since_tizen> 3 </since_tizen>
474 public Vector4 SecondaryCursorColor
478 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
479 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
483 SetValue(SecondaryCursorColorProperty, value);
484 NotifyPropertyChanged();
489 /// The EnableCursorBlink property.<br />
490 /// Whether the cursor should blink or not.<br />
492 /// <since_tizen> 3 </since_tizen>
493 public bool EnableCursorBlink
497 return (bool)GetValue(EnableCursorBlinkProperty);
501 SetValue(EnableCursorBlinkProperty, value);
502 NotifyPropertyChanged();
507 /// The CursorBlinkInterval property.<br />
508 /// The time interval in seconds between cursor on/off states.<br />
510 /// <since_tizen> 3 </since_tizen>
511 public float CursorBlinkInterval
515 return (float)GetValue(CursorBlinkIntervalProperty);
519 SetValue(CursorBlinkIntervalProperty, value);
520 NotifyPropertyChanged();
525 /// The CursorBlinkDuration property.<br />
526 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
528 /// <since_tizen> 3 </since_tizen>
529 public float CursorBlinkDuration
533 return (float)GetValue(CursorBlinkDurationProperty);
537 SetValue(CursorBlinkDurationProperty, value);
538 NotifyPropertyChanged();
543 /// The CursorWidth property.
545 /// <since_tizen> 3 </since_tizen>
546 public int CursorWidth
550 return (int)GetValue(CursorWidthProperty);
554 SetValue(CursorWidthProperty, value);
555 NotifyPropertyChanged();
560 /// The GrabHandleImage property.<br />
561 /// The image to display for the grab handle.<br />
563 /// <since_tizen> 3 </since_tizen>
564 public string GrabHandleImage
568 return (string)GetValue(GrabHandleImageProperty);
572 SetValue(GrabHandleImageProperty, value);
573 NotifyPropertyChanged();
578 /// The GrabHandlePressedImage property.<br />
579 /// The image to display when the grab handle is pressed.<br />
581 /// <since_tizen> 3 </since_tizen>
582 public string GrabHandlePressedImage
586 return (string)GetValue(GrabHandlePressedImageProperty);
590 SetValue(GrabHandlePressedImageProperty, value);
591 NotifyPropertyChanged();
596 /// The SelectionPopupStyle property.<br />
597 /// The style of the text selection popup can be set through SelectionPopupStyle property.
599 [EditorBrowsable(EditorBrowsableState.Never)]
600 public PropertyMap SelectionPopupStyle
604 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
608 SetValue(SelectionPopupStyleProperty, value);
609 NotifyPropertyChanged();
614 /// The SelectionHandleImageLeft property.<br />
615 /// The image to display for the left selection handle.<br />
616 /// The selectionHandleImageLeft map contains the following key :<br />
617 /// <list type="table">
618 /// <item><term>filename (string)</term><description>The path of image file</description></item>
621 /// <since_tizen> 3 </since_tizen>
622 public PropertyMap SelectionHandleImageLeft
626 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
630 SetValue(SelectionHandleImageLeftProperty, value);
631 NotifyPropertyChanged();
636 /// The SelectionHandleImageRight property.<br />
637 /// The image to display for the right selection handle.<br />
638 /// The selectionHandleImageRight map contains the following key :<br />
639 /// <list type="table">
640 /// <item><term>filename (string)</term><description>The path of image file</description></item>
643 /// <since_tizen> 3 </since_tizen>
644 public PropertyMap SelectionHandleImageRight
648 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
652 SetValue(SelectionHandleImageRightProperty, value);
653 NotifyPropertyChanged();
658 /// Set SelectionHandleImage to TextEditor. <br />
660 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
662 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
665 /// The following example demonstrates how to use the SetSelectionHandleImage method.
667 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
668 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
669 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
670 /// editor.SetSelectionHandleImage(selectionHandleImage);
673 [EditorBrowsable(EditorBrowsableState.Never)]
674 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
676 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
678 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
680 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
684 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
686 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
688 SetValue(SelectionHandleImageRightProperty, rightImageMap);
694 /// Get SelectionHandleImage from TextEditor. <br />
696 /// <returns>The SelectionHandleImage</returns>
698 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
700 [EditorBrowsable(EditorBrowsableState.Never)]
701 public SelectionHandleImage GetSelectionHandleImage()
703 SelectionHandleImage selectionHandleImage;
704 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
705 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
707 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
709 return selectionHandleImage;
713 /// The SelectionHandlePressedImageLeft property.<br />
714 /// The image to display when the left selection handle is pressed.<br />
715 /// The selectionHandlePressedImageLeft map contains the following key :<br />
716 /// <list type="table">
717 /// <item><term>filename (string)</term><description>The path of image file</description></item>
720 /// <since_tizen> 3 </since_tizen>
721 public PropertyMap SelectionHandlePressedImageLeft
725 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
729 SetValue(SelectionHandlePressedImageLeftProperty, value);
730 NotifyPropertyChanged();
735 /// The SelectionHandlePressedImageRight property.<br />
736 /// The image to display when the right selection handle is pressed.<br />
737 /// The selectionHandlePressedImageRight map contains the following key :<br />
738 /// <list type="table">
739 /// <item><term>filename (string)</term><description>The path of image file</description></item>
742 /// <since_tizen> 3 </since_tizen>
743 public PropertyMap SelectionHandlePressedImageRight
747 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
751 SetValue(SelectionHandlePressedImageRightProperty, value);
752 NotifyPropertyChanged();
757 /// Set SelectionHandlePressedImage to TextEditor. <br />
759 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
761 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
764 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
766 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
767 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
768 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
769 /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
772 [EditorBrowsable(EditorBrowsableState.Never)]
773 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
775 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
777 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
779 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
783 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
785 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
787 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
793 /// Get SelectionHandlePressedImage from TextEditor. <br />
795 /// <returns>The SelectionHandlePressedImage</returns>
797 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
799 [EditorBrowsable(EditorBrowsableState.Never)]
800 public SelectionHandleImage GetSelectionHandlePressedImage()
802 SelectionHandleImage selectionHandleImage;
803 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
804 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
806 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
808 return selectionHandleImage;
812 /// The SelectionHandleMarkerImageLeft property.<br />
813 /// The image to display for the left selection handle marker.<br />
814 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
815 /// <list type="table">
816 /// <item><term>filename (string)</term><description>The path of image file</description></item>
819 /// <since_tizen> 3 </since_tizen>
820 public PropertyMap SelectionHandleMarkerImageLeft
824 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
828 SetValue(SelectionHandleMarkerImageLeftProperty, value);
829 NotifyPropertyChanged();
834 /// The SelectionHandleMarkerImageRight property.<br />
835 /// The image to display for the right selection handle marker.<br />
836 /// The selectionHandleMarkerImageRight map contains the following key :<br />
837 /// <list type="table">
838 /// <item><term>filename (string)</term><description>The path of image file</description></item>
841 /// <since_tizen> 3 </since_tizen>
842 public PropertyMap SelectionHandleMarkerImageRight
846 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
850 SetValue(SelectionHandleMarkerImageRightProperty, value);
851 NotifyPropertyChanged();
856 /// Set SelectionHandleMarkerImage to TextEditor. <br />
858 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
860 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
863 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
865 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
866 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
867 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
868 /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
871 [EditorBrowsable(EditorBrowsableState.Never)]
872 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
874 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
876 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
878 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
882 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
884 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
886 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
892 /// Get SelectionHandleMarkerImage from TextEditor. <br />
894 /// <returns>The SelectionHandleMarkerImage</returns>
896 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
898 [EditorBrowsable(EditorBrowsableState.Never)]
899 public SelectionHandleImage GetSelectionHandleMarkerImage()
901 SelectionHandleImage selectionHandleImage;
902 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
903 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
905 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
907 return selectionHandleImage;
911 /// The SelectionHighlightColor property.<br />
912 /// The color of the selection highlight.<br />
915 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
917 /// <since_tizen> 3 </since_tizen>
918 public Vector4 SelectionHighlightColor
922 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
923 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
927 SetValue(SelectionHighlightColorProperty, value);
928 NotifyPropertyChanged();
933 /// The DecorationBoundingBox property.<br />
934 /// The decorations (handles etc) will positioned within this area on-screen.<br />
937 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
939 /// <since_tizen> 3 </since_tizen>
940 public Rectangle DecorationBoundingBox
944 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
945 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
949 SetValue(DecorationBoundingBoxProperty, value);
950 NotifyPropertyChanged();
955 /// The EnableMarkup property.<br />
956 /// Whether the mark-up processing is enabled.<br />
958 /// <since_tizen> 3 </since_tizen>
959 public bool EnableMarkup
963 return (bool)GetValue(EnableMarkupProperty);
967 SetValue(EnableMarkupProperty, value);
968 NotifyPropertyChanged();
973 /// The InputColor property.<br />
974 /// The color of the new input text.<br />
977 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
979 /// <since_tizen> 3 </since_tizen>
980 public Vector4 InputColor
984 Vector4 temp = (Vector4)GetValue(InputColorProperty);
985 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
989 SetValue(InputColorProperty, value);
990 NotifyPropertyChanged();
995 /// The InputFontFamily property.<br />
996 /// The font's family of the new input text.<br />
998 /// <since_tizen> 3 </since_tizen>
999 public string InputFontFamily
1003 return (string)GetValue(InputFontFamilyProperty);
1007 SetValue(InputFontFamilyProperty, value);
1008 NotifyPropertyChanged();
1013 /// The InputFontStyle property.<br />
1014 /// The font's style of the new input text.<br />
1015 /// The inputFontStyle map contains the following keys :<br />
1016 /// <list type="table">
1017 /// <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>
1018 /// <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>
1019 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1022 /// <since_tizen> 3 </since_tizen>
1023 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1024 public PropertyMap InputFontStyle
1028 return (PropertyMap)GetValue(InputFontStyleProperty);
1032 SetValue(InputFontStyleProperty, value);
1033 NotifyPropertyChanged();
1038 /// Set InputFontStyle to TextEditor. <br />
1040 /// <param name="fontStyle">The FontStyle</param>
1042 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1045 /// The following example demonstrates how to use the SetInputFontStyle method.
1047 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1048 /// fontStyle.Width = FontWidthType.Expanded;
1049 /// fontStyle.Weight = FontWeightType.Bold;
1050 /// fontStyle.Slant = FontSlantType.Italic;
1051 /// editor.SetInputFontStyle(fontStyle);
1054 [EditorBrowsable(EditorBrowsableState.Never)]
1055 public void SetInputFontStyle(FontStyle fontStyle)
1057 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1059 SetValue(InputFontStyleProperty, fontStyleMap);
1064 /// Get InputFontStyle from TextEditor. <br />
1066 /// <returns>The FontStyle</returns>
1068 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1070 [EditorBrowsable(EditorBrowsableState.Never)]
1071 public FontStyle GetInputFontStyle()
1073 FontStyle fontStyle;
1074 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1076 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1082 /// The InputPointSize property.<br />
1083 /// The font's size of the new input text in points.<br />
1085 /// <since_tizen> 3 </since_tizen>
1086 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1087 public float InputPointSize
1091 return (float)GetValue(InputPointSizeProperty);
1095 SetValue(InputPointSizeProperty, value);
1096 NotifyPropertyChanged();
1101 /// The LineSpacing property.<br />
1102 /// The default extra space between lines in points.<br />
1104 /// <since_tizen> 3 </since_tizen>
1105 public float LineSpacing
1109 return (float)GetValue(LineSpacingProperty);
1113 SetValue(LineSpacingProperty, value);
1114 NotifyPropertyChanged();
1119 /// The InputLineSpacing property.<br />
1120 /// The extra space between lines in points.<br />
1122 /// <since_tizen> 3 </since_tizen>
1123 public float InputLineSpacing
1127 return (float)GetValue(InputLineSpacingProperty);
1131 SetValue(InputLineSpacingProperty, value);
1132 NotifyPropertyChanged();
1137 /// The relative height of the line (a factor that will be multiplied by text height). <br />
1138 /// If the value is less than 1, the lines could to be overlapped.
1140 [EditorBrowsable(EditorBrowsableState.Never)]
1141 public float RelativeLineHeight
1145 return (float)GetValue(RelativeLineHeightProperty);
1149 SetValue(RelativeLineHeightProperty, value);
1150 NotifyPropertyChanged();
1155 /// The Underline property.<br />
1156 /// The default underline parameters.<br />
1157 /// The underline map contains the following keys :<br />
1158 /// <list type="table">
1159 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1160 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1161 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1164 /// <since_tizen> 3 </since_tizen>
1165 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1166 public PropertyMap Underline
1170 return (PropertyMap)GetValue(UnderlineProperty);
1174 SetValue(UnderlineProperty, value);
1175 NotifyPropertyChanged();
1180 /// Set Underline to TextEditor. <br />
1182 /// <param name="underline">The Underline</param>
1184 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1187 /// The following example demonstrates how to use the SetUnderline method.
1189 /// var underline = new Tizen.NUI.Text.Underline();
1190 /// underline.Enable = true;
1191 /// underline.Color = new Color("#3498DB");
1192 /// underline.Height = 2.0f;
1193 /// editor.SetUnderline(underline);
1196 [EditorBrowsable(EditorBrowsableState.Never)]
1197 public void SetUnderline(Underline underline)
1199 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1201 SetValue(UnderlineProperty, underlineMap);
1206 /// Get Underline from TextEditor. <br />
1208 /// <returns>The Underline</returns>
1210 /// <see cref="Tizen.NUI.Text.Underline"/>
1212 [EditorBrowsable(EditorBrowsableState.Never)]
1213 public Underline GetUnderline()
1215 Underline underline;
1216 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1218 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1224 /// The InputUnderline property.<br />
1225 /// The underline parameters of the new input text.<br />
1227 /// <since_tizen> 3 </since_tizen>
1228 public string InputUnderline
1232 return (string)GetValue(InputUnderlineProperty);
1236 SetValue(InputUnderlineProperty, value);
1237 NotifyPropertyChanged();
1242 /// The Shadow property.<br />
1243 /// The default shadow parameters.<br />
1244 /// The shadow map contains the following keys :<br />
1245 /// <list type="table">
1246 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1247 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1248 /// <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>
1251 /// <since_tizen> 3 </since_tizen>
1252 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1253 public PropertyMap Shadow
1257 return (PropertyMap)GetValue(ShadowProperty);
1261 SetValue(ShadowProperty, value);
1262 NotifyPropertyChanged();
1267 /// Set Shadow to TextEditor. <br />
1269 /// <param name="shadow">The Shadow</param>
1271 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1274 /// The following example demonstrates how to use the SetShadow method.
1276 /// var shadow = new Tizen.NUI.Text.Shadow();
1277 /// shadow.Offset = new Vector2(3, 3);
1278 /// shadow.Color = new Color("#F1C40F");
1279 /// editor.SetShadow(shadow);
1282 [EditorBrowsable(EditorBrowsableState.Never)]
1283 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1285 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1287 SetValue(ShadowProperty, shadowMap);
1292 /// Get Shadow from TextEditor. <br />
1294 /// <returns>The Shadow</returns>
1296 /// <see cref="Tizen.NUI.Text.Shadow"/>
1298 [EditorBrowsable(EditorBrowsableState.Never)]
1299 public Tizen.NUI.Text.Shadow GetShadow()
1301 Tizen.NUI.Text.Shadow shadow;
1302 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1304 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1310 /// The InputShadow property.<br />
1311 /// The shadow parameters of the new input text.<br />
1313 /// <since_tizen> 3 </since_tizen>
1314 public string InputShadow
1318 return (string)GetValue(InputShadowProperty);
1322 SetValue(InputShadowProperty, value);
1323 NotifyPropertyChanged();
1328 /// The Emboss property.<br />
1329 /// The default emboss parameters.<br />
1331 /// <since_tizen> 3 </since_tizen>
1332 public string Emboss
1336 return (string)GetValue(EmbossProperty);
1340 SetValue(EmbossProperty, value);
1341 NotifyPropertyChanged();
1346 /// The InputEmboss property.<br />
1347 /// The emboss parameters of the new input text.<br />
1349 /// <since_tizen> 3 </since_tizen>
1350 public string InputEmboss
1354 return (string)GetValue(InputEmbossProperty);
1358 SetValue(InputEmbossProperty, value);
1359 NotifyPropertyChanged();
1364 /// The Outline property.<br />
1365 /// The default outline parameters.<br />
1366 /// The outline map contains the following keys :<br />
1367 /// <list type="table">
1368 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1369 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1372 /// <since_tizen> 3 </since_tizen>
1373 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1374 public PropertyMap Outline
1378 return (PropertyMap)GetValue(OutlineProperty);
1382 SetValue(OutlineProperty, value);
1383 NotifyPropertyChanged();
1388 /// Set Outline to TextEditor. <br />
1390 /// <param name="outline">The Outline</param>
1392 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1395 /// The following example demonstrates how to use the SetOutline method.
1397 /// var outline = new Tizen.NUI.Text.Outline();
1398 /// outline.Width = 2.0f;
1399 /// outline.Color = new Color("#45B39D");
1400 /// editor.SetOutline(outline);
1403 [EditorBrowsable(EditorBrowsableState.Never)]
1404 public void SetOutline(Outline outline)
1406 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1408 SetValue(OutlineProperty, outlineMap);
1413 /// Get Outline from TextEditor. <br />
1415 /// <returns>The Outline</returns>
1417 /// <see cref="Tizen.NUI.Text.Outline"/>
1419 [EditorBrowsable(EditorBrowsableState.Never)]
1420 public Outline GetOutline()
1423 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1425 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1431 /// The InputOutline property.<br />
1432 /// The outline parameters of the new input text.<br />
1434 /// <since_tizen> 3 </since_tizen>
1435 public string InputOutline
1439 return (string)GetValue(InputOutlineProperty);
1443 SetValue(InputOutlineProperty, value);
1444 NotifyPropertyChanged();
1449 /// The SmoothScroll property.<br />
1450 /// Enable or disable the smooth scroll animation.<br />
1452 /// <since_tizen> 3 </since_tizen>
1453 public bool SmoothScroll
1457 return (bool)GetValue(SmoothScrollProperty);
1461 SetValue(SmoothScrollProperty, value);
1462 NotifyPropertyChanged();
1467 /// The SmoothScrollDuration property.<br />
1468 /// Sets the duration of smooth scroll animation.<br />
1470 /// <since_tizen> 3 </since_tizen>
1471 public float SmoothScrollDuration
1475 return (float)GetValue(SmoothScrollDurationProperty);
1479 SetValue(SmoothScrollDurationProperty, value);
1480 NotifyPropertyChanged();
1485 /// The EnableScrollBar property.<br />
1486 /// Enable or disable the scroll bar.<br />
1488 /// <since_tizen> 3 </since_tizen>
1489 public bool EnableScrollBar
1493 return (bool)GetValue(EnableScrollBarProperty);
1497 SetValue(EnableScrollBarProperty, value);
1498 NotifyPropertyChanged();
1503 /// The ScrollBarShowDuration property.<br />
1504 /// Sets the duration of scroll bar to show.<br />
1506 /// <since_tizen> 3 </since_tizen>
1507 public float ScrollBarShowDuration
1511 return (float)GetValue(ScrollBarShowDurationProperty);
1515 SetValue(ScrollBarShowDurationProperty, value);
1516 NotifyPropertyChanged();
1521 /// The ScrollBarFadeDuration property.<br />
1522 /// Sets the duration of scroll bar to fade out.<br />
1524 /// <since_tizen> 3 </since_tizen>
1525 public float ScrollBarFadeDuration
1529 return (float)GetValue(ScrollBarFadeDurationProperty);
1533 SetValue(ScrollBarFadeDurationProperty, value);
1534 NotifyPropertyChanged();
1539 /// The PixelSize property.<br />
1540 /// The size of font in pixels.<br />
1542 /// <since_tizen> 3 </since_tizen>
1543 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1544 public float PixelSize
1548 return (float)GetValue(PixelSizeProperty);
1552 SetValue(PixelSizeProperty, value);
1553 NotifyPropertyChanged();
1558 /// The line count of the text.
1560 /// <since_tizen> 3 </since_tizen>
1561 public int LineCount
1566 using (var propertyValue = GetProperty(TextEditor.Property.LineCount))
1568 propertyValue.Get(out lineCount);
1575 /// The text to display when the TextEditor is empty and inactive.
1577 /// <since_tizen> 3 </since_tizen>
1578 public string PlaceholderText
1582 return (string)GetValue(PlaceholderTextProperty);
1586 SetValue(PlaceholderTextProperty, value);
1587 NotifyPropertyChanged();
1592 /// The portion of the text that has been selected by the user.
1595 /// Empty string when nothing is selected.
1597 /// <since_tizen> 9 </since_tizen>
1598 public string SelectedText
1602 string selectedText;
1603 using (var propertyValue = GetProperty(TextEditor.Property.SelectedText))
1605 propertyValue.Get(out selectedText);
1607 return selectedText;
1612 /// The Placeholder text color.
1615 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1617 /// <since_tizen> 3 </since_tizen>
1618 public Color PlaceholderTextColor
1622 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1623 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1627 SetValue(PlaceholderTextColorProperty, value);
1628 NotifyPropertyChanged();
1633 /// The Enable selection property.<br />
1634 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1636 /// <since_tizen> 3 </since_tizen>
1637 public bool EnableSelection
1641 return (bool)GetValue(EnableSelectionProperty);
1645 SetValue(EnableSelectionProperty, value);
1646 NotifyPropertyChanged();
1651 /// The start index for selection.
1654 /// When there is no selection, the index is current cursor position.
1656 /// <since_tizen> 9 </since_tizen>
1657 public int SelectedTextStart
1661 int selectedTextStart;
1662 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextStart))
1664 propertyValue.Get(out selectedTextStart);
1666 return selectedTextStart;
1671 /// The end index for selection.
1674 /// When there is no selection, the index is current cursor position.
1676 /// <since_tizen> 9 </since_tizen>
1677 public int SelectedTextEnd
1681 int selectedTextEnd;
1682 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextEnd))
1684 propertyValue.Get(out selectedTextEnd);
1686 return selectedTextEnd;
1691 /// Enable editing in text control.
1693 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1694 [EditorBrowsable(EditorBrowsableState.Never)]
1695 public bool EnableEditing
1699 return (bool)GetValue(EnableEditingProperty);
1703 SetValue(EnableEditingProperty, value);
1707 private bool InternalEnableEditing
1712 using (var propertyValue = GetProperty(TextEditor.Property.EnableEditing))
1714 propertyValue.Get(out enableEditing);
1716 return enableEditing;
1720 using (var propertyValue = new PropertyValue(value))
1722 SetProperty(TextEditor.Property.EnableEditing, propertyValue);
1723 NotifyPropertyChanged();
1729 /// Specify horizontal scroll position in text control.
1731 [EditorBrowsable(EditorBrowsableState.Never)]
1732 public int HorizontalScrollPosition
1736 return (int)GetValue(HorizontalScrollPositionProperty);
1740 SetValue(HorizontalScrollPositionProperty, value);
1744 private int InternalHorizontalScrollPosition
1748 int horizontalScrollPosition;
1749 using (var propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1751 propertyValue.Get(out horizontalScrollPosition);
1753 return horizontalScrollPosition;
1757 using (var propertyValue = new PropertyValue(value))
1759 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1760 NotifyPropertyChanged();
1766 /// Specify vertical scroll position in text control.
1768 [EditorBrowsable(EditorBrowsableState.Never)]
1769 public int VerticalScrollPosition
1773 return (int)GetValue(VerticalScrollPositionProperty);
1777 SetValue(VerticalScrollPositionProperty, value);
1781 private int InternalVerticalScrollPosition
1785 int verticalScrollPosition;
1786 using (var propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1788 propertyValue.Get(out verticalScrollPosition);
1790 return verticalScrollPosition;
1794 using (var propertyValue = new PropertyValue(value))
1796 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1797 NotifyPropertyChanged();
1803 /// PrimaryCursorPosition property.<br />
1804 /// Specify the position of the primary cursor (caret) in text control.
1807 /// 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).
1809 /// <since_tizen> 10 </since_tizen>
1810 public int PrimaryCursorPosition
1814 return (int)GetValue(PrimaryCursorPositionProperty);
1818 SetValue(PrimaryCursorPositionProperty, value);
1822 private int InternalPrimaryCursorPosition
1826 int primaryCursorPosition;
1827 using (var propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1829 propertyValue.Get(out primaryCursorPosition);
1831 return primaryCursorPosition;
1835 using (var propertyValue = new PropertyValue(value))
1837 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1838 NotifyPropertyChanged();
1844 /// The GrabHandleColor property.
1847 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1849 [EditorBrowsable(EditorBrowsableState.Never)]
1850 public Color GrabHandleColor
1854 Color temp = (Color)GetValue(GrabHandleColorProperty);
1855 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1859 SetValue(GrabHandleColorProperty, value);
1860 NotifyPropertyChanged();
1865 /// Set InputFilter to TextEditor.
1867 /// <param name="inputFilter">The InputFilter</param>
1869 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1870 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1871 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1874 /// The following example demonstrates how to use the SetInputFilter method.
1876 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1877 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1878 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1879 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1882 /// <since_tizen> 9 </since_tizen>
1883 public void SetInputFilter(InputFilter inputFilter)
1885 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1886 using (var propertyValue = new PropertyValue(map))
1888 SetProperty(TextEditor.Property.InputFilter, propertyValue);
1893 /// Get InputFilter from TextEditor. <br />
1895 /// <returns>The InputFilter</returns>
1897 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1899 /// <since_tizen> 9 </since_tizen>
1900 public InputFilter GetInputFilter()
1902 InputFilter inputFilter;
1903 using (var propertyValue = GetProperty(TextEditor.Property.InputFilter))
1904 using (var map = new PropertyMap())
1906 propertyValue.Get(map);
1907 inputFilter = TextMapHelper.GetInputFilterStruct(map);
1913 /// Set Strikethrough to TextEditor. <br />
1915 /// <param name="strikethrough">The Strikethrough</param>
1917 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1920 /// The following example demonstrates how to use the SetStrikethrough method.
1922 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1923 /// strikethrough.Enable = true;
1924 /// strikethrough.Color = new Color("#3498DB");
1925 /// strikethrough.Height = 2.0f;
1926 /// editor.SetStrikethrough(strikethrough);
1929 [EditorBrowsable(EditorBrowsableState.Never)]
1930 public void SetStrikethrough(Strikethrough strikethrough)
1932 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1933 using (var propertyValue = new PropertyValue(map))
1935 SetProperty(TextEditor.Property.Strikethrough, propertyValue);
1940 /// Get Strikethrough from TextEditor. <br />
1942 /// <returns>The Strikethrough</returns>
1944 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1946 [EditorBrowsable(EditorBrowsableState.Never)]
1947 public Strikethrough GetStrikethrough()
1949 Strikethrough strikethrough;
1950 using (var propertyValue = GetProperty(TextEditor.Property.Strikethrough))
1951 using (var map = new PropertyMap())
1953 propertyValue.Get(map);
1954 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1956 return strikethrough;
1960 /// The Placeholder property.
1961 /// The placeholder map contains the following keys :<br />
1962 /// <list type="table">
1963 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1964 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1965 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1966 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1967 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1968 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1969 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1970 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1974 /// The following example demonstrates how to set the placeholder property.
1976 /// PropertyMap propertyMap = new PropertyMap();
1977 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1978 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1979 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1980 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1981 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1983 /// PropertyMap fontStyleMap = new PropertyMap();
1984 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1985 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1986 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1987 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1989 /// TextEditor editor = new TextEditor();
1990 /// editor.Placeholder = propertyMap;
1993 /// <since_tizen> 3 </since_tizen>
1994 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1995 public Tizen.NUI.PropertyMap Placeholder
1999 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2000 string defalutText = "";
2002 if (TextMapHelper.IsValue(map, 0))
2003 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2005 if (TextMapHelper.IsValue(map, 1))
2006 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2008 if (TextMapHelper.IsValue(map, 2))
2010 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2012 map.Add("color", color);
2016 if (TextMapHelper.IsValue(map, 3))
2017 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2019 if (TextMapHelper.IsValue(map, 4))
2021 using (var properyValue = map.Find(4))
2022 using (var fontStyle = new PropertyMap())
2024 properyValue.Get(fontStyle);
2025 using (var fontStyleValue = new PropertyValue(fontStyle))
2027 map.Add("fontStyle", fontStyleValue);
2032 if (TextMapHelper.IsValue(map, 5))
2033 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2035 if (TextMapHelper.IsValue(map, 6))
2036 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2038 if (TextMapHelper.IsValue(map, 7))
2039 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2045 SetValue(PlaceholderProperty, value);
2046 NotifyPropertyChanged();
2051 /// Set Placeholder to TextEditor. <br />
2053 /// <param name="placeholder">The Placeholder</param>
2055 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2058 /// The following example demonstrates how to use the SetPlaceholder method.
2060 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2061 /// placeholder.Text = "placeholder text";
2062 /// placeholder.TextFocused = "placeholder textFocused";
2063 /// placeholder.Color = new Color("#45B39D");
2064 /// placeholder.FontFamily = "BreezeSans";
2065 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2067 /// Width = FontWidthType.Expanded,
2068 /// Weight = FontWeightType.ExtraLight,
2069 /// Slant = FontSlantType.Italic,
2071 /// placeholder.PointSize = 25.0f;
2072 /// //placeholder.PixelSize = 50.0f;
2073 /// placeholder.Ellipsis = true;
2074 /// editor.SetPlaceholder(placeholder);
2077 [EditorBrowsable(EditorBrowsableState.Never)]
2078 public void SetPlaceholder(Placeholder placeholder)
2080 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2082 SetValue(PlaceholderProperty, placeholderMap);
2087 /// Get Placeholder from TextEditor. <br />
2089 /// <returns>The Placeholder</returns>
2091 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2093 [EditorBrowsable(EditorBrowsableState.Never)]
2094 public Placeholder GetPlaceholder()
2096 Placeholder placeholder;
2097 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2099 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2105 /// The Ellipsis property.<br />
2106 /// Enable or disable the ellipsis.<br />
2108 /// <since_tizen> 9 </since_tizen>
2109 public bool Ellipsis
2113 return (bool)GetValue(EllipsisProperty);
2117 SetValue(EllipsisProperty, value);
2118 NotifyPropertyChanged();
2124 /// The ellipsis position of the text.
2125 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2127 /// <since_tizen> 9 </since_tizen>
2128 public EllipsisPosition EllipsisPosition
2132 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2136 SetValue(EllipsisPositionProperty, value);
2137 NotifyPropertyChanged();
2142 /// The LineWrapMode property.<br />
2143 /// The line wrap mode when the text lines over the layout width.<br />
2145 /// <since_tizen> 4 </since_tizen>
2146 public LineWrapMode LineWrapMode
2150 return (LineWrapMode)GetValue(LineWrapModeProperty);
2154 SetValue(LineWrapModeProperty, value);
2155 NotifyPropertyChanged();
2160 /// Enables Text selection using Shift key.
2162 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2163 [EditorBrowsable(EditorBrowsableState.Never)]
2164 public bool EnableShiftSelection
2168 return (bool)GetValue(EnableShiftSelectionProperty);
2172 SetValue(EnableShiftSelectionProperty, value);
2173 NotifyPropertyChanged();
2178 /// The text alignment to match the direction of the system language.
2180 /// <since_tizen> 6 </since_tizen>
2181 public bool MatchSystemLanguageDirection
2185 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2189 SetValue(MatchSystemLanguageDirectionProperty, value);
2190 NotifyPropertyChanged();
2195 /// The MaxLength property.<br />
2196 /// The maximum number of characters that can be inserted.<br />
2198 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2199 [EditorBrowsable(EditorBrowsableState.Never)]
2200 public int MaxLength
2204 return (int)GetValue(MaxLengthProperty);
2208 SetValue(MaxLengthProperty, value);
2209 NotifyPropertyChanged();
2214 /// The FontSizeScale property. <br />
2215 /// The default value is 1.0. <br />
2216 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2217 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2219 /// <since_tizen> 9 </since_tizen>
2220 public float FontSizeScale
2224 return (float)GetValue(FontSizeScaleProperty);
2228 SetValue(FontSizeScaleProperty, value);
2229 NotifyPropertyChanged();
2233 private float InternalFontSizeScale
2237 return fontSizeScale;
2241 float newFontSizeScale;
2243 if (fontSizeScale == value) return;
2245 fontSizeScale = value;
2246 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2248 SystemSettingsFontSize systemSettingsFontSize;
2252 systemSettingsFontSize = SystemSettings.FontSize;
2256 Console.WriteLine("{0} Exception caught.", e);
2257 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2259 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2260 AddSystemSettingsFontSizeChanged();
2264 newFontSizeScale = fontSizeScale;
2265 RemoveSystemSettingsFontSizeChanged();
2268 SetInternalFontSizeScale(newFontSizeScale);
2272 private void SetInternalFontSizeScale(float fontSizeScale)
2275 Object.InternalSetPropertyFloat(this.SwigCPtr, TextEditor.Property.FontSizeScale, (float)fontSizeScale);
2279 /// The EnableFontSizeScale property.<br />
2280 /// Whether the font size scale is enabled. (The default value is true)
2282 [EditorBrowsable(EditorBrowsableState.Never)]
2283 public bool EnableFontSizeScale
2287 return (bool)GetValue(EnableFontSizeScaleProperty);
2291 SetValue(EnableFontSizeScaleProperty, value);
2292 NotifyPropertyChanged();
2297 /// The InputMethodSettings property.<br />
2298 /// The settings to relating to the System's Input Method, Key and Value.<br />
2301 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
2304 /// The following example demonstrates how to set the InputMethodSettings property.
2306 /// InputMethod method = new InputMethod();
2307 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
2308 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
2309 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
2310 /// method.Variation = 1;
2311 /// textEditor.InputMethodSettings = method.OutputMap;
2314 [EditorBrowsable(EditorBrowsableState.Never)]
2315 public PropertyMap InputMethodSettings
2319 return (PropertyMap)GetValue(InputMethodSettingsProperty);
2323 SetValue(InputMethodSettingsProperty, value);
2324 NotifyPropertyChanged();
2329 /// Scroll the text control by specific amount..
2331 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
2332 [EditorBrowsable(EditorBrowsableState.Never)]
2333 public void ScrollBy(Vector2 scroll)
2335 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
2336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2340 /// Get the InputMethodContext instance.
2342 /// <returns>The InputMethodContext instance.</returns>
2343 /// <since_tizen> 5 </since_tizen>
2344 public InputMethodContext GetInputMethodContext()
2346 if (inputMethodContext == null)
2348 /*Avoid raising InputMethodContext reference count.*/
2349 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
2350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2352 return inputMethodContext;
2356 /// Select the whole text.
2358 /// <since_tizen> 9 </since_tizen>
2359 public void SelectWholeText()
2361 Interop.TextEditor.SelectWholeText(SwigCPtr);
2362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2366 /// Select text from start to end index. <br />
2367 /// The index is valid when 0 or positive.
2369 /// <param name="start">The start index for selection.</param>
2370 /// <param name="end">The end index for selection.</param>
2372 /// If the end index exceeds the maximum value, it is set to the length of the text.
2374 /// <since_tizen> 9 </since_tizen>
2375 public void SelectText(int start, int end)
2378 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2380 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2382 Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
2383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2387 /// Clear selection of the text. <br />
2388 /// Valid when selection is activate.
2390 /// <since_tizen> 9 </since_tizen>
2391 public void SelectNone()
2393 _ = Interop.TextEditor.SelectNone(SwigCPtr);
2394 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2398 /// The Enable grab handle property.<br />
2399 /// Enables the grab handles for text selection.<br />
2400 /// The default value is true, which means the grab handles are enabled by default.<br />
2402 [EditorBrowsable(EditorBrowsableState.Never)]
2403 public bool EnableGrabHandle
2407 return (bool)GetValue(EnableGrabHandleProperty);
2411 SetValue(EnableGrabHandleProperty, value);
2412 NotifyPropertyChanged();
2417 /// The Enable grab handle popup property.<br />
2418 /// Enables the grab handle popup for text selection.<br />
2419 /// The default value is true, which means the grab handle popup is enabled by default.<br />
2421 [EditorBrowsable(EditorBrowsableState.Never)]
2422 public bool EnableGrabHandlePopup
2426 return (bool)GetValue(EnableGrabHandlePopupProperty);
2430 SetValue(EnableGrabHandlePopupProperty, value);
2431 NotifyPropertyChanged();
2436 /// Minimum line size to be used.<br />
2437 /// The height of the line in points. <br />
2438 /// If the font size is larger than the line size, it works with the font size. <br />
2440 [EditorBrowsable(EditorBrowsableState.Never)]
2441 public float MinLineSize
2445 return (float)GetValue(MinLineSizeProperty);
2449 SetValue(MinLineSizeProperty, value);
2450 NotifyPropertyChanged();
2454 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2456 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));
2457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2462 /// The spaces between characters in Pixels.
2464 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2465 /// The default value is 0.f which does nothing.
2468 [EditorBrowsable(EditorBrowsableState.Never)]
2469 public float CharacterSpacing
2473 return (float)GetValue(CharacterSpacingProperty);
2477 SetValue(CharacterSpacingProperty, value);
2478 NotifyPropertyChanged();
2485 /// <since_tizen> 3 </since_tizen>
2486 protected override void Dispose(DisposeTypes type)
2493 internalPlaceholderTextColor?.Dispose();
2494 internalPrimaryCursorColor?.Dispose();
2495 internalSecondaryCursorColor?.Dispose();
2496 internalSelectionHighlightColor?.Dispose();
2497 internalInputColor?.Dispose();
2498 internalTextColor?.Dispose();
2499 internalGrabHandleColor?.Dispose();
2501 if (hasSystemLanguageChanged)
2503 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2506 RemoveSystemSettingsFontTypeChanged();
2507 RemoveSystemSettingsFontSizeChanged();
2509 //Release your own unmanaged resources here.
2510 //You should not access any managed member here except static instance.
2511 //because the execution order of Finalizes is non-deterministic.
2515 if (textEditorTextChangedCallbackDelegate != null)
2517 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2520 if (textEditorMaxLengthReachedCallbackDelegate != null)
2522 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2525 if (textEditorSelectionStartedCallbackDelegate != null)
2527 this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
2530 if (textEditorSelectionClearedCallbackDelegate != null)
2532 this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2535 if (textEditorCursorPositionChangedCallbackDelegate != null)
2537 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2540 if (textEditorSelectionChangedCallbackDelegate != null)
2542 this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2546 TextChanged -= TextEditorTextChanged;
2550 /// This will not be public opened.
2551 [EditorBrowsable(EditorBrowsableState.Never)]
2552 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2554 // In order to speed up IME hide, temporarily add
2555 GetInputMethodContext()?.DestroyContext();
2556 Interop.TextEditor.DeleteTextEditor(swigCPtr);
2559 internal override LayoutItem CreateDefaultLayout()
2561 return new TextEditorLayout();
2564 internal void SetTextWithoutTextChanged(string text)
2566 invokeTextChanged = false;
2567 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2568 invokeTextChanged = true;
2571 private string SetTranslatable(string textEditorSid)
2573 string translatableText = null;
2574 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2575 if (translatableText != null)
2577 if (hasSystemLanguageChanged == false)
2579 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2580 hasSystemLanguageChanged = true;
2582 return translatableText;
2586 translatableText = "";
2587 return translatableText;
2591 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2593 if (textEditorTextSid != null)
2595 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2597 if (textEditorPlaceHolderTextSid != null)
2599 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2603 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2605 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2606 SetInternalFontSizeScale(newFontSizeScale);
2609 private void AddSystemSettingsFontSizeChanged()
2611 if (hasSystemFontSizeChanged != true)
2615 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2616 hasSystemFontSizeChanged = true;
2620 Console.WriteLine("{0} Exception caught.", e);
2621 hasSystemFontSizeChanged = false;
2626 private void RemoveSystemSettingsFontSizeChanged()
2628 if (hasSystemFontSizeChanged == true)
2632 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2633 hasSystemFontSizeChanged = false;
2637 Console.WriteLine("{0} Exception caught.", e);
2638 hasSystemFontSizeChanged = true;
2643 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2645 SetInternalFontFamily(e.Value);
2648 private void AddSystemSettingsFontTypeChanged()
2650 if (HasStyle() && !hasSystemFontTypeChanged)
2654 SystemSettings.FontTypeChanged += SystemSettingsFontTypeChanged;
2655 hasSystemFontTypeChanged = true;
2659 Console.WriteLine("{0} Exception caught.", e);
2660 hasSystemFontTypeChanged = false;
2665 private void RemoveSystemSettingsFontTypeChanged()
2667 if (hasSystemFontTypeChanged)
2671 SystemSettings.FontTypeChanged -= SystemSettingsFontTypeChanged;
2672 hasSystemFontTypeChanged = false;
2676 Console.WriteLine("{0} Exception caught.", e);
2677 hasSystemFontTypeChanged = true;
2682 private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
2684 if (!isSettingTextInCSharp)
2686 EnforceNotifyBindedInstance(TextProperty);
2690 internal new class Property
2692 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2693 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2694 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2695 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2696 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2697 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2698 internal static readonly int VerticalAlignment = Interop.TextEditor.VerticalAlignmentGet();
2699 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2700 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2701 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2702 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2703 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2704 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2705 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2706 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2707 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2708 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2709 internal static readonly int SelectionPopupStyle = Interop.TextEditor.SelectionPopupStyleGet();
2710 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2711 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2712 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2713 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2714 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2715 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2716 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2717 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2718 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2719 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2720 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2721 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2722 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2723 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2724 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2725 internal static readonly int RelativeLineHeight = Interop.TextEditor.RelativeLineHeightGet();
2726 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2727 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2728 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2729 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2730 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2731 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2732 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2733 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2734 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2735 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2736 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2737 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2738 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2739 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2740 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2741 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2742 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2743 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2744 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2745 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2746 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2747 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2748 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2749 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2750 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2751 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2752 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2753 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2754 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2755 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2756 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2757 internal static readonly int EnableFontSizeScale = Interop.TextEditor.EnableFontSizeScaleGet();
2758 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2759 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2760 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2761 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2762 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2763 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2764 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2765 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2766 internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
2767 internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
2770 internal class InputStyle
2776 FontFamily = 0x0002,
2779 LineSpacing = 0x0010,
2787 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2789 DecorationBoundingBox = new Rectangle(x, y, width, height);
2791 private void OnInputColorChanged(float x, float y, float z, float w)
2793 InputColor = new Vector4(x, y, z, w);
2795 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2797 PlaceholderTextColor = new Color(r, g, b, a);
2799 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2801 PrimaryCursorColor = new Vector4(x, y, z, w);
2803 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2805 SecondaryCursorColor = new Vector4(x, y, z, w);
2807 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2809 SelectionHighlightColor = new Vector4(x, y, z, w);
2811 private void OnTextColorChanged(float x, float y, float z, float w)
2813 TextColor = new Vector4(x, y, z, w);
2815 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2817 GrabHandleColor = new Color(r, g, b, a);
2820 private class TextEditorLayout : LayoutItem
2822 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2824 // Padding will be automatically applied by DALi TextEditor.
2825 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2826 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2827 var minSize = Owner.MinimumSize;
2828 var maxSize = Owner.MaximumSize;
2829 var naturalSize = Owner.GetNaturalSize();
2831 if (((TextEditor)Owner).Text.Length == 0)
2833 // Calculate height of TextEditor by setting Text with " ".
2834 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2835 ((TextEditor)Owner).SetTextWithoutTextChanged(" ");
2837 // Store original WidthSpecification to restore it after setting ResizePolicy.
2838 var widthSpecification = Owner.WidthSpecification;
2840 // In DALi's Size logic, if Width or Height is set to be 0, then
2841 // ResizePolicy is not changed to Fixed.
2842 // This causes Size changes after NUI Layout's OnMeasure is finished.
2843 // e.g. TextEditor's Width fills to its parent although Text is null and
2844 // WidthSpecification is WrapContent.
2845 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2846 // in advance if Text is null.
2847 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2849 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2850 Owner.WidthSpecification = widthSpecification;
2852 naturalSize = Owner.GetNaturalSize();
2854 // Restore TextEditor's Text after calculating height of TextEditor.
2855 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2856 ((TextEditor)Owner).SetTextWithoutTextChanged("");
2859 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2861 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2864 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2866 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2869 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2870 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2872 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2873 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2875 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2876 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));