From: Bowon Ryu Date: Wed, 10 Jul 2024 11:05:33 +0000 (+0900) Subject: [NUI] Add RenderMode to TextLabel X-Git-Tag: submit/tizen/20240821.061804~1^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ad0edf3654ebc458250be5d6d839d7a558f1e58;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add RenderMode to TextLabel Sync : default, synchronous text loading. AsyncAuto : automatically requests an asynchronous text load in OnRelayout. AsyncManual : users should manually request rendering using the async text method. All text rendering processes (update/layout/render) are performed asynchronously in AsyncAuto and AsyncManual. Removed unnecessary properties. Signed-off-by: Bowon Ryu --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs index 48849662d..bbb09ebdc 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs @@ -193,6 +193,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_CUTOUT_get")] public static extern int CutoutGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_RENDER_MODE_get")] + public static extern int RenderModeGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_RequestAsyncRenderWithFixedSize")] public static extern void RequestAsyncRenderWithFixedSize(global::System.Runtime.InteropServices.HandleRef textLabelRef, float width, float height); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index f3e0a8b54..16c0022a9 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -217,6 +217,9 @@ namespace Tizen.NUI.BaseComponents CutoutProperty = BindableProperty.Create(nameof(Cutout), typeof(bool), typeof(TextLabel), false, propertyChanged: SetInternalCutoutProperty, defaultValueCreator: GetInternalCutoutProperty); + + RenderModeProperty = BindableProperty.Create(nameof(RenderMode), typeof(TextRenderMode), typeof(TextLabel), TextRenderMode.Sync, + propertyChanged: SetInternalRenderModeProperty, defaultValueCreator: GetInternalRenderModeProperty); } } @@ -326,7 +329,7 @@ namespace Tizen.NUI.BaseComponents /// The width of text to render. /// The height of text to render. /// - /// Only works when AsyncLoad is true. + /// Only works when AsyncMode. /// [EditorBrowsable(EditorBrowsableState.Never)] public void RequestAsyncRenderWithFixedSize(float width, float height) @@ -341,7 +344,7 @@ namespace Tizen.NUI.BaseComponents /// The width of text to render. /// The maximum available height of text to render. /// - /// Only works when AsyncLoad is true.
+ /// Only works when AsyncMode.
/// The height is determined by the content of the text when rendered with the given width.
/// The result will be the same as the height returned by GetHeightForWidth. /// If the heightConstraint is given, the maximum height will be the heightConstraint. @@ -2563,6 +2566,44 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// The RenderMode property. + /// + /// + /// Sync : default, synchronous text loading.
+ /// AsyncAuto : automatically requests an asynchronous text load in OnRelayout.
+ /// AsyncManual : users should manually request rendering using the async text method.
+ /// All text rendering processes (update/layout/render) are performed asynchronously in AsyncAuto and AsyncManual. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public TextRenderMode RenderMode + { + get + { + if (NUIApplication.IsUsingXaml) + { + return (TextRenderMode)GetValue(RenderModeProperty); + } + else + { + return (TextRenderMode)GetInternalRenderModeProperty(this); + } + } + set + { + if (NUIApplication.IsUsingXaml) + { + SetValue(RenderModeProperty, value); + } + else + { + SetInternalRenderModeProperty(this, null, value); + } + NotifyPropertyChanged(); + } + } + + private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData()); /// @@ -2789,6 +2830,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int RemoveFrontInset = Interop.TextLabel.RemoveFrontInsetGet(); internal static readonly int RemoveBackInset = Interop.TextLabel.RemoveBackInsetGet(); internal static readonly int Cutout = Interop.TextLabel.CutoutGet(); + internal static readonly int RenderMode = Interop.TextLabel.RenderModeGet(); internal static void Preload() diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs index 7fa40904c..1e94fac9b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs @@ -953,6 +953,26 @@ namespace Tizen.NUI.BaseComponents return Object.InternalGetPropertyBool(textLabel.SwigCPtr, TextLabel.Property.Cutout); } + /// + /// RenderModeProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty RenderModeProperty = null; + internal static void SetInternalRenderModeProperty(BindableObject bindable, object oldValue, object newValue) + { + var textLabel = (TextLabel)bindable; + if (newValue != null) + { + Object.InternalSetPropertyInt(textLabel.SwigCPtr, TextLabel.Property.RenderMode, (int)newValue); + } + } + internal static object GetInternalRenderModeProperty(BindableObject bindable) + { + var textLabel = (TextLabel)bindable; + + return (TextRenderMode)Object.InternalGetPropertyInt(textLabel.SwigCPtr, TextLabel.Property.RenderMode); + } + internal Selector TranslatableTextSelector { get => GetSelector(selectorData?.TranslatableText, TextLabel.TranslatableTextProperty); diff --git a/src/Tizen.NUI/src/public/Common/NUIConstants.cs b/src/Tizen.NUI/src/public/Common/NUIConstants.cs index 0ece9f70b..65523d4d7 100755 --- a/src/Tizen.NUI/src/public/Common/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/Common/NUIConstants.cs @@ -2207,6 +2207,28 @@ namespace Tizen.NUI PixelSize } + /// + /// Enumeration for the render mode of text. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum TextRenderMode + { + /// + /// default, synchronous text loading. + /// + Sync, + + /// + /// automatically requests an asynchronous text load in OnRelayout. + /// + AsyncAuto, + + /// + /// users should manually request rendering using the async text method. + /// + AsyncManual + } + /// /// Pre-defined SlideTransition Direction ///