[NUI] Introduce CollectionView and related classes. (#2525)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RecyclerView / ItemSource / IItemSource.cs
1 /* Copyright (c) 2021 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
17 using System;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI.Components
21 {
22     /// <summary>
23     /// Base interface for encapsulated data source in RecyclerView.
24     /// </summary>
25     [EditorBrowsable(EditorBrowsableState.Never)]
26     public interface IItemSource : IDisposable
27     {
28         /// <summary>
29         /// Count of data source.
30         /// </summary>
31        [EditorBrowsable(EditorBrowsableState.Never)]
32         int Count { get; }
33
34         /// <summary>
35         /// Position integer value of data object.
36         /// </summary>
37        [EditorBrowsable(EditorBrowsableState.Never)]
38         int GetPosition(object item);
39
40         /// <summary>
41         /// Item object in position.
42         /// </summary>
43        [EditorBrowsable(EditorBrowsableState.Never)]
44         object GetItem(int position);
45
46         /// <summary>
47         /// Flag of header existence.
48         /// </summary>
49        [EditorBrowsable(EditorBrowsableState.Never)]
50         bool HasHeader { get; set; }
51
52         /// <summary>
53         /// Flag of Footer existence.
54         /// </summary>
55        [EditorBrowsable(EditorBrowsableState.Never)]
56         bool HasFooter { get; set; }
57
58         /// <summary>
59         /// Boolean checker for position is header or not.
60         /// 0 index will be header if header exist.
61         /// warning: if header exist, all item index will be increased.
62         /// </summary>
63         /// <param name="position">The position for checking header.</param>
64        [EditorBrowsable(EditorBrowsableState.Never)]
65         bool IsHeader(int position);
66
67         /// <summary>
68         /// Boolean checker for position is footer or not.
69         /// last index will be footer if footer exist.
70         /// warning: footer will be place original data count or data count + 1.
71         /// </summary>
72         /// <param name="position">The position for checking footer.</param>
73        [EditorBrowsable(EditorBrowsableState.Never)]
74         bool IsFooter(int position);
75     }
76
77     /// <summary>
78     /// Base interface for encapsulated data source with group structure in CollectionView.
79     /// </summary>
80     [EditorBrowsable(EditorBrowsableState.Never)]
81     public interface IGroupableItemSource : IItemSource
82     {
83         /// <summary>
84         /// Boolean checker for position is group header or not
85         /// </summary>
86         /// <param name="position">The position for checking group header.</param>
87        [EditorBrowsable(EditorBrowsableState.Never)]
88         bool IsGroupHeader(int position);
89
90         /// <summary>
91         /// Boolean checker for position is group footer or not
92         /// </summary>
93         /// <param name="position">The position for checking group footer.</param>
94        [EditorBrowsable(EditorBrowsableState.Never)]
95         bool IsGroupFooter(int position);
96
97         /// <summary>
98         /// Boolean checker for position is group footer or not
99         /// </summary>
100         /// <param name="position">The position for checking group footer.</param>
101        [EditorBrowsable(EditorBrowsableState.Never)]
102         object GetGroupParent(int position);
103
104     }
105 }