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 namespace Tizen.NUI.BaseComponents
28 /// A control which provides a multi-line editable text editor.
30 /// <since_tizen> 3 </since_tizen>
31 public partial class TextEditor : View
33 private string textEditorTextSid = null;
34 private string textEditorPlaceHolderTextSid = null;
35 private bool systemlangTextFlag = false;
36 private InputMethodContext inputMethodContext = null;
37 private float fontSizeScale = 1.0f;
38 private bool hasFontSizeChangedCallback = false;
40 static TextEditor() { }
43 /// Creates the TextEditor control.
45 /// <since_tizen> 3 </since_tizen>
46 public TextEditor() : this(Interop.TextEditor.New(), true)
48 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
52 /// Creates the TextEditor with specified style.
54 [EditorBrowsable(EditorBrowsableState.Never)]
55 public TextEditor(TextEditorStyle style) : this(Interop.TextLabel.New(), true, style: style)
60 /// Creates the TextEditor with setting the status of shown or hidden.
62 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
63 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public TextEditor(bool shown) : this(Interop.TextEditor.New(), true)
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true)
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style)
90 /// The TranslatableText property.<br />
91 /// The text can set the SID value.<br />
93 /// <exception cref='ArgumentNullException'>
94 /// ResourceManager about multilingual is null.
96 /// <since_tizen> 4 </since_tizen>
97 public string TranslatableText
101 return textEditorTextSid;
105 if (NUIApplication.MultilingualResourceManager == null)
107 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
109 textEditorTextSid = value;
110 Text = SetTranslatable(textEditorTextSid);
111 NotifyPropertyChanged();
115 /// The TranslatablePlaceholderText property.<br />
116 /// The text can set the SID value.<br />
118 /// <exception cref='ArgumentNullException'>
119 /// ResourceManager about multilingual is null.
121 /// <since_tizen> 4 </since_tizen>
122 public string TranslatablePlaceholderText
126 return textEditorPlaceHolderTextSid;
130 if (NUIApplication.MultilingualResourceManager == null)
132 throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
134 textEditorPlaceHolderTextSid = value;
135 PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
136 NotifyPropertyChanged();
141 /// The Text property.
143 /// <since_tizen> 3 </since_tizen>
148 return (string)GetValue(TextProperty);
152 SetValueAndForceSendChangeSignal(TextProperty, value);
153 NotifyPropertyChanged();
158 /// The TextColor property.
161 /// The property cascade chaining set is possible. For example, this (textEditor.TextColor.X = 0.1f;) is possible.
163 /// <since_tizen> 3 </since_tizen>
164 public Vector4 TextColor
168 Vector4 temp = (Vector4)GetValue(TextColorProperty);
169 return new Vector4(OnTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
173 SetValue(TextColorProperty, value);
174 NotifyPropertyChanged();
179 /// The FontFamily property.
181 /// <since_tizen> 3 </since_tizen>
182 public string FontFamily
186 return (string)GetValue(FontFamilyProperty);
190 SetValue(FontFamilyProperty, value);
191 NotifyPropertyChanged();
196 /// The FontStyle property.
198 /// <since_tizen> 3 </since_tizen>
199 public PropertyMap FontStyle
203 return (PropertyMap)GetValue(FontStyleProperty);
207 SetValue(FontStyleProperty, value);
208 NotifyPropertyChanged();
213 /// The PointSize property.
215 /// <since_tizen> 3 </since_tizen>
216 public float PointSize
220 return (float)GetValue(PointSizeProperty);
224 SetValue(PointSizeProperty, value);
225 NotifyPropertyChanged();
230 /// The HorizontalAlignment property.
232 /// <since_tizen> 3 </since_tizen>
233 public HorizontalAlignment HorizontalAlignment
237 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
241 SetValue(HorizontalAlignmentProperty, value);
242 NotifyPropertyChanged();
247 /// The ScrollThreshold property.
249 /// <since_tizen> 3 </since_tizen>
250 public float ScrollThreshold
254 return (float)GetValue(ScrollThresholdProperty);
258 SetValue(ScrollThresholdProperty, value);
259 NotifyPropertyChanged();
264 /// The ScrollSpeed property.
266 /// <since_tizen> 3 </since_tizen>
267 public float ScrollSpeed
271 return (float)GetValue(ScrollSpeedProperty);
275 SetValue(ScrollSpeedProperty, value);
276 NotifyPropertyChanged();
281 /// The PrimaryCursorColor property.
284 /// The property cascade chaining set is possible. For example, this (textEditor.PrimaryCursorColor.X = 0.1f;) is possible.
286 /// <since_tizen> 3 </since_tizen>
287 public Vector4 PrimaryCursorColor
291 Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
292 return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
296 SetValue(PrimaryCursorColorProperty, value);
297 NotifyPropertyChanged();
302 /// The SecondaryCursorColor property.
305 /// The property cascade chaining set is possible. For example, this (textEditor.SecondaryCursorColor.X = 0.1f;) is possible.
307 /// <since_tizen> 3 </since_tizen>
308 public Vector4 SecondaryCursorColor
312 Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
313 return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
317 SetValue(SecondaryCursorColorProperty, value);
318 NotifyPropertyChanged();
323 /// The EnableCursorBlink property.
325 /// <since_tizen> 3 </since_tizen>
326 public bool EnableCursorBlink
330 return (bool)GetValue(EnableCursorBlinkProperty);
334 SetValue(EnableCursorBlinkProperty, value);
335 NotifyPropertyChanged();
340 /// The CursorBlinkInterval property.
342 /// <since_tizen> 3 </since_tizen>
343 public float CursorBlinkInterval
347 return (float)GetValue(CursorBlinkIntervalProperty);
351 SetValue(CursorBlinkIntervalProperty, value);
352 NotifyPropertyChanged();
357 /// The CursorBlinkDuration property.
359 /// <since_tizen> 3 </since_tizen>
360 public float CursorBlinkDuration
364 return (float)GetValue(CursorBlinkDurationProperty);
368 SetValue(CursorBlinkDurationProperty, value);
369 NotifyPropertyChanged();
374 /// The CursorWidth property.
376 /// <since_tizen> 3 </since_tizen>
377 public int CursorWidth
381 return (int)GetValue(CursorWidthProperty);
385 SetValue(CursorWidthProperty, value);
386 NotifyPropertyChanged();
391 /// The GrabHandleImage property.
393 /// <since_tizen> 3 </since_tizen>
394 public string GrabHandleImage
398 return (string)GetValue(GrabHandleImageProperty);
402 SetValue(GrabHandleImageProperty, value);
403 NotifyPropertyChanged();
408 /// The GrabHandlePressedImage property.
410 /// <since_tizen> 3 </since_tizen>
411 public string GrabHandlePressedImage
415 return (string)GetValue(GrabHandlePressedImageProperty);
419 SetValue(GrabHandlePressedImageProperty, value);
420 NotifyPropertyChanged();
425 /// The SelectionHandleImageLeft property.
427 /// <since_tizen> 3 </since_tizen>
428 public PropertyMap SelectionHandleImageLeft
432 return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
436 SetValue(SelectionHandleImageLeftProperty, value);
437 NotifyPropertyChanged();
442 /// The SelectionHandleImageRight property.
444 /// <since_tizen> 3 </since_tizen>
445 public PropertyMap SelectionHandleImageRight
449 return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
453 SetValue(SelectionHandleImageRightProperty, value);
454 NotifyPropertyChanged();
459 /// The SelectionHandlePressedImageLeft property.
461 /// <since_tizen> 3 </since_tizen>
462 public PropertyMap SelectionHandlePressedImageLeft
466 return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
470 SetValue(SelectionHandlePressedImageLeftProperty, value);
471 NotifyPropertyChanged();
476 /// The SelectionHandlePressedImageRight property.
478 /// <since_tizen> 3 </since_tizen>
479 public PropertyMap SelectionHandlePressedImageRight
483 return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
487 SetValue(SelectionHandlePressedImageRightProperty, value);
488 NotifyPropertyChanged();
493 /// The SelectionHandleMarkerImageLeft property.
495 /// <since_tizen> 3 </since_tizen>
496 public PropertyMap SelectionHandleMarkerImageLeft
500 return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
504 SetValue(SelectionHandleMarkerImageLeftProperty, value);
505 NotifyPropertyChanged();
510 /// The SelectionHandleMarkerImageRight property.
512 /// <since_tizen> 3 </since_tizen>
513 public PropertyMap SelectionHandleMarkerImageRight
517 return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
521 SetValue(SelectionHandleMarkerImageRightProperty, value);
522 NotifyPropertyChanged();
527 /// The SelectionHighlightColor property.
530 /// The property cascade chaining set is possible. For example, this (textEditor.SelectionHighlightColor.X = 0.1f;) is possible.
532 /// <since_tizen> 3 </since_tizen>
533 public Vector4 SelectionHighlightColor
537 Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
538 return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
542 SetValue(SelectionHighlightColorProperty, value);
543 NotifyPropertyChanged();
548 /// The DecorationBoundingBox property.
551 /// The property cascade chaining set is possible. For example, this (textEditor.DecorationBoundingBox.X = 1;) is possible.
553 /// <since_tizen> 3 </since_tizen>
554 public Rectangle DecorationBoundingBox
558 Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
559 return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
563 SetValue(DecorationBoundingBoxProperty, value);
564 NotifyPropertyChanged();
569 /// The EnableMarkup property.
571 /// <since_tizen> 3 </since_tizen>
572 public bool EnableMarkup
576 return (bool)GetValue(EnableMarkupProperty);
580 SetValue(EnableMarkupProperty, value);
581 NotifyPropertyChanged();
586 /// The InputColor property.
589 /// The property cascade chaining set is possible. For example, this (textEditor.InputColor.X = 0.1f;) is possible.
591 /// <since_tizen> 3 </since_tizen>
592 public Vector4 InputColor
596 Vector4 temp = (Vector4)GetValue(InputColorProperty);
597 return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
601 SetValue(InputColorProperty, value);
602 NotifyPropertyChanged();
607 /// The InputFontFamily property.
609 /// <since_tizen> 3 </since_tizen>
610 public string InputFontFamily
614 return (string)GetValue(InputFontFamilyProperty);
618 SetValue(InputFontFamilyProperty, value);
619 NotifyPropertyChanged();
624 /// The InputFontStyle property.
626 /// <since_tizen> 3 </since_tizen>
627 public PropertyMap InputFontStyle
631 return (PropertyMap)GetValue(InputFontStyleProperty);
635 SetValue(InputFontStyleProperty, value);
636 NotifyPropertyChanged();
641 /// The InputPointSize property.
643 /// <since_tizen> 3 </since_tizen>
644 public float InputPointSize
648 return (float)GetValue(InputPointSizeProperty);
652 SetValue(InputPointSizeProperty, value);
653 NotifyPropertyChanged();
658 /// The LineSpacing property.
660 /// <since_tizen> 3 </since_tizen>
661 public float LineSpacing
665 return (float)GetValue(LineSpacingProperty);
669 SetValue(LineSpacingProperty, value);
670 NotifyPropertyChanged();
675 /// The InputLineSpacing property.
677 /// <since_tizen> 3 </since_tizen>
678 public float InputLineSpacing
682 return (float)GetValue(InputLineSpacingProperty);
686 SetValue(InputLineSpacingProperty, value);
687 NotifyPropertyChanged();
692 /// The Underline property.
694 /// <since_tizen> 3 </since_tizen>
695 public PropertyMap Underline
699 return (PropertyMap)GetValue(UnderlineProperty);
703 SetValue(UnderlineProperty, value);
704 NotifyPropertyChanged();
709 /// The InputUnderline property.
711 /// <since_tizen> 3 </since_tizen>
712 public string InputUnderline
716 return (string)GetValue(InputUnderlineProperty);
720 SetValue(InputUnderlineProperty, value);
721 NotifyPropertyChanged();
726 /// The Shadow property.
728 /// <since_tizen> 3 </since_tizen>
729 public PropertyMap Shadow
733 return (PropertyMap)GetValue(ShadowProperty);
737 SetValue(ShadowProperty, value);
738 NotifyPropertyChanged();
743 /// The InputShadow property.
745 /// <since_tizen> 3 </since_tizen>
746 public string InputShadow
750 return (string)GetValue(InputShadowProperty);
754 SetValue(InputShadowProperty, value);
755 NotifyPropertyChanged();
760 /// The Emboss property.
762 /// <since_tizen> 3 </since_tizen>
767 return (string)GetValue(EmbossProperty);
771 SetValue(EmbossProperty, value);
772 NotifyPropertyChanged();
777 /// The InputEmboss property.
779 /// <since_tizen> 3 </since_tizen>
780 public string InputEmboss
784 return (string)GetValue(InputEmbossProperty);
788 SetValue(InputEmbossProperty, value);
789 NotifyPropertyChanged();
794 /// The Outline property.
796 /// <since_tizen> 3 </since_tizen>
797 public PropertyMap Outline
801 return (PropertyMap)GetValue(OutlineProperty);
805 SetValue(OutlineProperty, value);
806 NotifyPropertyChanged();
811 /// The InputOutline property.
813 /// <since_tizen> 3 </since_tizen>
814 public string InputOutline
818 return (string)GetValue(InputOutlineProperty);
822 SetValue(InputOutlineProperty, value);
823 NotifyPropertyChanged();
828 /// The SmoothScroll property.
830 /// <since_tizen> 3 </since_tizen>
831 public bool SmoothScroll
835 return (bool)GetValue(SmoothScrollProperty);
839 SetValue(SmoothScrollProperty, value);
840 NotifyPropertyChanged();
845 /// The SmoothScrollDuration property.
847 /// <since_tizen> 3 </since_tizen>
848 public float SmoothScrollDuration
852 return (float)GetValue(SmoothScrollDurationProperty);
856 SetValue(SmoothScrollDurationProperty, value);
857 NotifyPropertyChanged();
862 /// The EnableScrollBar property.
864 /// <since_tizen> 3 </since_tizen>
865 public bool EnableScrollBar
869 return (bool)GetValue(EnableScrollBarProperty);
873 SetValue(EnableScrollBarProperty, value);
874 NotifyPropertyChanged();
879 /// The ScrollBarShowDuration property.
881 /// <since_tizen> 3 </since_tizen>
882 public float ScrollBarShowDuration
886 return (float)GetValue(ScrollBarShowDurationProperty);
890 SetValue(ScrollBarShowDurationProperty, value);
891 NotifyPropertyChanged();
896 /// The ScrollBarFadeDuration property.
898 /// <since_tizen> 3 </since_tizen>
899 public float ScrollBarFadeDuration
903 return (float)GetValue(ScrollBarFadeDurationProperty);
907 SetValue(ScrollBarFadeDurationProperty, value);
908 NotifyPropertyChanged();
913 /// The PixelSize property.
915 /// <since_tizen> 3 </since_tizen>
916 public float PixelSize
920 return (float)GetValue(PixelSizeProperty);
924 SetValue(PixelSizeProperty, value);
925 NotifyPropertyChanged();
930 /// The line count of the text.
932 /// <since_tizen> 3 </since_tizen>
938 GetProperty(TextEditor.Property.LineCount).Get(out temp);
944 /// The text to display when the TextEditor is empty and inactive.
946 /// <since_tizen> 3 </since_tizen>
947 public string PlaceholderText
951 return (string)GetValue(PlaceholderTextProperty);
955 SetValue(PlaceholderTextProperty, value);
956 NotifyPropertyChanged();
961 /// The Selected Text property (read-only).
963 [EditorBrowsable(EditorBrowsableState.Never)]
964 public string SelectedText
969 GetProperty(TextEditor.Property.SelectedText).Get(out temp);
975 /// The Placeholder text color.
978 /// The property cascade chaining set is possible. For example, this (textEditor.PlaceholderTextColor.X = 0.1f;) is possible.
980 /// <since_tizen> 3 </since_tizen>
981 public Color PlaceholderTextColor
985 Color temp = (Color)GetValue(PlaceholderTextColorProperty);
986 return new Color(OnPlaceholderTextColorChanged, temp.R, temp.G, temp.B, temp.A);
990 SetValue(PlaceholderTextColorProperty, value);
991 NotifyPropertyChanged();
996 /// The EnableSelection property.
998 /// <since_tizen> 3 </since_tizen>
999 public bool EnableSelection
1003 return (bool)GetValue(EnableSelectionProperty);
1007 SetValue(EnableSelectionProperty, value);
1008 NotifyPropertyChanged();
1013 /// The start index for selection.
1015 /// <since_tizen> 8 </since_tizen>
1016 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1017 [EditorBrowsable(EditorBrowsableState.Never)]
1018 public int SelectedTextStart
1023 GetProperty(TextEditor.Property.SelectedTextStart).Get(out temp);
1028 SetProperty(TextEditor.Property.SelectedTextStart, new PropertyValue(value));
1029 NotifyPropertyChanged();
1034 /// The end index for selection.
1036 /// <since_tizen> 8 </since_tizen>
1037 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1038 [EditorBrowsable(EditorBrowsableState.Never)]
1039 public int SelectedTextEnd
1044 GetProperty(TextEditor.Property.SelectedTextEnd).Get(out temp);
1049 SetProperty(TextEditor.Property.SelectedTextEnd, new PropertyValue(value));
1050 NotifyPropertyChanged();
1055 /// Enable editing in text control.
1057 /// <since_tizen> 8 </since_tizen>
1058 /// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
1059 [EditorBrowsable(EditorBrowsableState.Never)]
1060 public bool EnableEditing
1065 GetProperty(TextEditor.Property.EnableEditing).Get(out temp);
1070 SetProperty(TextEditor.Property.EnableEditing, new PropertyValue(value));
1071 NotifyPropertyChanged();
1076 /// Specify horizontal scroll position in text control.
1078 [EditorBrowsable(EditorBrowsableState.Never)]
1079 public int HorizontalScrollPosition
1084 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition))
1086 propertyValue.Get(out temp);
1092 using (PropertyValue propertyValue = new PropertyValue(value))
1094 SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue);
1095 NotifyPropertyChanged();
1101 /// Specify vertical scroll position in text control.
1103 [EditorBrowsable(EditorBrowsableState.Never)]
1104 public int VerticalScrollPosition
1109 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition))
1111 propertyValue.Get(out temp);
1117 using (PropertyValue propertyValue = new PropertyValue(value))
1119 SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue);
1120 NotifyPropertyChanged();
1126 /// Specify primary cursor (caret) position in text control.
1128 [EditorBrowsable(EditorBrowsableState.Never)]
1129 public int PrimaryCursorPosition
1134 using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
1136 propertyValue.Get(out temp);
1142 using (PropertyValue propertyValue = new PropertyValue(value))
1144 SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
1145 NotifyPropertyChanged();
1151 /// The GrabHandleColor property.
1154 /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible.
1156 [EditorBrowsable(EditorBrowsableState.Never)]
1157 public Color GrabHandleColor
1161 Color temp = (Color)GetValue(GrabHandleColorProperty);
1162 return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
1166 SetValue(GrabHandleColorProperty, value);
1167 NotifyPropertyChanged();
1172 /// The Placeholder property.
1173 /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
1176 /// The following example demonstrates how to set the placeholder property.
1178 /// PropertyMap propertyMap = new PropertyMap();
1179 /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
1180 /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
1181 /// propertyMap.Add("color", new PropertyValue(Color.Red));
1182 /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
1183 /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
1185 /// PropertyMap fontStyleMap = new PropertyMap();
1186 /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1187 /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1188 /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1189 /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
1191 /// TextEditor editor = new TextEditor();
1192 /// editor.Placeholder = propertyMap;
1195 /// <since_tizen> 3 </since_tizen>
1196 public Tizen.NUI.PropertyMap Placeholder
1200 return (PropertyMap)GetValue(PlaceholderProperty);
1204 SetValue(PlaceholderProperty, value);
1205 NotifyPropertyChanged();
1210 /// The LineWrapMode property.<br />
1211 /// The line wrap mode when the text lines over the layout width.<br />
1213 /// <since_tizen> 4 </since_tizen>
1214 public LineWrapMode LineWrapMode
1218 return (LineWrapMode)GetValue(LineWrapModeProperty);
1222 SetValue(LineWrapModeProperty, value);
1223 NotifyPropertyChanged();
1228 /// Enables Text selection using Shift key.
1230 /// <since_tizen> 5 </since_tizen>
1231 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1232 [EditorBrowsable(EditorBrowsableState.Never)]
1233 public bool EnableShiftSelection
1237 return (bool)GetValue(EnableShiftSelectionProperty);
1241 SetValue(EnableShiftSelectionProperty, value);
1242 NotifyPropertyChanged();
1247 /// The text alignment to match the direction of the system language.
1249 /// <since_tizen> 6 </since_tizen>
1250 public bool MatchSystemLanguageDirection
1254 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1258 SetValue(MatchSystemLanguageDirectionProperty, value);
1259 NotifyPropertyChanged();
1264 /// The MaxLength property.
1266 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1267 [EditorBrowsable(EditorBrowsableState.Never)]
1268 public int MaxLength
1272 return (int)GetValue(MaxLengthProperty);
1276 SetValue(MaxLengthProperty, value);
1277 NotifyPropertyChanged();
1281 /// Only used by the IL of xaml, will never changed to not hidden.
1282 [EditorBrowsable(EditorBrowsableState.Never)]
1283 public override bool IsCreateByXaml
1287 return base.IsCreateByXaml;
1291 base.IsCreateByXaml = value;
1295 this.TextChanged += (obj, e) =>
1297 this.Text = e.TextEditor.Text;
1304 /// The FontSizeScale property. <br />
1305 /// The default value is 1.0. <br />
1306 /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
1308 /// <since_tizen> 9 </since_tizen>
1309 public float FontSizeScale
1313 return fontSizeScale;
1317 float newFontSizeScale;
1319 if (fontSizeScale == value) return;
1321 fontSizeScale = value;
1322 if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
1324 SystemSettingsFontSize systemSettingsFontSize;
1328 systemSettingsFontSize = SystemSettings.FontSize;
1332 Console.WriteLine("{0} Exception caught.", e);
1333 systemSettingsFontSize = SystemSettingsFontSize.Normal;
1335 newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
1336 addFontSizeChangedCallback();
1340 newFontSizeScale = fontSizeScale;
1341 removeFontSizeChangedCallback();
1344 SetValue(FontSizeScaleProperty, newFontSizeScale);
1345 NotifyPropertyChanged();
1350 /// The InputMethodSettings property.
1352 [EditorBrowsable(EditorBrowsableState.Never)]
1353 public PropertyMap InputMethodSettings
1357 return (PropertyMap)GetValue(InputMethodSettingsProperty);
1361 SetValue(InputMethodSettingsProperty, value);
1362 NotifyPropertyChanged();
1367 /// Scroll the text control by specific amount..
1369 /// <param name="scroll">The amount (in pixels) of scrolling in horizontal & vertical directions.</param>
1370 [EditorBrowsable(EditorBrowsableState.Never)]
1371 public void ScrollBy(Vector2 scroll)
1373 Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll));
1374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378 /// Get the InputMethodContext instance.
1380 /// <returns>The InputMethodContext instance.</returns>
1381 /// <since_tizen> 5 </since_tizen>
1382 public InputMethodContext GetInputMethodContext()
1384 if (inputMethodContext == null)
1386 /*Avoid raising InputMethodContext reference count.*/
1387 inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true);
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1390 return inputMethodContext;
1394 /// Select the whole text.
1396 [EditorBrowsable(EditorBrowsableState.Never)]
1397 public void SelectWholeText()
1399 Interop.TextEditor.SelectWholeText(SwigCPtr);
1400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1404 /// Clear selection of the text.
1406 [EditorBrowsable(EditorBrowsableState.Never)]
1407 public void SelectNone()
1409 _ = Interop.TextEditor.SelectNone(SwigCPtr);
1410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1414 /// Enable grab handle property.
1416 [EditorBrowsable(EditorBrowsableState.Never)]
1417 public bool EnableGrabHandle
1421 return (bool)GetValue(EnableGrabHandleProperty);
1425 SetValue(EnableGrabHandleProperty, value);
1426 NotifyPropertyChanged();
1431 /// Enable grab handle popup property.
1433 [EditorBrowsable(EditorBrowsableState.Never)]
1434 public bool EnableGrabHandlePopup
1438 return (bool)GetValue(EnableGrabHandlePopupProperty);
1442 SetValue(EnableGrabHandlePopupProperty, value);
1443 NotifyPropertyChanged();
1447 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditor obj)
1449 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1452 internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal()
1454 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));
1455 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1462 /// <since_tizen> 3 </since_tizen>
1463 protected override void Dispose(DisposeTypes type)
1470 if (systemlangTextFlag)
1472 SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
1475 removeFontSizeChangedCallback();
1477 //Release your own unmanaged resources here.
1478 //You should not access any managed member here except static instance.
1479 //because the execution order of Finalizes is non-deterministic.
1483 if (textEditorTextChangedCallbackDelegate != null)
1485 TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate);
1488 if (textEditorMaxLengthReachedCallbackDelegate != null)
1490 this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
1497 /// This will not be public opened.
1498 [EditorBrowsable(EditorBrowsableState.Never)]
1499 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1501 // In order to speed up IME hide, temporarily add
1502 GetInputMethodContext()?.DestroyContext();
1503 Interop.TextEditor.DeleteTextEditor(swigCPtr);
1506 private string SetTranslatable(string textEditorSid)
1508 string translatableText = null;
1509 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
1510 if (translatableText != null)
1512 if (systemlangTextFlag == false)
1514 SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
1515 systemlangTextFlag = true;
1517 return translatableText;
1521 translatableText = "";
1522 return translatableText;
1526 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1528 if (textEditorTextSid != null)
1530 Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1532 if (textEditorPlaceHolderTextSid != null)
1534 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
1538 private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
1540 float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
1541 SetValue(FontSizeScaleProperty, newFontSizeScale);
1542 NotifyPropertyChanged();
1545 private void addFontSizeChangedCallback()
1547 if (hasFontSizeChangedCallback != true)
1551 SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
1552 hasFontSizeChangedCallback = true;
1556 Console.WriteLine("{0} Exception caught.", e);
1557 hasFontSizeChangedCallback = false;
1562 private void removeFontSizeChangedCallback()
1564 if (hasFontSizeChangedCallback == true)
1568 SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
1569 hasFontSizeChangedCallback = false;
1573 Console.WriteLine("{0} Exception caught.", e);
1574 hasFontSizeChangedCallback = true;
1579 internal new class Property
1581 internal static readonly int TEXT = Interop.TextEditor.TextGet();
1582 internal static readonly int TextColor = Interop.TextEditor.TextColorGet();
1583 internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet();
1584 internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet();
1585 internal static readonly int PointSize = Interop.TextEditor.PointSizeGet();
1586 internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet();
1587 internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet();
1588 internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet();
1589 internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet();
1590 internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet();
1591 internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet();
1592 internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet();
1593 internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet();
1594 internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet();
1595 internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet();
1596 internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet();
1597 internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet();
1598 internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet();
1599 internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet();
1600 internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet();
1601 internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet();
1602 internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet();
1603 internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet();
1604 internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet();
1605 internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet();
1606 internal static readonly int InputColor = Interop.TextEditor.InputColorGet();
1607 internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet();
1608 internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet();
1609 internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
1610 internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
1611 internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
1612 internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
1613 internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
1614 internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
1615 internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet();
1616 internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet();
1617 internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet();
1618 internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet();
1619 internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet();
1620 internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet();
1621 internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet();
1622 internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet();
1623 internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet();
1624 internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet();
1625 internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet();
1626 internal static readonly int LineCount = Interop.TextEditor.LineCountGet();
1627 internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet();
1628 internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet();
1629 internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet();
1630 internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet();
1631 internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet();
1632 internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet();
1633 internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet();
1634 internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet();
1635 internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet();
1636 internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet();
1637 internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet();
1638 internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
1639 internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
1640 internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
1641 internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
1642 internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet();
1643 internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet();
1644 internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet();
1645 internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet();
1646 internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
1649 internal class InputStyle
1655 FontFamily = 0x0002,
1658 LineSpacing = 0x0010,
1666 private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
1668 DecorationBoundingBox = new Rectangle(x, y, width, height);
1670 private void OnInputColorChanged(float x, float y, float z, float w)
1672 InputColor = new Vector4(x, y, z, w);
1674 private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
1676 PlaceholderTextColor = new Color(r, g, b, a);
1678 private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
1680 PrimaryCursorColor = new Vector4(x, y, z, w);
1682 private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
1684 SecondaryCursorColor = new Vector4(x, y, z, w);
1686 private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
1688 SelectionHighlightColor = new Vector4(x, y, z, w);
1690 private void OnTextColorChanged(float x, float y, float z, float w)
1692 TextColor = new Vector4(x, y, z, w);
1694 private void OnGrabHandleColorChanged(float r, float g, float b, float a)
1696 GrabHandleColor = new Color(r, g, b, a);