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;
40 private bool isSettingTextInCSharp = false;
42 static TextEditor() { }
45 /// Creates the TextEditor control.
47 /// <since_tizen> 3 </since_tizen>
48 public TextEditor() : this(Interop.TextEditor.New(), true)
50 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
54 /// Creates the TextEditor with specified style.
56 [EditorBrowsable(EditorBrowsableState.Never)]
57 public TextEditor(TextEditorStyle style) : this(Interop.TextLabel.New(), true, style: style)
62 /// Creates the TextEditor with setting the status of shown or hidden.
64 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
65 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 public TextEditor(bool shown) : this(Interop.TextEditor.New(), true)
69 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82 TextChanged += TextEditorTextChanged;
85 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
92 TextChanged += TextEditorTextChanged;
96 /// The TranslatableText property.<br />
97 /// The text can set the SID value.<br />
99 /// <exception cref='ArgumentNullException'>
100 /// ResourceManager about multilingual is null.
102 /// <since_tizen> 4 </since_tizen>
103 public string TranslatableText
107 return textEditorTextSid;
111 if (NUIApplication.MultilingualResourceManager == null)
113 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
115 textEditorTextSid = value;
116 Text = SetTranslatable(textEditorTextSid);
117 NotifyPropertyChanged();
121 /// The TranslatablePlaceholderText property.<br />
122 /// The text can set the SID value.<br />
124 /// <exception cref='ArgumentNullException'>
125 /// ResourceManager about multilingual is null.
127 /// <since_tizen> 4 </since_tizen>
128 public string TranslatablePlaceholderText
132 return textEditorPlaceHolderTextSid;
136 if (NUIApplication.MultilingualResourceManager == null)
138 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
140 textEditorPlaceHolderTextSid = value;
141 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
142 NotifyPropertyChanged();
147 /// The Text property.
149 /// <since_tizen> 3 </since_tizen>
154 return (string)GetValue(TextProperty);
158 SetValue(TextProperty, value);
159 NotifyPropertyChanged();
164 /// The TextColor property.
167 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
169 /// <since_tizen> 3 </since_tizen>
170 public Vector4 TextColor
174 Vector4 temp = (Vector4)GetValue(TextColorProperty);
175 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
179 SetValue(TextColorProperty, value);
180 NotifyPropertyChanged();
185 /// The FontFamily property.
187 /// <since_tizen> 3 </since_tizen>
188 public string FontFamily
192 return (string)GetValue(FontFamilyProperty);
196 SetValue(FontFamilyProperty, value);
197 NotifyPropertyChanged();
202 /// The FontStyle property.
203 /// The fontStyle map contains the following keys :<br />
204 /// <list type="table">
205 /// <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>
206 /// <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>
207 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
210 /// <since_tizen> 3 </since_tizen>
211 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
212 public PropertyMap FontStyle
216 return (PropertyMap)GetValue(FontStyleProperty);
220 SetValue(FontStyleProperty, value);
221 NotifyPropertyChanged();
226 /// Set FontStyle to TextEditor. <br />
228 /// <param name="fontStyle">The FontStyle</param>
230 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
233 /// The following example demonstrates how to use the SetFontStyle method.
235 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
236 /// fontStyle.Width = FontWidthType.Expanded;
237 /// fontStyle.Weight = FontWeightType.Bold;
238 /// fontStyle.Slant = FontSlantType.Italic;
239 /// editor.SetFontStyle(fontStyle);
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public void SetFontStyle(FontStyle fontStyle)
245 SetValue(FontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
249 /// Get FontStyle from TextEditor. <br />
251 /// <returns>The FontStyle</returns>
253 /// <see cref="Tizen.NUI.Text.FontStyle"/>
255 [EditorBrowsable(EditorBrowsableState.Never)]
256 public FontStyle GetFontStyle()
258 return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(FontStyleProperty));
262 /// The PointSize property.
264 /// <since_tizen> 3 </since_tizen>
265 public float PointSize
269 return (float)GetValue(PointSizeProperty);
273 SetValue(PointSizeProperty, value);
274 NotifyPropertyChanged();
279 /// The HorizontalAlignment property.
281 /// <since_tizen> 3 </since_tizen>
282 public HorizontalAlignment HorizontalAlignment
286 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
290 SetValue(HorizontalAlignmentProperty, value);
291 NotifyPropertyChanged();
296 /// The ScrollThreshold property.
298 /// <since_tizen> 3 </since_tizen>
299 public float ScrollThreshold
303 return (float)GetValue(ScrollThresholdProperty);
307 SetValue(ScrollThresholdProperty, value);
308 NotifyPropertyChanged();
313 /// The ScrollSpeed property.
315 /// <since_tizen> 3 </since_tizen>
316 public float ScrollSpeed
320 return (float)GetValue(ScrollSpeedProperty);
324 SetValue(ScrollSpeedProperty, value);
325 NotifyPropertyChanged();
330 /// The PrimaryCursorColor property.
333 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
335 /// <since_tizen> 3 </since_tizen>
336 public Vector4 PrimaryCursorColor
340 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
341 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
345 SetValue(PrimaryCursorColorProperty, value);
346 NotifyPropertyChanged();
351 /// The SecondaryCursorColor property.
354 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
356 /// <since_tizen> 3 </since_tizen>
357 public Vector4 SecondaryCursorColor
361 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
362 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
366 SetValue(SecondaryCursorColorProperty, value);
367 NotifyPropertyChanged();
372 /// The EnableCursorBlink property.
374 /// <since_tizen> 3 </since_tizen>
375 public bool EnableCursorBlink
379 return (bool)GetValue(EnableCursorBlinkProperty);
383 SetValue(EnableCursorBlinkProperty, value);
384 NotifyPropertyChanged();
389 /// The CursorBlinkInterval property.
391 /// <since_tizen> 3 </since_tizen>
392 public float CursorBlinkInterval
396 return (float)GetValue(CursorBlinkIntervalProperty);
400 SetValue(CursorBlinkIntervalProperty, value);
401 NotifyPropertyChanged();
406 /// The CursorBlinkDuration property.
408 /// <since_tizen> 3 </since_tizen>
409 public float CursorBlinkDuration
413 return (float)GetValue(CursorBlinkDurationProperty);
417 SetValue(CursorBlinkDurationProperty, value);
418 NotifyPropertyChanged();
423 /// The CursorWidth property.
425 /// <since_tizen> 3 </since_tizen>
426 public int CursorWidth
430 return (int)GetValue(CursorWidthProperty);
434 SetValue(CursorWidthProperty, value);
435 NotifyPropertyChanged();
440 /// The GrabHandleImage property.
442 /// <since_tizen> 3 </since_tizen>
443 public string GrabHandleImage
447 return (string)GetValue(GrabHandleImageProperty);
451 SetValue(GrabHandleImageProperty, value);
452 NotifyPropertyChanged();
457 /// The GrabHandlePressedImage property.
459 /// <since_tizen> 3 </since_tizen>
460 public string GrabHandlePressedImage
464 return (string)GetValue(GrabHandlePressedImageProperty);
468 SetValue(GrabHandlePressedImageProperty, value);
469 NotifyPropertyChanged();
474 /// The SelectionHandleImageLeft property.
475 /// The selectionHandleImageLeft map contains the following key :<br />
476 /// <list type="table">
477 /// <item><term>filename (string)</term><description>The path of image file</description></item>
480 /// <since_tizen> 3 </since_tizen>
481 public PropertyMap SelectionHandleImageLeft
485 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
489 SetValue(SelectionHandleImageLeftProperty, value);
490 NotifyPropertyChanged();
495 /// The SelectionHandleImageRight property.
496 /// The selectionHandleImageRight map contains the following key :<br />
497 /// <list type="table">
498 /// <item><term>filename (string)</term><description>The path of image file</description></item>
501 /// <since_tizen> 3 </since_tizen>
502 public PropertyMap SelectionHandleImageRight
506 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
510 SetValue(SelectionHandleImageRightProperty, value);
511 NotifyPropertyChanged();
516 /// Set SelectionHandleImage to TextEditor. <br />
518 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
520 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
523 /// The following example demonstrates how to use the SetSelectionHandleImage method.
525 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
526 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
527 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
528 /// editor.SetSelectionHandleImage(selectionHandleImage);
531 [EditorBrowsable(EditorBrowsableState.Never)]
532 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
534 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
536 SetValue(SelectionHandleImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleImage.LeftImageUrl));
539 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
541 SetValue(SelectionHandleImageRightProperty, TextUtils.GetFileNameMap(selectionHandleImage.RightImageUrl));
546 /// Get SelectionHandleImage from TextEditor. <br />
548 /// <returns>The SelectionHandleImage</returns>
550 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
552 [EditorBrowsable(EditorBrowsableState.Never)]
553 public SelectionHandleImage GetSelectionHandleImage()
555 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleImageLeftProperty), (PropertyMap)GetValue(SelectionHandleImageRightProperty));
559 /// The SelectionHandlePressedImageLeft property.
560 /// The selectionHandlePressedImageLeft map contains the following key :<br />
561 /// <list type="table">
562 /// <item><term>filename (string)</term><description>The path of image file</description></item>
565 /// <since_tizen> 3 </since_tizen>
566 public PropertyMap SelectionHandlePressedImageLeft
570 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
574 SetValue(SelectionHandlePressedImageLeftProperty, value);
575 NotifyPropertyChanged();
580 /// The SelectionHandlePressedImageRight property.
581 /// The selectionHandlePressedImageRight map contains the following key :<br />
582 /// <list type="table">
583 /// <item><term>filename (string)</term><description>The path of image file</description></item>
586 /// <since_tizen> 3 </since_tizen>
587 public PropertyMap SelectionHandlePressedImageRight
591 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
595 SetValue(SelectionHandlePressedImageRightProperty, value);
596 NotifyPropertyChanged();
601 /// Set SelectionHandlePressedImage to TextEditor. <br />
603 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
605 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
608 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
610 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
611 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
612 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
613 /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
616 [EditorBrowsable(EditorBrowsableState.Never)]
617 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
619 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
621 SetValue(SelectionHandlePressedImageLeftProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl));
624 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
626 SetValue(SelectionHandlePressedImageRightProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.RightImageUrl));
631 /// Get SelectionHandlePressedImage from TextEditor. <br />
633 /// <returns>The SelectionHandlePressedImage</returns>
635 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
637 [EditorBrowsable(EditorBrowsableState.Never)]
638 public SelectionHandleImage GetSelectionHandlePressedImage()
640 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty), (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty));
644 /// The SelectionHandleMarkerImageLeft property.
645 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
646 /// <list type="table">
647 /// <item><term>filename (string)</term><description>The path of image file</description></item>
650 /// <since_tizen> 3 </since_tizen>
651 public PropertyMap SelectionHandleMarkerImageLeft
655 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
659 SetValue(SelectionHandleMarkerImageLeftProperty, value);
660 NotifyPropertyChanged();
665 /// The SelectionHandleMarkerImageRight property.
666 /// The selectionHandleMarkerImageRight map contains the following key :<br />
667 /// <list type="table">
668 /// <item><term>filename (string)</term><description>The path of image file</description></item>
671 /// <since_tizen> 3 </since_tizen>
672 public PropertyMap SelectionHandleMarkerImageRight
676 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
680 SetValue(SelectionHandleMarkerImageRightProperty, value);
681 NotifyPropertyChanged();
686 /// Set SelectionHandleMarkerImage to TextEditor. <br />
688 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
690 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
693 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
695 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
696 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
697 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
698 /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
701 [EditorBrowsable(EditorBrowsableState.Never)]
702 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
704 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
706 SetValue(SelectionHandleMarkerImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl));
709 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
711 SetValue(SelectionHandleMarkerImageRightProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl));
716 /// Get SelectionHandleMarkerImage from TextEditor. <br />
718 /// <returns>The SelectionHandleMarkerImage</returns>
720 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
722 [EditorBrowsable(EditorBrowsableState.Never)]
723 public SelectionHandleImage GetSelectionHandleMarkerImage()
725 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty), (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty));
729 /// The SelectionHighlightColor property.
732 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
734 /// <since_tizen> 3 </since_tizen>
735 public Vector4 SelectionHighlightColor
739 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
740 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
744 SetValue(SelectionHighlightColorProperty, value);
745 NotifyPropertyChanged();
750 /// The DecorationBoundingBox property.
753 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
755 /// <since_tizen> 3 </since_tizen>
756 public Rectangle DecorationBoundingBox
760 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
761 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
765 SetValue(DecorationBoundingBoxProperty, value);
766 NotifyPropertyChanged();
771 /// The EnableMarkup property.
773 /// <since_tizen> 3 </since_tizen>
774 public bool EnableMarkup
778 return (bool)GetValue(EnableMarkupProperty);
782 SetValue(EnableMarkupProperty, value);
783 NotifyPropertyChanged();
788 /// The InputColor property.
791 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
793 /// <since_tizen> 3 </since_tizen>
794 public Vector4 InputColor
798 Vector4 temp = (Vector4)GetValue(InputColorProperty);
799 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
803 SetValue(InputColorProperty, value);
804 NotifyPropertyChanged();
809 /// The InputFontFamily property.
811 /// <since_tizen> 3 </since_tizen>
812 public string InputFontFamily
816 return (string)GetValue(InputFontFamilyProperty);
820 SetValue(InputFontFamilyProperty, value);
821 NotifyPropertyChanged();
826 /// The InputFontStyle property.
827 /// The inputFontStyle map contains the following keys :<br />
828 /// <list type="table">
829 /// <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>
830 /// <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>
831 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
834 /// <since_tizen> 3 </since_tizen>
835 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
836 public PropertyMap InputFontStyle
840 return (PropertyMap)GetValue(InputFontStyleProperty);
844 SetValue(InputFontStyleProperty, value);
845 NotifyPropertyChanged();
850 /// Set InputFontStyle to TextEditor. <br />
852 /// <param name="fontStyle">The FontStyle</param>
854 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
857 /// The following example demonstrates how to use the SetInputFontStyle method.
859 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
860 /// fontStyle.Width = FontWidthType.Expanded;
861 /// fontStyle.Weight = FontWeightType.Bold;
862 /// fontStyle.Slant = FontSlantType.Italic;
863 /// editor.SetInputFontStyle(fontStyle);
866 [EditorBrowsable(EditorBrowsableState.Never)]
867 public void SetInputFontStyle(FontStyle fontStyle)
869 SetValue(InputFontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
873 /// Get InputFontStyle from TextEditor. <br />
875 /// <returns>The FontStyle</returns>
877 /// <see cref="Tizen.NUI.Text.FontStyle"/>
879 [EditorBrowsable(EditorBrowsableState.Never)]
880 public FontStyle GetInputFontStyle()
882 return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(InputFontStyleProperty));
886 /// The InputPointSize property.
888 /// <since_tizen> 3 </since_tizen>
889 public float InputPointSize
893 return (float)GetValue(InputPointSizeProperty);
897 SetValue(InputPointSizeProperty, value);
898 NotifyPropertyChanged();
903 /// The LineSpacing property.
905 /// <since_tizen> 3 </since_tizen>
906 public float LineSpacing
910 return (float)GetValue(LineSpacingProperty);
914 SetValue(LineSpacingProperty, value);
915 NotifyPropertyChanged();
920 /// The InputLineSpacing property.
922 /// <since_tizen> 3 </since_tizen>
923 public float InputLineSpacing
927 return (float)GetValue(InputLineSpacingProperty);
931 SetValue(InputLineSpacingProperty, value);
932 NotifyPropertyChanged();
937 /// The Underline property.
938 /// The underline map contains the following keys :<br />
939 /// <list type="table">
940 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
941 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
942 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
945 /// <since_tizen> 3 </since_tizen>
946 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
947 public PropertyMap Underline
951 return (PropertyMap)GetValue(UnderlineProperty);
955 SetValue(UnderlineProperty, value);
956 NotifyPropertyChanged();
961 /// Set Underline to TextEditor. <br />
963 /// <param name="underline">The Underline</param>
965 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
968 /// The following example demonstrates how to use the SetUnderline method.
970 /// var underline = new Tizen.NUI.Text.Underline();
971 /// underline.Enable = true;
972 /// underline.Color = new Color("#3498DB");
973 /// underline.Height = 2.0f;
974 /// editor.SetUnderline(underline);
977 [EditorBrowsable(EditorBrowsableState.Never)]
978 public void SetUnderline(Underline underline)
980 SetValue(UnderlineProperty, TextUtils.GetUnderlineMap(underline));
984 /// Get Underline from TextEditor. <br />
986 /// <returns>The Underline</returns>
988 /// <see cref="Tizen.NUI.Text.Underline"/>
990 [EditorBrowsable(EditorBrowsableState.Never)]
991 public Underline GetUnderline()
993 return TextUtils.GetUnderlineStruct((PropertyMap)GetValue(UnderlineProperty));
997 /// The InputUnderline property.
999 /// <since_tizen> 3 </since_tizen>
1000 public string InputUnderline
1004 return (string)GetValue(InputUnderlineProperty);
1008 SetValue(InputUnderlineProperty, value);
1009 NotifyPropertyChanged();
1014 /// The Shadow property.
1015 /// The shadow map contains the following keys :<br />
1016 /// <list type="table">
1017 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1018 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1019 /// <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>
1022 /// <since_tizen> 3 </since_tizen>
1023 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1024 public PropertyMap Shadow
1028 return (PropertyMap)GetValue(ShadowProperty);
1032 SetValue(ShadowProperty, value);
1033 NotifyPropertyChanged();
1038 /// Set Shadow to TextEditor. <br />
1040 /// <param name="shadow">The Shadow</param>
1042 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1045 /// The following example demonstrates how to use the SetShadow method.
1047 /// var shadow = new Tizen.NUI.Text.Shadow();
1048 /// shadow.Offset = new Vector2(3, 3);
1049 /// shadow.Color = new Color("#F1C40F");
1050 /// editor.SetShadow(shadow);
1053 [EditorBrowsable(EditorBrowsableState.Never)]
1054 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1056 SetValue(ShadowProperty, TextUtils.GetShadowMap(shadow));
1060 /// Get Shadow from TextEditor. <br />
1062 /// <returns>The Shadow</returns>
1064 /// <see cref="Tizen.NUI.Text.Shadow"/>
1066 [EditorBrowsable(EditorBrowsableState.Never)]
1067 public Tizen.NUI.Text.Shadow GetShadow()
1069 return TextUtils.GetShadowStruct((PropertyMap)GetValue(ShadowProperty));
1073 /// The InputShadow property.
1075 /// <since_tizen> 3 </since_tizen>
1076 public string InputShadow
1080 return (string)GetValue(InputShadowProperty);
1084 SetValue(InputShadowProperty, value);
1085 NotifyPropertyChanged();
1090 /// The Emboss property.
1092 /// <since_tizen> 3 </since_tizen>
1093 public string Emboss
1097 return (string)GetValue(EmbossProperty);
1101 SetValue(EmbossProperty, value);
1102 NotifyPropertyChanged();
1107 /// The InputEmboss property.
1109 /// <since_tizen> 3 </since_tizen>
1110 public string InputEmboss
1114 return (string)GetValue(InputEmbossProperty);
1118 SetValue(InputEmbossProperty, value);
1119 NotifyPropertyChanged();
1124 /// The Outline property.
1125 /// The outline map contains the following keys :<br />
1126 /// <list type="table">
1127 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1128 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1131 /// <since_tizen> 3 </since_tizen>
1132 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1133 public PropertyMap Outline
1137 return (PropertyMap)GetValue(OutlineProperty);
1141 SetValue(OutlineProperty, value);
1142 NotifyPropertyChanged();
1147 /// Set Outline to TextEditor. <br />
1149 /// <param name="outline">The Outline</param>
1151 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1154 /// The following example demonstrates how to use the SetOutline method.
1156 /// var outline = new Tizen.NUI.Text.Outline();
1157 /// outline.Width = 2.0f;
1158 /// outline.Color = new Color("#45B39D");
1159 /// editor.SetOutline(outline);
1162 [EditorBrowsable(EditorBrowsableState.Never)]
1163 public void SetOutline(Outline outline)
1165 SetValue(OutlineProperty, TextUtils.GetOutlineMap(outline));
1169 /// Get Outline from TextEditor. <br />
1171 /// <returns>The Outline</returns>
1173 /// <see cref="Tizen.NUI.Text.Outline"/>
1175 [EditorBrowsable(EditorBrowsableState.Never)]
1176 public Outline GetOutline()
1178 return TextUtils.GetOutlineStruct((PropertyMap)GetValue(OutlineProperty));
1182 /// The InputOutline property.
1184 /// <since_tizen> 3 </since_tizen>
1185 public string InputOutline
1189 return (string)GetValue(InputOutlineProperty);
1193 SetValue(InputOutlineProperty, value);
1194 NotifyPropertyChanged();
1199 /// The SmoothScroll property.
1201 /// <since_tizen> 3 </since_tizen>
1202 public bool SmoothScroll
1206 return (bool)GetValue(SmoothScrollProperty);
1210 SetValue(SmoothScrollProperty, value);
1211 NotifyPropertyChanged();
1216 /// The SmoothScrollDuration property.
1218 /// <since_tizen> 3 </since_tizen>
1219 public float SmoothScrollDuration
1223 return (float)GetValue(SmoothScrollDurationProperty);
1227 SetValue(SmoothScrollDurationProperty, value);
1228 NotifyPropertyChanged();
1233 /// The EnableScrollBar property.
1235 /// <since_tizen> 3 </since_tizen>
1236 public bool EnableScrollBar
1240 return (bool)GetValue(EnableScrollBarProperty);
1244 SetValue(EnableScrollBarProperty, value);
1245 NotifyPropertyChanged();
1250 /// The ScrollBarShowDuration property.
1252 /// <since_tizen> 3 </since_tizen>
1253 public float ScrollBarShowDuration
1257 return (float)GetValue(ScrollBarShowDurationProperty);
1261 SetValue(ScrollBarShowDurationProperty, value);
1262 NotifyPropertyChanged();
1267 /// The ScrollBarFadeDuration property.
1269 /// <since_tizen> 3 </since_tizen>
1270 public float ScrollBarFadeDuration
1274 return (float)GetValue(ScrollBarFadeDurationProperty);
1278 SetValue(ScrollBarFadeDurationProperty, value);
1279 NotifyPropertyChanged();
1284 /// The PixelSize property.
1286 /// <since_tizen> 3 </since_tizen>
1287 public float PixelSize
1291 return (float)GetValue(PixelSizeProperty);
1295 SetValue(PixelSizeProperty, value);
1296 NotifyPropertyChanged();
1301 /// The line count of the text.
1303 /// <since_tizen> 3 </since_tizen>
1304 public int LineCount
1309 GetProperty(TextEditor.Property.LineCount).Get(out temp);
1315 /// The text to display when the TextEditor is empty and inactive.
1317 /// <since_tizen> 3 </since_tizen>
1318 public string PlaceholderText
1322 return (string)GetValue(PlaceholderTextProperty);
1326 SetValue(PlaceholderTextProperty, value);
1327 NotifyPropertyChanged();
1332 /// The portion of the text that has been selected by the user.
1335 /// Empty string when nothing is selected.
1337 /// <since_tizen> 9 </since_tizen>
1338 public string SelectedText
1343 GetProperty(TextEditor.Property.SelectedText).Get(out temp);
1349 /// The Placeholder text color.
1352 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1354 /// <since_tizen> 3 </since_tizen>
1355 public Color PlaceholderTextColor
1359 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1360 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1364 SetValue(PlaceholderTextColorProperty, value);
1365 NotifyPropertyChanged();
1370 /// The EnableSelection property.
1372 /// <since_tizen> 3 </since_tizen>
1373 public bool EnableSelection
1377 return (bool)GetValue(EnableSelectionProperty);
1381 SetValue(EnableSelectionProperty, value);
1382 NotifyPropertyChanged();
1387 /// The start index for selection.
1390 /// When there is no selection, the index is current cursor position.
1392 /// <since_tizen> 9 </since_tizen>
1393 public int SelectedTextStart
1398 GetProperty(TextEditor.Property.SelectedTextStart).Get(out temp);
1404 /// The end index for selection.
1407 /// When there is no selection, the index is current cursor position.
1409 /// <since_tizen> 9 </since_tizen>
1410 public int SelectedTextEnd
1415 GetProperty(TextEditor.Property.SelectedTextEnd).Get(out temp);
1421 /// Enable editing in text control.
1423 /// <since_tizen> 8 </since_tizen>
1424 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1425 [EditorBrowsable(EditorBrowsableState.Never)]
1426 public bool EnableEditing
1431 GetProperty(TextEditor.Property.EnableEditing).Get(out temp);
1436 SetProperty(TextEditor.Property.EnableEditing, new PropertyValue(value));
1437 NotifyPropertyChanged();
1442 /// Specify horizontal scroll position in text control.
1444 [EditorBrowsable(EditorBrowsableState.Never)]
1445 public int HorizontalScrollPosition
1450 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1452 propertyValue.Get(out temp);
1458 using (PropertyValue propertyValue = new PropertyValue(value))
1460 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1461 NotifyPropertyChanged();
1467 /// Specify vertical scroll position in text control.
1469 [EditorBrowsable(EditorBrowsableState.Never)]
1470 public int VerticalScrollPosition
1475 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1477 propertyValue.Get(out temp);
1483 using (PropertyValue propertyValue = new PropertyValue(value))
1485 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1486 NotifyPropertyChanged();
1492 /// Specify primary cursor (caret) position in text control.
1494 [EditorBrowsable(EditorBrowsableState.Never)]
1495 public int PrimaryCursorPosition
1500 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1502 propertyValue.Get(out temp);
1508 using (PropertyValue propertyValue = new PropertyValue(value))
1510 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1511 NotifyPropertyChanged();
1517 /// The GrabHandleColor property.
1520 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1522 [EditorBrowsable(EditorBrowsableState.Never)]
1523 public Color GrabHandleColor
1527 Color temp = (Color)GetValue(GrabHandleColorProperty);
1528 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1532 SetValue(GrabHandleColorProperty, value);
1533 NotifyPropertyChanged();
1538 /// Set InputFilter to TextEditor. <br />
1540 /// <param name="inputFilter">The InputFilter</param>
1542 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1543 /// Users can set the Accepted or Rejected regular expression set, or both. <br />
1544 /// If both are used, Rejected has higher priority. <br />
1545 /// The character set must follow the regular expression rules. <br />
1546 /// Behaviour can not be guaranteed for incorrect grammars. <br />
1547 /// Refer the link below for detailed rules. <br />
1548 /// The functions in std::regex library use the ECMAScript grammar: <br />
1549 /// http://cplusplus.com/reference/regex/ECMAScript/ <br />
1550 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1551 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description. <br />
1554 /// The following example demonstrates how to use the SetInputFilter method.
1556 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1557 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1558 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1559 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1562 [EditorBrowsable(EditorBrowsableState.Never)]
1563 public void SetInputFilter(InputFilter inputFilter)
1565 SetProperty(TextEditor.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter)));
1569 /// Get InputFilter from TextEditor. <br />
1571 /// <returns>The InputFilter</returns>
1573 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1575 [EditorBrowsable(EditorBrowsableState.Never)]
1576 public InputFilter GetInputFilter()
1578 var map = new PropertyMap();
1579 GetProperty(TextEditor.Property.InputFilter).Get(map);
1580 return TextUtils.GetInputFilterStruct(map);
1584 /// The Placeholder property.
1585 /// The placeholder map contains the following keys :<br />
1586 /// <list type="table">
1587 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1588 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1589 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1590 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1591 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1592 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1593 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1594 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1598 /// The following example demonstrates how to set the placeholder property.
1600 /// PropertyMap propertyMap = new PropertyMap();
1601 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1602 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1603 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1604 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1605 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1607 /// PropertyMap fontStyleMap = new PropertyMap();
1608 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1609 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1610 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1611 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1613 /// TextEditor editor = new TextEditor();
1614 /// editor.Placeholder = propertyMap;
1617 /// <since_tizen> 3 </since_tizen>
1618 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1619 public Tizen.NUI.PropertyMap Placeholder
1623 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1624 PropertyValue value = null;
1627 value = map.Find(0);
1630 value.Get(out string text);
1631 map.Add("text", new PropertyValue(text));
1635 value = map.Find(1);
1638 value.Get(out string textFocused);
1639 map.Add("textFocused", new PropertyValue(textFocused));
1643 value = map.Find(2);
1646 Color color = new Color();
1648 map.Add("color", new PropertyValue(color));
1652 value = map.Find(3);
1655 value.Get(out string fontFamily);
1656 map.Add("fontFamily", new PropertyValue(fontFamily));
1660 value = map.Find(4);
1663 PropertyMap fontStyle = new PropertyMap();
1664 value.Get(fontStyle);
1665 map.Add("fontStyle", new PropertyValue(fontStyle));
1669 value = map.Find(5);
1672 value.Get(out float pointSize);
1673 map.Add("pointSize", new PropertyValue(pointSize));
1677 value = map.Find(6);
1680 value.Get(out float pixelSize);
1681 map.Add("pixelSize", new PropertyValue(pixelSize));
1685 value = map.Find(7);
1688 value.Get(out bool ellipsis);
1689 map.Add("ellipsis", new PropertyValue(ellipsis));
1696 SetValue(PlaceholderProperty, value);
1697 NotifyPropertyChanged();
1702 /// Set Placeholder to TextEditor. <br />
1704 /// <param name="placeholder">The Placeholder</param>
1706 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
1709 /// The following example demonstrates how to use the SetPlaceholder method.
1711 /// var placeholder = new Tizen.NUI.Text.Placeholder();
1712 /// placeholder.Text = "placeholder text";
1713 /// placeholder.TextFocused = "placeholder textFocused";
1714 /// placeholder.Color = new Color("#45B39D");
1715 /// placeholder.FontFamily = "BreezeSans";
1716 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
1718 /// Width = FontWidthType.Expanded,
1719 /// Weight = FontWeightType.ExtraLight,
1720 /// Slant = FontSlantType.Italic,
1722 /// placeholder.PointSize = 25.0f;
1723 /// //placeholder.PixelSize = 50.0f;
1724 /// placeholder.Ellipsis = true;
1725 /// editor.SetPlaceholder(placeholder);
1728 [EditorBrowsable(EditorBrowsableState.Never)]
1729 public void SetPlaceholder(Placeholder placeholder)
1731 SetValue(PlaceholderProperty, TextUtils.GetPlaceholderMap(placeholder));
1735 /// Get Placeholder from TextEditor. <br />
1737 /// <returns>The Placeholder</returns>
1739 /// <see cref="Tizen.NUI.Text.Placeholder"/>
1741 [EditorBrowsable(EditorBrowsableState.Never)]
1742 public Placeholder GetPlaceholder()
1744 return TextUtils.GetPlaceholderStruct((PropertyMap)GetValue(PlaceholderProperty));
1748 /// The Ellipsis property.<br />
1749 /// Enable or disable the ellipsis.<br />
1751 /// <since_tizen> 9 </since_tizen>
1752 public bool Ellipsis
1756 return (bool)GetValue(EllipsisProperty);
1760 SetValue(EllipsisProperty, value);
1761 NotifyPropertyChanged();
1767 /// The ellipsis position of the text.
1768 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
1770 /// <since_tizen> 9 </since_tizen>
1771 public EllipsisPosition EllipsisPosition
1775 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1779 SetValue(EllipsisPositionProperty, value);
1780 NotifyPropertyChanged();
1785 /// The LineWrapMode property.<br />
1786 /// The line wrap mode when the text lines over the layout width.<br />
1788 /// <since_tizen> 4 </since_tizen>
1789 public LineWrapMode LineWrapMode
1793 return (LineWrapMode)GetValue(LineWrapModeProperty);
1797 SetValue(LineWrapModeProperty, value);
1798 NotifyPropertyChanged();
1803 /// Enables Text selection using Shift key.
1805 /// <since_tizen> 5 </since_tizen>
1806 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1807 [EditorBrowsable(EditorBrowsableState.Never)]
1808 public bool EnableShiftSelection
1812 return (bool)GetValue(EnableShiftSelectionProperty);
1816 SetValue(EnableShiftSelectionProperty, value);
1817 NotifyPropertyChanged();
1822 /// The text alignment to match the direction of the system language.
1824 /// <since_tizen> 6 </since_tizen>
1825 public bool MatchSystemLanguageDirection
1829 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1833 SetValue(MatchSystemLanguageDirectionProperty, value);
1834 NotifyPropertyChanged();
1839 /// The MaxLength property.
1841 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1842 [EditorBrowsable(EditorBrowsableState.Never)]
1843 public int MaxLength
1847 return (int)GetValue(MaxLengthProperty);
1851 SetValue(MaxLengthProperty, value);
1852 NotifyPropertyChanged();
1857 /// The FontSizeScale property. <br />
1858 /// The default value is 1.0. <br />
1859 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1861 /// <since_tizen> 9 </since_tizen>
1862 public float FontSizeScale
1866 return fontSizeScale;
1870 float newFontSizeScale;
1872 if (fontSizeScale == value) return;
1874 fontSizeScale = value;
1875 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1877 SystemSettingsFontSize systemSettingsFontSize;
1881 systemSettingsFontSize = SystemSettings.FontSize;
1885 Console.WriteLine("{0} Exception caught.", e);
1886 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1888 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1889 addFontSizeChangedCallback();
1893 newFontSizeScale = fontSizeScale;
1894 removeFontSizeChangedCallback();
1897 SetValue(FontSizeScaleProperty, newFontSizeScale);
1898 NotifyPropertyChanged();
1903 /// The InputMethodSettings property.
1906 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1909 /// The following example demonstrates how to set the InputMethodSettings property.
1911 /// InputMethod method = new InputMethod();
1912 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1913 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1914 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1915 /// method.Variation = 1;
1916 /// textEditor.InputMethodSettings = method.OutputMap;
1919 [EditorBrowsable(EditorBrowsableState.Never)]
1920 public PropertyMap InputMethodSettings
1924 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1928 SetValue(InputMethodSettingsProperty, value);
1929 NotifyPropertyChanged();
1934 /// Scroll the text control by specific amount..
1936 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
1937 [EditorBrowsable(EditorBrowsableState.Never)]
1938 public void ScrollBy(Vector2 scroll)
1940 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
1941 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1945 /// Get the InputMethodContext instance.
1947 /// <returns>The InputMethodContext instance.</returns>
1948 /// <since_tizen> 5 </since_tizen>
1949 public InputMethodContext GetInputMethodContext()
1951 if (inputMethodContext == null)
1953 /*Avoid raising InputMethodContext reference count.*/
1954 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
1955 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1957 return inputMethodContext;
1961 /// Select the whole text.
1963 /// <since_tizen> 9 </since_tizen>
1964 public void SelectWholeText()
1966 Interop.TextEditor.SelectWholeText(SwigCPtr);
1967 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1971 /// Select text from start to end index. <br />
1972 /// The index is valid when 0 or positive.
1974 /// <param name="start">The start index for selection.</param>
1975 /// <param name="end">The end index for selection.</param>
1977 /// If the end index exceeds the maximum value, it is set to the length of the text.
1979 /// <since_tizen> 9 </since_tizen>
1980 public void SelectText(int start, int end)
1983 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
1985 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
1987 Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
1988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1992 /// Clear selection of the text. <br />
1993 /// Valid when selection is activate.
1995 /// <since_tizen> 9 </since_tizen>
1996 public void SelectNone()
1998 _ = Interop.TextEditor.SelectNone(SwigCPtr);
1999 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2003 /// Enable grab handle property.
2005 [EditorBrowsable(EditorBrowsableState.Never)]
2006 public bool EnableGrabHandle
2010 return (bool)GetValue(EnableGrabHandleProperty);
2014 SetValue(EnableGrabHandleProperty, value);
2015 NotifyPropertyChanged();
2020 /// Enable grab handle popup property.
2022 [EditorBrowsable(EditorBrowsableState.Never)]
2023 public bool EnableGrabHandlePopup
2027 return (bool)GetValue(EnableGrabHandlePopupProperty);
2031 SetValue(EnableGrabHandlePopupProperty, value);
2032 NotifyPropertyChanged();
2037 /// Minimum line size to be used.
2039 [EditorBrowsable(EditorBrowsableState.Never)]
2040 public float MinLineSize
2044 return (float)GetValue(MinLineSizeProperty);
2048 SetValue(MinLineSizeProperty, value);
2049 NotifyPropertyChanged();
2053 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2055 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));
2056 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2063 /// <since_tizen> 3 </since_tizen>
2064 protected override void Dispose(DisposeTypes type)
2071 if (systemlangTextFlag)
2073 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2076 removeFontSizeChangedCallback();
2078 //Release your own unmanaged resources here.
2079 //You should not access any managed member here except static instance.
2080 //because the execution order of Finalizes is non-deterministic.
2084 if (textEditorTextChangedCallbackDelegate != null)
2086 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2089 if (textEditorMaxLengthReachedCallbackDelegate != null)
2091 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2094 if (textEditorSelectionClearedCallbackDelegate != null)
2096 this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2099 if (textEditorCursorPositionChangedCallbackDelegate != null)
2101 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2104 if (textEditorSelectionChangedCallbackDelegate != null)
2106 this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2110 TextChanged -= TextEditorTextChanged;
2115 /// This will not be public opened.
2116 [EditorBrowsable(EditorBrowsableState.Never)]
2117 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2119 // In order to speed up IME hide, temporarily add
2120 GetInputMethodContext()?.DestroyContext();
2121 Interop.TextEditor.DeleteTextEditor(swigCPtr);
2124 private string SetTranslatable(string textEditorSid)
2126 string translatableText = null;
2127 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2128 if (translatableText != null)
2130 if (systemlangTextFlag == false)
2132 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2133 systemlangTextFlag = true;
2135 return translatableText;
2139 translatableText = "";
2140 return translatableText;
2144 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2146 if (textEditorTextSid != null)
2148 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2150 if (textEditorPlaceHolderTextSid != null)
2152 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2156 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2158 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2159 SetValue(FontSizeScaleProperty, newFontSizeScale);
2160 NotifyPropertyChanged();
2163 private void addFontSizeChangedCallback()
2165 if (hasFontSizeChangedCallback != true)
2169 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2170 hasFontSizeChangedCallback = true;
2174 Console.WriteLine("{0} Exception caught.", e);
2175 hasFontSizeChangedCallback = false;
2180 private void removeFontSizeChangedCallback()
2182 if (hasFontSizeChangedCallback == true)
2186 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2187 hasFontSizeChangedCallback = false;
2191 Console.WriteLine("{0} Exception caught.", e);
2192 hasFontSizeChangedCallback = true;
2197 private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
2199 if (!isSettingTextInCSharp)
2201 EnforceNotifyBindedInstance(TextProperty);
2205 internal new class Property
2207 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2208 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2209 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2210 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2211 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2212 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2213 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2214 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2215 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2216 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2217 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2218 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2219 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2220 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2221 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2222 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2223 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2224 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2225 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2226 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2227 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2228 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2229 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2230 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2231 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2232 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2233 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2234 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2235 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2236 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2237 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2238 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2239 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2240 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2241 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2242 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2243 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2244 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2245 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2246 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2247 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2248 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2249 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2250 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2251 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2252 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2253 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2254 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2255 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2256 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2257 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2258 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2259 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2260 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2261 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2262 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2263 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2264 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2265 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2266 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2267 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2268 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2269 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2270 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2271 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2272 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2273 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2274 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2275 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2276 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2279 internal class InputStyle
2285 FontFamily = 0x0002,
2288 LineSpacing = 0x0010,
2296 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2298 DecorationBoundingBox = new Rectangle(x, y, width, height);
2300 private void OnInputColorChanged(float x, float y, float z, float w)
2302 InputColor = new Vector4(x, y, z, w);
2304 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2306 PlaceholderTextColor = new Color(r, g, b, a);
2308 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2310 PrimaryCursorColor = new Vector4(x, y, z, w);
2312 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2314 SecondaryCursorColor = new Vector4(x, y, z, w);
2316 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2318 SelectionHighlightColor = new Vector4(x, y, z, w);
2320 private void OnTextColorChanged(float x, float y, float z, float w)
2322 TextColor = new Vector4(x, y, z, w);
2324 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2326 GrabHandleColor = new Color(r, g, b, a);