From: Bowon Ryu Date: Wed, 24 Mar 2021 04:24:56 +0000 (+0900) Subject: [NUI] Add GrabHandleColor property (#2776) X-Git-Tag: citest_t1~194 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ed9f8be428119deea59429a2300b491044dbeff;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add GrabHandleColor property (#2776) GrabHandleColor property can set the color of grab handle in TextField/TextEditor. exmaple) field.GrabHandleColor = new Color(0.0f, 1.0f, 0.0f, 1.0f); this patch should be merged after below patches are applied. https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/255726/ https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/255739/ Signed-off-by: Bowon Ryu [NUI] Use Color type instead of Vector4 for GrabHandleColor Signed-off-by: Bowon Ryu [NUI] Add missing code for GrabHandleColor field.GrabHandleColor = new Color(0.0f, 1.0f, 0.0f, 1.0f); Signed-off-by: Bowon Ryu [NUI] Replace Vector4 with Color in TextField/TextEditorBindableProperty Signed-off-by: Bowon Ryu --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs index d7330ca..d0a0a56 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs @@ -285,6 +285,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_FONT_SIZE_SCALE_get")] public static extern int FontSizeScaleGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_GRAB_HANDLE_COLOR_get")] + public static extern int GrabHandleColorGet(); } } } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs index 1b7854d..4e7706f 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs @@ -269,6 +269,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_FONT_SIZE_SCALE_get")] public static extern int FontSizeScaleGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_GRAB_HANDLE_COLOR_get")] + public static extern int GrabHandleColorGet(); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 717ffd4..a1414d8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -1138,6 +1138,27 @@ namespace Tizen.NUI.BaseComponents } /// + /// 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(); + } + } + + /// /// The Placeholder property. /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size. /// @@ -1558,6 +1579,7 @@ namespace Tizen.NUI.BaseComponents 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 class InputStyle @@ -1605,6 +1627,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); + } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs index b594845..4217254 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs @@ -955,5 +955,23 @@ namespace Tizen.NUI.BaseComponents Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.FontSizeScale).Get(out temp); return temp; })); + + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty GrabHandleColorProperty = BindableProperty.Create(nameof(GrabHandleColor), typeof(Color), typeof(TextEditor), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => + { + var textEditor = (TextEditor)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.GrabHandleColor, new Tizen.NUI.PropertyValue((Color)newValue)); + } + }), + defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => + { + var textEditor = (TextEditor)bindable; + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.GrabHandleColor).Get(temp); + return temp; + })); } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index 6377d92..47ba1b8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -1252,6 +1252,27 @@ namespace Tizen.NUI.BaseComponents } /// + /// The GrabHandleColor property. + /// + /// + /// The property cascade chaining set is possible. For example, this (textField.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(); + } + } + + /// /// The Placeholder property. /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size. /// @@ -1659,6 +1680,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet(); internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet(); internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet(); + internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet(); } internal class InputStyle @@ -1713,5 +1735,9 @@ namespace Tizen.NUI.BaseComponents { TextColor = new Color(r, g, b, a); } + private void OnGrabHandleColorChanged(float r, float g, float b, float a) + { + GrabHandleColor = new Color(r, g, b, a); + } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs index cd08a01..209b6cc 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs @@ -1006,6 +1006,23 @@ namespace Tizen.NUI.BaseComponents Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.FontSizeScale).Get(out temp); return temp; })); + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty GrabHandleColorProperty = BindableProperty.Create(nameof(TextField.GrabHandleColor), typeof(Color), typeof(TextField), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => + { + var textField = (TextField)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.GrabHandleColor, new Tizen.NUI.PropertyValue((Color)newValue)); + } + }), + defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => + { + var textField = (TextField)bindable; + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.GrabHandleColor).Get(temp); + return temp; + })); #region Selectors internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>