2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
22 using System.Globalization;
23 using System.ComponentModel;
25 using Tizen.NUI.Binding;
27 namespace Tizen.NUI.BaseComponents
30 /// A control which provides a multi-line editable text editor.
32 /// <since_tizen> 3 </since_tizen>
33 public partial class TextEditor : View
35 static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextEditor";
36 static private string defaultFontFamily = "TizenSans";
37 private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
38 private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
39 private string textEditorTextSid = null;
40 private string textEditorPlaceHolderTextSid = null;
41 private InputMethodContext inputMethodContext = null;
42 private string fontFamily = defaultFontFamily;
43 private float fontSizeScale = 1.0f;
44 private bool hasSystemLanguageChanged = false;
45 private bool hasSystemFontSizeChanged = false;
46 private bool hasSystemFontTypeChanged = false;
47 private bool isSettingTextInCSharp = false;
49 private Color internalPlaceholderTextColor = null;
50 private Vector4 internalPrimaryCursorColor = null;
51 private Vector4 internalSecondaryCursorColor = null;
52 private Vector4 internalSelectionHighlightColor = null;
53 private Vector4 internalInputColor = null;
54 private Vector4 internalTextColor = null;
55 private Color internalGrabHandleColor = null;
58 static TextEditor() { }
61 /// Creates the TextEditor control.
63 /// <since_tizen> 3 </since_tizen>
64 public TextEditor() : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
66 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70 /// Creates the TextEditor with specified style.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public TextEditor(TextEditorStyle style) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true, style: style)
78 /// Creates the TextEditor with setting the status of shown or hidden.
80 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
81 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 public TextEditor(bool shown) : this(Interop.TextEditor.New(ThemeManager.GetStyle(defaultStyleName) == null ? false : true), true)
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
101 TextChanged += TextEditorTextChanged;
104 private bool HasStyle()
106 return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
110 /// The TranslatableText property.<br />
111 /// The text can set the SID value.<br />
113 /// <exception cref='ArgumentNullException'>
114 /// ResourceManager about multilingual is null.
116 /// <since_tizen> 4 </since_tizen>
117 public string TranslatableText
121 return GetValue(TranslatableTextProperty) as string;
125 SetValue(TranslatableTextProperty, value);
129 private string InternalTranslatableText
133 return textEditorTextSid;
137 if (NUIApplication.MultilingualResourceManager == null)
139 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
141 textEditorTextSid = value;
142 Text = SetTranslatable(textEditorTextSid);
143 NotifyPropertyChanged();
147 /// The TranslatablePlaceholderText property.<br />
148 /// The text can set the SID value.<br />
150 /// <exception cref='ArgumentNullException'>
151 /// ResourceManager about multilingual is null.
153 /// <since_tizen> 4 </since_tizen>
154 public string TranslatablePlaceholderText
158 return GetValue(TranslatablePlaceholderTextProperty) as string;
162 SetValue(TranslatablePlaceholderTextProperty, value);
166 private string InternalTranslatablePlaceholderText
170 return textEditorPlaceHolderTextSid;
174 if (NUIApplication.MultilingualResourceManager == null)
176 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
178 textEditorPlaceHolderTextSid = value;
179 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
180 NotifyPropertyChanged();
185 /// The Text property.<br />
186 /// The text to display in the UTF-8 format.<br />
188 /// <since_tizen> 3 </since_tizen>
193 return (string)GetValue(TextProperty);
197 SetValue(TextProperty, value);
198 NotifyPropertyChanged();
203 /// The TextColor property.<br />
204 /// The color of the text.<br />
207 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
209 /// <since_tizen> 3 </since_tizen>
210 public Vector4 TextColor
214 Vector4 temp = (Vector4)GetValue(TextColorProperty);
215 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
219 SetValue(TextColorProperty, value);
220 NotifyPropertyChanged();
225 /// The FontFamily property.<br />
226 /// The requested font family to use.<br />
228 /// <since_tizen> 3 </since_tizen>
229 public string FontFamily
233 return (string)GetValue(FontFamilyProperty);
237 SetValue(FontFamilyProperty, value);
238 NotifyPropertyChanged();
242 private string InternalFontFamily
249 return Object.InternalGetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily);
253 string newFontFamily;
255 if (string.Equals(fontFamily, value)) return;
258 if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
262 newFontFamily = SystemSettings.FontType;
266 Console.WriteLine("{0} Exception caught.", e);
267 newFontFamily = defaultFontFamily;
269 AddSystemSettingsFontTypeChanged();
273 newFontFamily = fontFamily;
274 RemoveSystemSettingsFontTypeChanged();
277 SetInternalFontFamily(newFontFamily);
281 private void SetInternalFontFamily(string fontFamily)
283 Object.InternalSetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily, (string)fontFamily);
287 /// The FontStyle property.<br />
288 /// The requested font style to use.<br />
289 /// The fontStyle map contains the following keys :<br />
290 /// <list type="table">
291 /// <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>
292 /// <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>
293 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
296 /// <since_tizen> 3 </since_tizen>
297 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
298 public PropertyMap FontStyle
302 return (PropertyMap)GetValue(FontStyleProperty);
306 SetValue(FontStyleProperty, value);
307 NotifyPropertyChanged();
312 /// Set FontStyle to TextEditor. <br />
314 /// <param name="fontStyle">The FontStyle</param>
316 /// SetFontStyle specifies the requested font style through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
319 /// The following example demonstrates how to use the SetFontStyle method.
321 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
322 /// fontStyle.Width = FontWidthType.Expanded;
323 /// fontStyle.Weight = FontWeightType.Bold;
324 /// fontStyle.Slant = FontSlantType.Italic;
325 /// editor.SetFontStyle(fontStyle);
328 [EditorBrowsable(EditorBrowsableState.Never)]
329 public void SetFontStyle(FontStyle fontStyle)
331 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
333 SetValue(FontStyleProperty, fontStyleMap);
338 /// Get FontStyle from TextEditor. <br />
340 /// <returns>The FontStyle</returns>
342 /// <see cref="Tizen.NUI.Text.FontStyle"/>
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public FontStyle GetFontStyle()
348 using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
350 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
356 /// The PointSize property.<br />
357 /// The size of font in points.<br />
359 /// <since_tizen> 3 </since_tizen>
360 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
361 public float PointSize
365 return (float)GetValue(PointSizeProperty);
369 SetValue(PointSizeProperty, value);
370 NotifyPropertyChanged();
375 /// The HorizontalAlignment property.<br />
376 /// The line horizontal alignment.<br />
378 /// <since_tizen> 3 </since_tizen>
379 public HorizontalAlignment HorizontalAlignment
383 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
387 SetValue(HorizontalAlignmentProperty, value);
388 NotifyPropertyChanged();
393 /// The VerticalAlignment property.<br />
394 /// The line vertical alignment.
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 public VerticalAlignment VerticalAlignment
401 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
405 SetValue(VerticalAlignmentProperty, value);
406 NotifyPropertyChanged();
411 /// The ScrollThreshold property.<br />
412 /// Horizontal scrolling will occur if the cursor is this close to the control border.<br />
414 /// <since_tizen> 3 </since_tizen>
415 public float ScrollThreshold
419 return (float)GetValue(ScrollThresholdProperty);
423 SetValue(ScrollThresholdProperty, value);
424 NotifyPropertyChanged();
429 /// The ScrollSpeed property.<br />
430 /// The scroll speed in pixels per second.<br />
432 /// <since_tizen> 3 </since_tizen>
433 public float ScrollSpeed
437 return (float)GetValue(ScrollSpeedProperty);
441 SetValue(ScrollSpeedProperty, value);
442 NotifyPropertyChanged();
447 /// The PrimaryCursorColor property.<br />
448 /// The color to apply to the primary cursor.<br />
451 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
453 /// <since_tizen> 3 </since_tizen>
454 public Vector4 PrimaryCursorColor
458 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
459 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
463 SetValue(PrimaryCursorColorProperty, value);
464 NotifyPropertyChanged();
469 /// The SecondaryCursorColor property.<br />
470 /// The color to apply to the secondary cursor.<br />
473 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
475 /// <since_tizen> 3 </since_tizen>
476 public Vector4 SecondaryCursorColor
480 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
481 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
485 SetValue(SecondaryCursorColorProperty, value);
486 NotifyPropertyChanged();
491 /// The EnableCursorBlink property.<br />
492 /// Whether the cursor should blink or not.<br />
494 /// <since_tizen> 3 </since_tizen>
495 public bool EnableCursorBlink
499 return (bool)GetValue(EnableCursorBlinkProperty);
503 SetValue(EnableCursorBlinkProperty, value);
504 NotifyPropertyChanged();
509 /// The CursorBlinkInterval property.<br />
510 /// The time interval in seconds between cursor on/off states.<br />
512 /// <since_tizen> 3 </since_tizen>
513 public float CursorBlinkInterval
517 return (float)GetValue(CursorBlinkIntervalProperty);
521 SetValue(CursorBlinkIntervalProperty, value);
522 NotifyPropertyChanged();
527 /// The CursorBlinkDuration property.<br />
528 /// The cursor will stop blinking after this number of seconds (if non-zero).<br />
530 /// <since_tizen> 3 </since_tizen>
531 public float CursorBlinkDuration
535 return (float)GetValue(CursorBlinkDurationProperty);
539 SetValue(CursorBlinkDurationProperty, value);
540 NotifyPropertyChanged();
545 /// The CursorWidth property.
547 /// <since_tizen> 3 </since_tizen>
548 public int CursorWidth
552 return (int)GetValue(CursorWidthProperty);
556 SetValue(CursorWidthProperty, value);
557 NotifyPropertyChanged();
562 /// The GrabHandleImage property.<br />
563 /// The image to display for the grab handle.<br />
565 /// <since_tizen> 3 </since_tizen>
566 public string GrabHandleImage
570 return (string)GetValue(GrabHandleImageProperty);
574 SetValue(GrabHandleImageProperty, value);
575 NotifyPropertyChanged();
580 /// The GrabHandlePressedImage property.<br />
581 /// The image to display when the grab handle is pressed.<br />
583 /// <since_tizen> 3 </since_tizen>
584 public string GrabHandlePressedImage
588 return (string)GetValue(GrabHandlePressedImageProperty);
592 SetValue(GrabHandlePressedImageProperty, value);
593 NotifyPropertyChanged();
598 /// The SelectionPopupStyle property.<br />
599 /// The style of the text selection popup can be set through SelectionPopupStyle property.
601 [EditorBrowsable(EditorBrowsableState.Never)]
602 public PropertyMap SelectionPopupStyle
606 return (PropertyMap)GetValue(SelectionPopupStyleProperty);
610 SetValue(SelectionPopupStyleProperty, value);
611 NotifyPropertyChanged();
616 /// The SelectionHandleImageLeft property.<br />
617 /// The image to display for the left selection handle.<br />
618 /// The selectionHandleImageLeft map contains the following key :<br />
619 /// <list type="table">
620 /// <item><term>filename (string)</term><description>The path of image file</description></item>
623 /// <since_tizen> 3 </since_tizen>
624 public PropertyMap SelectionHandleImageLeft
628 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
632 SetValue(SelectionHandleImageLeftProperty, value);
633 NotifyPropertyChanged();
638 /// The SelectionHandleImageRight property.<br />
639 /// The image to display for the right selection handle.<br />
640 /// The selectionHandleImageRight 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 SelectionHandleImageRight
650 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
654 SetValue(SelectionHandleImageRightProperty, value);
655 NotifyPropertyChanged();
660 /// Set SelectionHandleImage to TextEditor. <br />
662 /// <param name="selectionHandleImage">The SelectionHandleImage</param>
664 /// SetSelectionHandleImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
667 /// The following example demonstrates how to use the SetSelectionHandleImage method.
669 /// var selectionHandleImage = new Tizen.NUI.Text.SelectionHandleImage();
670 /// selectionHandleImage.LeftImageUrl = "handle_downleft.png";
671 /// selectionHandleImage.RightImageUrl = "handle_downright.png";
672 /// editor.SetSelectionHandleImage(selectionHandleImage);
675 [EditorBrowsable(EditorBrowsableState.Never)]
676 public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
678 if (!String.IsNullOrEmpty(selectionHandleImage.LeftImageUrl))
680 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
682 SetValue(SelectionHandleImageLeftProperty, leftImageMap);
686 if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
688 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
690 SetValue(SelectionHandleImageRightProperty, rightImageMap);
696 /// Get SelectionHandleImage from TextEditor. <br />
698 /// <returns>The SelectionHandleImage</returns>
700 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
702 [EditorBrowsable(EditorBrowsableState.Never)]
703 public SelectionHandleImage GetSelectionHandleImage()
705 SelectionHandleImage selectionHandleImage;
706 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
707 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
709 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
711 return selectionHandleImage;
715 /// The SelectionHandlePressedImageLeft property.<br />
716 /// The image to display when the left selection handle is pressed.<br />
717 /// The selectionHandlePressedImageLeft map contains the following key :<br />
718 /// <list type="table">
719 /// <item><term>filename (string)</term><description>The path of image file</description></item>
722 /// <since_tizen> 3 </since_tizen>
723 public PropertyMap SelectionHandlePressedImageLeft
727 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
731 SetValue(SelectionHandlePressedImageLeftProperty, value);
732 NotifyPropertyChanged();
737 /// The SelectionHandlePressedImageRight property.<br />
738 /// The image to display when the right selection handle is pressed.<br />
739 /// The selectionHandlePressedImageRight map contains the following key :<br />
740 /// <list type="table">
741 /// <item><term>filename (string)</term><description>The path of image file</description></item>
744 /// <since_tizen> 3 </since_tizen>
745 public PropertyMap SelectionHandlePressedImageRight
749 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
753 SetValue(SelectionHandlePressedImageRightProperty, value);
754 NotifyPropertyChanged();
759 /// Set SelectionHandlePressedImage to TextEditor. <br />
761 /// <param name="selectionHandlePressedImage">The SelectionHandleImage</param>
763 /// SetSelectionHandlePressedImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
766 /// The following example demonstrates how to use the SetSelectionHandlePressedImage method.
768 /// var selectionHandlePressedImage = new Tizen.NUI.Text.SelectionHandleImage();
769 /// selectionHandlePressedImage.LeftImageUrl = "handle_pressed_downleft.png";
770 /// selectionHandlePressedImage.RightImageUrl = "handle_pressed_downright.png";
771 /// editor.SetSelectionHandlePressedImage(selectionHandlePressedImage);
774 [EditorBrowsable(EditorBrowsableState.Never)]
775 public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandlePressedImage)
777 if (!String.IsNullOrEmpty(selectionHandlePressedImage.LeftImageUrl))
779 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
781 SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
785 if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
787 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
789 SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
795 /// Get SelectionHandlePressedImage from TextEditor. <br />
797 /// <returns>The SelectionHandlePressedImage</returns>
799 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
801 [EditorBrowsable(EditorBrowsableState.Never)]
802 public SelectionHandleImage GetSelectionHandlePressedImage()
804 SelectionHandleImage selectionHandleImage;
805 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
806 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
808 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
810 return selectionHandleImage;
814 /// The SelectionHandleMarkerImageLeft property.<br />
815 /// The image to display for the left selection handle marker.<br />
816 /// The selectionHandleMarkerImageLeft map contains the following key :<br />
817 /// <list type="table">
818 /// <item><term>filename (string)</term><description>The path of image file</description></item>
821 /// <since_tizen> 3 </since_tizen>
822 public PropertyMap SelectionHandleMarkerImageLeft
826 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
830 SetValue(SelectionHandleMarkerImageLeftProperty, value);
831 NotifyPropertyChanged();
836 /// The SelectionHandleMarkerImageRight property.<br />
837 /// The image to display for the right selection handle marker.<br />
838 /// The selectionHandleMarkerImageRight map contains the following key :<br />
839 /// <list type="table">
840 /// <item><term>filename (string)</term><description>The path of image file</description></item>
843 /// <since_tizen> 3 </since_tizen>
844 public PropertyMap SelectionHandleMarkerImageRight
848 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
852 SetValue(SelectionHandleMarkerImageRightProperty, value);
853 NotifyPropertyChanged();
858 /// Set SelectionHandleMarkerImage to TextEditor. <br />
860 /// <param name="selectionHandleMarkerImage">The SelectionHandleImage</param>
862 /// SetSelectionHandleMarkerImage specifies the display image used for the selection handle through <see cref="Tizen.NUI.Text.SelectionHandleImage"/>. <br />
865 /// The following example demonstrates how to use the SetSelectionHandleMarkerImage method.
867 /// var selectionHandleMarkerImage = new Tizen.NUI.Text.SelectionHandleImage();
868 /// selectionHandleMarkerImage.LeftImageUrl = "handle_pressed_downleft.png";
869 /// selectionHandleMarkerImage.RightImageUrl = "handle_pressed_downright.png";
870 /// editor.SetSelectionHandleMarkerImage(selectionHandleMarkerImage);
873 [EditorBrowsable(EditorBrowsableState.Never)]
874 public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMarkerImage)
876 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.LeftImageUrl))
878 using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
880 SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
884 if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
886 using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
888 SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
894 /// Get SelectionHandleMarkerImage from TextEditor. <br />
896 /// <returns>The SelectionHandleMarkerImage</returns>
898 /// <see cref="Tizen.NUI.Text.SelectionHandleImage"/>
900 [EditorBrowsable(EditorBrowsableState.Never)]
901 public SelectionHandleImage GetSelectionHandleMarkerImage()
903 SelectionHandleImage selectionHandleImage;
904 using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
905 using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
907 selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
909 return selectionHandleImage;
913 /// The SelectionHighlightColor property.<br />
914 /// The color of the selection highlight.<br />
917 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
919 /// <since_tizen> 3 </since_tizen>
920 public Vector4 SelectionHighlightColor
924 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
925 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
929 SetValue(SelectionHighlightColorProperty, value);
930 NotifyPropertyChanged();
935 /// The DecorationBoundingBox property.<br />
936 /// The decorations (handles etc) will positioned within this area on-screen.<br />
939 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
941 /// <since_tizen> 3 </since_tizen>
942 public Rectangle DecorationBoundingBox
946 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
947 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
951 SetValue(DecorationBoundingBoxProperty, value);
952 NotifyPropertyChanged();
957 /// The EnableMarkup property.<br />
958 /// Whether the mark-up processing is enabled.<br />
960 /// <since_tizen> 3 </since_tizen>
961 public bool EnableMarkup
965 return (bool)GetValue(EnableMarkupProperty);
969 SetValue(EnableMarkupProperty, value);
970 NotifyPropertyChanged();
975 /// The InputColor property.<br />
976 /// The color of the new input text.<br />
979 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
981 /// <since_tizen> 3 </since_tizen>
982 public Vector4 InputColor
986 Vector4 temp = (Vector4)GetValue(InputColorProperty);
987 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
991 SetValue(InputColorProperty, value);
992 NotifyPropertyChanged();
997 /// The InputFontFamily property.<br />
998 /// The font's family of the new input text.<br />
1000 /// <since_tizen> 3 </since_tizen>
1001 public string InputFontFamily
1005 return (string)GetValue(InputFontFamilyProperty);
1009 SetValue(InputFontFamilyProperty, value);
1010 NotifyPropertyChanged();
1015 /// The InputFontStyle property.<br />
1016 /// The font's style of the new input text.<br />
1017 /// The inputFontStyle map contains the following keys :<br />
1018 /// <list type="table">
1019 /// <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>
1020 /// <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>
1021 /// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
1024 /// <since_tizen> 3 </since_tizen>
1025 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1026 public PropertyMap InputFontStyle
1030 return (PropertyMap)GetValue(InputFontStyleProperty);
1034 SetValue(InputFontStyleProperty, value);
1035 NotifyPropertyChanged();
1040 /// Set InputFontStyle to TextEditor. <br />
1042 /// <param name="fontStyle">The FontStyle</param>
1044 /// SetInputFontStyle specifies the requested font style for new input text through <see cref="Tizen.NUI.Text.FontStyle"/>. <br />
1047 /// The following example demonstrates how to use the SetInputFontStyle method.
1049 /// var fontStyle = new Tizen.NUI.Text.FontStyle();
1050 /// fontStyle.Width = FontWidthType.Expanded;
1051 /// fontStyle.Weight = FontWeightType.Bold;
1052 /// fontStyle.Slant = FontSlantType.Italic;
1053 /// editor.SetInputFontStyle(fontStyle);
1056 [EditorBrowsable(EditorBrowsableState.Never)]
1057 public void SetInputFontStyle(FontStyle fontStyle)
1059 using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
1061 SetValue(InputFontStyleProperty, fontStyleMap);
1066 /// Get InputFontStyle from TextEditor. <br />
1068 /// <returns>The FontStyle</returns>
1070 /// <see cref="Tizen.NUI.Text.FontStyle"/>
1072 [EditorBrowsable(EditorBrowsableState.Never)]
1073 public FontStyle GetInputFontStyle()
1075 FontStyle fontStyle;
1076 using (var fontStyleMap = (PropertyMap)GetValue(InputFontStyleProperty))
1078 fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
1084 /// The InputPointSize property.<br />
1085 /// The font's size of the new input text in points.<br />
1087 /// <since_tizen> 3 </since_tizen>
1088 [Binding.TypeConverter(typeof(PointSizeTypeConverter))]
1089 public float InputPointSize
1093 return (float)GetValue(InputPointSizeProperty);
1097 SetValue(InputPointSizeProperty, value);
1098 NotifyPropertyChanged();
1103 /// The LineSpacing property.<br />
1104 /// The default extra space between lines in points.<br />
1106 /// <since_tizen> 3 </since_tizen>
1107 public float LineSpacing
1111 return (float)GetValue(LineSpacingProperty);
1115 SetValue(LineSpacingProperty, value);
1116 NotifyPropertyChanged();
1121 /// The InputLineSpacing property.<br />
1122 /// The extra space between lines in points.<br />
1124 /// <since_tizen> 3 </since_tizen>
1125 public float InputLineSpacing
1129 return (float)GetValue(InputLineSpacingProperty);
1133 SetValue(InputLineSpacingProperty, value);
1134 NotifyPropertyChanged();
1139 /// The relative height of the line (a factor that will be multiplied by text height). <br />
1140 /// If the value is less than 1, the lines could to be overlapped.
1142 [EditorBrowsable(EditorBrowsableState.Never)]
1143 public float RelativeLineHeight
1147 return (float)GetValue(RelativeLineHeightProperty);
1151 SetValue(RelativeLineHeightProperty, value);
1152 NotifyPropertyChanged();
1157 /// The Underline property.<br />
1158 /// The default underline parameters.<br />
1159 /// The underline map contains the following keys :<br />
1160 /// <list type="table">
1161 /// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
1162 /// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
1163 /// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
1166 /// <since_tizen> 3 </since_tizen>
1167 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1168 public PropertyMap Underline
1172 return (PropertyMap)GetValue(UnderlineProperty);
1176 SetValue(UnderlineProperty, value);
1177 NotifyPropertyChanged();
1182 /// Set Underline to TextEditor. <br />
1184 /// <param name="underline">The Underline</param>
1186 /// SetUnderline specifies the underline of the text through <see cref="Tizen.NUI.Text.Underline"/>. <br />
1189 /// The following example demonstrates how to use the SetUnderline method.
1191 /// var underline = new Tizen.NUI.Text.Underline();
1192 /// underline.Enable = true;
1193 /// underline.Color = new Color("#3498DB");
1194 /// underline.Height = 2.0f;
1195 /// editor.SetUnderline(underline);
1198 [EditorBrowsable(EditorBrowsableState.Never)]
1199 public void SetUnderline(Underline underline)
1201 using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
1203 SetValue(UnderlineProperty, underlineMap);
1208 /// Get Underline from TextEditor. <br />
1210 /// <returns>The Underline</returns>
1212 /// <see cref="Tizen.NUI.Text.Underline"/>
1214 [EditorBrowsable(EditorBrowsableState.Never)]
1215 public Underline GetUnderline()
1217 Underline underline;
1218 using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
1220 underline = TextMapHelper.GetUnderlineStruct(underlineMap);
1226 /// The InputUnderline property.<br />
1227 /// The underline parameters of the new input text.<br />
1229 /// <since_tizen> 3 </since_tizen>
1230 public string InputUnderline
1234 return (string)GetValue(InputUnderlineProperty);
1238 SetValue(InputUnderlineProperty, value);
1239 NotifyPropertyChanged();
1244 /// The Shadow property.<br />
1245 /// The default shadow parameters.<br />
1246 /// The shadow map contains the following keys :<br />
1247 /// <list type="table">
1248 /// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
1249 /// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
1250 /// <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>
1253 /// <since_tizen> 3 </since_tizen>
1254 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1255 public PropertyMap Shadow
1259 return (PropertyMap)GetValue(ShadowProperty);
1263 SetValue(ShadowProperty, value);
1264 NotifyPropertyChanged();
1269 /// Set Shadow to TextEditor. <br />
1271 /// <param name="shadow">The Shadow</param>
1273 /// SetShadow specifies the shadow of the text through <see cref="Tizen.NUI.Text.Shadow"/>. <br />
1276 /// The following example demonstrates how to use the SetShadow method.
1278 /// var shadow = new Tizen.NUI.Text.Shadow();
1279 /// shadow.Offset = new Vector2(3, 3);
1280 /// shadow.Color = new Color("#F1C40F");
1281 /// editor.SetShadow(shadow);
1284 [EditorBrowsable(EditorBrowsableState.Never)]
1285 public void SetShadow(Tizen.NUI.Text.Shadow shadow)
1287 using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
1289 SetValue(ShadowProperty, shadowMap);
1294 /// Get Shadow from TextEditor. <br />
1296 /// <returns>The Shadow</returns>
1298 /// <see cref="Tizen.NUI.Text.Shadow"/>
1300 [EditorBrowsable(EditorBrowsableState.Never)]
1301 public Tizen.NUI.Text.Shadow GetShadow()
1303 Tizen.NUI.Text.Shadow shadow;
1304 using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
1306 shadow = TextMapHelper.GetShadowStruct(shadowMap);
1312 /// The InputShadow property.<br />
1313 /// The shadow parameters of the new input text.<br />
1315 /// <since_tizen> 3 </since_tizen>
1316 public string InputShadow
1320 return (string)GetValue(InputShadowProperty);
1324 SetValue(InputShadowProperty, value);
1325 NotifyPropertyChanged();
1330 /// The Emboss property.<br />
1331 /// The default emboss parameters.<br />
1333 /// <since_tizen> 3 </since_tizen>
1334 public string Emboss
1338 return (string)GetValue(EmbossProperty);
1342 SetValue(EmbossProperty, value);
1343 NotifyPropertyChanged();
1348 /// The InputEmboss property.<br />
1349 /// The emboss parameters of the new input text.<br />
1351 /// <since_tizen> 3 </since_tizen>
1352 public string InputEmboss
1356 return (string)GetValue(InputEmbossProperty);
1360 SetValue(InputEmbossProperty, value);
1361 NotifyPropertyChanged();
1366 /// The Outline property.<br />
1367 /// The default outline parameters.<br />
1368 /// The outline map contains the following keys :<br />
1369 /// <list type="table">
1370 /// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
1371 /// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
1374 /// <since_tizen> 3 </since_tizen>
1375 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1376 public PropertyMap Outline
1380 return (PropertyMap)GetValue(OutlineProperty);
1384 SetValue(OutlineProperty, value);
1385 NotifyPropertyChanged();
1390 /// Set Outline to TextEditor. <br />
1392 /// <param name="outline">The Outline</param>
1394 /// SetOutline specifies the outline of the text through <see cref="Tizen.NUI.Text.Outline"/>. <br />
1397 /// The following example demonstrates how to use the SetOutline method.
1399 /// var outline = new Tizen.NUI.Text.Outline();
1400 /// outline.Width = 2.0f;
1401 /// outline.Color = new Color("#45B39D");
1402 /// editor.SetOutline(outline);
1405 [EditorBrowsable(EditorBrowsableState.Never)]
1406 public void SetOutline(Outline outline)
1408 using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
1410 SetValue(OutlineProperty, outlineMap);
1415 /// Get Outline from TextEditor. <br />
1417 /// <returns>The Outline</returns>
1419 /// <see cref="Tizen.NUI.Text.Outline"/>
1421 [EditorBrowsable(EditorBrowsableState.Never)]
1422 public Outline GetOutline()
1425 using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
1427 outline = TextMapHelper.GetOutlineStruct(outlineMap);
1433 /// The InputOutline property.<br />
1434 /// The outline parameters of the new input text.<br />
1436 /// <since_tizen> 3 </since_tizen>
1437 public string InputOutline
1441 return (string)GetValue(InputOutlineProperty);
1445 SetValue(InputOutlineProperty, value);
1446 NotifyPropertyChanged();
1451 /// The SmoothScroll property.<br />
1452 /// Enable or disable the smooth scroll animation.<br />
1454 /// <since_tizen> 3 </since_tizen>
1455 public bool SmoothScroll
1459 return (bool)GetValue(SmoothScrollProperty);
1463 SetValue(SmoothScrollProperty, value);
1464 NotifyPropertyChanged();
1469 /// The SmoothScrollDuration property.<br />
1470 /// Sets the duration of smooth scroll animation.<br />
1472 /// <since_tizen> 3 </since_tizen>
1473 public float SmoothScrollDuration
1477 return (float)GetValue(SmoothScrollDurationProperty);
1481 SetValue(SmoothScrollDurationProperty, value);
1482 NotifyPropertyChanged();
1487 /// The EnableScrollBar property.<br />
1488 /// Enable or disable the scroll bar.<br />
1490 /// <since_tizen> 3 </since_tizen>
1491 public bool EnableScrollBar
1495 return (bool)GetValue(EnableScrollBarProperty);
1499 SetValue(EnableScrollBarProperty, value);
1500 NotifyPropertyChanged();
1505 /// The ScrollBarShowDuration property.<br />
1506 /// Sets the duration of scroll bar to show.<br />
1508 /// <since_tizen> 3 </since_tizen>
1509 public float ScrollBarShowDuration
1513 return (float)GetValue(ScrollBarShowDurationProperty);
1517 SetValue(ScrollBarShowDurationProperty, value);
1518 NotifyPropertyChanged();
1523 /// The ScrollBarFadeDuration property.<br />
1524 /// Sets the duration of scroll bar to fade out.<br />
1526 /// <since_tizen> 3 </since_tizen>
1527 public float ScrollBarFadeDuration
1531 return (float)GetValue(ScrollBarFadeDurationProperty);
1535 SetValue(ScrollBarFadeDurationProperty, value);
1536 NotifyPropertyChanged();
1541 /// The PixelSize property.<br />
1542 /// The size of font in pixels.<br />
1544 /// <since_tizen> 3 </since_tizen>
1545 [Binding.TypeConverter(typeof(FloatGraphicsTypeConverter))]
1546 public float PixelSize
1550 return (float)GetValue(PixelSizeProperty);
1554 SetValue(PixelSizeProperty, value);
1555 NotifyPropertyChanged();
1560 /// The line count of the text.
1562 /// <since_tizen> 3 </since_tizen>
1563 public int LineCount
1568 using (var propertyValue = GetProperty(TextEditor.Property.LineCount))
1570 propertyValue.Get(out lineCount);
1577 /// The text to display when the TextEditor is empty and inactive.
1579 /// <since_tizen> 3 </since_tizen>
1580 public string PlaceholderText
1584 return (string)GetValue(PlaceholderTextProperty);
1588 SetValue(PlaceholderTextProperty, value);
1589 NotifyPropertyChanged();
1594 /// The portion of the text that has been selected by the user.
1597 /// Empty string when nothing is selected.
1599 /// <since_tizen> 9 </since_tizen>
1600 public string SelectedText
1604 string selectedText;
1605 using (var propertyValue = GetProperty(TextEditor.Property.SelectedText))
1607 propertyValue.Get(out selectedText);
1609 return selectedText;
1614 /// The Placeholder text color.
1617 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
1619 /// <since_tizen> 3 </since_tizen>
1620 public Color PlaceholderTextColor
1624 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
1625 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
1629 SetValue(PlaceholderTextColorProperty, value);
1630 NotifyPropertyChanged();
1635 /// The Enable selection property.<br />
1636 /// Enables Text selection, such as the cursor, handle, clipboard, and highlight color.<br />
1638 /// <since_tizen> 3 </since_tizen>
1639 public bool EnableSelection
1643 return (bool)GetValue(EnableSelectionProperty);
1647 SetValue(EnableSelectionProperty, value);
1648 NotifyPropertyChanged();
1653 /// The start index for selection.
1656 /// When there is no selection, the index is current cursor position.
1658 /// <since_tizen> 9 </since_tizen>
1659 public int SelectedTextStart
1663 int selectedTextStart;
1664 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextStart))
1666 propertyValue.Get(out selectedTextStart);
1668 return selectedTextStart;
1673 /// The end index for selection.
1676 /// When there is no selection, the index is current cursor position.
1678 /// <since_tizen> 9 </since_tizen>
1679 public int SelectedTextEnd
1683 int selectedTextEnd;
1684 using (var propertyValue = GetProperty(TextEditor.Property.SelectedTextEnd))
1686 propertyValue.Get(out selectedTextEnd);
1688 return selectedTextEnd;
1693 /// Enable editing in text control.
1695 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
1696 [EditorBrowsable(EditorBrowsableState.Never)]
1697 public bool EnableEditing
1701 return (bool)GetValue(EnableEditingProperty);
1705 SetValue(EnableEditingProperty, value);
1709 private bool InternalEnableEditing
1714 using (var propertyValue = GetProperty(TextEditor.Property.EnableEditing))
1716 propertyValue.Get(out enableEditing);
1718 return enableEditing;
1722 using (var propertyValue = new PropertyValue(value))
1724 SetProperty(TextEditor.Property.EnableEditing, propertyValue);
1725 NotifyPropertyChanged();
1731 /// Specify horizontal scroll position in text control.
1733 [EditorBrowsable(EditorBrowsableState.Never)]
1734 public int HorizontalScrollPosition
1738 return (int)GetValue(HorizontalScrollPositionProperty);
1742 SetValue(HorizontalScrollPositionProperty, value);
1746 private int InternalHorizontalScrollPosition
1750 int horizontalScrollPosition;
1751 using (var propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1753 propertyValue.Get(out horizontalScrollPosition);
1755 return horizontalScrollPosition;
1759 using (var propertyValue = new PropertyValue(value))
1761 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1762 NotifyPropertyChanged();
1768 /// Specify vertical scroll position in text control.
1770 [EditorBrowsable(EditorBrowsableState.Never)]
1771 public int VerticalScrollPosition
1775 return (int)GetValue(VerticalScrollPositionProperty);
1779 SetValue(VerticalScrollPositionProperty, value);
1783 private int InternalVerticalScrollPosition
1787 int verticalScrollPosition;
1788 using (var propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1790 propertyValue.Get(out verticalScrollPosition);
1792 return verticalScrollPosition;
1796 using (var propertyValue = new PropertyValue(value))
1798 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1799 NotifyPropertyChanged();
1805 /// PrimaryCursorPosition property.<br />
1806 /// Specify the position of the primary cursor (caret) in text control.
1809 /// 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).
1811 /// <since_tizen> 10 </since_tizen>
1812 public int PrimaryCursorPosition
1816 return (int)GetValue(PrimaryCursorPositionProperty);
1820 SetValue(PrimaryCursorPositionProperty, value);
1824 private int InternalPrimaryCursorPosition
1828 int primaryCursorPosition;
1829 using (var propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1831 propertyValue.Get(out primaryCursorPosition);
1833 return primaryCursorPosition;
1837 using (var propertyValue = new PropertyValue(value))
1839 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1840 NotifyPropertyChanged();
1846 /// The GrabHandleColor property.
1849 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1851 [EditorBrowsable(EditorBrowsableState.Never)]
1852 public Color GrabHandleColor
1856 Color temp = (Color)GetValue(GrabHandleColorProperty);
1857 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1861 SetValue(GrabHandleColorProperty, value);
1862 NotifyPropertyChanged();
1867 /// Set InputFilter to TextEditor.
1869 /// <param name="inputFilter">The InputFilter</param>
1871 /// <see cref="Tizen.NUI.Text.InputFilter"/> filters input based on regular expressions. <br />
1872 /// InputFiltered signal is emitted when the input is filtered by InputFilter <br />
1873 /// See <see cref="InputFiltered"/>, <see cref="InputFilterType"/> and <see cref="InputFilteredEventArgs"/> for a detailed description.
1876 /// The following example demonstrates how to use the SetInputFilter method.
1878 /// var inputFilter = new Tizen.NUI.Text.InputFilter();
1879 /// inputFilter.Accepted = @"[\d]"; // accept whole digits
1880 /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3
1881 /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9
1884 /// <since_tizen> 9 </since_tizen>
1885 public void SetInputFilter(InputFilter inputFilter)
1887 using (var map = TextMapHelper.GetInputFilterMap(inputFilter))
1888 using (var propertyValue = new PropertyValue(map))
1890 SetProperty(TextEditor.Property.InputFilter, propertyValue);
1895 /// Get InputFilter from TextEditor. <br />
1897 /// <returns>The InputFilter</returns>
1899 /// <see cref="Tizen.NUI.Text.InputFilter"/>
1901 /// <since_tizen> 9 </since_tizen>
1902 public InputFilter GetInputFilter()
1904 InputFilter inputFilter;
1905 using (var propertyValue = GetProperty(TextEditor.Property.InputFilter))
1906 using (var map = new PropertyMap())
1908 propertyValue.Get(map);
1909 inputFilter = TextMapHelper.GetInputFilterStruct(map);
1915 /// Set Strikethrough to TextEditor. <br />
1917 /// <param name="strikethrough">The Strikethrough</param>
1919 /// SetStrikethrough specifies the strikethrough of the text through <see cref="Tizen.NUI.Text.Strikethrough"/>. <br />
1922 /// The following example demonstrates how to use the SetStrikethrough method.
1924 /// var strikethrough = new Tizen.NUI.Text.Strikethrough();
1925 /// strikethrough.Enable = true;
1926 /// strikethrough.Color = new Color("#3498DB");
1927 /// strikethrough.Height = 2.0f;
1928 /// editor.SetStrikethrough(strikethrough);
1931 [EditorBrowsable(EditorBrowsableState.Never)]
1932 public void SetStrikethrough(Strikethrough strikethrough)
1934 using (var map = TextMapHelper.GetStrikethroughMap(strikethrough))
1935 using (var propertyValue = new PropertyValue(map))
1937 SetProperty(TextEditor.Property.Strikethrough, propertyValue);
1942 /// Get Strikethrough from TextEditor. <br />
1944 /// <returns>The Strikethrough</returns>
1946 /// <see cref="Tizen.NUI.Text.Strikethrough"/>
1948 [EditorBrowsable(EditorBrowsableState.Never)]
1949 public Strikethrough GetStrikethrough()
1951 Strikethrough strikethrough;
1952 using (var propertyValue = GetProperty(TextEditor.Property.Strikethrough))
1953 using (var map = new PropertyMap())
1955 propertyValue.Get(map);
1956 strikethrough = TextMapHelper.GetStrikethroughStruct(map);
1958 return strikethrough;
1962 /// The Placeholder property.
1963 /// The placeholder map contains the following keys :<br />
1964 /// <list type="table">
1965 /// <item><term>text (string)</term><description>The text to display when the TextEditor is empty and inactive</description></item>
1966 /// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
1967 /// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
1968 /// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
1969 /// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
1970 /// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
1971 /// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
1972 /// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
1976 /// The following example demonstrates how to set the placeholder property.
1978 /// PropertyMap propertyMap = new PropertyMap();
1979 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1980 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1981 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1982 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1983 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1985 /// PropertyMap fontStyleMap = new PropertyMap();
1986 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1987 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1988 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1989 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1991 /// TextEditor editor = new TextEditor();
1992 /// editor.Placeholder = propertyMap;
1995 /// <since_tizen> 3 </since_tizen>
1996 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")]
1997 public Tizen.NUI.PropertyMap Placeholder
2001 PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
2002 string defalutText = "";
2004 if (TextMapHelper.IsValue(map, 0))
2005 map.Add("text", TextMapHelper.GetStringFromMap(map, 0, defalutText));
2007 if (TextMapHelper.IsValue(map, 1))
2008 map.Add("textFocused", TextMapHelper.GetStringFromMap(map, 1, defalutText));
2010 if (TextMapHelper.IsValue(map, 2))
2012 using (var color = TextMapHelper.GetColorFromMap(map, 2))
2014 map.Add("color", color);
2018 if (TextMapHelper.IsValue(map, 3))
2019 map.Add("fontFamily", TextMapHelper.GetStringFromMap(map, 3, defalutText));
2021 if (TextMapHelper.IsValue(map, 4))
2023 using (var properyValue = map.Find(4))
2024 using (var fontStyle = new PropertyMap())
2026 properyValue.Get(fontStyle);
2027 using (var fontStyleValue = new PropertyValue(fontStyle))
2029 map.Add("fontStyle", fontStyleValue);
2034 if (TextMapHelper.IsValue(map, 5))
2035 map.Add("pointSize", TextMapHelper.GetNullableFloatFromMap(map, 5));
2037 if (TextMapHelper.IsValue(map, 6))
2038 map.Add("pixelSize", TextMapHelper.GetNullableFloatFromMap(map, 6));
2040 if (TextMapHelper.IsValue(map, 7))
2041 map.Add("ellipsis", TextMapHelper.GetBoolFromMap(map, 7, false));
2047 SetValue(PlaceholderProperty, value);
2048 NotifyPropertyChanged();
2053 /// Set Placeholder to TextEditor. <br />
2055 /// <param name="placeholder">The Placeholder</param>
2057 /// SetPlaceholder specifies the attributes of the placeholder property through <see cref="Tizen.NUI.Text.Placeholder"/>. <br />
2060 /// The following example demonstrates how to use the SetPlaceholder method.
2062 /// var placeholder = new Tizen.NUI.Text.Placeholder();
2063 /// placeholder.Text = "placeholder text";
2064 /// placeholder.TextFocused = "placeholder textFocused";
2065 /// placeholder.Color = new Color("#45B39D");
2066 /// placeholder.FontFamily = "BreezeSans";
2067 /// placeholder.FontStyle = new Tizen.NUI.Text.FontStyle()
2069 /// Width = FontWidthType.Expanded,
2070 /// Weight = FontWeightType.ExtraLight,
2071 /// Slant = FontSlantType.Italic,
2073 /// placeholder.PointSize = 25.0f;
2074 /// //placeholder.PixelSize = 50.0f;
2075 /// placeholder.Ellipsis = true;
2076 /// editor.SetPlaceholder(placeholder);
2079 [EditorBrowsable(EditorBrowsableState.Never)]
2080 public void SetPlaceholder(Placeholder placeholder)
2082 using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
2084 SetValue(PlaceholderProperty, placeholderMap);
2089 /// Get Placeholder from TextEditor. <br />
2091 /// <returns>The Placeholder</returns>
2093 /// <see cref="Tizen.NUI.Text.Placeholder"/>
2095 [EditorBrowsable(EditorBrowsableState.Never)]
2096 public Placeholder GetPlaceholder()
2098 Placeholder placeholder;
2099 using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
2101 placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
2107 /// The Ellipsis property.<br />
2108 /// Enable or disable the ellipsis.<br />
2110 /// <since_tizen> 9 </since_tizen>
2111 public bool Ellipsis
2115 return (bool)GetValue(EllipsisProperty);
2119 SetValue(EllipsisProperty, value);
2120 NotifyPropertyChanged();
2126 /// The ellipsis position of the text.
2127 /// Specifies which portion of the text should be replaced with an ellipsis when the text size exceeds the layout size.<br />
2129 /// <since_tizen> 9 </since_tizen>
2130 public EllipsisPosition EllipsisPosition
2134 return (EllipsisPosition)GetValue(EllipsisPositionProperty);
2138 SetValue(EllipsisPositionProperty, value);
2139 NotifyPropertyChanged();
2144 /// The LineWrapMode property.<br />
2145 /// The line wrap mode when the text lines over the layout width.<br />
2147 /// <since_tizen> 4 </since_tizen>
2148 public LineWrapMode LineWrapMode
2152 return (LineWrapMode)GetValue(LineWrapModeProperty);
2156 SetValue(LineWrapModeProperty, value);
2157 NotifyPropertyChanged();
2162 /// Enables Text selection using Shift key.
2164 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2165 [EditorBrowsable(EditorBrowsableState.Never)]
2166 public bool EnableShiftSelection
2170 return (bool)GetValue(EnableShiftSelectionProperty);
2174 SetValue(EnableShiftSelectionProperty, value);
2175 NotifyPropertyChanged();
2180 /// The text alignment to match the direction of the system language.
2182 /// <since_tizen> 6 </since_tizen>
2183 public bool MatchSystemLanguageDirection
2187 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
2191 SetValue(MatchSystemLanguageDirectionProperty, value);
2192 NotifyPropertyChanged();
2197 /// The MaxLength property.<br />
2198 /// The maximum number of characters that can be inserted.<br />
2200 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
2201 [EditorBrowsable(EditorBrowsableState.Never)]
2202 public int MaxLength
2206 return (int)GetValue(MaxLengthProperty);
2210 SetValue(MaxLengthProperty, value);
2211 NotifyPropertyChanged();
2216 /// The FontSizeScale property. <br />
2217 /// The default value is 1.0. <br />
2218 /// The given font size scale value is used for multiplying the specified font size before querying fonts. <br />
2219 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
2221 /// <since_tizen> 9 </since_tizen>
2222 public float FontSizeScale
2226 return (float)GetValue(FontSizeScaleProperty);
2230 SetValue(FontSizeScaleProperty, value);
2231 NotifyPropertyChanged();
2235 private float InternalFontSizeScale
2239 return fontSizeScale;
2243 float newFontSizeScale;
2245 if (fontSizeScale == value) return;
2247 fontSizeScale = value;
2248 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
2250 SystemSettingsFontSize systemSettingsFontSize;
2254 systemSettingsFontSize = SystemSettings.FontSize;
2258 Console.WriteLine("{0} Exception caught.", e);
2259 systemSettingsFontSize = SystemSettingsFontSize.Normal;
2261 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
2262 AddSystemSettingsFontSizeChanged();
2266 newFontSizeScale = fontSizeScale;
2267 RemoveSystemSettingsFontSizeChanged();
2270 SetInternalFontSizeScale(newFontSizeScale);
2274 private void SetInternalFontSizeScale(float fontSizeScale)
2276 Object.InternalSetPropertyFloat(this.SwigCPtr, TextEditor.Property.FontSizeScale, (float)fontSizeScale);
2280 /// The EnableFontSizeScale property.<br />
2281 /// Whether the font size scale is enabled. (The default value is true)
2283 [EditorBrowsable(EditorBrowsableState.Never)]
2284 public bool EnableFontSizeScale
2288 return (bool)GetValue(EnableFontSizeScaleProperty);
2292 SetValue(EnableFontSizeScaleProperty, value);
2293 NotifyPropertyChanged();
2298 /// The InputMethodSettings property.<br />
2299 /// The settings to relating to the System's Input Method, Key and Value.<br />
2302 /// <see cref="InputMethod"/> is a class encapsulating the input method map. Use the <see cref="InputMethod"/> class for this property.
2305 /// The following example demonstrates how to set the InputMethodSettings property.
2307 /// InputMethod method = new InputMethod();
2308 /// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
2309 /// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
2310 /// method.AutoCapital = InputMethod.AutoCapitalType.Word;
2311 /// method.Variation = 1;
2312 /// textEditor.InputMethodSettings = method.OutputMap;
2315 [EditorBrowsable(EditorBrowsableState.Never)]
2316 public PropertyMap InputMethodSettings
2320 return (PropertyMap)GetValue(InputMethodSettingsProperty);
2324 SetValue(InputMethodSettingsProperty, value);
2325 NotifyPropertyChanged();
2330 /// Scroll the text control by specific amount..
2332 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
2333 [EditorBrowsable(EditorBrowsableState.Never)]
2334 public void ScrollBy(Vector2 scroll)
2336 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
2337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2341 /// Get the InputMethodContext instance.
2343 /// <returns>The InputMethodContext instance.</returns>
2344 /// <since_tizen> 5 </since_tizen>
2345 public InputMethodContext GetInputMethodContext()
2347 if (inputMethodContext == null)
2349 /*Avoid raising InputMethodContext reference count.*/
2350 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
2351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2353 return inputMethodContext;
2357 /// Select the whole text.
2359 /// <since_tizen> 9 </since_tizen>
2360 public void SelectWholeText()
2362 Interop.TextEditor.SelectWholeText(SwigCPtr);
2363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2367 /// Select text from start to end index. <br />
2368 /// The index is valid when 0 or positive.
2370 /// <param name="start">The start index for selection.</param>
2371 /// <param name="end">The end index for selection.</param>
2373 /// If the end index exceeds the maximum value, it is set to the length of the text.
2375 /// <since_tizen> 9 </since_tizen>
2376 public void SelectText(int start, int end)
2379 throw new global::System.ArgumentOutOfRangeException(nameof(start), "Value is less than zero");
2381 throw new global::System.ArgumentOutOfRangeException(nameof(end), "Value is less than zero");
2383 Interop.TextEditor.SelectText(SwigCPtr, (uint)start, (uint)end);
2384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2388 /// Clear selection of the text. <br />
2389 /// Valid when selection is activate.
2391 /// <since_tizen> 9 </since_tizen>
2392 public void SelectNone()
2394 _ = Interop.TextEditor.SelectNone(SwigCPtr);
2395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2399 /// The Enable grab handle property.<br />
2400 /// Enables the grab handles for text selection.<br />
2401 /// The default value is true, which means the grab handles are enabled by default.<br />
2403 [EditorBrowsable(EditorBrowsableState.Never)]
2404 public bool EnableGrabHandle
2408 return (bool)GetValue(EnableGrabHandleProperty);
2412 SetValue(EnableGrabHandleProperty, value);
2413 NotifyPropertyChanged();
2418 /// The Enable grab handle popup property.<br />
2419 /// Enables the grab handle popup for text selection.<br />
2420 /// The default value is true, which means the grab handle popup is enabled by default.<br />
2422 [EditorBrowsable(EditorBrowsableState.Never)]
2423 public bool EnableGrabHandlePopup
2427 return (bool)GetValue(EnableGrabHandlePopupProperty);
2431 SetValue(EnableGrabHandlePopupProperty, value);
2432 NotifyPropertyChanged();
2437 /// Minimum line size to be used.<br />
2438 /// The height of the line in points. <br />
2439 /// If the font size is larger than the line size, it works with the font size. <br />
2441 [EditorBrowsable(EditorBrowsableState.Never)]
2442 public float MinLineSize
2446 return (float)GetValue(MinLineSizeProperty);
2450 SetValue(MinLineSizeProperty, value);
2451 NotifyPropertyChanged();
2455 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
2457 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));
2458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2463 /// The spaces between characters in Pixels.
2465 /// A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).<br />
2466 /// The default value is 0.f which does nothing.
2469 [EditorBrowsable(EditorBrowsableState.Never)]
2470 public float CharacterSpacing
2474 return (float)GetValue(CharacterSpacingProperty);
2478 SetValue(CharacterSpacingProperty, value);
2479 NotifyPropertyChanged();
2486 /// <since_tizen> 3 </since_tizen>
2487 protected override void Dispose(DisposeTypes type)
2494 internalPlaceholderTextColor?.Dispose();
2495 internalPrimaryCursorColor?.Dispose();
2496 internalSecondaryCursorColor?.Dispose();
2497 internalSelectionHighlightColor?.Dispose();
2498 internalInputColor?.Dispose();
2499 internalTextColor?.Dispose();
2500 internalGrabHandleColor?.Dispose();
2502 if (hasSystemLanguageChanged)
2504 systemLocaleLanguageChanged.Remove(SystemSettings_LocaleLanguageChanged);
2507 RemoveSystemSettingsFontTypeChanged();
2508 RemoveSystemSettingsFontSizeChanged();
2510 //Release your own unmanaged resources here.
2511 //You should not access any managed member here except static instance.
2512 //because the execution order of Finalizes is non-deterministic.
2516 if (textEditorTextChangedCallbackDelegate != null)
2518 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
2521 if (textEditorMaxLengthReachedCallbackDelegate != null)
2523 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
2526 if (textEditorSelectionStartedCallbackDelegate != null)
2528 this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
2531 if (textEditorSelectionClearedCallbackDelegate != null)
2533 this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
2536 if (textEditorCursorPositionChangedCallbackDelegate != null)
2538 this.CursorPositionChangedSignal().Disconnect(textEditorCursorPositionChangedCallbackDelegate);
2541 if (textEditorSelectionChangedCallbackDelegate != null)
2543 this.SelectionChangedSignal().Disconnect(textEditorSelectionChangedCallbackDelegate);
2547 TextChanged -= TextEditorTextChanged;
2548 GetInputMethodContext()?.DestroyContext();
2553 /// This will not be public opened.
2554 [EditorBrowsable(EditorBrowsableState.Never)]
2555 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2557 Interop.TextEditor.DeleteTextEditor(swigCPtr);
2560 internal override LayoutItem CreateDefaultLayout()
2562 return new TextEditorLayout();
2565 internal void SetTextWithoutTextChanged(string text)
2567 invokeTextChanged = false;
2568 Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue(text));
2569 invokeTextChanged = true;
2572 private string SetTranslatable(string textEditorSid)
2574 string translatableText = null;
2575 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
2576 if (translatableText != null)
2578 if (hasSystemLanguageChanged == false)
2580 systemLocaleLanguageChanged.Add(SystemSettings_LocaleLanguageChanged);
2581 hasSystemLanguageChanged = true;
2583 return translatableText;
2587 translatableText = "";
2588 return translatableText;
2592 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
2594 if (textEditorTextSid != null)
2596 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2598 if (textEditorPlaceHolderTextSid != null)
2600 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
2604 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
2606 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
2607 SetInternalFontSizeScale(newFontSizeScale);
2610 private void AddSystemSettingsFontSizeChanged()
2612 if (hasSystemFontSizeChanged != true)
2616 SystemFontSizeChangedManager.Add(SystemSettingsFontSizeChanged);
2617 hasSystemFontSizeChanged = true;
2621 Console.WriteLine("{0} Exception caught.", e);
2622 hasSystemFontSizeChanged = false;
2627 private void RemoveSystemSettingsFontSizeChanged()
2629 if (hasSystemFontSizeChanged == true)
2633 SystemFontSizeChangedManager.Remove(SystemSettingsFontSizeChanged);
2634 hasSystemFontSizeChanged = false;
2638 Console.WriteLine("{0} Exception caught.", e);
2639 hasSystemFontSizeChanged = true;
2644 private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
2646 SetInternalFontFamily(e.Value);
2649 private void AddSystemSettingsFontTypeChanged()
2651 if (HasStyle() && !hasSystemFontTypeChanged)
2655 systemFontTypeChanged.Add(SystemSettingsFontTypeChanged);
2656 hasSystemFontTypeChanged = true;
2660 Console.WriteLine("{0} Exception caught.", e);
2661 hasSystemFontTypeChanged = false;
2666 private void RemoveSystemSettingsFontTypeChanged()
2668 if (hasSystemFontTypeChanged)
2672 systemFontTypeChanged.Remove(SystemSettingsFontTypeChanged);
2673 hasSystemFontTypeChanged = false;
2677 Console.WriteLine("{0} Exception caught.", e);
2678 hasSystemFontTypeChanged = true;
2683 private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
2685 if (!isSettingTextInCSharp)
2687 EnforceNotifyBindedInstance(TextProperty);
2691 internal new class Property
2693 internal static readonly int TEXT = Interop.TextEditor.TextGet();
2694 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
2695 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
2696 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
2697 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
2698 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
2699 internal static readonly int VerticalAlignment = Interop.TextEditor.VerticalAlignmentGet();
2700 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
2701 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
2702 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
2703 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
2704 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
2705 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
2706 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
2707 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
2708 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
2709 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
2710 internal static readonly int SelectionPopupStyle = Interop.TextEditor.SelectionPopupStyleGet();
2711 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
2712 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
2713 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
2714 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
2715 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
2716 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
2717 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
2718 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
2719 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
2720 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
2721 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
2722 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
2723 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
2724 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
2725 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
2726 internal static readonly int RelativeLineHeight = Interop.TextEditor.RelativeLineHeightGet();
2727 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
2728 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
2729 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
2730 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
2731 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
2732 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
2733 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
2734 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
2735 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
2736 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
2737 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
2738 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
2739 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
2740 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
2741 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
2742 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
2743 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
2744 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
2745 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
2746 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
2747 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
2748 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
2749 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
2750 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
2751 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
2752 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
2753 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
2754 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
2755 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
2756 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
2757 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
2758 internal static readonly int EnableFontSizeScale = Interop.TextEditor.EnableFontSizeScaleGet();
2759 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
2760 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
2761 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
2762 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
2763 internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
2764 internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
2765 internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
2766 internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
2767 internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
2768 internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
2771 internal class InputStyle
2777 FontFamily = 0x0002,
2780 LineSpacing = 0x0010,
2788 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
2790 DecorationBoundingBox = new Rectangle(x, y, width, height);
2792 private void OnInputColorChanged(float x, float y, float z, float w)
2794 InputColor = new Vector4(x, y, z, w);
2796 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
2798 PlaceholderTextColor = new Color(r, g, b, a);
2800 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
2802 PrimaryCursorColor = new Vector4(x, y, z, w);
2804 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
2806 SecondaryCursorColor = new Vector4(x, y, z, w);
2808 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
2810 SelectionHighlightColor = new Vector4(x, y, z, w);
2812 private void OnTextColorChanged(float x, float y, float z, float w)
2814 TextColor = new Vector4(x, y, z, w);
2816 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
2818 GrabHandleColor = new Color(r, g, b, a);
2821 internal class TextEditorLayout : LayoutItem
2823 protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
2825 // Padding will be automatically applied by DALi TextEditor.
2826 var totalWidth = widthMeasureSpec.Size.AsDecimal();
2827 var totalHeight = heightMeasureSpec.Size.AsDecimal();
2828 var minSize = Owner.MinimumSize;
2829 var maxSize = Owner.MaximumSize;
2830 var naturalSize = Owner.GetNaturalSize();
2832 if (((TextEditor)Owner).Text.Length == 0)
2834 // Calculate height of TextEditor by setting Text with " ".
2835 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2836 ((TextEditor)Owner).SetTextWithoutTextChanged(" ");
2838 // Store original WidthSpecification to restore it after setting ResizePolicy.
2839 var widthSpecification = Owner.WidthSpecification;
2841 // In DALi's Size logic, if Width or Height is set to be 0, then
2842 // ResizePolicy is not changed to Fixed.
2843 // This causes Size changes after NUI Layout's OnMeasure is finished.
2844 // e.g. TextEditor's Width fills to its parent although Text is null and
2845 // WidthSpecification is WrapContent.
2846 // To prevent the Size changes, WidthResizePolicy is set to be Fixed
2847 // in advance if Text is null.
2848 Owner.WidthResizePolicy = ResizePolicyType.Fixed;
2850 // Restore WidthSpecification because ResizePolicy changes WidthSpecification.
2851 Owner.WidthSpecification = widthSpecification;
2853 naturalSize = Owner.GetNaturalSize();
2855 // Restore TextEditor's Text after calculating height of TextEditor.
2856 // By calling SetTextWithoutTextChanged, TextChanged callback is not called for this.
2857 ((TextEditor)Owner).SetTextWithoutTextChanged("");
2860 if (widthMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2862 totalWidth = Math.Min(Math.Max(naturalSize.Width, minSize.Width), maxSize.Width);
2865 if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
2867 totalHeight = Math.Min(Math.Max(naturalSize.Height, minSize.Height), maxSize.Height);
2870 widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
2871 heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
2873 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
2874 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
2876 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
2877 ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));