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 SetValue(FontStyleProperty, 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 return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(FontStyleProperty));
257 /// The PointSize property.
259 /// <since_tizen> 3 </since_tizen>
260 public float PointSize
264 return (float)GetValue(PointSizeProperty);
268 SetValue(PointSizeProperty, value);
269 NotifyPropertyChanged();
274 /// The HorizontalAlignment property.
276 /// <since_tizen> 3 </since_tizen>
277 public HorizontalAlignment HorizontalAlignment
281 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
285 SetValue(HorizontalAlignmentProperty, value);
286 NotifyPropertyChanged();
291 /// The ScrollThreshold property.
293 /// <since_tizen> 3 </since_tizen>
294 public float ScrollThreshold
298 return (float)GetValue(ScrollThresholdProperty);
302 SetValue(ScrollThresholdProperty, value);
303 NotifyPropertyChanged();
308 /// The ScrollSpeed property.
310 /// <since_tizen> 3 </since_tizen>
311 public float ScrollSpeed
315 return (float)GetValue(ScrollSpeedProperty);
319 SetValue(ScrollSpeedProperty, value);
320 NotifyPropertyChanged();
325 /// The PrimaryCursorColor property.
328 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
330 /// <since_tizen> 3 </since_tizen>
331 public Vector4 PrimaryCursorColor
335 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
336 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
340 SetValue(PrimaryCursorColorProperty, value);
341 NotifyPropertyChanged();
346 /// The SecondaryCursorColor property.
349 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
351 /// <since_tizen> 3 </since_tizen>
352 public Vector4 SecondaryCursorColor
356 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
357 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
361 SetValue(SecondaryCursorColorProperty, value);
362 NotifyPropertyChanged();
367 /// The EnableCursorBlink property.
369 /// <since_tizen> 3 </since_tizen>
370 public bool EnableCursorBlink
374 return (bool)GetValue(EnableCursorBlinkProperty);
378 SetValue(EnableCursorBlinkProperty, value);
379 NotifyPropertyChanged();
384 /// The CursorBlinkInterval property.
386 /// <since_tizen> 3 </since_tizen>
387 public float CursorBlinkInterval
391 return (float)GetValue(CursorBlinkIntervalProperty);
395 SetValue(CursorBlinkIntervalProperty, value);
396 NotifyPropertyChanged();
401 /// The CursorBlinkDuration property.
403 /// <since_tizen> 3 </since_tizen>
404 public float CursorBlinkDuration
408 return (float)GetValue(CursorBlinkDurationProperty);
412 SetValue(CursorBlinkDurationProperty, value);
413 NotifyPropertyChanged();
418 /// The CursorWidth property.
420 /// <since_tizen> 3 </since_tizen>
421 public int CursorWidth
425 return (int)GetValue(CursorWidthProperty);
429 SetValue(CursorWidthProperty, value);
430 NotifyPropertyChanged();
435 /// The GrabHandleImage property.
437 /// <since_tizen> 3 </since_tizen>
438 public string GrabHandleImage
442 return (string)GetValue(GrabHandleImageProperty);
446 SetValue(GrabHandleImageProperty, value);
447 NotifyPropertyChanged();
452 /// The GrabHandlePressedImage property.
454 /// <since_tizen> 3 </since_tizen>
455 public string GrabHandlePressedImage
459 return (string)GetValue(GrabHandlePressedImageProperty);
463 SetValue(GrabHandlePressedImageProperty, value);
464 NotifyPropertyChanged();
469 /// The SelectionHandleImageLeft property.
470 /// The selectionHandleImageLeft map contains the following key :<br />
471 /// <list type="table">
472 /// <item><term>filename (string)</term><description>The path of image file</description></item>
475 /// <since_tizen> 3 </since_tizen>
476 public PropertyMap SelectionHandleImageLeft
480 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
484 SetValue(SelectionHandleImageLeftProperty, value);
485 NotifyPropertyChanged();
490 /// The SelectionHandleImageRight property.
491 /// The selectionHandleImageRight map contains the following key :<br />
492 /// <list type="table">
493 /// <item><term>filename (string)</term><description>The path of image file</description></item>
496 /// <since_tizen> 3 </since_tizen>
497 public PropertyMap SelectionHandleImageRight
501 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
505 SetValue(SelectionHandleImageRightProperty, value);
506 NotifyPropertyChanged();
511 /// Set SelectionHandleImage to TextEditor. <br />
513 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
515 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
518 /// The following example demonstrates how to use the SetSelectionHandleImage method.
520 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
521 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
522 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
523 /// editor.SetSelectionHandleImage(selectionHandleImage);
526 [EditorBrowsable(EditorBrowsableState.Never)]
527 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
529 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
531 SetValue(SelectionHandleImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleImage.LeftImageUrl));
534 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
536 SetValue(SelectionHandleImageRightProperty, TextUtils.GetFileNameMap(selectionHandleImage.RightImageUrl));
541 /// Get SelectionHandleImage from TextEditor. <br />
543 /// <returns>The SelectionHandleImage</returns>
545 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
547 [EditorBrowsable(EditorBrowsableState.Never)]
548 public SelectionHandleImage GetSelectionHandleImage()
550 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleImageLeftProperty), (PropertyMap)GetValue(SelectionHandleImageRightProperty));
554 /// The SelectionHandlePressedImageLeft property.
555 /// The selectionHandlePressedImageLeft map contains the following key :<br />
556 /// <list type="table">
557 /// <item><term>filename (string)</term><description>The path of image file</description></item>
560 /// <since_tizen> 3 </since_tizen>
561 public PropertyMap SelectionHandlePressedImageLeft
565 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
569 SetValue(SelectionHandlePressedImageLeftProperty, value);
570 NotifyPropertyChanged();
575 /// The SelectionHandlePressedImageRight property.
576 /// The selectionHandlePressedImageRight map contains the following key :<br />
577 /// <list type="table">
578 /// <item><term>filename (string)</term><description>The path of image file</description></item>
581 /// <since_tizen> 3 </since_tizen>
582 public PropertyMap SelectionHandlePressedImageRight
586 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
590 SetValue(SelectionHandlePressedImageRightProperty, value);
591 NotifyPropertyChanged();
596 /// Set SelectionHandlePressedImage to TextEditor. <br />
598 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
600 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
603 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
605 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
606 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
607 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
608 /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
611 [EditorBrowsable(EditorBrowsableState.Never)]
612 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
614 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
616 SetValue(SelectionHandlePressedImageLeftProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl));
619 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
621 SetValue(SelectionHandlePressedImageRightProperty, TextUtils.GetFileNameMap(selectionHandlePressedImage.RightImageUrl));
626 /// Get SelectionHandlePressedImage from TextEditor. <br />
628 /// <returns>The SelectionHandlePressedImage</returns>
630 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
632 [EditorBrowsable(EditorBrowsableState.Never)]
633 public SelectionHandleImage GetSelectionHandlePressedImage()
635 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty), (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty));
639 /// The SelectionHandleMarkerImageLeft property.
640 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
641 /// <list type="table">
642 /// <item><term>filename (string)</term><description>The path of image file</description></item>
645 /// <since_tizen> 3 </since_tizen>
646 public PropertyMap SelectionHandleMarkerImageLeft
650 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
654 SetValue(SelectionHandleMarkerImageLeftProperty, value);
655 NotifyPropertyChanged();
660 /// The SelectionHandleMarkerImageRight property.
661 /// The selectionHandleMarkerImageRight map contains the following key :<br />
662 /// <list type="table">
663 /// <item><term>filename (string)</term><description>The path of image file</description></item>
666 /// <since_tizen> 3 </since_tizen>
667 public PropertyMap SelectionHandleMarkerImageRight
671 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
675 SetValue(SelectionHandleMarkerImageRightProperty, value);
676 NotifyPropertyChanged();
681 /// Set SelectionHandleMarkerImage to TextEditor. <br />
683 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
685 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
688 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
690 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
691 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
692 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
693 /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
696 [EditorBrowsable(EditorBrowsableState.Never)]
697 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
699 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
701 SetValue(SelectionHandleMarkerImageLeftProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl));
704 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
706 SetValue(SelectionHandleMarkerImageRightProperty, TextUtils.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl));
711 /// Get SelectionHandleMarkerImage from TextEditor. <br />
713 /// <returns>The SelectionHandleMarkerImage</returns>
715 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
717 [EditorBrowsable(EditorBrowsableState.Never)]
718 public SelectionHandleImage GetSelectionHandleMarkerImage()
720 return TextUtils.GetSelectionHandleImageStruct((PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty), (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty));
724 /// The SelectionHighlightColor property.
727 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
729 /// <since_tizen> 3 </since_tizen>
730 public Vector4 SelectionHighlightColor
734 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
735 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
739 SetValue(SelectionHighlightColorProperty, value);
740 NotifyPropertyChanged();
745 /// The DecorationBoundingBox property.
748 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
750 /// <since_tizen> 3 </since_tizen>
751 public Rectangle DecorationBoundingBox
755 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
756 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
760 SetValue(DecorationBoundingBoxProperty, value);
761 NotifyPropertyChanged();
766 /// The EnableMarkup property.
768 /// <since_tizen> 3 </since_tizen>
769 public bool EnableMarkup
773 return (bool)GetValue(EnableMarkupProperty);
777 SetValue(EnableMarkupProperty, value);
778 NotifyPropertyChanged();
783 /// The InputColor property.
786 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
788 /// <since_tizen> 3 </since_tizen>
789 public Vector4 InputColor
793 Vector4 temp = (Vector4)GetValue(InputColorProperty);
794 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
798 SetValue(InputColorProperty, value);
799 NotifyPropertyChanged();
804 /// The InputFontFamily property.
806 /// <since_tizen> 3 </since_tizen>
807 public string InputFontFamily
811 return (string)GetValue(InputFontFamilyProperty);
815 SetValue(InputFontFamilyProperty, value);
816 NotifyPropertyChanged();
821 /// The InputFontStyle property.
822 /// The inputFontStyle map contains the following keys :<br />
823 /// <list type="table">
824 /// <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>
825 /// <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>
826 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
829 /// <since_tizen> 3 </since_tizen>
830 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
831 public PropertyMap InputFontStyle
835 return (PropertyMap)GetValue(InputFontStyleProperty);
839 SetValue(InputFontStyleProperty, value);
840 NotifyPropertyChanged();
845 /// Set InputFontStyle to TextEditor. <br />
847 /// <param name="fontStyle">The FontStyle</param>
849 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
852 /// The following example demonstrates how to use the SetInputFontStyle method.
854 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
855 /// fontStyle.Width = FontWidthType.Expanded;
856 /// fontStyle.Weight = FontWeightType.Bold;
857 /// fontStyle.Slant = FontSlantType.Italic;
858 /// editor.SetInputFontStyle(fontStyle);
861 [EditorBrowsable(EditorBrowsableState.Never)]
862 public void SetInputFontStyle(FontStyle fontStyle)
864 SetValue(InputFontStyleProperty, TextUtils.GetFontStyleMap(fontStyle));
868 /// Get InputFontStyle from TextEditor. <br />
870 /// <returns>The FontStyle</returns>
872 /// <see cref="Tizen.NUI.Text.FontStyle"/>
874 [EditorBrowsable(EditorBrowsableState.Never)]
875 public FontStyle GetInputFontStyle()
877 return TextUtils.GetFontStyleStruct((PropertyMap)GetValue(InputFontStyleProperty));
881 /// The InputPointSize property.
883 /// <since_tizen> 3 </since_tizen>
884 public float InputPointSize
888 return (float)GetValue(InputPointSizeProperty);
892 SetValue(InputPointSizeProperty, value);
893 NotifyPropertyChanged();
898 /// The LineSpacing property.
900 /// <since_tizen> 3 </since_tizen>
901 public float LineSpacing
905 return (float)GetValue(LineSpacingProperty);
909 SetValue(LineSpacingProperty, value);
910 NotifyPropertyChanged();
915 /// The InputLineSpacing property.
917 /// <since_tizen> 3 </since_tizen>
918 public float InputLineSpacing
922 return (float)GetValue(InputLineSpacingProperty);
926 SetValue(InputLineSpacingProperty, value);
927 NotifyPropertyChanged();
932 /// The Underline property.
933 /// The underline map contains the following keys :<br />
934 /// <list type="table">
935 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
936 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
937 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
940 /// <since_tizen> 3 </since_tizen>
941 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
942 public PropertyMap Underline
946 return (PropertyMap)GetValue(UnderlineProperty);
950 SetValue(UnderlineProperty, value);
951 NotifyPropertyChanged();
956 /// Set Underline to TextEditor. <br />
958 /// <param name="underline">The Underline</param>
960 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
963 /// The following example demonstrates how to use the SetUnderline method.
965 /// var underline = new Tizen.NUI.Text.Underline();
966 /// underline.Enable = true;
967 /// underline.Color = new Color("#3498DB");
968 /// underline.Height = 2.0f;
969 /// editor.SetUnderline(underline);
972 [EditorBrowsable(EditorBrowsableState.Never)]
973 public void SetUnderline(Underline underline)
975 SetValue(UnderlineProperty, TextUtils.GetUnderlineMap(underline));
979 /// Get Underline from TextEditor. <br />
981 /// <returns>The Underline</returns>
983 /// <see cref="Tizen.NUI.Text.Underline"/>
985 [EditorBrowsable(EditorBrowsableState.Never)]
986 public Underline GetUnderline()
988 return TextUtils.GetUnderlineStruct((PropertyMap)GetValue(UnderlineProperty));
992 /// The InputUnderline property.
994 /// <since_tizen> 3 </since_tizen>
995 public string InputUnderline
999 return (string)GetValue(InputUnderlineProperty);
1003 SetValue(InputUnderlineProperty, value);
1004 NotifyPropertyChanged();
1009 /// The Shadow property.
1010 /// The shadow map contains the following keys :<br />
1011 /// <list type="table">
1012 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1013 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1014 /// <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>
1017 /// <since_tizen> 3 </since_tizen>
1018 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1019 public PropertyMap Shadow
1023 return (PropertyMap)GetValue(ShadowProperty);
1027 SetValue(ShadowProperty, value);
1028 NotifyPropertyChanged();
1033 /// Set Shadow to TextEditor. <br />
1035 /// <param name="shadow">The Shadow</param>
1037 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1040 /// The following example demonstrates how to use the SetShadow method.
1042 /// var shadow = new Tizen.NUI.Text.Shadow();
1043 /// shadow.Offset = new Vector2(3, 3);
1044 /// shadow.Color = new Color("#F1C40F");
1045 /// editor.SetShadow(shadow);
1048 [EditorBrowsable(EditorBrowsableState.Never)]
1049 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1051 SetValue(ShadowProperty, TextUtils.GetShadowMap(shadow));
1055 /// Get Shadow from TextEditor. <br />
1057 /// <returns>The Shadow</returns>
1059 /// <see cref="Tizen.NUI.Text.Shadow"/>
1061 [EditorBrowsable(EditorBrowsableState.Never)]
1062 public Tizen.NUI.Text.Shadow GetShadow()
1064 return TextUtils.GetShadowStruct((PropertyMap)GetValue(ShadowProperty));
1068 /// The InputShadow property.
1070 /// <since_tizen> 3 </since_tizen>
1071 public string InputShadow
1075 return (string)GetValue(InputShadowProperty);
1079 SetValue(InputShadowProperty, value);
1080 NotifyPropertyChanged();
1085 /// The Emboss property.
1087 /// <since_tizen> 3 </since_tizen>
1088 public string Emboss
1092 return (string)GetValue(EmbossProperty);
1096 SetValue(EmbossProperty, value);
1097 NotifyPropertyChanged();
1102 /// The InputEmboss property.
1104 /// <since_tizen> 3 </since_tizen>
1105 public string InputEmboss
1109 return (string)GetValue(InputEmbossProperty);
1113 SetValue(InputEmbossProperty, value);
1114 NotifyPropertyChanged();
1119 /// The Outline property.
1120 /// The outline map contains the following keys :<br />
1121 /// <list type="table">
1122 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1123 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1126 /// <since_tizen> 3 </since_tizen>
1127 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1128 public PropertyMap Outline
1132 return (PropertyMap)GetValue(OutlineProperty);
1136 SetValue(OutlineProperty, value);
1137 NotifyPropertyChanged();
1142 /// Set Outline to TextEditor. <br />
1144 /// <param name="outline">The Outline</param>
1146 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1149 /// The following example demonstrates how to use the SetOutline method.
1151 /// var outline = new Tizen.NUI.Text.Outline();
1152 /// outline.Width = 2.0f;
1153 /// outline.Color = new Color("#45B39D");
1154 /// editor.SetOutline(outline);
1157 [EditorBrowsable(EditorBrowsableState.Never)]
1158 public void SetOutline(Outline outline)
1160 SetValue(OutlineProperty, TextUtils.GetOutlineMap(outline));
1164 /// Get Outline from TextEditor. <br />
1166 /// <returns>The Outline</returns>
1168 /// <see cref="Tizen.NUI.Text.Outline"/>
1170 [EditorBrowsable(EditorBrowsableState.Never)]
1171 public Outline GetOutline()
1173 return TextUtils.GetOutlineStruct((PropertyMap)GetValue(OutlineProperty));
1177 /// The InputOutline property.
1179 /// <since_tizen> 3 </since_tizen>
1180 public string InputOutline
1184 return (string)GetValue(InputOutlineProperty);
1188 SetValue(InputOutlineProperty, value);
1189 NotifyPropertyChanged();
1194 /// The SmoothScroll property.
1196 /// <since_tizen> 3 </since_tizen>
1197 public bool SmoothScroll
1201 return (bool)GetValue(SmoothScrollProperty);
1205 SetValue(SmoothScrollProperty, value);
1206 NotifyPropertyChanged();
1211 /// The SmoothScrollDuration property.
1213 /// <since_tizen> 3 </since_tizen>
1214 public float SmoothScrollDuration
1218 return (float)GetValue(SmoothScrollDurationProperty);
1222 SetValue(SmoothScrollDurationProperty, value);
1223 NotifyPropertyChanged();
1228 /// The EnableScrollBar property.
1230 /// <since_tizen> 3 </since_tizen>
1231 public bool EnableScrollBar
1235 return (bool)GetValue(EnableScrollBarProperty);
1239 SetValue(EnableScrollBarProperty, value);
1240 NotifyPropertyChanged();
1245 /// The ScrollBarShowDuration property.
1247 /// <since_tizen> 3 </since_tizen>
1248 public float ScrollBarShowDuration
1252 return (float)GetValue(ScrollBarShowDurationProperty);
1256 SetValue(ScrollBarShowDurationProperty, value);
1257 NotifyPropertyChanged();
1262 /// The ScrollBarFadeDuration property.
1264 /// <since_tizen> 3 </since_tizen>
1265 public float ScrollBarFadeDuration
1269 return (float)GetValue(ScrollBarFadeDurationProperty);
1273 SetValue(ScrollBarFadeDurationProperty, value);
1274 NotifyPropertyChanged();
1279 /// The PixelSize property.
1281 /// <since_tizen> 3 </since_tizen>
1282 public float PixelSize
1286 return (float)GetValue(PixelSizeProperty);
1290 SetValue(PixelSizeProperty, value);
1291 NotifyPropertyChanged();
1296 /// The line count of the text.
1298 /// <since_tizen> 3 </since_tizen>
1299 public int LineCount
1304 GetProperty(TextEditor.Property.LineCount).Get(out temp);
1310 /// The text to display when the TextEditor is empty and inactive.
1312 /// <since_tizen> 3 </since_tizen>
1313 public string PlaceholderText
1317 return (string)GetValue(PlaceholderTextProperty);
1321 SetValue(PlaceholderTextProperty, value);
1322 NotifyPropertyChanged();
1327 /// The Selected Text property (read-only).
1329 [EditorBrowsable(EditorBrowsableState.Never)]
1330 public string SelectedText
1335 GetProperty(TextEditor.Property.SelectedText).Get(out temp);
1341 /// The Placeholder text color.
1344 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1346 /// <since_tizen> 3 </since_tizen>
1347 public Color PlaceholderTextColor
1351 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1352 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1356 SetValue(PlaceholderTextColorProperty, value);
1357 NotifyPropertyChanged();
1362 /// The EnableSelection property.
1364 /// <since_tizen> 3 </since_tizen>
1365 public bool EnableSelection
1369 return (bool)GetValue(EnableSelectionProperty);
1373 SetValue(EnableSelectionProperty, value);
1374 NotifyPropertyChanged();
1379 /// The start index for selection.
1381 /// <since_tizen> 8 </since_tizen>
1382 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1383 [EditorBrowsable(EditorBrowsableState.Never)]
1384 public int SelectedTextStart
1389 GetProperty(TextEditor.Property.SelectedTextStart).Get(out temp);
1395 /// The end index for selection.
1397 /// <since_tizen> 8 </since_tizen>
1398 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1399 [EditorBrowsable(EditorBrowsableState.Never)]
1400 public int SelectedTextEnd
1405 GetProperty(TextEditor.Property.SelectedTextEnd).Get(out temp);
1411 /// Enable editing in text control.
1413 /// <since_tizen> 8 </since_tizen>
1414 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1415 [EditorBrowsable(EditorBrowsableState.Never)]
1416 public bool EnableEditing
1421 GetProperty(TextEditor.Property.EnableEditing).Get(out temp);
1426 SetProperty(TextEditor.Property.EnableEditing, new PropertyValue(value));
1427 NotifyPropertyChanged();
1432 /// Specify horizontal scroll position in text control.
1434 [EditorBrowsable(EditorBrowsableState.Never)]
1435 public int HorizontalScrollPosition
1440 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1442 propertyValue.Get(out temp);
1448 using (PropertyValue propertyValue = new PropertyValue(value))
1450 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1451 NotifyPropertyChanged();
1457 /// Specify vertical scroll position in text control.
1459 [EditorBrowsable(EditorBrowsableState.Never)]
1460 public int VerticalScrollPosition
1465 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1467 propertyValue.Get(out temp);
1473 using (PropertyValue propertyValue = new PropertyValue(value))
1475 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1476 NotifyPropertyChanged();
1482 /// Specify primary cursor (caret) position in text control.
1484 [EditorBrowsable(EditorBrowsableState.Never)]
1485 public int PrimaryCursorPosition
1490 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1492 propertyValue.Get(out temp);
1498 using (PropertyValue propertyValue = new PropertyValue(value))
1500 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1501 NotifyPropertyChanged();
1507 /// The GrabHandleColor property.
1510 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1512 [EditorBrowsable(EditorBrowsableState.Never)]
1513 public Color GrabHandleColor
1517 Color temp = (Color)GetValue(GrabHandleColorProperty);
1518 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1522 SetValue(GrabHandleColorProperty, value);
1523 NotifyPropertyChanged();
1528 /// Set InputFilter to TextEditor. <br />
1530 /// <param name="inputFilter">The InputFilter</param>
1532 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1533 /// Users can set the Accepted or Rejected regular expression set, or both. <br />
1534 /// If both are used, Rejected has higher priority. <br />
1535 /// The character set must follow the regular expression rules. <br />
1536 /// Behaviour can not be guaranteed for incorrect grammars. <br />
1537 /// Refer the link below for detailed rules. <br />
1538 /// The functions in std::regex library use the ECMAScript grammar: <br />
1539 /// http://cplusplus.com/reference/regex/ECMAScript/ <br />
1540 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1541 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description. <br />
1544 /// The following example demonstrates how to use the SetInputFilter method.
1546 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1547 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1548 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1549 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1552 [EditorBrowsable(EditorBrowsableState.Never)]
1553 public void SetInputFilter(InputFilter inputFilter)
1555 SetProperty(TextEditor.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter)));
1559 /// Get InputFilter from TextEditor. <br />
1561 /// <returns>The InputFilter</returns>
1563 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1565 [EditorBrowsable(EditorBrowsableState.Never)]
1566 public InputFilter GetInputFilter()
1568 var map = new PropertyMap();
1569 GetProperty(TextEditor.Property.InputFilter).Get(map);
1570 return TextUtils.GetInputFilterStruct(map);
1574 /// The Placeholder property.
1575 /// The placeholder map contains the following keys :<br />
1576 /// <list type="table">
1577 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1578 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1579 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1580 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1581 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1582 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1583 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1584 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1588 /// The following example demonstrates how to set the placeholder property.
1590 /// PropertyMap propertyMap = new PropertyMap();
1591 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1592 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1593 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1594 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1595 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1597 /// PropertyMap fontStyleMap = new PropertyMap();
1598 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1599 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1600 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1601 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1603 /// TextEditor editor = new TextEditor();
1604 /// editor.Placeholder = propertyMap;
1607 /// <since_tizen> 3 </since_tizen>
1608 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1609 public Tizen.NUI.PropertyMap Placeholder
1613 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1614 PropertyValue value = null;
1617 value = map.Find(0);
1620 value.Get(out string text);
1621 map.Add("text", new PropertyValue(text));
1625 value = map.Find(1);
1628 value.Get(out string textFocused);
1629 map.Add("textFocused", new PropertyValue(textFocused));
1633 value = map.Find(2);
1636 Color color = new Color();
1638 map.Add("color", new PropertyValue(color));
1642 value = map.Find(3);
1645 value.Get(out string fontFamily);
1646 map.Add("fontFamily", new PropertyValue(fontFamily));
1650 value = map.Find(4);
1653 PropertyMap fontStyle = new PropertyMap();
1654 value.Get(fontStyle);
1655 map.Add("fontStyle", new PropertyValue(fontStyle));
1659 value = map.Find(5);
1662 value.Get(out float pointSize);
1663 map.Add("pointSize", new PropertyValue(pointSize));
1667 value = map.Find(6);
1670 value.Get(out float pixelSize);
1671 map.Add("pixelSize", new PropertyValue(pixelSize));
1675 value = map.Find(7);
1678 value.Get(out bool ellipsis);
1679 map.Add("ellipsis", new PropertyValue(ellipsis));
1686 SetValue(PlaceholderProperty, value);
1687 NotifyPropertyChanged();
1692 /// Set Placeholder to TextEditor. <br />
1694 /// <param name="placeholder">The Placeholder</param>
1696 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
1699 /// The following example demonstrates how to use the SetPlaceholder method.
1701 /// var placeholder = new Tizen.NUI.Text.Placeholder();
1702 /// placeholder.Text = "placeholder text";
1703 /// placeholder.TextFocused = "placeholder textFocused";
1704 /// placeholder.Color = new Color("#45B39D");
1705 /// placeholder.FontFamily = "BreezeSans";
1706 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
1708 /// Width = FontWidthType.Expanded,
1709 /// Weight = FontWeightType.ExtraLight,
1710 /// Slant = FontSlantType.Italic,
1712 /// placeholder.PointSize = 25.0f;
1713 /// //placeholder.PixelSize = 50.0f;
1714 /// placeholder.Ellipsis = true;
1715 /// editor.SetPlaceholder(placeholder);
1718 [EditorBrowsable(EditorBrowsableState.Never)]
1719 public void SetPlaceholder(Placeholder placeholder)
1721 SetValue(PlaceholderProperty, TextUtils.GetPlaceholderMap(placeholder));
1725 /// Get Placeholder from TextEditor. <br />
1727 /// <returns>The Placeholder</returns>
1729 /// <see cref="Tizen.NUI.Text.Placeholder"/>
1731 [EditorBrowsable(EditorBrowsableState.Never)]
1732 public Placeholder GetPlaceholder()
1734 return TextUtils.GetPlaceholderStruct((PropertyMap)GetValue(PlaceholderProperty));
1738 /// The Ellipsis property.<br />
1739 /// Enable or disable the ellipsis.<br />
1741 [EditorBrowsable(EditorBrowsableState.Never)]
1742 public bool Ellipsis
1746 return (bool)GetValue(EllipsisProperty);
1750 SetValue(EllipsisProperty, value);
1751 NotifyPropertyChanged();
1757 /// The ellipsis position of the text.
1758 /// The ellipsis position type when the text size over the layout size.<br />
1759 /// The ellipsis position: End, Start or Middle.<br />
1761 [EditorBrowsable(EditorBrowsableState.Never)]
1762 public EllipsisPosition EllipsisPosition
1766 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
1770 SetValue(EllipsisPositionProperty, value);
1771 NotifyPropertyChanged();
1776 /// The LineWrapMode property.<br />
1777 /// The line wrap mode when the text lines over the layout width.<br />
1779 /// <since_tizen> 4 </since_tizen>
1780 public LineWrapMode LineWrapMode
1784 return (LineWrapMode)GetValue(LineWrapModeProperty);
1788 SetValue(LineWrapModeProperty, value);
1789 NotifyPropertyChanged();
1794 /// Enables Text selection using Shift key.
1796 /// <since_tizen> 5 </since_tizen>
1797 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1798 [EditorBrowsable(EditorBrowsableState.Never)]
1799 public bool EnableShiftSelection
1803 return (bool)GetValue(EnableShiftSelectionProperty);
1807 SetValue(EnableShiftSelectionProperty, value);
1808 NotifyPropertyChanged();
1813 /// The text alignment to match the direction of the system language.
1815 /// <since_tizen> 6 </since_tizen>
1816 public bool MatchSystemLanguageDirection
1820 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1824 SetValue(MatchSystemLanguageDirectionProperty, value);
1825 NotifyPropertyChanged();
1830 /// The MaxLength property.
1832 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1833 [EditorBrowsable(EditorBrowsableState.Never)]
1834 public int MaxLength
1838 return (int)GetValue(MaxLengthProperty);
1842 SetValue(MaxLengthProperty, value);
1843 NotifyPropertyChanged();
1847 /// Only used by the IL of xaml, will never changed to not hidden.
1848 [EditorBrowsable(EditorBrowsableState.Never)]
1849 public override bool IsCreateByXaml
1853 return base.IsCreateByXaml;
1857 base.IsCreateByXaml = value;
1861 this.TextChanged += (obj, e) =>
1863 this.Text = e.TextEditor.Text;
1870 /// The FontSizeScale property. <br />
1871 /// The default value is 1.0. <br />
1872 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1874 /// <since_tizen> 9 </since_tizen>
1875 public float FontSizeScale
1879 return fontSizeScale;
1883 float newFontSizeScale;
1885 if (fontSizeScale == value) return;
1887 fontSizeScale = value;
1888 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1890 SystemSettingsFontSize systemSettingsFontSize;
1894 systemSettingsFontSize = SystemSettings.FontSize;
1898 Console.WriteLine("{0} Exception caught.", e);
1899 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1901 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1902 addFontSizeChangedCallback();
1906 newFontSizeScale = fontSizeScale;
1907 removeFontSizeChangedCallback();
1910 SetValue(FontSizeScaleProperty, newFontSizeScale);
1911 NotifyPropertyChanged();
1916 /// The InputMethodSettings property.
1919 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
1922 /// The following example demonstrates how to set the InputMethodSettings property.
1924 /// InputMethod method = new InputMethod();
1925 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
1926 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
1927 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
1928 /// method.Variation = 1;
1929 /// textEditor.InputMethodSettings = method.OutputMap;
1932 [EditorBrowsable(EditorBrowsableState.Never)]
1933 public PropertyMap InputMethodSettings
1937 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1941 SetValue(InputMethodSettingsProperty, value);
1942 NotifyPropertyChanged();
1947 /// Scroll the text control by specific amount..
1949 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
1950 [EditorBrowsable(EditorBrowsableState.Never)]
1951 public void ScrollBy(Vector2 scroll)
1953 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
1954 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1958 /// Get the InputMethodContext instance.
1960 /// <returns>The InputMethodContext instance.</returns>
1961 /// <since_tizen> 5 </since_tizen>
1962 public InputMethodContext GetInputMethodContext()
1964 if (inputMethodContext == null)
1966 /*Avoid raising InputMethodContext reference count.*/
1967 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
1968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1970 return inputMethodContext;
1974 /// Select the whole text.
1976 [EditorBrowsable(EditorBrowsableState.Never)]
1977 public void SelectWholeText()
1979 Interop.TextEditor.SelectWholeText(SwigCPtr);
1980 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1984 /// Select text from start to end index. <br />
1985 /// The index is valid when 0 or positive. <br />
1987 /// <param name="start">The start index for selection.</param>
1988 /// <param name="end">The end index for selection.</param>
1989 [EditorBrowsable(EditorBrowsableState.Never)]
1990 public void SelectText(int start, int end)
1993 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
1995 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
1997 Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
1998 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2002 /// Clear selection of the text.
2004 [EditorBrowsable(EditorBrowsableState.Never)]
2005 public void SelectNone()
2007 _ = Interop.TextEditor.SelectNone(SwigCPtr);
2008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2012 /// Enable grab handle property.
2014 [EditorBrowsable(EditorBrowsableState.Never)]
2015 public bool EnableGrabHandle
2019 return (bool)GetValue(EnableGrabHandleProperty);
2023 SetValue(EnableGrabHandleProperty, value);
2024 NotifyPropertyChanged();
2029 /// Enable grab handle popup property.
2031 [EditorBrowsable(EditorBrowsableState.Never)]
2032 public bool EnableGrabHandlePopup
2036 return (bool)GetValue(EnableGrabHandlePopupProperty);
2040 SetValue(EnableGrabHandlePopupProperty, value);
2041 NotifyPropertyChanged();
2046 /// Minimum line size to be used.
2048 [EditorBrowsable(EditorBrowsableState.Never)]
2049 public float MinLineSize
2053 return (float)GetValue(MinLineSizeProperty);
2057 SetValue(MinLineSizeProperty, value);
2058 NotifyPropertyChanged();
2062 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2064 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));
2065 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2072 /// <since_tizen> 3 </since_tizen>
2073 protected override void Dispose(DisposeTypes type)
2080 if (systemlangTextFlag)
2082 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2085 removeFontSizeChangedCallback();
2087 //Release your own unmanaged resources here.
2088 //You should not access any managed member here except static instance.
2089 //because the execution order of Finalizes is non-deterministic.
2093 if (textEditorTextChangedCallbackDelegate != null)
2095 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2098 if (textEditorMaxLengthReachedCallbackDelegate != null)
2100 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2103 if (textEditorSelectionClearedCallbackDelegate != null)
2105 this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2108 if (textEditorCursorPositionChangedCallbackDelegate != null)
2110 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2113 if (textEditorSelectionChangedCallbackDelegate != null)
2115 this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2122 /// This will not be public opened.
2123 [EditorBrowsable(EditorBrowsableState.Never)]
2124 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2126 // In order to speed up IME hide, temporarily add
2127 GetInputMethodContext()?.DestroyContext();
2128 Interop.TextEditor.DeleteTextEditor(swigCPtr);
2131 private string SetTranslatable(string textEditorSid)
2133 string translatableText = null;
2134 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2135 if (translatableText != null)
2137 if (systemlangTextFlag == false)
2139 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2140 systemlangTextFlag = true;
2142 return translatableText;
2146 translatableText = "";
2147 return translatableText;
2151 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2153 if (textEditorTextSid != null)
2155 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2157 if (textEditorPlaceHolderTextSid != null)
2159 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2163 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2165 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2166 SetValue(FontSizeScaleProperty, newFontSizeScale);
2167 NotifyPropertyChanged();
2170 private void addFontSizeChangedCallback()
2172 if (hasFontSizeChangedCallback != true)
2176 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2177 hasFontSizeChangedCallback = true;
2181 Console.WriteLine("{0} Exception caught.", e);
2182 hasFontSizeChangedCallback = false;
2187 private void removeFontSizeChangedCallback()
2189 if (hasFontSizeChangedCallback == true)
2193 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2194 hasFontSizeChangedCallback = false;
2198 Console.WriteLine("{0} Exception caught.", e);
2199 hasFontSizeChangedCallback = true;
2204 internal new class Property
2206 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2207 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2208 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2209 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2210 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2211 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2212 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2213 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2214 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2215 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2216 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2217 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2218 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2219 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2220 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2221 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2222 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2223 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2224 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2225 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2226 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2227 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2228 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2229 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2230 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2231 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2232 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2233 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2234 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2235 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2236 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2237 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2238 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2239 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2240 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2241 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2242 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2243 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2244 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2245 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2246 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2247 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2248 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2249 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2250 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2251 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2252 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2253 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2254 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2255 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2256 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2257 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2258 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2259 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2260 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2261 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2262 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2263 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2264 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2265 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2266 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2267 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2268 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2269 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2270 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2271 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2272 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2273 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2274 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2275 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2278 internal class InputStyle
2284 FontFamily = 0x0002,
2287 LineSpacing = 0x0010,
2295 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2297 DecorationBoundingBox = new Rectangle(x, y, width, height);
2299 private void OnInputColorChanged(float x, float y, float z, float w)
2301 InputColor = new Vector4(x, y, z, w);
2303 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2305 PlaceholderTextColor = new Color(r, g, b, a);
2307 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2309 PrimaryCursorColor = new Vector4(x, y, z, w);
2311 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2313 SecondaryCursorColor = new Vector4(x, y, z, w);
2315 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2317 SelectionHighlightColor = new Vector4(x, y, z, w);
2319 private void OnTextColorChanged(float x, float y, float z, float w)
2321 TextColor = new Vector4(x, y, z, w);
2323 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2325 GrabHandleColor = new Color(r, g, b, a);