[NUI] Introduce CollectionView and related classes. (#2525)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / RecyclerView / ItemSource / UngroupedItemSource.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 namespace Tizen.NUI.Components
18 {
19     internal class UngroupedItemSource : IGroupableItemSource
20     {
21         readonly IItemSource source;
22
23         public UngroupedItemSource(IItemSource itemSource)
24         {
25             source = itemSource;
26         }
27
28         public int Count => source.Count;
29
30         public bool HasHeader { get => source.HasHeader; set => source.HasHeader = value; }
31         public bool HasFooter { get => source.HasFooter; set => source.HasFooter = value; }
32
33         public void Dispose()
34         {
35             source.Dispose();
36         }
37
38         public object GetItem(int position)
39         {
40             return source.GetItem(position);
41         }
42
43         public int GetPosition(object item)
44         {
45             return source.GetPosition(item);
46         }
47
48         public bool IsFooter(int position)
49         {
50             return source.IsFooter(position);
51         }
52
53         public bool IsGroupFooter(int position)
54         {
55             return false;
56         }
57
58         public bool IsGroupHeader(int position)
59         {
60             return false;
61         }
62
63         public bool IsHeader(int position)
64         {
65             return source.IsHeader(position);
66         }
67
68         public object GetGroupParent(int position)
69         {
70             return null;
71         }
72     }
73 }