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;
26 namespace Tizen.NUI.BaseComponents
29 /// A control which provides a multi-line editable text editor.
31 /// <since_tizen> 3 </since_tizen>
32 public partial class TextEditor : View
34 private string textEditorTextSid = null;
35 private string textEditorPlaceHolderTextSid = null;
36 private bool systemlangTextFlag = false;
37 private InputMethodContext inputMethodContext = null;
38 private float fontSizeScale = 1.0f;
39 private bool hasFontSizeChangedCallback = false;
41 static TextEditor() { }
44 /// Creates the TextEditor control.
46 /// <since_tizen> 3 </since_tizen>
47 public TextEditor() : this(Interop.TextEditor.New(), true)
49 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
53 /// Creates the TextEditor with specified style.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public TextEditor(TextEditorStyle style) : this(Interop.TextLabel.New(), true, style: style)
61 /// Creates the TextEditor with setting the status of shown or hidden.
63 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
64 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
65 [EditorBrowsable(EditorBrowsableState.Never)]
66 public TextEditor(bool shown) : this(Interop.TextEditor.New(), true)
68 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
74 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
91 /// The TranslatableText property.<br />
92 /// The text can set the SID value.<br />
94 /// <exception cref='ArgumentNullException'>
95 /// ResourceManager about multilingual is null.
97 /// <since_tizen> 4 </since_tizen>
98 public string TranslatableText
102 return textEditorTextSid;
106 if (NUIApplication.MultilingualResourceManager == null)
108 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
110 textEditorTextSid = value;
111 Text = SetTranslatable(textEditorTextSid);
112 NotifyPropertyChanged();
116 /// The TranslatablePlaceholderText property.<br />
117 /// The text can set the SID value.<br />
119 /// <exception cref='ArgumentNullException'>
120 /// ResourceManager about multilingual is null.
122 /// <since_tizen> 4 </since_tizen>
123 public string TranslatablePlaceholderText
127 return textEditorPlaceHolderTextSid;
131 if (NUIApplication.MultilingualResourceManager == null)
133 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
135 textEditorPlaceHolderTextSid = value;
136 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
137 NotifyPropertyChanged();
142 /// The Text property.
144 /// <since_tizen> 3 </since_tizen>
149 return (string)GetValue(TextProperty);
153 SetValueAndForceSendChangeSignal(TextProperty, value);
154 NotifyPropertyChanged();
159 /// The TextColor property.
162 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
164 /// <since_tizen> 3 </since_tizen>
165 public Vector4 TextColor
169 Vector4 temp = (Vector4)GetValue(TextColorProperty);
170 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
174 SetValue(TextColorProperty, value);
175 NotifyPropertyChanged();
180 /// The FontFamily property.
182 /// <since_tizen> 3 </since_tizen>
183 public string FontFamily
187 return (string)GetValue(FontFamilyProperty);
191 SetValue(FontFamilyProperty, value);
192 NotifyPropertyChanged();
197 /// The FontStyle property.
198 /// The fontStyle map contains the following keys :<br />
199 /// <list type="table">
200 /// <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>
201 /// <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>
202 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
205 /// <since_tizen> 3 </since_tizen>
206 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
207 public PropertyMap FontStyle
211 return (PropertyMap)GetValue(FontStyleProperty);
215 SetValue(FontStyleProperty, value);
216 NotifyPropertyChanged();
221 /// Set FontStyle to TextEditor. <br />
223 /// <param name="fontStyle">The FontStyle</param>
225 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
228 /// The following example demonstrates how to use the SetFontStyle method.
230 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
231 /// fontStyle.Width = FontWidthType.Expanded;
232 /// fontStyle.Weight = FontWeightType.Bold;
233 /// fontStyle.Slant = FontSlantType.Italic;
234 /// editor.SetFontStyle(fontStyle);
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public void SetFontStyle(FontStyle fontStyle)
240 SetProperty(TextEditor.Property.FontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
244 /// Get FontStyle from TextEditor. <br />
246 /// <returns>The FontStyle</returns>
248 /// <see cref="Tizen.NUI.Text.FontStyle"/>
250 [EditorBrowsable(EditorBrowsableState.Never)]
251 public FontStyle GetFontStyle()
253 var map = new PropertyMap();
254 GetProperty(TextEditor.Property.FontStyle).Get(map);
255 return TextUtils.GetFontStyleStruct(map);
259 /// The PointSize property.
261 /// <since_tizen> 3 </since_tizen>
262 public float PointSize
266 return (float)GetValue(PointSizeProperty);
270 SetValue(PointSizeProperty, value);
271 NotifyPropertyChanged();
276 /// The HorizontalAlignment property.
278 /// <since_tizen> 3 </since_tizen>
279 public HorizontalAlignment HorizontalAlignment
283 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
287 SetValue(HorizontalAlignmentProperty, value);
288 NotifyPropertyChanged();
293 /// The ScrollThreshold property.
295 /// <since_tizen> 3 </since_tizen>
296 public float ScrollThreshold
300 return (float)GetValue(ScrollThresholdProperty);
304 SetValue(ScrollThresholdProperty, value);
305 NotifyPropertyChanged();
310 /// The ScrollSpeed property.
312 /// <since_tizen> 3 </since_tizen>
313 public float ScrollSpeed
317 return (float)GetValue(ScrollSpeedProperty);
321 SetValue(ScrollSpeedProperty, value);
322 NotifyPropertyChanged();
327 /// The PrimaryCursorColor property.
330 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
332 /// <since_tizen> 3 </since_tizen>
333 public Vector4 PrimaryCursorColor
337 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
338 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
342 SetValue(PrimaryCursorColorProperty, value);
343 NotifyPropertyChanged();
348 /// The SecondaryCursorColor property.
351 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
353 /// <since_tizen> 3 </since_tizen>
354 public Vector4 SecondaryCursorColor
358 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
359 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
363 SetValue(SecondaryCursorColorProperty, value);
364 NotifyPropertyChanged();
369 /// The EnableCursorBlink property.
371 /// <since_tizen> 3 </since_tizen>
372 public bool EnableCursorBlink
376 return (bool)GetValue(EnableCursorBlinkProperty);
380 SetValue(EnableCursorBlinkProperty, value);
381 NotifyPropertyChanged();
386 /// The CursorBlinkInterval property.
388 /// <since_tizen> 3 </since_tizen>
389 public float CursorBlinkInterval
393 return (float)GetValue(CursorBlinkIntervalProperty);
397 SetValue(CursorBlinkIntervalProperty, value);
398 NotifyPropertyChanged();
403 /// The CursorBlinkDuration property.
405 /// <since_tizen> 3 </since_tizen>
406 public float CursorBlinkDuration
410 return (float)GetValue(CursorBlinkDurationProperty);
414 SetValue(CursorBlinkDurationProperty, value);
415 NotifyPropertyChanged();
420 /// The CursorWidth property.
422 /// <since_tizen> 3 </since_tizen>
423 public int CursorWidth
427 return (int)GetValue(CursorWidthProperty);
431 SetValue(CursorWidthProperty, value);
432 NotifyPropertyChanged();
437 /// The GrabHandleImage property.
439 /// <since_tizen> 3 </since_tizen>
440 public string GrabHandleImage
444 return (string)GetValue(GrabHandleImageProperty);
448 SetValue(GrabHandleImageProperty, value);
449 NotifyPropertyChanged();
454 /// The GrabHandlePressedImage property.
456 /// <since_tizen> 3 </since_tizen>
457 public string GrabHandlePressedImage
461 return (string)GetValue(GrabHandlePressedImageProperty);
465 SetValue(GrabHandlePressedImageProperty, value);
466 NotifyPropertyChanged();
471 /// The SelectionHandleImageLeft property.
472 /// The selectionHandleImageLeft map contains the following key :<br />
473 /// <list type="table">
474 /// <item><term>filename (string)</term><description>The path of image file</description></item>
477 /// <since_tizen> 3 </since_tizen>
478 public PropertyMap SelectionHandleImageLeft
482 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
486 SetValue(SelectionHandleImageLeftProperty, value);
487 NotifyPropertyChanged();
492 /// The SelectionHandleImageRight property.
493 /// The selectionHandleImageRight map contains the following key :<br />
494 /// <list type="table">
495 /// <item><term>filename (string)</term><description>The path of image file</description></item>
498 /// <since_tizen> 3 </since_tizen>
499 public PropertyMap SelectionHandleImageRight
503 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
507 SetValue(SelectionHandleImageRightProperty, value);
508 NotifyPropertyChanged();
513 /// The SelectionHandlePressedImageLeft property.
514 /// The selectionHandlePressedImageLeft map contains the following key :<br />
515 /// <list type="table">
516 /// <item><term>filename (string)</term><description>The path of image file</description></item>
519 /// <since_tizen> 3 </since_tizen>
520 public PropertyMap SelectionHandlePressedImageLeft
524 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
528 SetValue(SelectionHandlePressedImageLeftProperty, value);
529 NotifyPropertyChanged();
534 /// The SelectionHandlePressedImageRight property.
535 /// The selectionHandlePressedImageRight map contains the following key :<br />
536 /// <list type="table">
537 /// <item><term>filename (string)</term><description>The path of image file</description></item>
540 /// <since_tizen> 3 </since_tizen>
541 public PropertyMap SelectionHandlePressedImageRight
545 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
549 SetValue(SelectionHandlePressedImageRightProperty, value);
550 NotifyPropertyChanged();
555 /// The SelectionHandleMarkerImageLeft property.
556 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
557 /// <list type="table">
558 /// <item><term>filename (string)</term><description>The path of image file</description></item>
561 /// <since_tizen> 3 </since_tizen>
562 public PropertyMap SelectionHandleMarkerImageLeft
566 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
570 SetValue(SelectionHandleMarkerImageLeftProperty, value);
571 NotifyPropertyChanged();
576 /// The SelectionHandleMarkerImageRight property.
577 /// The selectionHandleMarkerImageRight map contains the following key :<br />
578 /// <list type="table">
579 /// <item><term>filename (string)</term><description>The path of image file</description></item>
582 /// <since_tizen> 3 </since_tizen>
583 public PropertyMap SelectionHandleMarkerImageRight
587 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
591 SetValue(SelectionHandleMarkerImageRightProperty, value);
592 NotifyPropertyChanged();
597 /// The SelectionHighlightColor property.
600 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
602 /// <since_tizen> 3 </since_tizen>
603 public Vector4 SelectionHighlightColor
607 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
608 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
612 SetValue(SelectionHighlightColorProperty, value);
613 NotifyPropertyChanged();
618 /// The DecorationBoundingBox property.
621 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
623 /// <since_tizen> 3 </since_tizen>
624 public Rectangle DecorationBoundingBox
628 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
629 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
633 SetValue(DecorationBoundingBoxProperty, value);
634 NotifyPropertyChanged();
639 /// The EnableMarkup property.
641 /// <since_tizen> 3 </since_tizen>
642 public bool EnableMarkup
646 return (bool)GetValue(EnableMarkupProperty);
650 SetValue(EnableMarkupProperty, value);
651 NotifyPropertyChanged();
656 /// The InputColor property.
659 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
661 /// <since_tizen> 3 </since_tizen>
662 public Vector4 InputColor
666 Vector4 temp = (Vector4)GetValue(InputColorProperty);
667 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
671 SetValue(InputColorProperty, value);
672 NotifyPropertyChanged();
677 /// The InputFontFamily property.
679 /// <since_tizen> 3 </since_tizen>
680 public string InputFontFamily
684 return (string)GetValue(InputFontFamilyProperty);
688 SetValue(InputFontFamilyProperty, value);
689 NotifyPropertyChanged();
694 /// The InputFontStyle property.
695 /// The inputFontStyle map contains the following keys :<br />
696 /// <list type="table">
697 /// <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>
698 /// <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>
699 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
702 /// <since_tizen> 3 </since_tizen>
703 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
704 public PropertyMap InputFontStyle
708 return (PropertyMap)GetValue(InputFontStyleProperty);
712 SetValue(InputFontStyleProperty, value);
713 NotifyPropertyChanged();
718 /// Set InputFontStyle to TextEditor. <br />
720 /// <param name="fontStyle">The FontStyle</param>
722 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
725 /// The following example demonstrates how to use the SetInputFontStyle method.
727 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
728 /// fontStyle.Width = FontWidthType.Expanded;
729 /// fontStyle.Weight = FontWeightType.Bold;
730 /// fontStyle.Slant = FontSlantType.Italic;
731 /// editor.SetInputFontStyle(fontStyle);
734 [EditorBrowsable(EditorBrowsableState.Never)]
735 public void SetInputFontStyle(FontStyle fontStyle)
737 SetProperty(TextEditor.Property.InputFontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle)));
738 NotifyPropertyChanged();
742 /// Get InputFontStyle from TextEditor. <br />
744 /// <returns>The FontStyle</returns>
746 /// <see cref="Tizen.NUI.Text.FontStyle"/>
748 [EditorBrowsable(EditorBrowsableState.Never)]
749 public FontStyle GetInputFontStyle()
751 var map = new PropertyMap();
752 GetProperty(TextEditor.Property.InputFontStyle).Get(map);
753 return TextUtils.GetFontStyleStruct(map);
757 /// The InputPointSize property.
759 /// <since_tizen> 3 </since_tizen>
760 public float InputPointSize
764 return (float)GetValue(InputPointSizeProperty);
768 SetValue(InputPointSizeProperty, value);
769 NotifyPropertyChanged();
774 /// The LineSpacing property.
776 /// <since_tizen> 3 </since_tizen>
777 public float LineSpacing
781 return (float)GetValue(LineSpacingProperty);
785 SetValue(LineSpacingProperty, value);
786 NotifyPropertyChanged();
791 /// The InputLineSpacing property.
793 /// <since_tizen> 3 </since_tizen>
794 public float InputLineSpacing
798 return (float)GetValue(InputLineSpacingProperty);
802 SetValue(InputLineSpacingProperty, value);
803 NotifyPropertyChanged();
808 /// The Underline property.
809 /// The underline map contains the following keys :<br />
810 /// <list type="table">
811 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
812 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
813 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
816 /// <since_tizen> 3 </since_tizen>
817 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
818 public PropertyMap Underline
822 return (PropertyMap)GetValue(UnderlineProperty);
826 SetValue(UnderlineProperty, value);
827 NotifyPropertyChanged();
832 /// Set Underline to TextEditor. <br />
834 /// <param name="underline">The Underline</param>
836 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
839 /// The following example demonstrates how to use the SetUnderline method.
841 /// var underline = new Tizen.NUI.Text.Underline();
842 /// underline.Enable = true;
843 /// underline.Color = new Color("#3498DB");
844 /// underline.Height = 2.0f;
845 /// editor.SetUnderline(underline);
848 [EditorBrowsable(EditorBrowsableState.Never)]
849 public void SetUnderline(Underline underline)
851 SetProperty(TextEditor.Property.UNDERLINE, new PropertyValue(TextUtils.GetUnderlineMap(underline)));
855 /// Get Underline from TextEditor. <br />
857 /// <returns>The Underline</returns>
859 /// <see cref="Tizen.NUI.Text.Underline"/>
861 [EditorBrowsable(EditorBrowsableState.Never)]
862 public Underline GetUnderline()
864 var map = new PropertyMap();
865 GetProperty(TextEditor.Property.UNDERLINE).Get(map);
866 return TextUtils.GetUnderlineStruct(map);
870 /// The InputUnderline property.
872 /// <since_tizen> 3 </since_tizen>
873 public string InputUnderline
877 return (string)GetValue(InputUnderlineProperty);
881 SetValue(InputUnderlineProperty, value);
882 NotifyPropertyChanged();
887 /// The Shadow property.
888 /// The shadow map contains the following keys :<br />
889 /// <list type="table">
890 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
891 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
892 /// <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>
895 /// <since_tizen> 3 </since_tizen>
896 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
897 public PropertyMap Shadow
901 return (PropertyMap)GetValue(ShadowProperty);
905 SetValue(ShadowProperty, value);
906 NotifyPropertyChanged();
911 /// Set Shadow to TextEditor. <br />
913 /// <param name="shadow">The Shadow</param>
915 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
918 /// The following example demonstrates how to use the SetShadow method.
920 /// var shadow = new Tizen.NUI.Text.Shadow();
921 /// shadow.Offset = new Vector2(3, 3);
922 /// shadow.Color = new Color("#F1C40F");
923 /// editor.SetShadow(shadow);
926 [EditorBrowsable(EditorBrowsableState.Never)]
927 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
929 SetProperty(TextEditor.Property.SHADOW, new PropertyValue(TextUtils.GetShadowMap(shadow)));
933 /// Get Shadow from TextEditor. <br />
935 /// <returns>The Shadow</returns>
937 /// <see cref="Tizen.NUI.Text.Shadow"/>
939 [EditorBrowsable(EditorBrowsableState.Never)]
940 public Tizen.NUI.Text.Shadow GetShadow()
942 var map = new PropertyMap();
943 GetProperty(TextEditor.Property.SHADOW).Get(map);
944 return TextUtils.GetShadowStruct(map);
948 /// The InputShadow property.
950 /// <since_tizen> 3 </since_tizen>
951 public string InputShadow
955 return (string)GetValue(InputShadowProperty);
959 SetValue(InputShadowProperty, value);
960 NotifyPropertyChanged();
965 /// The Emboss property.
967 /// <since_tizen> 3 </since_tizen>
972 return (string)GetValue(EmbossProperty);
976 SetValue(EmbossProperty, value);
977 NotifyPropertyChanged();
982 /// The InputEmboss property.
984 /// <since_tizen> 3 </since_tizen>
985 public string InputEmboss
989 return (string)GetValue(InputEmbossProperty);
993 SetValue(InputEmbossProperty, value);
994 NotifyPropertyChanged();
999 /// The Outline property.
1000 /// The outline map contains the following keys :<br />
1001 /// <list type="table">
1002 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1003 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1006 /// <since_tizen> 3 </since_tizen>
1007 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1008 public PropertyMap Outline
1012 return (PropertyMap)GetValue(OutlineProperty);
1016 SetValue(OutlineProperty, value);
1017 NotifyPropertyChanged();
1022 /// Set Outline to TextEditor. <br />
1024 /// <param name="outline">The Outline</param>
1026 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1029 /// The following example demonstrates how to use the SetOutline method.
1031 /// var outline = new Tizen.NUI.Text.Outline();
1032 /// outline.Width = 2.0f;
1033 /// outline.Color = new Color("#45B39D");
1034 /// editor.SetOutline(outline);
1037 [EditorBrowsable(EditorBrowsableState.Never)]
1038 public void SetOutline(Outline outline)
1040 SetProperty(TextEditor.Property.OUTLINE, new PropertyValue(TextUtils.GetOutlineMap(outline)));
1044 /// Get Outline from TextEditor. <br />
1046 /// <returns>The Outline</returns>
1048 /// <see cref="Tizen.NUI.Text.Outline"/>
1050 [EditorBrowsable(EditorBrowsableState.Never)]
1051 public Outline GetOutline()
1053 var map = new PropertyMap();
1054 GetProperty(TextEditor.Property.OUTLINE).Get(map);
1055 return TextUtils.GetOutlineStruct(map);
1059 /// The InputOutline property.
1061 /// <since_tizen> 3 </since_tizen>
1062 public string InputOutline
1066 return (string)GetValue(InputOutlineProperty);
1070 SetValue(InputOutlineProperty, value);
1071 NotifyPropertyChanged();
1076 /// The SmoothScroll property.
1078 /// <since_tizen> 3 </since_tizen>
1079 public bool SmoothScroll
1083 return (bool)GetValue(SmoothScrollProperty);
1087 SetValue(SmoothScrollProperty, value);
1088 NotifyPropertyChanged();
1093 /// The SmoothScrollDuration property.
1095 /// <since_tizen> 3 </since_tizen>
1096 public float SmoothScrollDuration
1100 return (float)GetValue(SmoothScrollDurationProperty);
1104 SetValue(SmoothScrollDurationProperty, value);
1105 NotifyPropertyChanged();
1110 /// The EnableScrollBar property.
1112 /// <since_tizen> 3 </since_tizen>
1113 public bool EnableScrollBar
1117 return (bool)GetValue(EnableScrollBarProperty);
1121 SetValue(EnableScrollBarProperty, value);
1122 NotifyPropertyChanged();
1127 /// The ScrollBarShowDuration property.
1129 /// <since_tizen> 3 </since_tizen>
1130 public float ScrollBarShowDuration
1134 return (float)GetValue(ScrollBarShowDurationProperty);
1138 SetValue(ScrollBarShowDurationProperty, value);
1139 NotifyPropertyChanged();
1144 /// The ScrollBarFadeDuration property.
1146 /// <since_tizen> 3 </since_tizen>
1147 public float ScrollBarFadeDuration
1151 return (float)GetValue(ScrollBarFadeDurationProperty);
1155 SetValue(ScrollBarFadeDurationProperty, value);
1156 NotifyPropertyChanged();
1161 /// The PixelSize property.
1163 /// <since_tizen> 3 </since_tizen>
1164 public float PixelSize
1168 return (float)GetValue(PixelSizeProperty);
1172 SetValue(PixelSizeProperty, value);
1173 NotifyPropertyChanged();
1178 /// The line count of the text.
1180 /// <since_tizen> 3 </since_tizen>
1181 public int LineCount
1186 GetProperty(TextEditor.Property.LineCount).Get(out temp);
1192 /// The text to display when the TextEditor is empty and inactive.
1194 /// <since_tizen> 3 </since_tizen>
1195 public string PlaceholderText
1199 return (string)GetValue(PlaceholderTextProperty);
1203 SetValue(PlaceholderTextProperty, value);
1204 NotifyPropertyChanged();
1209 /// The Selected Text property (read-only).
1211 [EditorBrowsable(EditorBrowsableState.Never)]
1212 public string SelectedText
1217 GetProperty(TextEditor.Property.SelectedText).Get(out temp);
1223 /// The Placeholder text color.
1226 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1228 /// <since_tizen> 3 </since_tizen>
1229 public Color PlaceholderTextColor
1233 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1234 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1238 SetValue(PlaceholderTextColorProperty, value);
1239 NotifyPropertyChanged();
1244 /// The EnableSelection property.
1246 /// <since_tizen> 3 </since_tizen>
1247 public bool EnableSelection
1251 return (bool)GetValue(EnableSelectionProperty);
1255 SetValue(EnableSelectionProperty, value);
1256 NotifyPropertyChanged();
1261 /// The start index for selection.
1263 /// <since_tizen> 8 </since_tizen>
1264 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1265 [EditorBrowsable(EditorBrowsableState.Never)]
1266 public int SelectedTextStart
1271 GetProperty(TextEditor.Property.SelectedTextStart).Get(out temp);
1276 SetProperty(TextEditor.Property.SelectedTextStart, new PropertyValue(value));
1277 NotifyPropertyChanged();
1282 /// The end index for selection.
1284 /// <since_tizen> 8 </since_tizen>
1285 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1286 [EditorBrowsable(EditorBrowsableState.Never)]
1287 public int SelectedTextEnd
1292 GetProperty(TextEditor.Property.SelectedTextEnd).Get(out temp);
1297 SetProperty(TextEditor.Property.SelectedTextEnd, new PropertyValue(value));
1298 NotifyPropertyChanged();
1303 /// Enable editing in text control.
1305 /// <since_tizen> 8 </since_tizen>
1306 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1307 [EditorBrowsable(EditorBrowsableState.Never)]
1308 public bool EnableEditing
1313 GetProperty(TextEditor.Property.EnableEditing).Get(out temp);
1318 SetProperty(TextEditor.Property.EnableEditing, new PropertyValue(value));
1319 NotifyPropertyChanged();
1324 /// Specify horizontal scroll position in text control.
1326 [EditorBrowsable(EditorBrowsableState.Never)]
1327 public int HorizontalScrollPosition
1332 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1334 propertyValue.Get(out temp);
1340 using (PropertyValue propertyValue = new PropertyValue(value))
1342 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1343 NotifyPropertyChanged();
1349 /// Specify vertical scroll position in text control.
1351 [EditorBrowsable(EditorBrowsableState.Never)]
1352 public int VerticalScrollPosition
1357 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1359 propertyValue.Get(out temp);
1365 using (PropertyValue propertyValue = new PropertyValue(value))
1367 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1368 NotifyPropertyChanged();
1374 /// Specify primary cursor (caret) position in text control.
1376 [EditorBrowsable(EditorBrowsableState.Never)]
1377 public int PrimaryCursorPosition
1382 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1384 propertyValue.Get(out temp);
1390 using (PropertyValue propertyValue = new PropertyValue(value))
1392 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1393 NotifyPropertyChanged();
1399 /// The GrabHandleColor property.
1402 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1404 [EditorBrowsable(EditorBrowsableState.Never)]
1405 public Color GrabHandleColor
1409 Color temp = (Color)GetValue(GrabHandleColorProperty);
1410 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1414 SetValue(GrabHandleColorProperty, value);
1415 NotifyPropertyChanged();
1420 /// Set InputFilter to TextEditor. <br />
1422 /// <param name="inputFilter">The InputFilter</param>
1424 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1425 /// Users can set the Accepted or Rejected regular expression set, or both. <br />
1426 /// If both are used, Rejected has higher priority. <br />
1427 /// The character set must follow the regular expression rules. <br />
1428 /// Behaviour can not be guaranteed for incorrect grammars. <br />
1429 /// Refer the link below for detailed rules. <br />
1430 /// The functions in std::regex library use the ECMAScript grammar: <br />
1431 /// http://cplusplus.com/reference/regex/ECMAScript/ <br />
1432 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1433 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description. <br />
1436 /// The following example demonstrates how to use the SetInputFilter method.
1438 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1439 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1440 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1441 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1444 [EditorBrowsable(EditorBrowsableState.Never)]
1445 public void SetInputFilter(InputFilter inputFilter)
1447 SetProperty(TextEditor.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter)));
1451 /// Get InputFilter from TextEditor. <br />
1453 /// <returns>The InputFilter</returns>
1455 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1457 [EditorBrowsable(EditorBrowsableState.Never)]
1458 public InputFilter GetInputFilter()
1460 var map = new PropertyMap();
1461 GetProperty(TextEditor.Property.InputFilter).Get(map);
1462 return TextUtils.GetInputFilterStruct(map);
1466 /// The Placeholder property.
1467 /// The placeholder map contains the following keys :<br />
1468 /// <list type="table">
1469 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1470 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1471 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1472 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1473 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1474 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1475 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1476 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1480 /// The following example demonstrates how to set the placeholder property.
1482 /// PropertyMap propertyMap = new PropertyMap();
1483 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1484 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1485 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1486 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1487 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1489 /// PropertyMap fontStyleMap = new PropertyMap();
1490 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1491 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1492 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1493 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1495 /// TextEditor editor = new TextEditor();
1496 /// editor.Placeholder = propertyMap;
1499 /// <since_tizen> 3 </since_tizen>
1500 public Tizen.NUI.PropertyMap Placeholder
1504 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1505 PropertyValue value = null;
1508 value = map.Find(0);
1511 value.Get(out string text);
1512 map.Add("text", new PropertyValue(text));
1516 value = map.Find(1);
1519 value.Get(out string textFocused);
1520 map.Add("textFocused", new PropertyValue(textFocused));
1524 value = map.Find(2);
1527 Color color = new Color();
1529 map.Add("color", new PropertyValue(color));
1533 value = map.Find(3);
1536 value.Get(out string fontFamily);
1537 map.Add("fontFamily", new PropertyValue(fontFamily));
1541 value = map.Find(4);
1544 PropertyMap fontStyle = new PropertyMap();
1545 value.Get(fontStyle);
1546 map.Add("fontStyle", new PropertyValue(fontStyle));
1550 value = map.Find(5);
1553 value.Get(out float pointSize);
1554 map.Add("pointSize", new PropertyValue(pointSize));
1558 value = map.Find(6);
1561 value.Get(out float pixelSize);
1562 map.Add("pixelSize", new PropertyValue(pixelSize));
1566 value = map.Find(7);
1569 value.Get(out bool ellipsis);
1570 map.Add("ellipsis", new PropertyValue(ellipsis));
1577 SetValue(PlaceholderProperty, value);
1578 NotifyPropertyChanged();
1583 /// The Ellipsis property.<br />
1584 /// Enable or disable the ellipsis.<br />
1586 [EditorBrowsable(EditorBrowsableState.Never)]
1587 public bool Ellipsis
1591 return (bool)GetValue(EllipsisProperty);
1595 SetValue(EllipsisProperty, value);
1596 NotifyPropertyChanged();
1602 /// The ellipsis position of the text.
1603 /// The ellipsis position type when the text size over the layout size.<br />
1604 /// The ellipsis position: End, Start or Middle.<br />
1606 [EditorBrowsable(EditorBrowsableState.Never)]
1607 public EllipsisPosition EllipsisPosition
1611 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1615 SetValue(EllipsisPositionProperty, value);
1616 NotifyPropertyChanged();
1621 /// The LineWrapMode property.<br />
1622 /// The line wrap mode when the text lines over the layout width.<br />
1624 /// <since_tizen> 4 </since_tizen>
1625 public LineWrapMode LineWrapMode
1629 return (LineWrapMode)GetValue(LineWrapModeProperty);
1633 SetValue(LineWrapModeProperty, value);
1634 NotifyPropertyChanged();
1639 /// Enables Text selection using Shift key.
1641 /// <since_tizen> 5 </since_tizen>
1642 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1643 [EditorBrowsable(EditorBrowsableState.Never)]
1644 public bool EnableShiftSelection
1648 return (bool)GetValue(EnableShiftSelectionProperty);
1652 SetValue(EnableShiftSelectionProperty, value);
1653 NotifyPropertyChanged();
1658 /// The text alignment to match the direction of the system language.
1660 /// <since_tizen> 6 </since_tizen>
1661 public bool MatchSystemLanguageDirection
1665 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1669 SetValue(MatchSystemLanguageDirectionProperty, value);
1670 NotifyPropertyChanged();
1675 /// The MaxLength property.
1677 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1678 [EditorBrowsable(EditorBrowsableState.Never)]
1679 public int MaxLength
1683 return (int)GetValue(MaxLengthProperty);
1687 SetValue(MaxLengthProperty, value);
1688 NotifyPropertyChanged();
1692 /// Only used by the IL of xaml, will never changed to not hidden.
1693 [EditorBrowsable(EditorBrowsableState.Never)]
1694 public override bool IsCreateByXaml
1698 return base.IsCreateByXaml;
1702 base.IsCreateByXaml = value;
1706 this.TextChanged += (obj, e) =>
1708 this.Text = e.TextEditor.Text;
1715 /// The FontSizeScale property. <br />
1716 /// The default value is 1.0. <br />
1717 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1719 /// <since_tizen> 9 </since_tizen>
1720 public float FontSizeScale
1724 return fontSizeScale;
1728 float newFontSizeScale;
1730 if (fontSizeScale == value) return;
1732 fontSizeScale = value;
1733 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1735 SystemSettingsFontSize systemSettingsFontSize;
1739 systemSettingsFontSize = SystemSettings.FontSize;
1743 Console.WriteLine("{0} Exception caught.", e);
1744 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1746 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1747 addFontSizeChangedCallback();
1751 newFontSizeScale = fontSizeScale;
1752 removeFontSizeChangedCallback();
1755 SetValue(FontSizeScaleProperty, newFontSizeScale);
1756 NotifyPropertyChanged();
1761 /// The InputMethodSettings property.
1764 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1767 /// The following example demonstrates how to set the InputMethodSettings property.
1769 /// InputMethod method = new InputMethod();
1770 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1771 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1772 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1773 /// method.Variation = 1;
1774 /// textEditor.InputMethodSettings = method.OutputMap;
1777 [EditorBrowsable(EditorBrowsableState.Never)]
1778 public PropertyMap InputMethodSettings
1782 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1786 SetValue(InputMethodSettingsProperty, value);
1787 NotifyPropertyChanged();
1792 /// Scroll the text control by specific amount..
1794 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
1795 [EditorBrowsable(EditorBrowsableState.Never)]
1796 public void ScrollBy(Vector2 scroll)
1798 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
1799 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1803 /// Get the InputMethodContext instance.
1805 /// <returns>The InputMethodContext instance.</returns>
1806 /// <since_tizen> 5 </since_tizen>
1807 public InputMethodContext GetInputMethodContext()
1809 if (inputMethodContext == null)
1811 /*Avoid raising InputMethodContext reference count.*/
1812 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
1813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1815 return inputMethodContext;
1819 /// Select the whole text.
1821 [EditorBrowsable(EditorBrowsableState.Never)]
1822 public void SelectWholeText()
1824 Interop.TextEditor.SelectWholeText(SwigCPtr);
1825 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1829 /// Select text from start to end index.
1831 /// <param name="start">The start index for selection.</param>
1832 /// <param name="end">The end index for selection.</param>
1833 [EditorBrowsable(EditorBrowsableState.Never)]
1834 public void SelectText(uint start, uint end)
1836 Interop.TextEditor.SelectText(SwigCPtr, start, end);
1837 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1841 /// Clear selection of the text.
1843 [EditorBrowsable(EditorBrowsableState.Never)]
1844 public void SelectNone()
1846 _ = Interop.TextEditor.SelectNone(SwigCPtr);
1847 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1851 /// Enable grab handle property.
1853 [EditorBrowsable(EditorBrowsableState.Never)]
1854 public bool EnableGrabHandle
1858 return (bool)GetValue(EnableGrabHandleProperty);
1862 SetValue(EnableGrabHandleProperty, value);
1863 NotifyPropertyChanged();
1868 /// Enable grab handle popup property.
1870 [EditorBrowsable(EditorBrowsableState.Never)]
1871 public bool EnableGrabHandlePopup
1875 return (bool)GetValue(EnableGrabHandlePopupProperty);
1879 SetValue(EnableGrabHandlePopupProperty, value);
1880 NotifyPropertyChanged();
1885 /// Minimum line size to be used.
1887 [EditorBrowsable(EditorBrowsableState.Never)]
1888 public float MinLineSize
1892 return (float)GetValue(MinLineSizeProperty);
1896 SetValue(MinLineSizeProperty, value);
1897 NotifyPropertyChanged();
1901 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditor obj)
1903 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1906 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
1908 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));
1909 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1916 /// <since_tizen> 3 </since_tizen>
1917 protected override void Dispose(DisposeTypes type)
1924 if (systemlangTextFlag)
1926 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1929 removeFontSizeChangedCallback();
1931 //Release your own unmanaged resources here.
1932 //You should not access any managed member here except static instance.
1933 //because the execution order of Finalizes is non-deterministic.
1937 if (textEditorTextChangedCallbackDelegate != null)
1939 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
1942 if (textEditorMaxLengthReachedCallbackDelegate != null)
1944 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
1947 if (textEditorCursorPositionChangedCallbackDelegate != null)
1949 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
1956 /// This will not be public opened.
1957 [EditorBrowsable(EditorBrowsableState.Never)]
1958 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1960 // In order to speed up IME hide, temporarily add
1961 GetInputMethodContext()?.DestroyContext();
1962 Interop.TextEditor.DeleteTextEditor(swigCPtr);
1965 private string SetTranslatable(string textEditorSid)
1967 string translatableText = null;
1968 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1969 if (translatableText != null)
1971 if (systemlangTextFlag == false)
1973 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1974 systemlangTextFlag = true;
1976 return translatableText;
1980 translatableText = "";
1981 return translatableText;
1985 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1987 if (textEditorTextSid != null)
1989 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1991 if (textEditorPlaceHolderTextSid != null)
1993 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1997 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1999 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2000 SetValue(FontSizeScaleProperty, newFontSizeScale);
2001 NotifyPropertyChanged();
2004 private void addFontSizeChangedCallback()
2006 if (hasFontSizeChangedCallback != true)
2010 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2011 hasFontSizeChangedCallback = true;
2015 Console.WriteLine("{0} Exception caught.", e);
2016 hasFontSizeChangedCallback = false;
2021 private void removeFontSizeChangedCallback()
2023 if (hasFontSizeChangedCallback == true)
2027 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2028 hasFontSizeChangedCallback = false;
2032 Console.WriteLine("{0} Exception caught.", e);
2033 hasFontSizeChangedCallback = true;
2038 internal new class Property
2040 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2041 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2042 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2043 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2044 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2045 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2046 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2047 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2048 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2049 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2050 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2051 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2052 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2053 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2054 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2055 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2056 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2057 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2058 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2059 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2060 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2061 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2062 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2063 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2064 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2065 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2066 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2067 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2068 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2069 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2070 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2071 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2072 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2073 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2074 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2075 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2076 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2077 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2078 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2079 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2080 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2081 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2082 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2083 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2084 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2085 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2086 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2087 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2088 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2089 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2090 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2091 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2092 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2093 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2094 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2095 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2096 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2097 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2098 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2099 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2100 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2101 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2102 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2103 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2104 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2105 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2106 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2107 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2108 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2109 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2112 internal class InputStyle
2118 FontFamily = 0x0002,
2121 LineSpacing = 0x0010,
2129 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2131 DecorationBoundingBox = new Rectangle(x, y, width, height);
2133 private void OnInputColorChanged(float x, float y, float z, float w)
2135 InputColor = new Vector4(x, y, z, w);
2137 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2139 PlaceholderTextColor = new Color(r, g, b, a);
2141 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2143 PrimaryCursorColor = new Vector4(x, y, z, w);
2145 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2147 SecondaryCursorColor = new Vector4(x, y, z, w);
2149 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2151 SelectionHighlightColor = new Vector4(x, y, z, w);
2153 private void OnTextColorChanged(float x, float y, float z, float w)
2155 TextColor = new Vector4(x, y, z, w);
2157 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2159 GrabHandleColor = new Color(r, g, b, a);