[NUI] Add GridRecycleLayotManager (#1685)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RecyclerView / RecycleLayoutManager.cs
1 /* Copyright (c) 2020 Samsung Electronics Co., Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  */
16 using Tizen.NUI.BaseComponents;
17 using System.Collections.Generic;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI.Components
21 {
22     /// <summary>
23     /// [Draft] Defalt layout manager for RecyclerView.
24     /// Lay out RecycleItem and recycle RecycleItem.
25     /// </summary>
26     /// <since_tizen> 8 </since_tizen>
27     /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class RecycleLayoutManager
30     {
31         protected float mPrevScrollPosition = 0.0f;
32         protected int mPrevFirstDataIndex = 0;
33         protected float mStepSize = 0.0f;
34
35         /// <summary>
36         /// Enumeration for the direction in which the content is laid out
37         /// </summary>
38         /// <since_tizen> 8 </since_tizen>
39         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
40         [EditorBrowsable(EditorBrowsableState.Never)]
41         public enum Orientation
42         {
43             /// <summary>
44             /// Vertical
45             /// </summary>
46             /// <since_tizen> 8 </since_tizen>
47             /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
48             [EditorBrowsable(EditorBrowsableState.Never)]
49             Vertical = 0,
50             /// <summary>
51             /// Horizontal
52             /// </summary>
53             /// <since_tizen> 8 </since_tizen>
54             /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
55             [EditorBrowsable(EditorBrowsableState.Never)]
56             Horizontal = 1,
57         }
58
59         /// <summary>
60         /// Container which contains RecycleItems.
61         /// </summary>
62         /// <since_tizen> 8 </since_tizen>
63         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
64         [EditorBrowsable(EditorBrowsableState.Never)]
65         public View Container{get;set;}
66  
67         /// <summary>
68         /// Size of RecycleItem.
69         /// </summary>
70         /// <since_tizen> 8 </since_tizen>
71         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
72         [EditorBrowsable(EditorBrowsableState.Never)]
73         public Size ItemSize{get;set;} = new Size();
74  
75         /// <summary>
76         /// Get/Set the orientation in the layout.
77         /// </summary>
78         /// <since_tizen> 8 </since_tizen>
79         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
80         [EditorBrowsable(EditorBrowsableState.Never)]
81         public Orientation LayoutOrientation{get;set;} = Orientation.Vertical;
82
83         /// <summary>
84         /// How far can you reach the next item.
85         /// </summary>
86         /// <since_tizen> 8 </since_tizen>
87         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
88         [EditorBrowsable(EditorBrowsableState.Never)]
89         public float StepSize{
90             get
91             {
92                 return mStepSize;
93             }
94         }
95
96         /// <summary>
97         /// How far can you reach the next item.
98         /// </summary>
99         /// <since_tizen> 8 </since_tizen>
100         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
101         [EditorBrowsable(EditorBrowsableState.Never)]
102         public int DataCount{get; set;}
103
104         /// <summary>
105         /// This is called to find out where items are lain out according to current scroll position.
106         /// </summary>
107         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
108         /// <since_tizen> 8 </since_tizen>
109         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
110         [EditorBrowsable(EditorBrowsableState.Never)]
111         public virtual void Layout(float scrollPosition)
112         {
113            
114         }
115
116         /// <summary>
117         /// This is called to find out how much container size can be.
118         /// </summary>
119         /// <since_tizen> 8 </since_tizen>
120         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
121         [EditorBrowsable(EditorBrowsableState.Never)]
122         public virtual float CalculateLayoutOrientationSize()
123         {
124             return 0.0f;
125         }
126
127         /// <summary>
128         /// This is called to find out which items should be recycled according to current scroll position.
129         /// </summary>
130         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
131         /// <returns>List of RecycleItems which should be recycled.</returns>
132         /// <since_tizen> 8 </since_tizen>
133         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
134         [EditorBrowsable(EditorBrowsableState.Never)]
135         public virtual List<RecycleItem> Recycle(float scrollPosition)
136         {
137             return new List<RecycleItem>();
138         }
139
140         /// <summary>
141         /// Adjust scrolling position by own scrolling rules.
142         /// </summary>
143         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
144         /// <since_tizen> 8 </since_tizen>
145         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
146         [EditorBrowsable(EditorBrowsableState.Never)]
147         public virtual float CalculateCandidateScrollPosition(float scrollPosition)
148         {
149             return scrollPosition;
150         }
151     }
152 }