[NUI] Add ScrollEnabled to ScrollbarBase (#1838)
authorjaehyun0cho <jaehyun0cho@gmail.com>
Tue, 21 Jul 2020 02:39:51 +0000 (11:39 +0900)
committerGitHub <noreply@github.com>
Tue, 21 Jul 2020 02:39:51 +0000 (11:39 +0900)
To enable and disable scrolling of scrollbar, ScrollEnabled is added.

Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
src/Tizen.NUI.Components/Controls/Scrollbar.cs
src/Tizen.NUI.Components/Controls/ScrollbarBase.cs
src/Tizen.NUI.Wearable/src/public/CircularScrollbar.cs

index 1059fca..5da4255 100755 (executable)
@@ -111,6 +111,7 @@ namespace Tizen.NUI.Components
         private Calculator calculator;
         private Size containerSize = new Size(0, 0);
         private ScrollbarStyle scrollbarStyle => ViewStyle as ScrollbarStyle;
+        private bool mScrollEnabled = true;
 
         #endregion Fields
 
@@ -341,6 +342,11 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override void ScrollTo(float position, uint durationMs = 0, AlphaFunction alphaFunction = null)
         {
+            if (mScrollEnabled == false)
+            {
+                return;
+            }
+
             if (calculator == null)
             {
                 return;
@@ -482,6 +488,23 @@ namespace Tizen.NUI.Components
             thumbVisual.UpdateVisual(true);
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override bool ScrollEnabled
+        {
+            get
+            {
+                return mScrollEnabled;
+            }
+            set
+            {
+                if (value != mScrollEnabled)
+                {
+                    mScrollEnabled = value;
+                }
+            }
+        }
+
         #endregion Methods
 
 
index 0017e57..45d8de5 100755 (executable)
@@ -26,6 +26,8 @@ namespace Tizen.NUI.Components
     [EditorBrowsable(EditorBrowsableState.Never)]
     public abstract class ScrollbarBase : Control
     {
+        private bool mScrollEnabled = true;
+
         #region Constructors
 
         /// <summary>
@@ -84,6 +86,12 @@ namespace Tizen.NUI.Components
         [EditorBrowsable(EditorBrowsableState.Never)]
         public abstract void Initialize(float contentLength, float viewportLength, float currentPosition, bool isHorizontal = false);
 
+        /// <summary>
+        /// Enable or disable scrolling.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public abstract bool ScrollEnabled { get; set; }
+
         #endregion Methods
     }
 }
index d369d59..656fe7e 100644 (file)
@@ -90,6 +90,7 @@ namespace Tizen.NUI.Wearable
         private Size containerSize = new Size(0, 0);
         private Animation thumbStartAngleAnimation;
         private Animation thumbSweepAngleAnimation;
+        private bool mScrollEnabled = true;
 
         #endregion Fields
 
@@ -313,6 +314,11 @@ namespace Tizen.NUI.Wearable
         {
             currentPosition = position;
 
+            if (mScrollEnabled == false)
+            {
+                return;
+            }
+
             if (thumbVisual == null)
             {
                 return;
@@ -451,6 +457,23 @@ namespace Tizen.NUI.Wearable
             thumbVisual.UpdateVisual(true);
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public override bool ScrollEnabled
+        {
+            get
+            {
+                return mScrollEnabled;
+            }
+            set
+            {
+                if (value != mScrollEnabled)
+                {
+                    mScrollEnabled = value;
+                }
+            }
+        }
+
         #endregion Methods
     }
 }