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