6a946e26eb3bd6245f000c91400a69280e7ed3f1
[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         /// <summary>
32         /// Enumeration for the direction in which the content is laid out
33         /// </summary>
34         /// <since_tizen> 8 </since_tizen>
35         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public enum Orientation
38         {
39             /// <summary>
40             /// Vertical
41             /// </summary>
42             /// <since_tizen> 8 </since_tizen>
43             /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
44             [EditorBrowsable(EditorBrowsableState.Never)]
45             Vertical = 0,
46             /// <summary>
47             /// Horizontal
48             /// </summary>
49             /// <since_tizen> 8 </since_tizen>
50             /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
51             [EditorBrowsable(EditorBrowsableState.Never)]
52             Horizontal = 1,
53         }
54
55         /// <summary>
56         /// Container which contains RecycleItems.
57         /// </summary>
58         /// <since_tizen> 8 </since_tizen>
59         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
60         [EditorBrowsable(EditorBrowsableState.Never)]
61         public View Container{get;set;}
62  
63         /// <summary>
64         /// Size of RecycleItem.
65         /// </summary>
66         /// <since_tizen> 8 </since_tizen>
67         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
68         [EditorBrowsable(EditorBrowsableState.Never)]
69         public Size ItemSize{get;set;} = new Size();
70  
71         /// <summary>
72         /// Get/Set the orientation in the layout.
73         /// </summary>
74         /// <since_tizen> 8 </since_tizen>
75         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
76         [EditorBrowsable(EditorBrowsableState.Never)]
77         public Orientation LayoutOrientation{get;set;} = Orientation.Vertical;
78
79         /// <summary>
80         /// How far can you reach the next item.
81         /// </summary>
82         /// <since_tizen> 8 </since_tizen>
83         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
84         [EditorBrowsable(EditorBrowsableState.Never)]
85         public float StepSize { get; protected set; }
86
87         /// <summary>
88         /// How far can you reach the next item.
89         /// </summary>
90         /// <since_tizen> 8 </since_tizen>
91         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
92         [EditorBrowsable(EditorBrowsableState.Never)]
93         public int DataCount{get; set;}
94
95         /// <summary>
96         /// The last scrolled position which is calculated by ScrollableBase. The value should be updated in the Recycle() method.
97         /// </summary>
98         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
99         [EditorBrowsable(EditorBrowsableState.Never)]
100         protected float PrevScrollPosition { get; set; }
101
102         /// <summary>
103         /// This is called to find out where items are lain out according to current scroll position.
104         /// </summary>
105         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
106         /// <since_tizen> 8 </since_tizen>
107         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
108         [EditorBrowsable(EditorBrowsableState.Never)]
109         public virtual void Layout(float scrollPosition)
110         {
111            
112         }
113
114         /// <summary>
115         /// This is called to find out how much container size can be.
116         /// </summary>
117         /// <since_tizen> 8 </since_tizen>
118         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
119         [EditorBrowsable(EditorBrowsableState.Never)]
120         public virtual float CalculateLayoutOrientationSize()
121         {
122             return 0.0f;
123         }
124
125         /// <summary>
126         /// This is called to find out which items should be recycled according to current scroll position.
127         /// </summary>
128         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
129         /// <returns>List of RecycleItems which should be recycled.</returns>
130         /// <since_tizen> 8 </since_tizen>
131         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
132         [EditorBrowsable(EditorBrowsableState.Never)]
133         public virtual List<RecycleItem> Recycle(float scrollPosition)
134         {
135             return new List<RecycleItem>();
136         }
137
138         /// <summary>
139         /// Adjust scrolling position by own scrolling rules.
140         /// </summary>
141         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
142         /// <since_tizen> 8 </since_tizen>
143         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
144         [EditorBrowsable(EditorBrowsableState.Never)]
145         public virtual float CalculateCandidateScrollPosition(float scrollPosition)
146         {
147             return scrollPosition;
148         }
149
150         /// <summary>
151         /// Gets the next keyboard focusable view in this control towards the given direction.<br />
152         /// A control needs to override this function in order to support two dimensional keyboard navigation.<br />
153         /// </summary>
154         /// <param name="currentFocusedView">The current focused view.</param>
155         /// <param name="direction">The direction to move the focus towards.</param>
156         /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
157         /// <returns>The next keyboard focusable view in this control or an empty handle if no view can be focused.</returns>
158         [EditorBrowsable(EditorBrowsableState.Never)]
159         public virtual View RequestNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
160         {
161             return null;
162         }
163
164     }
165 }