[NUI] Scrollbar uses View instead Visual since blinking issue (#2735)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / ScrollbarBase.cs
1 /*
2  * Copyright(c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI.Components
21 {
22     /// <summary>
23     /// The ScrollbarBase is an abstract class that can be linked to the scrollable objects
24     /// indicating the current scrolled position of the scrollable object.
25     /// This only contains non-graphical functionalities of basic scrollbar.
26     /// </summary>
27     [EditorBrowsable(EditorBrowsableState.Never)]
28     public abstract class ScrollbarBase : VisualView
29     {
30         private bool mScrollEnabled = true;
31
32         #region Constructors
33
34         /// <summary>
35         /// Create an empty ScrollbarBase.
36         /// </summary>
37         public ScrollbarBase() : base(CustomViewBehaviour.ViewBehaviourDefault)
38         {
39         }
40
41         /// <summary>
42         /// Create an empty Scrollbar with a ViewStyle instance to set style properties.
43         /// </summary>
44         [EditorBrowsable(EditorBrowsableState.Never)]
45         public ScrollbarBase(ViewStyle style) : base(CustomViewBehaviour.ViewBehaviourDefault, style)
46         {
47         }
48
49         /// <summary>
50         /// Static constructor to initialize bindable properties when loading.
51         /// </summary>
52         static ScrollbarBase()
53         {
54         }
55
56         #endregion Constructors
57
58
59         #region Methods
60
61         /// <summary>
62         /// Update content length and position at once.
63         /// </summary>
64         /// <param name="contentLength">The total length of the content.</param>
65         /// <param name="viewportLength">The length of the viewport representing the amount of visible content.</param>
66         /// <param name="position">The destination position of the View in content length. This is the View's top position if the scroller is vertical, otherwise, View's left position.</param>
67         /// <param name="durationMs">The time it takes to scroll in milliseconds.</param>
68         /// <param name="alphaFunction">The timing function used in animation. It describes the rate of change of the animation parameter over time. (e.g. EaseOut)</param>
69         [EditorBrowsable(EditorBrowsableState.Never)]
70         public abstract void Update(float contentLength, float viewportLength, float position, uint durationMs = 0, AlphaFunction alphaFunction = null);
71
72         /// <summary>
73         /// Update content length and position at once.
74         /// </summary>
75         /// <param name="contentLength">The total length of the content.</param>
76         /// <param name="position">The destination position of the View in content length. This is the View's top position if the scroller is vertical, otherwise, View's left position.</param>
77         /// <param name="durationMs">The time it takes to scroll in milliseconds.</param>
78         /// <param name="alphaFunction">The timing function used in animation. It describes the rate of change of the animation parameter over time. (e.g. EaseOut)</param>
79         [EditorBrowsable(EditorBrowsableState.Never)]
80         public abstract void Update(float contentLength, float position, uint durationMs = 0, AlphaFunction alphaFunction = null);
81
82         /// <summary>
83         /// Scroll content to a specific position.
84         /// </summary>
85         /// <param name="position">The destination to scroll.</param>
86         /// <param name="durationMs">The time it takes to scroll in milliseconds.</param>
87         /// <param name="alphaFunction">The timing function used in animation. It describes the rate of change of the animation parameter over time. (e.g. EaseOut)</param>
88         [EditorBrowsable(EditorBrowsableState.Never)]
89         public abstract void ScrollTo(float position, uint durationMs = 0, AlphaFunction alphaFunction = null);
90
91         /// <summary>
92         /// Initialize the scroll bar.
93         /// </summary>
94         /// <param name="contentLength">The length of the scrollable content area.</param>
95         /// <param name="viewportLength">The length of the viewport representing the amount of visible content.</param>
96         /// <param name="currentPosition">The current position of the viewport in scrollable content area. This is the viewport's top position if the scroller is vertical, otherwise, left.</param>
97         /// <param name="isHorizontal">Whether the direction of scrolling is horizontal or not. It is vertical by default.</param>
98         [EditorBrowsable(EditorBrowsableState.Never)]
99         public abstract void Initialize(float contentLength, float viewportLength, float currentPosition, bool isHorizontal = false);
100
101         /// <summary>
102         /// Enable or disable scrolling.
103         /// </summary>
104         [EditorBrowsable(EditorBrowsableState.Never)]
105         public abstract bool ScrollEnabled { get; set; }
106
107         /// <summary>
108         /// Scroll position given to ScrollTo or Update.
109         /// </summary>
110         [EditorBrowsable(EditorBrowsableState.Never)]
111         public abstract Position ScrollPosition { get; }
112
113         /// <summary>
114         /// Current scroll position in the middle of ScrollTo or Update animation.
115         /// </summary>
116         [EditorBrowsable(EditorBrowsableState.Never)]
117         public abstract Position ScrollCurrentPosition { get; }
118
119         #endregion Methods
120     }
121 }