[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 1059fca9dee1252749acd6063c1af76dc446f073..5da4255abe3166736afbb8077a12b272531f0e7e 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 0017e57318b61c050636f79e18dd7c02382deaa5..45d8de51ffd1598a54e4b0b54985a779be13e1ec 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 d369d5968fd6e2aa5cec3491b7d2971f7ab336c4..656fe7e8fb1dd2f91886aca0699c66a0e6cb618e 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
     }
 }