[Bluetooth][Non-ACR] Fix Native callback GC issue (#1678)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RecyclerView / LayoutManager.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 LayoutManager
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         public Size ItemSize{get;set;} = new Size();
73  
74         /// <summary>
75         /// Get/Set the orientation in the layout.
76         /// </summary>
77         /// <since_tizen> 8 </since_tizen>
78         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
79         public Orientation LayoutOrientation{get;set;} = Orientation.Vertical;
80
81         /// <summary>
82         /// How far can you reach the next item.
83         /// </summary>
84         /// <since_tizen> 8 </since_tizen>
85         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
86         public float StepSize{
87             get
88             {
89                 return mStepSize;
90             }
91         }
92
93         /// <summary>
94         /// This is called to find out where items are lain out according to current scroll position.
95         /// </summary>
96         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
97         /// <since_tizen> 8 </since_tizen>
98         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
99         public virtual void Layout(float scrollPosition)
100         {
101            
102         }
103
104         /// <summary>
105         /// This is called to find out which items should be recycled according to current scroll position.
106         /// </summary>
107         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
108         /// <returns>List of RecycleItems which should be recycled.</returns>
109         /// <since_tizen> 8 </since_tizen>
110         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
111         public virtual List<RecycleItem> Recycle(float scrollPosition)
112         {
113             return new List<RecycleItem>();
114         }
115
116         /// <summary>
117         /// Adjust scrolling position by own scrolling rules.
118         /// </summary>
119         /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
120         /// <since_tizen> 8 </since_tizen>
121         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
122         public virtual float CalculateCandidateScrollPosition(float scrollPosition)
123         {
124             return scrollPosition;
125         }
126     }
127 }