[NUI] Add EllipsisMode to TextLabel
authorBowon Ryu <bowon.ryu@samsung.com>
Fri, 7 Mar 2025 11:04:20 +0000 (20:04 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 27 Mar 2025 06:54:21 +0000 (15:54 +0900)
Added EllipsisMode to automatically support auto scroll.

In case of EllipsisMode.AutoScroll,
when the text exceeds the layout, it will automatically scroll with animation.

Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
src/Tizen.NUI/src/public/Common/NUIConstants.cs

index d0605cb56aca1b9a504dd7bf80b74612893297fe..dc45094c5b9e2c58bc698dbf5d63394d14d410a3 100755 (executable)
@@ -197,6 +197,12 @@ namespace Tizen.NUI
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_RENDER_MODE_get")]
             public static extern int RenderModeGet();
 
+            [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_ELLIPSIS_MODE_get")]
+            public static extern int EllipsisModeGet();
+
+            [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_IS_SCROLLING_get")]
+            public static extern int IsScrollingGet();
+
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_MANUAL_RENDERED_get")]
             public static extern int ManualRenderedGet();
 
index ec043e6b4d1468abdd96e7c3eaa00e312c3034bf..68c5603c9af8112d6bb251bae18800f3d5146ad4 100755 (executable)
@@ -1895,6 +1895,53 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// The EllipsisMode property.
+        /// </summary>
+        /// <remarks>
+        /// This property is valid when Ellipsis is true.<br />
+        /// Truncate(default), if the text exceeds the layout, it will be truncated with an ellipsis.<br />
+        /// AutoScroll, if the text exceeds the layout, it will be auto scroll animated.<br />
+        /// EllipsisMode.AutoScroll shares the properties of AutoScroll Animation: AutoScrollSpeed, AutoScrollLoopCount, AutoScrollGap, AutoScrollLoopDelay<br />
+        /// EllipsisMode.AutoScroll forces the setting of AutoScrollStopMode to Immediate.<br />
+        /// To dynamically turn off EllipsisMode.AutoScroll, set EllipsisMode.Truncate.<br />
+        /// Cannot be used simultaneously with EnableAutoScroll.<br />
+        /// This property supports get/set operations in XAML scripts, but does not support XAML Data Binding functionality.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public EllipsisMode EllipsisMode
+        {
+            get
+            {
+                return (EllipsisMode)Object.InternalGetPropertyInt(this.SwigCPtr, TextLabel.Property.EllipsisMode);
+            }
+            set
+            {
+                Object.InternalSetPropertyInt(this.SwigCPtr, TextLabel.Property.EllipsisMode, (int)value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
+        /// Whether the auto scroll animation is playing or not.
+        /// </summary>
+        /// <remarks>
+        /// This property supports get operations in XAML scripts, but does not support XAML Data Binding functionality.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool IsScrolling
+        {
+            get
+            {
+                bool isScrolling = false;
+                using (var propertyValue = GetProperty(TextLabel.Property.IsScrolling))
+                {
+                    propertyValue.Get(out isScrolling);
+                }
+                return isScrolling;
+            }
+        }
+
         /// <summary>
         /// The AutoScrollLoopDelay property.<br />
         /// The amount of time to delay the starting time of auto scrolling and further loops.<br />
@@ -3005,6 +3052,8 @@ namespace Tizen.NUI.BaseComponents
             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 readonly int EllipsisMode = Interop.TextLabel.EllipsisModeGet();
+            internal static readonly int IsScrolling = Interop.TextLabel.IsScrollingGet();
 
 
             internal static void Preload()
index c32a9c5dbeb73f81bd74ff5fbe39a6503edc01e0..cfa4e8675505176554897c9c74c6302e9718d628 100755 (executable)
@@ -984,6 +984,23 @@ namespace Tizen.NUI
         Middle
     }
 
+    /// <summary>
+    /// Enumeration for the ellipsis mode of text.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public enum EllipsisMode
+    {
+        /// <summary>
+        /// When the text is long, it will be truncated with ellipsis.
+        /// </summary>
+        Truncate,
+
+        /// <summary>
+        /// When the text is long, it will automatically scroll with animation.
+        /// </summary>
+        AutoScroll
+    }
+
     /// <summary>
     /// Enumeration type for the font's slant.
     /// </summary>