2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
22 using System.Globalization;
23 using System.ComponentModel;
25 using Tizen.NUI.Binding;
27 namespace Tizen.NUI.BaseComponents
30 /// A control which provides a multi-line editable text editor.
32 /// <since_tizen> 3 </since_tizen>
33 public partial class TextEditor : View
35 private string textEditorTextSid = null;
36 private string textEditorPlaceHolderTextSid = null;
37 private bool systemlangTextFlag = false;
38 private InputMethodContext inputMethodContext = null;
39 private float fontSizeScale = 1.0f;
40 private bool hasFontSizeChangedCallback = false;
41 private bool isSettingTextInCSharp = false;
42 static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextEditor";
44 #if NUI_PROPERTY_CHANGE_2
45 private Color internalPlaceholderTextColor = null;
46 private Vector4 internalPrimaryCursorColor = null;
47 private Vector4 internalSecondaryCursorColor = null;
48 private Vector4 internalSelectionHighlightColor = null;
49 private Vector4 internalInputColor = null;
50 private Vector4 internalTextColor = null;
51 private Color internalGrabHandleColor = null;
55 static TextEditor() { }
58 /// Creates the TextEditor control.
60 /// <since_tizen> 3 </since_tizen>
61 public TextEditor() : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
63 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// Creates the TextEditor with specified style.
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public TextEditor(TextEditorStyle style) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, style: style)
75 /// Creates the TextEditor with setting the status of shown or hidden.
77 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
78 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public TextEditor(bool shown) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
88 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
98 TextChanged += TextEditorTextChanged;
102 /// The TranslatableText property.<br />
103 /// The text can set the SID value.<br />
105 /// <exception cref='ArgumentNullException'>
106 /// ResourceManager about multilingual is null.
108 /// <since_tizen> 4 </since_tizen>
109 public string TranslatableText
113 return GetValue(TranslatableTextProperty) as string;
117 SetValue(TranslatableTextProperty, value);
121 private string InternalTranslatableText
125 return textEditorTextSid;
129 if (NUIApplication.MultilingualResourceManager == null)
131 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
133 textEditorTextSid = value;
134 Text = SetTranslatable(textEditorTextSid);
135 NotifyPropertyChanged();
139 /// The TranslatablePlaceholderText property.<br />
140 /// The text can set the SID value.<br />
142 /// <exception cref='ArgumentNullException'>
143 /// ResourceManager about multilingual is null.
145 /// <since_tizen> 4 </since_tizen>
146 public string TranslatablePlaceholderText
150 return GetValue(TranslatablePlaceholderTextProperty) as string;
154 SetValue(TranslatablePlaceholderTextProperty, value);
158 private string InternalTranslatablePlaceholderText
162 return textEditorPlaceHolderTextSid;
166 if (NUIApplication.MultilingualResourceManager == null)
168 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
170 textEditorPlaceHolderTextSid = value;
171 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
172 NotifyPropertyChanged();
177 /// The Text property.<br />
178 /// The text to display in the UTF-8 format.<br />
180 /// <since_tizen> 3 </since_tizen>
185 return (string)GetValue(TextProperty);
189 SetValue(TextProperty, value);
190 NotifyPropertyChanged();
195 /// The TextColor property.<br />
196 /// The color of the text.<br />
199 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
201 /// <since_tizen> 3 </since_tizen>
202 public Vector4 TextColor
206 Vector4 temp = (Vector4)GetValue(TextColorProperty);
207 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
211 SetValue(TextColorProperty, value);
212 NotifyPropertyChanged();
217 /// The FontFamily property.<br />
218 /// The requested font family to use.<br />
220 /// <since_tizen> 3 </since_tizen>
221 public string FontFamily
225 return (string)GetValue(FontFamilyProperty);
229 SetValue(FontFamilyProperty, value);
230 NotifyPropertyChanged();
235 /// The FontStyle property.<br />
236 /// The requested font style to use.<br />
237 /// The fontStyle map contains the following keys :<br />
238 /// <list type="table">
239 /// <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>
240 /// <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>
241 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
244 /// <since_tizen> 3 </since_tizen>
245 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
246 public PropertyMap FontStyle
250 return (PropertyMap)GetValue(FontStyleProperty);
254 SetValue(FontStyleProperty, value);
255 NotifyPropertyChanged();
260 /// Set FontStyle to TextEditor. <br />
262 /// <param name="fontStyle">The FontStyle</param>
264 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
267 /// The following example demonstrates how to use the SetFontStyle method.
269 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
270 /// fontStyle.Width = FontWidthType.Expanded;
271 /// fontStyle.Weight = FontWeightType.Bold;
272 /// fontStyle.Slant = FontSlantType.Italic;
273 /// editor.SetFontStyle(fontStyle);
276 [EditorBrowsable(EditorBrowsableState.Never)]
277 public void SetFontStyle(FontStyle fontStyle)
279 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
281 SetValue(FontStyleProperty, fontStyleMap);
286 /// Get FontStyle from TextEditor. <br />
288 /// <returns>The FontStyle</returns>
290 /// <see cref="Tizen.NUI.Text.FontStyle"/>
292 [EditorBrowsable(EditorBrowsableState.Never)]
293 public FontStyle GetFontStyle()
296 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
298 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
304 /// The PointSize property.<br />
305 /// The size of font in points.<br />
307 /// <since_tizen> 3 </since_tizen>
308 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
309 public float PointSize
313 return (float)GetValue(PointSizeProperty);
317 SetValue(PointSizeProperty, value);
318 NotifyPropertyChanged();
323 /// The HorizontalAlignment property.<br />
324 /// The line horizontal alignment.<br />
326 /// <since_tizen> 3 </since_tizen>
327 public HorizontalAlignment HorizontalAlignment
331 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
335 SetValue(HorizontalAlignmentProperty, value);
336 NotifyPropertyChanged();
341 /// The VerticalAlignment property.<br />
342 /// The line vertical alignment.
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public VerticalAlignment VerticalAlignment
349 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
353 SetValue(VerticalAlignmentProperty, value);
354 NotifyPropertyChanged();
359 /// The ScrollThreshold property.<br />
360 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
362 /// <since_tizen> 3 </since_tizen>
363 public float ScrollThreshold
367 return (float)GetValue(ScrollThresholdProperty);
371 SetValue(ScrollThresholdProperty, value);
372 NotifyPropertyChanged();
377 /// The ScrollSpeed property.<br />
378 /// The scroll speed in pixels per second.<br />
380 /// <since_tizen> 3 </since_tizen>
381 public float ScrollSpeed
385 return (float)GetValue(ScrollSpeedProperty);
389 SetValue(ScrollSpeedProperty, value);
390 NotifyPropertyChanged();
395 /// The PrimaryCursorColor property.<br />
396 /// The color to apply to the primary cursor.<br />
399 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
401 /// <since_tizen> 3 </since_tizen>
402 public Vector4 PrimaryCursorColor
406 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
407 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
411 SetValue(PrimaryCursorColorProperty, value);
412 NotifyPropertyChanged();
417 /// The SecondaryCursorColor property.<br />
418 /// The color to apply to the secondary cursor.<br />
421 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
423 /// <since_tizen> 3 </since_tizen>
424 public Vector4 SecondaryCursorColor
428 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
429 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
433 SetValue(SecondaryCursorColorProperty, value);
434 NotifyPropertyChanged();
439 /// The EnableCursorBlink property.<br />
440 /// Whether the cursor should blink or not.<br />
442 /// <since_tizen> 3 </since_tizen>
443 public bool EnableCursorBlink
447 return (bool)GetValue(EnableCursorBlinkProperty);
451 SetValue(EnableCursorBlinkProperty, value);
452 NotifyPropertyChanged();
457 /// The CursorBlinkInterval property.<br />
458 /// The time interval in seconds between cursor on/off states.<br />
460 /// <since_tizen> 3 </since_tizen>
461 public float CursorBlinkInterval
465 return (float)GetValue(CursorBlinkIntervalProperty);
469 SetValue(CursorBlinkIntervalProperty, value);
470 NotifyPropertyChanged();
475 /// The CursorBlinkDuration property.<br />
476 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
478 /// <since_tizen> 3 </since_tizen>
479 public float CursorBlinkDuration
483 return (float)GetValue(CursorBlinkDurationProperty);
487 SetValue(CursorBlinkDurationProperty, value);
488 NotifyPropertyChanged();
493 /// The CursorWidth property.
495 /// <since_tizen> 3 </since_tizen>
496 public int CursorWidth
500 return (int)GetValue(CursorWidthProperty);
504 SetValue(CursorWidthProperty, value);
505 NotifyPropertyChanged();
510 /// The GrabHandleImage property.<br />
511 /// The image to display for the grab handle.<br />
513 /// <since_tizen> 3 </since_tizen>
514 public string GrabHandleImage
518 return (string)GetValue(GrabHandleImageProperty);
522 SetValue(GrabHandleImageProperty, value);
523 NotifyPropertyChanged();
528 /// The GrabHandlePressedImage property.<br />
529 /// The image to display when the grab handle is pressed.<br />
531 /// <since_tizen> 3 </since_tizen>
532 public string GrabHandlePressedImage
536 return (string)GetValue(GrabHandlePressedImageProperty);
540 SetValue(GrabHandlePressedImageProperty, value);
541 NotifyPropertyChanged();
546 /// The SelectionPopupStyle property.<br />
547 /// The style of the text selection popup can be set through SelectionPopupStyle property.
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 public PropertyMap SelectionPopupStyle
554 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
558 SetValue(SelectionPopupStyleProperty, value);
559 NotifyPropertyChanged();
564 /// The SelectionHandleImageLeft property.<br />
565 /// The image to display for the left selection handle.<br />
566 /// The selectionHandleImageLeft map contains the following key :<br />
567 /// <list type="table">
568 /// <item><term>filename (string)</term><description>The path of image file</description></item>
571 /// <since_tizen> 3 </since_tizen>
572 public PropertyMap SelectionHandleImageLeft
576 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
580 SetValue(SelectionHandleImageLeftProperty, value);
581 NotifyPropertyChanged();
586 /// The SelectionHandleImageRight property.<br />
587 /// The image to display for the right selection handle.<br />
588 /// The selectionHandleImageRight map contains the following key :<br />
589 /// <list type="table">
590 /// <item><term>filename (string)</term><description>The path of image file</description></item>
593 /// <since_tizen> 3 </since_tizen>
594 public PropertyMap SelectionHandleImageRight
598 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
602 SetValue(SelectionHandleImageRightProperty, value);
603 NotifyPropertyChanged();
608 /// Set SelectionHandleImage to TextEditor. <br />
610 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
612 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
615 /// The following example demonstrates how to use the SetSelectionHandleImage method.
617 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
618 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
619 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
620 /// editor.SetSelectionHandleImage(selectionHandleImage);
623 [EditorBrowsable(EditorBrowsableState.Never)]
624 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
626 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
628 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
630 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
634 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
636 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
638 SetValue(SelectionHandleImageRightProperty, rightImageMap);
644 /// Get SelectionHandleImage from TextEditor. <br />
646 /// <returns>The SelectionHandleImage</returns>
648 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
650 [EditorBrowsable(EditorBrowsableState.Never)]
651 public SelectionHandleImage GetSelectionHandleImage()
653 SelectionHandleImage selectionHandleImage;
654 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
655 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
657 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
659 return selectionHandleImage;
663 /// The SelectionHandlePressedImageLeft property.<br />
664 /// The image to display when the left selection handle is pressed.<br />
665 /// The selectionHandlePressedImageLeft map contains the following key :<br />
666 /// <list type="table">
667 /// <item><term>filename (string)</term><description>The path of image file</description></item>
670 /// <since_tizen> 3 </since_tizen>
671 public PropertyMap SelectionHandlePressedImageLeft
675 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
679 SetValue(SelectionHandlePressedImageLeftProperty, value);
680 NotifyPropertyChanged();
685 /// The SelectionHandlePressedImageRight property.<br />
686 /// The image to display when the right selection handle is pressed.<br />
687 /// The selectionHandlePressedImageRight map contains the following key :<br />
688 /// <list type="table">
689 /// <item><term>filename (string)</term><description>The path of image file</description></item>
692 /// <since_tizen> 3 </since_tizen>
693 public PropertyMap SelectionHandlePressedImageRight
697 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
701 SetValue(SelectionHandlePressedImageRightProperty, value);
702 NotifyPropertyChanged();
707 /// Set SelectionHandlePressedImage to TextEditor. <br />
709 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
711 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
714 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
716 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
717 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
718 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
719 /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
722 [EditorBrowsable(EditorBrowsableState.Never)]
723 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
725 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
727 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
729 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
733 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
735 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
737 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
743 /// Get SelectionHandlePressedImage from TextEditor. <br />
745 /// <returns>The SelectionHandlePressedImage</returns>
747 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
749 [EditorBrowsable(EditorBrowsableState.Never)]
750 public SelectionHandleImage GetSelectionHandlePressedImage()
752 SelectionHandleImage selectionHandleImage;
753 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
754 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
756 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
758 return selectionHandleImage;
762 /// The SelectionHandleMarkerImageLeft property.<br />
763 /// The image to display for the left selection handle marker.<br />
764 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
765 /// <list type="table">
766 /// <item><term>filename (string)</term><description>The path of image file</description></item>
769 /// <since_tizen> 3 </since_tizen>
770 public PropertyMap SelectionHandleMarkerImageLeft
774 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
778 SetValue(SelectionHandleMarkerImageLeftProperty, value);
779 NotifyPropertyChanged();
784 /// The SelectionHandleMarkerImageRight property.<br />
785 /// The image to display for the right selection handle marker.<br />
786 /// The selectionHandleMarkerImageRight map contains the following key :<br />
787 /// <list type="table">
788 /// <item><term>filename (string)</term><description>The path of image file</description></item>
791 /// <since_tizen> 3 </since_tizen>
792 public PropertyMap SelectionHandleMarkerImageRight
796 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
800 SetValue(SelectionHandleMarkerImageRightProperty, value);
801 NotifyPropertyChanged();
806 /// Set SelectionHandleMarkerImage to TextEditor. <br />
808 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
810 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
813 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
815 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
816 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
817 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
818 /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
821 [EditorBrowsable(EditorBrowsableState.Never)]
822 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
824 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
826 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
828 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
832 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
834 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
836 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
842 /// Get SelectionHandleMarkerImage from TextEditor. <br />
844 /// <returns>The SelectionHandleMarkerImage</returns>
846 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
848 [EditorBrowsable(EditorBrowsableState.Never)]
849 public SelectionHandleImage GetSelectionHandleMarkerImage()
851 SelectionHandleImage selectionHandleImage;
852 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
853 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
855 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
857 return selectionHandleImage;
861 /// The SelectionHighlightColor property.<br />
862 /// The color of the selection highlight.<br />
865 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
867 /// <since_tizen> 3 </since_tizen>
868 public Vector4 SelectionHighlightColor
872 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
873 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
877 SetValue(SelectionHighlightColorProperty, value);
878 NotifyPropertyChanged();
883 /// The DecorationBoundingBox property.<br />
884 /// The decorations (handles etc) will positioned within this area on-screen.<br />
887 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
889 /// <since_tizen> 3 </since_tizen>
890 public Rectangle DecorationBoundingBox
894 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
895 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
899 SetValue(DecorationBoundingBoxProperty, value);
900 NotifyPropertyChanged();
905 /// The EnableMarkup property.<br />
906 /// Whether the mark-up processing is enabled.<br />
908 /// <since_tizen> 3 </since_tizen>
909 public bool EnableMarkup
913 return (bool)GetValue(EnableMarkupProperty);
917 SetValue(EnableMarkupProperty, value);
918 NotifyPropertyChanged();
923 /// The InputColor property.<br />
924 /// The color of the new input text.<br />
927 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
929 /// <since_tizen> 3 </since_tizen>
930 public Vector4 InputColor
934 Vector4 temp = (Vector4)GetValue(InputColorProperty);
935 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
939 SetValue(InputColorProperty, value);
940 NotifyPropertyChanged();
945 /// The InputFontFamily property.<br />
946 /// The font's family of the new input text.<br />
948 /// <since_tizen> 3 </since_tizen>
949 public string InputFontFamily
953 return (string)GetValue(InputFontFamilyProperty);
957 SetValue(InputFontFamilyProperty, value);
958 NotifyPropertyChanged();
963 /// The InputFontStyle property.<br />
964 /// The font's style of the new input text.<br />
965 /// The inputFontStyle map contains the following keys :<br />
966 /// <list type="table">
967 /// <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>
968 /// <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>
969 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
972 /// <since_tizen> 3 </since_tizen>
973 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
974 public PropertyMap InputFontStyle
978 return (PropertyMap)GetValue(InputFontStyleProperty);
982 SetValue(InputFontStyleProperty, value);
983 NotifyPropertyChanged();
988 /// Set InputFontStyle to TextEditor. <br />
990 /// <param name="fontStyle">The FontStyle</param>
992 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
995 /// The following example demonstrates how to use the SetInputFontStyle method.
997 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
998 /// fontStyle.Width = FontWidthType.Expanded;
999 /// fontStyle.Weight = FontWeightType.Bold;
1000 /// fontStyle.Slant = FontSlantType.Italic;
1001 /// editor.SetInputFontStyle(fontStyle);
1004 [EditorBrowsable(EditorBrowsableState.Never)]
1005 public void SetInputFontStyle(FontStyle fontStyle)
1007 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1009 SetValue(InputFontStyleProperty, fontStyleMap);
1014 /// Get InputFontStyle from TextEditor. <br />
1016 /// <returns>The FontStyle</returns>
1018 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1020 [EditorBrowsable(EditorBrowsableState.Never)]
1021 public FontStyle GetInputFontStyle()
1023 FontStyle fontStyle;
1024 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1026 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1032 /// The InputPointSize property.<br />
1033 /// The font's size of the new input text in points.<br />
1035 /// <since_tizen> 3 </since_tizen>
1036 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1037 public float InputPointSize
1041 return (float)GetValue(InputPointSizeProperty);
1045 SetValue(InputPointSizeProperty, value);
1046 NotifyPropertyChanged();
1051 /// The LineSpacing property.<br />
1052 /// The default extra space between lines in points.<br />
1054 /// <since_tizen> 3 </since_tizen>
1055 public float LineSpacing
1059 return (float)GetValue(LineSpacingProperty);
1063 SetValue(LineSpacingProperty, value);
1064 NotifyPropertyChanged();
1069 /// The InputLineSpacing property.<br />
1070 /// The extra space between lines in points.<br />
1072 /// <since_tizen> 3 </since_tizen>
1073 public float InputLineSpacing
1077 return (float)GetValue(InputLineSpacingProperty);
1081 SetValue(InputLineSpacingProperty, value);
1082 NotifyPropertyChanged();
1087 /// The relative height of the line (a factor that will be multiplied by text height). <br />
1088 /// If the value is less than 1, the lines could to be overlapped.
1090 [EditorBrowsable(EditorBrowsableState.Never)]
1091 public float RelativeLineHeight
1095 return (float)GetValue(RelativeLineHeightProperty);
1099 SetValue(RelativeLineHeightProperty, value);
1100 NotifyPropertyChanged();
1105 /// The Underline property.<br />
1106 /// The default underline parameters.<br />
1107 /// The underline map contains the following keys :<br />
1108 /// <list type="table">
1109 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1110 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1111 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1114 /// <since_tizen> 3 </since_tizen>
1115 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1116 public PropertyMap Underline
1120 return (PropertyMap)GetValue(UnderlineProperty);
1124 SetValue(UnderlineProperty, value);
1125 NotifyPropertyChanged();
1130 /// Set Underline to TextEditor. <br />
1132 /// <param name="underline">The Underline</param>
1134 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1137 /// The following example demonstrates how to use the SetUnderline method.
1139 /// var underline = new Tizen.NUI.Text.Underline();
1140 /// underline.Enable = true;
1141 /// underline.Color = new Color("#3498DB");
1142 /// underline.Height = 2.0f;
1143 /// editor.SetUnderline(underline);
1146 [EditorBrowsable(EditorBrowsableState.Never)]
1147 public void SetUnderline(Underline underline)
1149 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1151 SetValue(UnderlineProperty, underlineMap);
1156 /// Get Underline from TextEditor. <br />
1158 /// <returns>The Underline</returns>
1160 /// <see cref="Tizen.NUI.Text.Underline"/>
1162 [EditorBrowsable(EditorBrowsableState.Never)]
1163 public Underline GetUnderline()
1165 Underline underline;
1166 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1168 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1174 /// The InputUnderline property.<br />
1175 /// The underline parameters of the new input text.<br />
1177 /// <since_tizen> 3 </since_tizen>
1178 public string InputUnderline
1182 return (string)GetValue(InputUnderlineProperty);
1186 SetValue(InputUnderlineProperty, value);
1187 NotifyPropertyChanged();
1192 /// The Shadow property.<br />
1193 /// The default shadow parameters.<br />
1194 /// The shadow map contains the following keys :<br />
1195 /// <list type="table">
1196 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1197 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1198 /// <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>
1201 /// <since_tizen> 3 </since_tizen>
1202 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1203 public PropertyMap Shadow
1207 return (PropertyMap)GetValue(ShadowProperty);
1211 SetValue(ShadowProperty, value);
1212 NotifyPropertyChanged();
1217 /// Set Shadow to TextEditor. <br />
1219 /// <param name="shadow">The Shadow</param>
1221 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1224 /// The following example demonstrates how to use the SetShadow method.
1226 /// var shadow = new Tizen.NUI.Text.Shadow();
1227 /// shadow.Offset = new Vector2(3, 3);
1228 /// shadow.Color = new Color("#F1C40F");
1229 /// editor.SetShadow(shadow);
1232 [EditorBrowsable(EditorBrowsableState.Never)]
1233 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1235 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1237 SetValue(ShadowProperty, shadowMap);
1242 /// Get Shadow from TextEditor. <br />
1244 /// <returns>The Shadow</returns>
1246 /// <see cref="Tizen.NUI.Text.Shadow"/>
1248 [EditorBrowsable(EditorBrowsableState.Never)]
1249 public Tizen.NUI.Text.Shadow GetShadow()
1251 Tizen.NUI.Text.Shadow shadow;
1252 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1254 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1260 /// The InputShadow property.<br />
1261 /// The shadow parameters of the new input text.<br />
1263 /// <since_tizen> 3 </since_tizen>
1264 public string InputShadow
1268 return (string)GetValue(InputShadowProperty);
1272 SetValue(InputShadowProperty, value);
1273 NotifyPropertyChanged();
1278 /// The Emboss property.<br />
1279 /// The default emboss parameters.<br />
1281 /// <since_tizen> 3 </since_tizen>
1282 public string Emboss
1286 return (string)GetValue(EmbossProperty);
1290 SetValue(EmbossProperty, value);
1291 NotifyPropertyChanged();
1296 /// The InputEmboss property.<br />
1297 /// The emboss parameters of the new input text.<br />
1299 /// <since_tizen> 3 </since_tizen>
1300 public string InputEmboss
1304 return (string)GetValue(InputEmbossProperty);
1308 SetValue(InputEmbossProperty, value);
1309 NotifyPropertyChanged();
1314 /// The Outline property.<br />
1315 /// The default outline parameters.<br />
1316 /// The outline map contains the following keys :<br />
1317 /// <list type="table">
1318 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1319 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1322 /// <since_tizen> 3 </since_tizen>
1323 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1324 public PropertyMap Outline
1328 return (PropertyMap)GetValue(OutlineProperty);
1332 SetValue(OutlineProperty, value);
1333 NotifyPropertyChanged();
1338 /// Set Outline to TextEditor. <br />
1340 /// <param name="outline">The Outline</param>
1342 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1345 /// The following example demonstrates how to use the SetOutline method.
1347 /// var outline = new Tizen.NUI.Text.Outline();
1348 /// outline.Width = 2.0f;
1349 /// outline.Color = new Color("#45B39D");
1350 /// editor.SetOutline(outline);
1353 [EditorBrowsable(EditorBrowsableState.Never)]
1354 public void SetOutline(Outline outline)
1356 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1358 SetValue(OutlineProperty, outlineMap);
1363 /// Get Outline from TextEditor. <br />
1365 /// <returns>The Outline</returns>
1367 /// <see cref="Tizen.NUI.Text.Outline"/>
1369 [EditorBrowsable(EditorBrowsableState.Never)]
1370 public Outline GetOutline()
1373 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1375 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1381 /// The InputOutline property.<br />
1382 /// The outline parameters of the new input text.<br />
1384 /// <since_tizen> 3 </since_tizen>
1385 public string InputOutline
1389 return (string)GetValue(InputOutlineProperty);
1393 SetValue(InputOutlineProperty, value);
1394 NotifyPropertyChanged();
1399 /// The SmoothScroll property.<br />
1400 /// Enable or disable the smooth scroll animation.<br />
1402 /// <since_tizen> 3 </since_tizen>
1403 public bool SmoothScroll
1407 return (bool)GetValue(SmoothScrollProperty);
1411 SetValue(SmoothScrollProperty, value);
1412 NotifyPropertyChanged();
1417 /// The SmoothScrollDuration property.<br />
1418 /// Sets the duration of smooth scroll animation.<br />
1420 /// <since_tizen> 3 </since_tizen>
1421 public float SmoothScrollDuration
1425 return (float)GetValue(SmoothScrollDurationProperty);
1429 SetValue(SmoothScrollDurationProperty, value);
1430 NotifyPropertyChanged();
1435 /// The EnableScrollBar property.<br />
1436 /// Enable or disable the scroll bar.<br />
1438 /// <since_tizen> 3 </since_tizen>
1439 public bool EnableScrollBar
1443 return (bool)GetValue(EnableScrollBarProperty);
1447 SetValue(EnableScrollBarProperty, value);
1448 NotifyPropertyChanged();
1453 /// The ScrollBarShowDuration property.<br />
1454 /// Sets the duration of scroll bar to show.<br />
1456 /// <since_tizen> 3 </since_tizen>
1457 public float ScrollBarShowDuration
1461 return (float)GetValue(ScrollBarShowDurationProperty);
1465 SetValue(ScrollBarShowDurationProperty, value);
1466 NotifyPropertyChanged();
1471 /// The ScrollBarFadeDuration property.<br />
1472 /// Sets the duration of scroll bar to fade out.<br />
1474 /// <since_tizen> 3 </since_tizen>
1475 public float ScrollBarFadeDuration
1479 return (float)GetValue(ScrollBarFadeDurationProperty);
1483 SetValue(ScrollBarFadeDurationProperty, value);
1484 NotifyPropertyChanged();
1489 /// The PixelSize property.<br />
1490 /// The size of font in pixels.<br />
1492 /// <since_tizen> 3 </since_tizen>
1493 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1494 public float PixelSize
1498 return (float)GetValue(PixelSizeProperty);
1502 SetValue(PixelSizeProperty, value);
1503 NotifyPropertyChanged();
1508 /// The line count of the text.
1510 /// <since_tizen> 3 </since_tizen>
1511 public int LineCount
1516 using (var propertyValue = GetProperty(TextEditor.Property.LineCount))
1518 propertyValue.Get(out lineCount);
1525 /// The text to display when the TextEditor is empty and inactive.
1527 /// <since_tizen> 3 </since_tizen>
1528 public string PlaceholderText
1532 return (string)GetValue(PlaceholderTextProperty);
1536 SetValue(PlaceholderTextProperty, value);
1537 NotifyPropertyChanged();
1542 /// The portion of the text that has been selected by the user.
1545 /// Empty string when nothing is selected.
1547 /// <since_tizen> 9 </since_tizen>
1548 public string SelectedText
1552 string selectedText;
1553 using (var propertyValue = GetProperty(TextEditor.Property.SelectedText))
1555 propertyValue.Get(out selectedText);
1557 return selectedText;
1562 /// The Placeholder text color.
1565 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1567 /// <since_tizen> 3 </since_tizen>
1568 public Color PlaceholderTextColor
1572 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1573 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1577 SetValue(PlaceholderTextColorProperty, value);
1578 NotifyPropertyChanged();
1583 /// The Enable selection property.<br />
1584 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1586 /// <since_tizen> 3 </since_tizen>
1587 public bool EnableSelection
1591 return (bool)GetValue(EnableSelectionProperty);
1595 SetValue(EnableSelectionProperty, value);
1596 NotifyPropertyChanged();
1601 /// The start index for selection.
1604 /// When there is no selection, the index is current cursor position.
1606 /// <since_tizen> 9 </since_tizen>
1607 public int SelectedTextStart
1611 int selectedTextStart;
1612 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextStart))
1614 propertyValue.Get(out selectedTextStart);
1616 return selectedTextStart;
1621 /// The end index for selection.
1624 /// When there is no selection, the index is current cursor position.
1626 /// <since_tizen> 9 </since_tizen>
1627 public int SelectedTextEnd
1631 int selectedTextEnd;
1632 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextEnd))
1634 propertyValue.Get(out selectedTextEnd);
1636 return selectedTextEnd;
1641 /// Enable editing in text control.
1643 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1644 [EditorBrowsable(EditorBrowsableState.Never)]
1645 public bool EnableEditing
1649 return (bool)GetValue(EnableEditingProperty);
1653 SetValue(EnableEditingProperty, value);
1657 private bool InternalEnableEditing
1662 using (var propertyValue = GetProperty(TextEditor.Property.EnableEditing))
1664 propertyValue.Get(out enableEditing);
1666 return enableEditing;
1670 using (var propertyValue = new PropertyValue(value))
1672 SetProperty(TextEditor.Property.EnableEditing, propertyValue);
1673 NotifyPropertyChanged();
1679 /// Specify horizontal scroll position in text control.
1681 [EditorBrowsable(EditorBrowsableState.Never)]
1682 public int HorizontalScrollPosition
1686 return (int)GetValue(HorizontalScrollPositionProperty);
1690 SetValue(HorizontalScrollPositionProperty, value);
1694 private int InternalHorizontalScrollPosition
1698 int horizontalScrollPosition;
1699 using (var propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1701 propertyValue.Get(out horizontalScrollPosition);
1703 return horizontalScrollPosition;
1707 using (var propertyValue = new PropertyValue(value))
1709 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1710 NotifyPropertyChanged();
1716 /// Specify vertical scroll position in text control.
1718 [EditorBrowsable(EditorBrowsableState.Never)]
1719 public int VerticalScrollPosition
1723 return (int)GetValue(VerticalScrollPositionProperty);
1727 SetValue(VerticalScrollPositionProperty, value);
1731 private int InternalVerticalScrollPosition
1735 int verticalScrollPosition;
1736 using (var propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1738 propertyValue.Get(out verticalScrollPosition);
1740 return verticalScrollPosition;
1744 using (var propertyValue = new PropertyValue(value))
1746 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1747 NotifyPropertyChanged();
1753 /// PrimaryCursorPosition property.<br />
1754 /// Specify the position of the primary cursor (caret) in text control.
1757 /// If the value set is out of range (negative or greater than or equal the number of characters in Text) then the PrimaryCursorPosition is moved to the end of Text (the number of characters in Text).
1759 /// <since_tizen> 10 </since_tizen>
1760 public int PrimaryCursorPosition
1764 return (int)GetValue(PrimaryCursorPositionProperty);
1768 SetValue(PrimaryCursorPositionProperty, value);
1772 private int InternalPrimaryCursorPosition
1776 int primaryCursorPosition;
1777 using (var propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1779 propertyValue.Get(out primaryCursorPosition);
1781 return primaryCursorPosition;
1785 using (var propertyValue = new PropertyValue(value))
1787 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1788 NotifyPropertyChanged();
1794 /// The GrabHandleColor property.
1797 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1799 [EditorBrowsable(EditorBrowsableState.Never)]
1800 public Color GrabHandleColor
1804 Color temp = (Color)GetValue(GrabHandleColorProperty);
1805 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1809 SetValue(GrabHandleColorProperty, value);
1810 NotifyPropertyChanged();
1815 /// Set InputFilter to TextEditor.
1817 /// <param name="inputFilter">The InputFilter</param>
1819 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1820 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1821 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1824 /// The following example demonstrates how to use the SetInputFilter method.
1826 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1827 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1828 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1829 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1832 /// <since_tizen> 9 </since_tizen>
1833 public void SetInputFilter(InputFilter inputFilter)
1835 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1836 using (var propertyValue = new PropertyValue(map))
1838 SetProperty(TextEditor.Property.InputFilter, propertyValue);
1843 /// Get InputFilter from TextEditor. <br />
1845 /// <returns>The InputFilter</returns>
1847 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1849 /// <since_tizen> 9 </since_tizen>
1850 public InputFilter GetInputFilter()
1852 InputFilter inputFilter;
1853 using (var propertyValue = GetProperty(TextEditor.Property.InputFilter))
1854 using (var map = new PropertyMap())
1856 propertyValue.Get(map);
1857 inputFilter = TextMapHelper.GetInputFilterStruct(map);
1863 /// Set Strikethrough to TextEditor. <br />
1865 /// <param name="strikethrough">The Strikethrough</param>
1867 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1870 /// The following example demonstrates how to use the SetStrikethrough method.
1872 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1873 /// strikethrough.Enable = true;
1874 /// strikethrough.Color = new Color("#3498DB");
1875 /// strikethrough.Height = 2.0f;
1876 /// editor.SetStrikethrough(strikethrough);
1879 [EditorBrowsable(EditorBrowsableState.Never)]
1880 public void SetStrikethrough(Strikethrough strikethrough)
1882 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1883 using (var propertyValue = new PropertyValue(map))
1885 SetProperty(TextEditor.Property.Strikethrough, propertyValue);
1890 /// Get Strikethrough from TextEditor. <br />
1892 /// <returns>The Strikethrough</returns>
1894 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1896 [EditorBrowsable(EditorBrowsableState.Never)]
1897 public Strikethrough GetStrikethrough()
1899 Strikethrough strikethrough;
1900 using (var propertyValue = GetProperty(TextEditor.Property.Strikethrough))
1901 using (var map = new PropertyMap())
1903 propertyValue.Get(map);
1904 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1906 return strikethrough;
1910 /// The Placeholder property.
1911 /// The placeholder map contains the following keys :<br />
1912 /// <list type="table">
1913 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1914 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1915 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1916 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1917 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1918 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1919 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1920 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1924 /// The following example demonstrates how to set the placeholder property.
1926 /// PropertyMap propertyMap = new PropertyMap();
1927 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1928 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1929 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1930 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1931 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1933 /// PropertyMap fontStyleMap = new PropertyMap();
1934 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1935 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1936 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1937 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1939 /// TextEditor editor = new TextEditor();
1940 /// editor.Placeholder = propertyMap;
1943 /// <since_tizen> 3 </since_tizen>
1944 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1945 public Tizen.NUI.PropertyMap Placeholder
1949 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
1950 string defalutText = "";
1952 if (TextMapHelper.IsValue(map, 0))
1953 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
1955 if (TextMapHelper.IsValue(map, 1))
1956 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
1958 if (TextMapHelper.IsValue(map, 2))
1960 using (var color = TextMapHelper.GetColorFromMap(map, 2))
1962 map.Add("color", color);
1966 if (TextMapHelper.IsValue(map, 3))
1967 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
1969 if (TextMapHelper.IsValue(map, 4))
1971 using (var properyValue = map.Find(4))
1972 using (var fontStyle = new PropertyMap())
1974 properyValue.Get(fontStyle);
1975 using (var fontStyleValue = new PropertyValue(fontStyle))
1977 map.Add("fontStyle", fontStyleValue);
1982 if (TextMapHelper.IsValue(map, 5))
1983 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
1985 if (TextMapHelper.IsValue(map, 6))
1986 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
1988 if (TextMapHelper.IsValue(map, 7))
1989 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
1995 SetValue(PlaceholderProperty, value);
1996 NotifyPropertyChanged();
2001 /// Set Placeholder to TextEditor. <br />
2003 /// <param name="placeholder">The Placeholder</param>
2005 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2008 /// The following example demonstrates how to use the SetPlaceholder method.
2010 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2011 /// placeholder.Text = "placeholder text";
2012 /// placeholder.TextFocused = "placeholder textFocused";
2013 /// placeholder.Color = new Color("#45B39D");
2014 /// placeholder.FontFamily = "BreezeSans";
2015 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2017 /// Width = FontWidthType.Expanded,
2018 /// Weight = FontWeightType.ExtraLight,
2019 /// Slant = FontSlantType.Italic,
2021 /// placeholder.PointSize = 25.0f;
2022 /// //placeholder.PixelSize = 50.0f;
2023 /// placeholder.Ellipsis = true;
2024 /// editor.SetPlaceholder(placeholder);
2027 [EditorBrowsable(EditorBrowsableState.Never)]
2028 public void SetPlaceholder(Placeholder placeholder)
2030 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2032 SetValue(PlaceholderProperty, placeholderMap);
2037 /// Get Placeholder from TextEditor. <br />
2039 /// <returns>The Placeholder</returns>
2041 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2043 [EditorBrowsable(EditorBrowsableState.Never)]
2044 public Placeholder GetPlaceholder()
2046 Placeholder placeholder;
2047 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2049 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2055 /// The Ellipsis property.<br />
2056 /// Enable or disable the ellipsis.<br />
2058 /// <since_tizen> 9 </since_tizen>
2059 public bool Ellipsis
2063 return (bool)GetValue(EllipsisProperty);
2067 SetValue(EllipsisProperty, value);
2068 NotifyPropertyChanged();
2074 /// The ellipsis position of the text.
2075 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2077 /// <since_tizen> 9 </since_tizen>
2078 public EllipsisPosition EllipsisPosition
2082 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2086 SetValue(EllipsisPositionProperty, value);
2087 NotifyPropertyChanged();
2092 /// The LineWrapMode property.<br />
2093 /// The line wrap mode when the text lines over the layout width.<br />
2095 /// <since_tizen> 4 </since_tizen>
2096 public LineWrapMode LineWrapMode
2100 return (LineWrapMode)GetValue(LineWrapModeProperty);
2104 SetValue(LineWrapModeProperty, value);
2105 NotifyPropertyChanged();
2110 /// Enables Text selection using Shift key.
2112 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2113 [EditorBrowsable(EditorBrowsableState.Never)]
2114 public bool EnableShiftSelection
2118 return (bool)GetValue(EnableShiftSelectionProperty);
2122 SetValue(EnableShiftSelectionProperty, value);
2123 NotifyPropertyChanged();
2128 /// The text alignment to match the direction of the system language.
2130 /// <since_tizen> 6 </since_tizen>
2131 public bool MatchSystemLanguageDirection
2135 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2139 SetValue(MatchSystemLanguageDirectionProperty, value);
2140 NotifyPropertyChanged();
2145 /// The MaxLength property.<br />
2146 /// The maximum number of characters that can be inserted.<br />
2148 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2149 [EditorBrowsable(EditorBrowsableState.Never)]
2150 public int MaxLength
2154 return (int)GetValue(MaxLengthProperty);
2158 SetValue(MaxLengthProperty, value);
2159 NotifyPropertyChanged();
2164 /// The FontSizeScale property. <br />
2165 /// The default value is 1.0. <br />
2166 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2167 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2169 /// <since_tizen> 9 </since_tizen>
2170 public float FontSizeScale
2174 return (float)GetValue(FontSizeScaleProperty);
2178 SetValue(FontSizeScaleProperty, value);
2179 NotifyPropertyChanged();
2183 private float InternalFontSizeScale
2187 return fontSizeScale;
2191 float newFontSizeScale;
2193 if (fontSizeScale == value) return;
2195 fontSizeScale = value;
2196 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2198 SystemSettingsFontSize systemSettingsFontSize;
2202 systemSettingsFontSize = SystemSettings.FontSize;
2206 Console.WriteLine("{0} Exception caught.", e);
2207 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2209 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2210 addFontSizeChangedCallback();
2214 newFontSizeScale = fontSizeScale;
2215 removeFontSizeChangedCallback();
2218 SetInternalFontSizeScale(newFontSizeScale);
2222 private void SetInternalFontSizeScale(float fontSizeScale)
2224 #if NUI_PROPERTY_CHANGE_2
2225 Object.InternalSetPropertyFloat(this.SwigCPtr, TextEditor.Property.FontSizeScale, (float)fontSizeScale);
2227 using (var property = new Tizen.NUI.PropertyValue((float)fontSizeScale))
2229 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)this.SwigCPtr, TextEditor.Property.FontSizeScale, property);
2235 /// The EnableFontSizeScale property.<br />
2236 /// Whether the font size scale is enabled. (The default value is true)
2238 [EditorBrowsable(EditorBrowsableState.Never)]
2239 public bool EnableFontSizeScale
2243 return (bool)GetValue(EnableFontSizeScaleProperty);
2247 SetValue(EnableFontSizeScaleProperty, value);
2248 NotifyPropertyChanged();
2253 /// The InputMethodSettings property.<br />
2254 /// The settings to relating to the System's Input Method, Key and Value.<br />
2257 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
2260 /// The following example demonstrates how to set the InputMethodSettings property.
2262 /// InputMethod method = new InputMethod();
2263 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
2264 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
2265 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
2266 /// method.Variation = 1;
2267 /// textEditor.InputMethodSettings = method.OutputMap;
2270 [EditorBrowsable(EditorBrowsableState.Never)]
2271 public PropertyMap InputMethodSettings
2275 return (PropertyMap)GetValue(InputMethodSettingsProperty);
2279 SetValue(InputMethodSettingsProperty, value);
2280 NotifyPropertyChanged();
2285 /// Scroll the text control by specific amount..
2287 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
2288 [EditorBrowsable(EditorBrowsableState.Never)]
2289 public void ScrollBy(Vector2 scroll)
2291 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
2292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2296 /// Get the InputMethodContext instance.
2298 /// <returns>The InputMethodContext instance.</returns>
2299 /// <since_tizen> 5 </since_tizen>
2300 public InputMethodContext GetInputMethodContext()
2302 if (inputMethodContext == null)
2304 /*Avoid raising InputMethodContext reference count.*/
2305 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
2306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2308 return inputMethodContext;
2312 /// Select the whole text.
2314 /// <since_tizen> 9 </since_tizen>
2315 public void SelectWholeText()
2317 Interop.TextEditor.SelectWholeText(SwigCPtr);
2318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2322 /// Select text from start to end index. <br />
2323 /// The index is valid when 0 or positive.
2325 /// <param name="start">The start index for selection.</param>
2326 /// <param name="end">The end index for selection.</param>
2328 /// If the end index exceeds the maximum value, it is set to the length of the text.
2330 /// <since_tizen> 9 </since_tizen>
2331 public void SelectText(int start, int end)
2334 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2336 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2338 Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
2339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2343 /// Clear selection of the text. <br />
2344 /// Valid when selection is activate.
2346 /// <since_tizen> 9 </since_tizen>
2347 public void SelectNone()
2349 _ = Interop.TextEditor.SelectNone(SwigCPtr);
2350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2354 /// The Enable grab handle property.<br />
2355 /// Enables the grab handles for text selection.<br />
2356 /// The default value is true, which means the grab handles are enabled by default.<br />
2358 [EditorBrowsable(EditorBrowsableState.Never)]
2359 public bool EnableGrabHandle
2363 return (bool)GetValue(EnableGrabHandleProperty);
2367 SetValue(EnableGrabHandleProperty, value);
2368 NotifyPropertyChanged();
2373 /// The Enable grab handle popup property.<br />
2374 /// Enables the grab handle popup for text selection.<br />
2375 /// The default value is true, which means the grab handle popup is enabled by default.<br />
2377 [EditorBrowsable(EditorBrowsableState.Never)]
2378 public bool EnableGrabHandlePopup
2382 return (bool)GetValue(EnableGrabHandlePopupProperty);
2386 SetValue(EnableGrabHandlePopupProperty, value);
2387 NotifyPropertyChanged();
2392 /// Minimum line size to be used.<br />
2393 /// The height of the line in points. <br />
2394 /// If the font size is larger than the line size, it works with the font size. <br />
2396 [EditorBrowsable(EditorBrowsableState.Never)]
2397 public float MinLineSize
2401 return (float)GetValue(MinLineSizeProperty);
2405 SetValue(MinLineSizeProperty, value);
2406 NotifyPropertyChanged();
2410 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2412 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));
2413 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2418 /// The spaces between characters in Pixels.
2420 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2421 /// The default value is 0.f which does nothing.
2424 [EditorBrowsable(EditorBrowsableState.Never)]
2425 public float CharacterSpacing
2429 return (float)GetValue(CharacterSpacingProperty);
2433 SetValue(CharacterSpacingProperty, value);
2434 NotifyPropertyChanged();
2441 /// <since_tizen> 3 </since_tizen>
2442 protected override void Dispose(DisposeTypes type)
2449 #if NUI_PROPERTY_CHANGE_2
2450 internalPlaceholderTextColor?.Dispose();
2451 internalPrimaryCursorColor?.Dispose();
2452 internalSecondaryCursorColor?.Dispose();
2453 internalSelectionHighlightColor?.Dispose();
2454 internalInputColor?.Dispose();
2455 internalTextColor?.Dispose();
2456 internalGrabHandleColor?.Dispose();
2459 if (systemlangTextFlag)
2461 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
2464 removeFontSizeChangedCallback();
2466 //Release your own unmanaged resources here.
2467 //You should not access any managed member here except static instance.
2468 //because the execution order of Finalizes is non-deterministic.
2472 if (textEditorTextChangedCallbackDelegate != null)
2474 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2477 if (textEditorMaxLengthReachedCallbackDelegate != null)
2479 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2482 if (textEditorSelectionStartedCallbackDelegate != null)
2484 this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
2487 if (textEditorSelectionClearedCallbackDelegate != null)
2489 this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2492 if (textEditorCursorPositionChangedCallbackDelegate != null)
2494 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2497 if (textEditorSelectionChangedCallbackDelegate != null)
2499 this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2503 TextChanged -= TextEditorTextChanged;
2507 /// This will not be public opened.
2508 [EditorBrowsable(EditorBrowsableState.Never)]
2509 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2511 // In order to speed up IME hide, temporarily add
2512 GetInputMethodContext()?.DestroyContext();
2513 Interop.TextEditor.DeleteTextEditor(swigCPtr);
2516 internal override LayoutItem CreateDefaultLayout()
2518 return new TextEditorLayout();
2521 internal void SetTextWithoutTextChanged(string text)
2523 invokeTextChanged = false;
2524 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2525 invokeTextChanged = true;
2528 private string SetTranslatable(string textEditorSid)
2530 string translatableText = null;
2531 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2532 if (translatableText != null)
2534 if (systemlangTextFlag == false)
2536 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
2537 systemlangTextFlag = true;
2539 return translatableText;
2543 translatableText = "";
2544 return translatableText;
2548 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2550 if (textEditorTextSid != null)
2552 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2554 if (textEditorPlaceHolderTextSid != null)
2556 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2560 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2562 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2563 SetInternalFontSizeScale(newFontSizeScale);
2566 private void addFontSizeChangedCallback()
2568 if (hasFontSizeChangedCallback != true)
2572 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
2573 hasFontSizeChangedCallback = true;
2577 Console.WriteLine("{0} Exception caught.", e);
2578 hasFontSizeChangedCallback = false;
2583 private void removeFontSizeChangedCallback()
2585 if (hasFontSizeChangedCallback == true)
2589 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
2590 hasFontSizeChangedCallback = false;
2594 Console.WriteLine("{0} Exception caught.", e);
2595 hasFontSizeChangedCallback = true;
2600 private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
2602 if (!isSettingTextInCSharp)
2604 EnforceNotifyBindedInstance(TextProperty);
2608 internal new class Property
2610 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2611 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2612 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2613 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2614 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2615 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2616 internal static readonly int VerticalAlignment = Interop.TextEditor.VerticalAlignmentGet();
2617 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2618 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2619 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2620 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2621 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2622 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2623 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2624 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2625 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2626 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2627 internal static readonly int SelectionPopupStyle = Interop.TextEditor.SelectionPopupStyleGet();
2628 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2629 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2630 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2631 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2632 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2633 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2634 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2635 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2636 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2637 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2638 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2639 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2640 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2641 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2642 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2643 internal static readonly int RelativeLineHeight = Interop.TextEditor.RelativeLineHeightGet();
2644 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2645 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2646 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2647 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2648 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2649 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2650 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2651 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2652 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2653 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2654 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2655 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2656 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2657 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2658 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2659 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2660 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2661 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2662 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2663 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2664 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2665 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2666 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2667 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2668 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2669 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2670 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2671 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2672 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2673 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2674 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2675 internal static readonly int EnableFontSizeScale = Interop.TextEditor.EnableFontSizeScaleGet();
2676 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2677 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2678 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2679 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2680 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2681 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2682 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2683 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2684 internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
2685 internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
2688 internal class InputStyle
2694 FontFamily = 0x0002,
2697 LineSpacing = 0x0010,
2705 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2707 DecorationBoundingBox = new Rectangle(x, y, width, height);
2709 private void OnInputColorChanged(float x, float y, float z, float w)
2711 InputColor = new Vector4(x, y, z, w);
2713 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2715 PlaceholderTextColor = new Color(r, g, b, a);
2717 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2719 PrimaryCursorColor = new Vector4(x, y, z, w);
2721 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2723 SecondaryCursorColor = new Vector4(x, y, z, w);
2725 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2727 SelectionHighlightColor = new Vector4(x, y, z, w);
2729 private void OnTextColorChanged(float x, float y, float z, float w)
2731 TextColor = new Vector4(x, y, z, w);
2733 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2735 GrabHandleColor = new Color(r, g, b, a);
2738 private class TextEditorLayout : LayoutItem
2740 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2742 // Padding will be automatically applied by DALi TextEditor.
2743 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2744 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2745 var minSize = Owner.MinimumSize;
2746 var maxSize = Owner.MaximumSize;
2747 var naturalSize = Owner.GetNaturalSize();
2749 if (((TextEditor)Owner).Text.Length == 0)
2751 // Calculate height of TextEditor by setting Text with " ".
2752 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2753 ((TextEditor)Owner).SetTextWithoutTextChanged(" ");
2755 // Store original WidthSpecification to restore it after setting ResizePolicy.
2756 var widthSpecification = Owner.WidthSpecification;
2758 // In DALi's Size logic, if Width or Height is set to be 0, then
2759 // ResizePolicy is not changed to Fixed.
2760 // This causes Size changes after NUI Layout's OnMeasure is finished.
2761 // e.g. TextEditor's Width fills to its parent although Text is null and
2762 // WidthSpecification is WrapContent.
2763 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2764 // in advance if Text is null.
2765 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2767 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2768 Owner.WidthSpecification = widthSpecification;
2770 naturalSize = Owner.GetNaturalSize();
2772 // Restore TextEditor's Text after calculating height of TextEditor.
2773 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2774 ((TextEditor)Owner).SetTextWithoutTextChanged("");
2777 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2779 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2782 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2784 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2787 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2788 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2790 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2791 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2793 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2794 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));