X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FBaseComponents%2FTextEditor.cs;h=b1621c31d07acd9be82434efc40392a70825dc01;hb=308e593b8a453186b4a6275f68255d622a493f46;hp=1f425201341a8206fcc2acf3eecd6de825c284b5;hpb=b5f2167b13a48985763f70a979779f2bc35db894;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 1f42520..b1621c3 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2018 Samsung Electronics Co., Ltd. + * Copyright(c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ using TizenSystemSettings.Tizen.System; using System; using System.Globalization; using System.ComponentModel; +using Tizen.NUI.Text; namespace Tizen.NUI.BaseComponents { @@ -34,29 +35,41 @@ namespace Tizen.NUI.BaseComponents private string textEditorPlaceHolderTextSid = null; private bool systemlangTextFlag = false; private InputMethodContext inputMethodContext = null; + private float fontSizeScale = 1.0f; + private bool hasFontSizeChangedCallback = false; + + static TextEditor() { } /// /// Creates the TextEditor control. /// /// 3 - public TextEditor() : this(Interop.TextEditor.TextEditor_New(), true) + public TextEditor() : this(Interop.TextEditor.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// + /// Creates the TextEditor with specified style. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public TextEditor(TextEditorStyle style) : this(Interop.TextLabel.New(), true, style: style) + { + } + + /// /// Creates the TextEditor with setting the status of shown or hidden. /// /// false : Not displayed (hidden), true : displayed (shown) /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] - public TextEditor(bool shown) : this(Interop.TextEditor.TextEditor_New(), true) + public TextEditor(bool shown) : this(Interop.TextEditor.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SetVisible(shown); } - internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.new_TextEditor__SWIG_1(TextEditor.getCPtr(handle)), true) + internal TextEditor(TextEditor handle, bool shown = true) : this(Interop.TextEditor.NewTextEditor(TextEditor.getCPtr(handle)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -66,7 +79,7 @@ namespace Tizen.NUI.BaseComponents } } - internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextEditor.TextEditor_SWIGUpcast(cPtr), cMemoryOwn) + internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true, TextEditorStyle style = null) : base(cPtr, cMemoryOwn, style) { if (!shown) { @@ -182,8 +195,15 @@ namespace Tizen.NUI.BaseComponents /// /// The FontStyle property. + /// The fontStyle map contains the following keys :
+ /// + /// width (string)The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded) + /// weight (string)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) + /// slant (string)The slant key defines whether to use italics. (values: normal, roman, italic, oblique) + /// ///
/// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap FontStyle { get @@ -198,6 +218,44 @@ namespace Tizen.NUI.BaseComponents } /// + /// Set FontStyle to TextEditor.
+ ///
+ /// The FontStyle + /// + /// SetFontStyle specifies the requested font style through .
+ ///
+ /// + /// The following example demonstrates how to use the SetFontStyle method. + /// + /// var fontStyle = new Tizen.NUI.Text.FontStyle(); + /// fontStyle.Width = FontWidthType.Expanded; + /// fontStyle.Weight = FontWeightType.Bold; + /// fontStyle.Slant = FontSlantType.Italic; + /// editor.SetFontStyle(fontStyle); + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetFontStyle(FontStyle fontStyle) + { + SetProperty(TextEditor.Property.FontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle))); + } + + /// + /// Get FontStyle from TextEditor.
+ ///
+ /// The FontStyle + /// + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public FontStyle GetFontStyle() + { + var map = new PropertyMap(); + GetProperty(TextEditor.Property.FontStyle).Get(map); + return TextUtils.GetFontStyleStruct(map); + } + + /// /// The PointSize property. /// /// 3 @@ -411,6 +469,10 @@ namespace Tizen.NUI.BaseComponents /// /// The SelectionHandleImageLeft property. + /// The selectionHandleImageLeft map contains the following key :
+ /// + /// filename (string)The path of image file + /// ///
/// 3 public PropertyMap SelectionHandleImageLeft @@ -428,6 +490,10 @@ namespace Tizen.NUI.BaseComponents /// /// The SelectionHandleImageRight property. + /// The selectionHandleImageRight map contains the following key :
+ /// + /// filename (string)The path of image file + /// ///
/// 3 public PropertyMap SelectionHandleImageRight @@ -445,6 +511,10 @@ namespace Tizen.NUI.BaseComponents /// /// The SelectionHandlePressedImageLeft property. + /// The selectionHandlePressedImageLeft map contains the following key :
+ /// + /// filename (string)The path of image file + /// ///
/// 3 public PropertyMap SelectionHandlePressedImageLeft @@ -462,6 +532,10 @@ namespace Tizen.NUI.BaseComponents /// /// The SelectionHandlePressedImageRight property. + /// The selectionHandlePressedImageRight map contains the following key :
+ /// + /// filename (string)The path of image file + /// ///
/// 3 public PropertyMap SelectionHandlePressedImageRight @@ -479,6 +553,10 @@ namespace Tizen.NUI.BaseComponents /// /// The SelectionHandleMarkerImageLeft property. + /// The selectionHandleMarkerImageLeft map contains the following key :
+ /// + /// filename (string)The path of image file + /// ///
/// 3 public PropertyMap SelectionHandleMarkerImageLeft @@ -496,6 +574,10 @@ namespace Tizen.NUI.BaseComponents /// /// The SelectionHandleMarkerImageRight property. + /// The selectionHandleMarkerImageRight map contains the following key :
+ /// + /// filename (string)The path of image file + /// ///
/// 3 public PropertyMap SelectionHandleMarkerImageRight @@ -610,8 +692,15 @@ namespace Tizen.NUI.BaseComponents /// /// The InputFontStyle property. + /// The inputFontStyle map contains the following keys :
+ /// + /// width (string)The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded) + /// weight (string)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) + /// slant (string)The slant key defines whether to use italics. (values: normal, roman, italic, oblique) + /// ///
/// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap InputFontStyle { get @@ -626,6 +715,45 @@ namespace Tizen.NUI.BaseComponents } /// + /// Set InputFontStyle to TextEditor.
+ ///
+ /// The FontStyle + /// + /// SetInputFontStyle specifies the requested font style for new input text through .
+ ///
+ /// + /// The following example demonstrates how to use the SetInputFontStyle method. + /// + /// var fontStyle = new Tizen.NUI.Text.FontStyle(); + /// fontStyle.Width = FontWidthType.Expanded; + /// fontStyle.Weight = FontWeightType.Bold; + /// fontStyle.Slant = FontSlantType.Italic; + /// editor.SetInputFontStyle(fontStyle); + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetInputFontStyle(FontStyle fontStyle) + { + SetProperty(TextEditor.Property.InputFontStyle, new PropertyValue(TextUtils.GetFontStyleMap(fontStyle))); + NotifyPropertyChanged(); + } + + /// + /// Get InputFontStyle from TextEditor.
+ ///
+ /// The FontStyle + /// + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public FontStyle GetInputFontStyle() + { + var map = new PropertyMap(); + GetProperty(TextEditor.Property.InputFontStyle).Get(map); + return TextUtils.GetFontStyleStruct(map); + } + + /// /// The InputPointSize property. /// /// 3 @@ -678,8 +806,15 @@ namespace Tizen.NUI.BaseComponents /// /// The Underline property. + /// The underline map contains the following keys :
+ /// + /// enable (bool)Whether the underline is enabled (the default value is false) + /// color (Color)The color of the underline (If not provided then the color of the text is used) + /// height (float)The height in pixels of the underline (the default value is 1.f) + /// ///
/// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap Underline { get @@ -694,6 +829,44 @@ namespace Tizen.NUI.BaseComponents } /// + /// Set Underline to TextEditor.
+ ///
+ /// The Underline + /// + /// SetUnderline specifies the underline of the text through .
+ ///
+ /// + /// The following example demonstrates how to use the SetUnderline method. + /// + /// var underline = new Tizen.NUI.Text.Underline(); + /// underline.Enable = true; + /// underline.Color = new Color("#3498DB"); + /// underline.Height = 2.0f; + /// editor.SetUnderline(underline); + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetUnderline(Underline underline) + { + SetProperty(TextEditor.Property.UNDERLINE, new PropertyValue(TextUtils.GetUnderlineMap(underline))); + } + + /// + /// Get Underline from TextEditor.
+ ///
+ /// The Underline + /// + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Underline GetUnderline() + { + var map = new PropertyMap(); + GetProperty(TextEditor.Property.UNDERLINE).Get(map); + return TextUtils.GetUnderlineStruct(map); + } + + /// /// The InputUnderline property. /// /// 3 @@ -712,8 +885,15 @@ namespace Tizen.NUI.BaseComponents /// /// The Shadow property. + /// The shadow map contains the following keys :
+ /// + /// color (Color)The color of the shadow (the default color is Color.Black) + /// offset (Vector2)The offset in pixels of the shadow (If not provided then the shadow is not enabled) + /// blurRadius (float)The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled) + /// ///
/// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap Shadow { get @@ -728,6 +908,43 @@ namespace Tizen.NUI.BaseComponents } /// + /// Set Shadow to TextEditor.
+ ///
+ /// The Shadow + /// + /// SetShadow specifies the shadow of the text through .
+ ///
+ /// + /// The following example demonstrates how to use the SetShadow method. + /// + /// var shadow = new Tizen.NUI.Text.Shadow(); + /// shadow.Offset = new Vector2(3, 3); + /// shadow.Color = new Color("#F1C40F"); + /// editor.SetShadow(shadow); + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetShadow(Tizen.NUI.Text.Shadow shadow) + { + SetProperty(TextEditor.Property.SHADOW, new PropertyValue(TextUtils.GetShadowMap(shadow))); + } + + /// + /// Get Shadow from TextEditor.
+ ///
+ /// The Shadow + /// + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Tizen.NUI.Text.Shadow GetShadow() + { + var map = new PropertyMap(); + GetProperty(TextEditor.Property.SHADOW).Get(map); + return TextUtils.GetShadowStruct(map); + } + + /// /// The InputShadow property. /// /// 3 @@ -780,8 +997,14 @@ namespace Tizen.NUI.BaseComponents /// /// The Outline property. + /// The outline map contains the following keys :
+ /// + /// color (Color)The color of the outline (the default color is Color.White) + /// width (float)The width in pixels of the outline (If not provided then the outline is not enabled) + /// ///
/// 3 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1721: Property names should not match get methods")] public PropertyMap Outline { get @@ -796,6 +1019,43 @@ namespace Tizen.NUI.BaseComponents } /// + /// Set Outline to TextEditor.
+ ///
+ /// The Outline + /// + /// SetOutline specifies the outline of the text through .
+ ///
+ /// + /// The following example demonstrates how to use the SetOutline method. + /// + /// var outline = new Tizen.NUI.Text.Outline(); + /// outline.Width = 2.0f; + /// outline.Color = new Color("#45B39D"); + /// editor.SetOutline(outline); + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetOutline(Outline outline) + { + SetProperty(TextEditor.Property.OUTLINE, new PropertyValue(TextUtils.GetOutlineMap(outline))); + } + + /// + /// Get Outline from TextEditor.
+ ///
+ /// The Outline + /// + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Outline GetOutline() + { + var map = new PropertyMap(); + GetProperty(TextEditor.Property.OUTLINE).Get(map); + return TextUtils.GetOutlineStruct(map); + } + + /// /// The InputOutline property. /// /// 3 @@ -923,7 +1183,7 @@ namespace Tizen.NUI.BaseComponents get { int temp = 0; - GetProperty(TextEditor.Property.LINE_COUNT).Get(out temp); + GetProperty(TextEditor.Property.LineCount).Get(out temp); return temp; } } @@ -954,7 +1214,7 @@ namespace Tizen.NUI.BaseComponents get { string temp; - GetProperty(TextEditor.Property.SELECTED_TEXT).Get(out temp); + GetProperty(TextEditor.Property.SelectedText).Get(out temp); return temp; } } @@ -1008,12 +1268,12 @@ namespace Tizen.NUI.BaseComponents get { int temp; - GetProperty(TextEditor.Property.SELECTED_TEXT_START).Get(out temp); + GetProperty(TextEditor.Property.SelectedTextStart).Get(out temp); return temp; } set { - SetProperty(TextEditor.Property.SELECTED_TEXT_START, new PropertyValue(value)); + SetProperty(TextEditor.Property.SelectedTextStart, new PropertyValue(value)); NotifyPropertyChanged(); } } @@ -1029,16 +1289,17 @@ namespace Tizen.NUI.BaseComponents get { int temp; - GetProperty(TextEditor.Property.SELECTED_TEXT_END).Get(out temp); + GetProperty(TextEditor.Property.SelectedTextEnd).Get(out temp); return temp; } set { - SetProperty(TextEditor.Property.SELECTED_TEXT_END, new PropertyValue(value)); + SetProperty(TextEditor.Property.SelectedTextEnd, new PropertyValue(value)); NotifyPropertyChanged(); } } + /// /// Enable editing in text control. /// /// 8 @@ -1049,19 +1310,171 @@ namespace Tizen.NUI.BaseComponents get { bool temp; - GetProperty(TextEditor.Property.ENABLE_EDITING).Get(out temp); + GetProperty(TextEditor.Property.EnableEditing).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.EnableEditing, new PropertyValue(value)); + NotifyPropertyChanged(); + } + } + + /// + /// Specify horizontal scroll position in text control. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public int HorizontalScrollPosition + { + get + { + int temp; + using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HorizontalScrollPosition)) + { + propertyValue.Get(out temp); + } + return temp; + } + set + { + using (PropertyValue propertyValue = new PropertyValue(value)) + { + SetProperty(TextEditor.Property.HorizontalScrollPosition, propertyValue); + NotifyPropertyChanged(); + } + } + } + + /// + /// Specify vertical scroll position in text control. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public int VerticalScrollPosition + { + get + { + int temp; + using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VerticalScrollPosition)) + { + propertyValue.Get(out temp); + } + return temp; + } + set + { + using (PropertyValue propertyValue = new PropertyValue(value)) + { + SetProperty(TextEditor.Property.VerticalScrollPosition, propertyValue); + NotifyPropertyChanged(); + } + } + } + + /// + /// Specify primary cursor (caret) position in text control. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public int PrimaryCursorPosition + { + get + { + int temp; + using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition)) + { + propertyValue.Get(out temp); + } return temp; } set { - SetProperty(TextEditor.Property.ENABLE_EDITING, new PropertyValue(value)); + using (PropertyValue propertyValue = new PropertyValue(value)) + { + SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue); + NotifyPropertyChanged(); + } + } + } + + /// + /// The GrabHandleColor property. + /// + /// + /// The property cascade chaining set is possible. For example, this (textEditor.GrabHandleColor.X = 0.1f;) is possible. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public Color GrabHandleColor + { + get + { + Color temp = (Color)GetValue(GrabHandleColorProperty); + return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A); + } + set + { + SetValue(GrabHandleColorProperty, value); NotifyPropertyChanged(); } } /// + /// Set InputFilter to TextEditor.
+ ///
+ /// The InputFilter + /// + /// filters input based on regular expressions.
+ /// Users can set the Accepted or Rejected regular expression set, or both.
+ /// If both are used, Rejected has higher priority.
+ /// The character set must follow the regular expression rules.
+ /// Behaviour can not be guaranteed for incorrect grammars.
+ /// Refer the link below for detailed rules.
+ /// The functions in std::regex library use the ECMAScript grammar:
+ /// http://cplusplus.com/reference/regex/ECMAScript/
+ /// InputFiltered signal is emitted when the input is filtered by InputFilter
+ /// See , and for a detailed description.
+ ///
+ /// + /// The following example demonstrates how to use the SetInputFilter method. + /// + /// var inputFilter = new Tizen.NUI.Text.InputFilter(); + /// inputFilter.Accepted = @"[\d]"; // accept whole digits + /// inputFilter.Rejected = "[0-3]"; // reject 0, 1, 2, 3 + /// editor.SetInputFilter(inputFilter); // acceptable inputs are 4, 5, 6, 7, 8, 9 + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetInputFilter(InputFilter inputFilter) + { + SetProperty(TextEditor.Property.InputFilter, new PropertyValue(TextUtils.GetInputFilterMap(inputFilter))); + } + + /// + /// Get InputFilter from TextEditor.
+ ///
+ /// The InputFilter + /// + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public InputFilter GetInputFilter() + { + var map = new PropertyMap(); + GetProperty(TextEditor.Property.InputFilter).Get(map); + return TextUtils.GetInputFilterStruct(map); + } + + /// /// The Placeholder property. - /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size. + /// The placeholder map contains the following keys :
+ /// + /// text (string)The text to display when the TextEditor is empty and inactive + /// textFocused (string)The text to display when the placeholder has focus + /// color (Color)The color of the placeholder text + /// fontFamily (string)The fontFamily of the placeholder text + /// fontStyle (PropertyMap)The fontStyle of the placeholder text + /// pointSize (float)The pointSize of the placeholder text + /// pixelSize (float)The pixelSize of the placeholder text + /// ellipsis (bool)The ellipsis of the placeholder text + /// ///
/// /// The following example demonstrates how to set the placeholder property. @@ -1088,7 +1501,76 @@ namespace Tizen.NUI.BaseComponents { get { - return (PropertyMap)GetValue(PlaceholderProperty); + PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty); + PropertyValue value = null; + + // text + value = map.Find(0); + if (null != value) + { + value.Get(out string text); + map.Add("text", new PropertyValue(text)); + } + + // textFocused + value = map.Find(1); + if (null != value) + { + value.Get(out string textFocused); + map.Add("textFocused", new PropertyValue(textFocused)); + } + + // color + value = map.Find(2); + if (null != value) + { + Color color = new Color(); + value.Get(color); + map.Add("color", new PropertyValue(color)); + } + + // fontFamily + value = map.Find(3); + if (null != value) + { + value.Get(out string fontFamily); + map.Add("fontFamily", new PropertyValue(fontFamily)); + } + + // fontStyle + value = map.Find(4); + if (null != value) + { + PropertyMap fontStyle = new PropertyMap(); + value.Get(fontStyle); + map.Add("fontStyle", new PropertyValue(fontStyle)); + } + + // pointSize + value = map.Find(5); + if (null != value) + { + value.Get(out float pointSize); + map.Add("pointSize", new PropertyValue(pointSize)); + } + + // pixelSize + value = map.Find(6); + if (null != value) + { + value.Get(out float pixelSize); + map.Add("pixelSize", new PropertyValue(pixelSize)); + } + + // ellipsis + value = map.Find(7); + if (null != value) + { + value.Get(out bool ellipsis); + map.Add("ellipsis", new PropertyValue(ellipsis)); + } + + return map; } set { @@ -1098,6 +1580,44 @@ namespace Tizen.NUI.BaseComponents } /// + /// The Ellipsis property.
+ /// Enable or disable the ellipsis.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public bool Ellipsis + { + get + { + return (bool)GetValue(EllipsisProperty); + } + set + { + SetValue(EllipsisProperty, value); + NotifyPropertyChanged(); + } + } + + + /// + /// The ellipsis position of the text. + /// The ellipsis position type when the text size over the layout size.
+ /// The ellipsis position: End, Start or Middle.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public EllipsisPosition EllipsisPosition + { + get + { + return (EllipsisPosition)GetValue(EllipsisPositionProperty); + } + set + { + SetValue(EllipsisPositionProperty, value); + NotifyPropertyChanged(); + } + } + + /// /// The LineWrapMode property.
/// The line wrap mode when the text lines over the layout width.
///
@@ -1192,6 +1712,94 @@ namespace Tizen.NUI.BaseComponents } /// + /// The FontSizeScale property.
+ /// The default value is 1.0.
+ /// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally.
+ ///
+ /// 9 + public float FontSizeScale + { + get + { + return fontSizeScale; + } + set + { + float newFontSizeScale; + + if (fontSizeScale == value) return; + + fontSizeScale = value; + if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting) + { + SystemSettingsFontSize systemSettingsFontSize; + + try + { + systemSettingsFontSize = SystemSettings.FontSize; + } + catch (Exception e) + { + Console.WriteLine("{0} Exception caught.", e); + systemSettingsFontSize = SystemSettingsFontSize.Normal; + } + newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize); + addFontSizeChangedCallback(); + } + else + { + newFontSizeScale = fontSizeScale; + removeFontSizeChangedCallback(); + } + + SetValue(FontSizeScaleProperty, newFontSizeScale); + NotifyPropertyChanged(); + } + } + + /// + /// The InputMethodSettings property. + /// + /// + /// is a class encapsulating the input method map. Please use the class for this property. + /// + /// + /// The following example demonstrates how to set the InputMethodSettings property. + /// + /// InputMethod method = new InputMethod(); + /// method.PanelLayout = InputMethod.PanelLayoutType.Normal; + /// method.ActionButton = InputMethod.ActionButtonTitleType.Default; + /// method.AutoCapital = InputMethod.AutoCapitalType.Word; + /// method.Variation = 1; + /// textEditor.InputMethodSettings = method.OutputMap; + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public PropertyMap InputMethodSettings + { + get + { + return (PropertyMap)GetValue(InputMethodSettingsProperty); + } + set + { + SetValue(InputMethodSettingsProperty, value); + NotifyPropertyChanged(); + } + } + + /// + /// Scroll the text control by specific amount.. + /// + /// The amount (in pixels) of scrolling in horizontal & vertical directions. + [EditorBrowsable(EditorBrowsableState.Never)] + public void ScrollBy(Vector2 scroll) + { + Interop.TextEditor.ScrollBy(SwigCPtr, Vector2.getCPtr(scroll)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Get the InputMethodContext instance. /// /// The InputMethodContext instance. @@ -1201,7 +1809,7 @@ namespace Tizen.NUI.BaseComponents if (inputMethodContext == null) { /*Avoid raising InputMethodContext reference count.*/ - inputMethodContext = new InputMethodContext(Interop.TextEditor.TextEditor_GetInputMethodContext(swigCPtr), true); + inputMethodContext = new InputMethodContext(Interop.TextEditor.GetInputMethodContext(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return inputMethodContext; @@ -1213,7 +1821,19 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public void SelectWholeText() { - Interop.TextEditor.TextEditor_SelectWholeText(swigCPtr); + Interop.TextEditor.SelectWholeText(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Select text from start to end index. + /// + /// The start index for selection. + /// The end index for selection. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SelectText(uint start, uint end) + { + Interop.TextEditor.SelectText(SwigCPtr, start, end); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -1223,18 +1843,69 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public void SelectNone() { - Interop.TextEditor.TextEditor_SelectNone(swigCPtr); + _ = Interop.TextEditor.SelectNone(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Enable grab handle property. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool EnableGrabHandle + { + get + { + return (bool)GetValue(EnableGrabHandleProperty); + } + set + { + SetValue(EnableGrabHandleProperty, value); + NotifyPropertyChanged(); + } + } + + /// + /// Enable grab handle popup property. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool EnableGrabHandlePopup + { + get + { + return (bool)GetValue(EnableGrabHandlePopupProperty); + } + set + { + SetValue(EnableGrabHandlePopupProperty, value); + NotifyPropertyChanged(); + } + } + + /// + /// Minimum line size to be used. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public float MinLineSize + { + get + { + return (float)GetValue(MinLineSizeProperty); + } + set + { + SetValue(MinLineSizeProperty, value); + NotifyPropertyChanged(); + } + } + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditor obj) { - return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr; } internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal() { - 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.TextEditor_InputStyleChangedSignal(swigCPtr)); + 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)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1255,20 +1926,22 @@ namespace Tizen.NUI.BaseComponents SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged; } + removeFontSizeChangedCallback(); + //Release your own unmanaged resources here. //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. if (this.HasBody()) { - if (_textEditorTextChangedCallbackDelegate != null) + if (textEditorTextChangedCallbackDelegate != null) { - TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate); + TextChangedSignal().Disconnect(textEditorTextChangedCallbackDelegate); } - if (_textEditorMaxLengthReachedCallbackDelegate != null) + if (textEditorMaxLengthReachedCallbackDelegate != null) { - this.MaxLengthReachedSignal().Disconnect(_textEditorMaxLengthReachedCallbackDelegate); + this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate); } } @@ -1281,7 +1954,7 @@ namespace Tizen.NUI.BaseComponents { // In order to speed up IME hide, temporarily add GetInputMethodContext()?.DestroyContext(); - Interop.TextEditor.delete_TextEditor(swigCPtr); + Interop.TextEditor.DeleteTextEditor(swigCPtr); } private string SetTranslatable(string textEditorSid) @@ -1316,66 +1989,119 @@ namespace Tizen.NUI.BaseComponents } } + private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e) + { + float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value); + SetValue(FontSizeScaleProperty, newFontSizeScale); + NotifyPropertyChanged(); + } + + private void addFontSizeChangedCallback() + { + if (hasFontSizeChangedCallback != true) + { + try + { + SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged; + hasFontSizeChangedCallback = true; + } + catch (Exception e) + { + Console.WriteLine("{0} Exception caught.", e); + hasFontSizeChangedCallback = false; + } + } + } + + private void removeFontSizeChangedCallback() + { + if (hasFontSizeChangedCallback == true) + { + try + { + SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged; + hasFontSizeChangedCallback = false; + } + catch (Exception e) + { + Console.WriteLine("{0} Exception caught.", e); + hasFontSizeChangedCallback = true; + } + } + } + internal new class Property { - internal static readonly int TEXT = Interop.TextEditor.TextEditor_Property_TEXT_get(); - internal static readonly int TEXT_COLOR = Interop.TextEditor.TextEditor_Property_TEXT_COLOR_get(); - internal static readonly int FONT_FAMILY = Interop.TextEditor.TextEditor_Property_FONT_FAMILY_get(); - internal static readonly int FONT_STYLE = Interop.TextEditor.TextEditor_Property_FONT_STYLE_get(); - internal static readonly int POINT_SIZE = Interop.TextEditor.TextEditor_Property_POINT_SIZE_get(); - internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextEditor.TextEditor_Property_HORIZONTAL_ALIGNMENT_get(); - internal static readonly int SCROLL_THRESHOLD = Interop.TextEditor.TextEditor_Property_SCROLL_THRESHOLD_get(); - internal static readonly int SCROLL_SPEED = Interop.TextEditor.TextEditor_Property_SCROLL_SPEED_get(); - internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextEditor.TextEditor_Property_PRIMARY_CURSOR_COLOR_get(); - internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextEditor.TextEditor_Property_SECONDARY_CURSOR_COLOR_get(); - internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextEditor.TextEditor_Property_ENABLE_CURSOR_BLINK_get(); - internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextEditor.TextEditor_Property_CURSOR_BLINK_INTERVAL_get(); - internal static readonly int CURSOR_BLINK_DURATION = Interop.TextEditor.TextEditor_Property_CURSOR_BLINK_DURATION_get(); - internal static readonly int CURSOR_WIDTH = Interop.TextEditor.TextEditor_Property_CURSOR_WIDTH_get(); - internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextEditor.TextEditor_Property_GRAB_HANDLE_IMAGE_get(); - internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextEditor.TextEditor_Property_GRAB_HANDLE_PRESSED_IMAGE_get(); - internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextEditor.TextEditor_Property_SELECTION_HANDLE_IMAGE_LEFT_get(); - internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextEditor.TextEditor_Property_SELECTION_HANDLE_IMAGE_RIGHT_get(); - internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextEditor.TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get(); - internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextEditor.TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get(); - internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextEditor.TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get(); - internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextEditor.TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get(); - internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextEditor.TextEditor_Property_SELECTION_HIGHLIGHT_COLOR_get(); - internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextEditor.TextEditor_Property_DECORATION_BOUNDING_BOX_get(); - internal static readonly int ENABLE_MARKUP = Interop.TextEditor.TextEditor_Property_ENABLE_MARKUP_get(); - internal static readonly int INPUT_COLOR = Interop.TextEditor.TextEditor_Property_INPUT_COLOR_get(); - internal static readonly int INPUT_FONT_FAMILY = Interop.TextEditor.TextEditor_Property_INPUT_FONT_FAMILY_get(); - internal static readonly int INPUT_FONT_STYLE = Interop.TextEditor.TextEditor_Property_INPUT_FONT_STYLE_get(); - internal static readonly int INPUT_POINT_SIZE = Interop.TextEditor.TextEditor_Property_INPUT_POINT_SIZE_get(); - internal static readonly int LINE_SPACING = Interop.TextEditor.TextEditor_Property_LINE_SPACING_get(); - internal static readonly int INPUT_LINE_SPACING = Interop.TextEditor.TextEditor_Property_INPUT_LINE_SPACING_get(); - internal static readonly int UNDERLINE = Interop.TextEditor.TextEditor_Property_UNDERLINE_get(); - internal static readonly int INPUT_UNDERLINE = Interop.TextEditor.TextEditor_Property_INPUT_UNDERLINE_get(); - internal static readonly int SHADOW = Interop.TextEditor.TextEditor_Property_SHADOW_get(); - internal static readonly int INPUT_SHADOW = Interop.TextEditor.TextEditor_Property_INPUT_SHADOW_get(); - internal static readonly int EMBOSS = Interop.TextEditor.TextEditor_Property_EMBOSS_get(); - internal static readonly int INPUT_EMBOSS = Interop.TextEditor.TextEditor_Property_INPUT_EMBOSS_get(); - internal static readonly int OUTLINE = Interop.TextEditor.TextEditor_Property_OUTLINE_get(); - internal static readonly int INPUT_OUTLINE = Interop.TextEditor.TextEditor_Property_INPUT_OUTLINE_get(); - internal static readonly int SMOOTH_SCROLL = Interop.TextEditor.TextEditor_Property_SMOOTH_SCROLL_get(); - internal static readonly int SMOOTH_SCROLL_DURATION = Interop.TextEditor.TextEditor_Property_SMOOTH_SCROLL_DURATION_get(); - internal static readonly int ENABLE_SCROLL_BAR = Interop.TextEditor.TextEditor_Property_ENABLE_SCROLL_BAR_get(); - internal static readonly int SCROLL_BAR_SHOW_DURATION = Interop.TextEditor.TextEditor_Property_SCROLL_BAR_SHOW_DURATION_get(); - internal static readonly int SCROLL_BAR_FADE_DURATION = Interop.TextEditor.TextEditor_Property_SCROLL_BAR_FADE_DURATION_get(); - internal static readonly int PIXEL_SIZE = Interop.TextEditor.TextEditor_Property_PIXEL_SIZE_get(); - internal static readonly int LINE_COUNT = Interop.TextEditor.TextEditor_Property_LINE_COUNT_get(); - internal static readonly int ENABLE_SELECTION = Interop.TextEditor.TextEditor_Property_ENABLE_SELECTION_get(); - internal static readonly int PLACEHOLDER = Interop.TextEditor.TextEditor_Property_PLACEHOLDER_get(); - internal static readonly int LINE_WRAP_MODE = Interop.TextEditor.TextEditor_Property_LINE_WRAP_MODE_get(); - internal static readonly int PLACEHOLDER_TEXT = Interop.TextEditor.TextEditor_Property_PLACEHOLDER_TEXT_get(); - internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextEditor.TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get(); - internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextEditor.TextEditor_Property_ENABLE_SHIFT_SELECTION_get(); - internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextEditor.TextEditor_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get(); - internal static readonly int MAX_LENGTH = Interop.TextEditor.TextEditor_Property_MAX_LENGTH_get(); - internal static readonly int SELECTED_TEXT_START = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_START_get(); - internal static readonly int SELECTED_TEXT_END = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_END_get(); - internal static readonly int ENABLE_EDITING = Interop.TextEditor.TextEditor_Property_ENABLE_EDITING_get(); - internal static readonly int SELECTED_TEXT = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_get(); + internal static readonly int TEXT = Interop.TextEditor.TextGet(); + internal static readonly int TextColor = Interop.TextEditor.TextColorGet(); + internal static readonly int FontFamily = Interop.TextEditor.FontFamilyGet(); + internal static readonly int FontStyle = Interop.TextEditor.FontStyleGet(); + internal static readonly int PointSize = Interop.TextEditor.PointSizeGet(); + internal static readonly int HorizontalAlignment = Interop.TextEditor.HorizontalAlignmentGet(); + internal static readonly int ScrollThreshold = Interop.TextEditor.ScrollThresholdGet(); + internal static readonly int ScrollSpeed = Interop.TextEditor.ScrollSpeedGet(); + internal static readonly int PrimaryCursorColor = Interop.TextEditor.PrimaryCursorColorGet(); + internal static readonly int SecondaryCursorColor = Interop.TextEditor.SecondaryCursorColorGet(); + internal static readonly int EnableCursorBlink = Interop.TextEditor.EnableCursorBlinkGet(); + internal static readonly int CursorBlinkInterval = Interop.TextEditor.CursorBlinkIntervalGet(); + internal static readonly int CursorBlinkDuration = Interop.TextEditor.CursorBlinkDurationGet(); + internal static readonly int CursorWidth = Interop.TextEditor.CursorWidthGet(); + internal static readonly int GrabHandleImage = Interop.TextEditor.GrabHandleImageGet(); + internal static readonly int GrabHandlePressedImage = Interop.TextEditor.GrabHandlePressedImageGet(); + internal static readonly int SelectionHandleImageLeft = Interop.TextEditor.SelectionHandleImageLeftGet(); + internal static readonly int SelectionHandleImageRight = Interop.TextEditor.SelectionHandleImageRightGet(); + internal static readonly int SelectionHandlePressedImageLeft = Interop.TextEditor.SelectionHandlePressedImageLeftGet(); + internal static readonly int SelectionHandlePressedImageRight = Interop.TextEditor.SelectionHandlePressedImageRightGet(); + internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextEditor.SelectionHandleMarkerImageLeftGet(); + internal static readonly int SelectionHandleMarkerImageRight = Interop.TextEditor.SelectionHandleMarkerImageRightGet(); + internal static readonly int SelectionHighlightColor = Interop.TextEditor.SelectionHighlightColorGet(); + internal static readonly int DecorationBoundingBox = Interop.TextEditor.DecorationBoundingBoxGet(); + internal static readonly int EnableMarkup = Interop.TextEditor.EnableMarkupGet(); + internal static readonly int InputColor = Interop.TextEditor.InputColorGet(); + internal static readonly int InputFontFamily = Interop.TextEditor.InputFontFamilyGet(); + internal static readonly int InputFontStyle = Interop.TextEditor.InputFontStyleGet(); + internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet(); + internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet(); + internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet(); + internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet(); + internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet(); + internal static readonly int SHADOW = Interop.TextEditor.ShadowGet(); + internal static readonly int InputShadow = Interop.TextEditor.InputShadowGet(); + internal static readonly int EMBOSS = Interop.TextEditor.EmbossGet(); + internal static readonly int InputEmboss = Interop.TextEditor.InputEmbossGet(); + internal static readonly int OUTLINE = Interop.TextEditor.OutlineGet(); + internal static readonly int InputOutline = Interop.TextEditor.InputOutlineGet(); + internal static readonly int SmoothScroll = Interop.TextEditor.SmoothScrollGet(); + internal static readonly int SmoothScrollDuration = Interop.TextEditor.SmoothScrollDurationGet(); + internal static readonly int EnableScrollBar = Interop.TextEditor.EnableScrollBarGet(); + internal static readonly int ScrollBarShowDuration = Interop.TextEditor.ScrollBarShowDurationGet(); + internal static readonly int ScrollBarFadeDuration = Interop.TextEditor.ScrollBarFadeDurationGet(); + internal static readonly int PixelSize = Interop.TextEditor.PixelSizeGet(); + internal static readonly int LineCount = Interop.TextEditor.LineCountGet(); + internal static readonly int EnableSelection = Interop.TextEditor.EnableSelectionGet(); + internal static readonly int PLACEHOLDER = Interop.TextEditor.PlaceholderGet(); + internal static readonly int LineWrapMode = Interop.TextEditor.LineWrapModeGet(); + internal static readonly int PlaceholderText = Interop.TextEditor.PlaceholderTextGet(); + internal static readonly int PlaceholderTextColor = Interop.TextEditor.PlaceholderTextColorGet(); + internal static readonly int EnableShiftSelection = Interop.TextEditor.EnableShiftSelectionGet(); + internal static readonly int MatchSystemLanguageDirection = Interop.TextEditor.MatchSystemLanguageDirectionGet(); + internal static readonly int MaxLength = Interop.TextEditor.MaxLengthGet(); + internal static readonly int SelectedTextStart = Interop.TextEditor.SelectedTextStartGet(); + internal static readonly int SelectedTextEnd = Interop.TextEditor.SelectedTextEndGet(); + internal static readonly int EnableEditing = Interop.TextEditor.EnableEditingGet(); + internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet(); + internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet(); + internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet(); + internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet(); + internal static readonly int FontSizeScale = Interop.TextEditor.FontSizeScaleGet(); + internal static readonly int GrabHandleColor = Interop.TextEditor.GrabHandleColorGet(); + internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet(); + internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet(); + internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet(); + internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet(); + internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet(); + internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet(); + internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet(); } internal class InputStyle @@ -1423,6 +2149,9 @@ namespace Tizen.NUI.BaseComponents { TextColor = new Vector4(x, y, z, w); } - + private void OnGrabHandleColorChanged(float r, float g, float b, float a) + { + GrabHandleColor = new Color(r, g, b, a); + } } }