From d0bd85ab62b02859c5ab834eb8cfeb4d2a6a3afd Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Mon, 15 Jul 2024 20:35:10 +0900 Subject: [PATCH] [NUI] Add AsyncLineCount to TextLabel Number of lines after latest asynchronous computing or rendering of text. Signed-off-by: Bowon Ryu --- .../src/internal/Interop/Interop.TextLabel.cs | 3 ++ .../src/public/BaseComponents/TextLabel.cs | 33 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs index 3e7aee5d1..21b2de627 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs @@ -199,6 +199,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_MANUAL_RENDERED_get")] public static extern int ManualRenderedGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_ASYNC_LINE_COUNT_get")] + public static extern int AsyncLineCountGet(); + [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 0133a50a6..1e007ce16 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -329,7 +329,7 @@ namespace Tizen.NUI.BaseComponents /// The width of text to render. /// The height of text to render. /// - /// Only works when AsyncMode. + /// Only works when AsyncAuto and AsyncManual. /// [EditorBrowsable(EditorBrowsableState.Never)] public void RequestAsyncRenderWithFixedSize(float width, float height) @@ -344,7 +344,7 @@ namespace Tizen.NUI.BaseComponents /// The width of text to render. /// The maximum available height of text to render. /// - /// Only works when AsyncMode.
+ /// Only works when AsyncAuto and AsyncManual.
/// 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. @@ -362,6 +362,7 @@ namespace Tizen.NUI.BaseComponents /// The maximum available width of text to render. /// The maximum available height of text to render. /// + /// Only works when AsyncAuto and AsyncManual.
/// If the width of the text content is smaller than the widthConstraint, the width will be determined by the width of the text.
/// If the width of the text content is larger than the widthConstraint, the width will be determined by the widthConstraint.
/// The height is determined by the content of the text when rendered with the given width.
@@ -2642,6 +2643,33 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// Number of lines after latest asynchronous computing or rendering of text. + /// + /// + /// The following example demonstrates how to obtain the LineCount asynchronously. + /// + /// label.RequestAsyncHeightForWidth(label.Size.Width); + /// label.AsyncHeightForWidthComputed += (s, e) => + /// { + /// int lineCount = label.AsyncLineCount; + /// }; + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public int AsyncLineCount + { + get + { + int asyncLineCount = 0; + using (var propertyValue = GetProperty(TextLabel.Property.AsyncLineCount)) + { + propertyValue.Get(out asyncLineCount); + } + return asyncLineCount; + } + } + private TextLabelSelectorData EnsureSelectorData() => selectorData ?? (selectorData = new TextLabelSelectorData()); /// @@ -2870,6 +2898,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int Cutout = Interop.TextLabel.CutoutGet(); internal static readonly int RenderMode = Interop.TextLabel.RenderModeGet(); internal static readonly int ManualRendered = Interop.TextLabel.ManualRenderedGet(); + internal static readonly int AsyncLineCount = Interop.TextLabel.AsyncLineCountGet(); internal static void Preload() -- 2.34.1