[NUI] Introduce CollectionView and related classes. (#2525)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Style / RecyclerViewItemStyle.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17  
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Binding;
21 using Tizen.NUI.Components.Extension;
22
23 namespace Tizen.NUI.Components
24 {
25     /// <summary>
26     /// RecyclerViewItemStyle is a class which saves RecyclerViewItem's ux data.
27     /// </summary>
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class RecyclerViewItemStyle : ControlStyle
30     {
31         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
32         [EditorBrowsable(EditorBrowsableState.Never)]
33         public static readonly BindableProperty IsSelectableProperty = BindableProperty.Create(nameof(IsSelectable), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
34         {
35             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
36             RecyclerViewItemStyle.isSelectable = (bool?)newValue;
37         },
38         defaultValueCreator: (bindable) =>
39         {
40             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
41             return RecyclerViewItemStyle.isSelectable;
42         });
43         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
44         [EditorBrowsable(EditorBrowsableState.Never)]
45         public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
46         {
47             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
48             RecyclerViewItemStyle.isSelected = (bool?)newValue;
49         },
50         defaultValueCreator: (bindable) =>
51         {
52             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
53             return RecyclerViewItemStyle.isSelected;
54         });
55         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
56         [EditorBrowsable(EditorBrowsableState.Never)]
57         public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool?), typeof(RecyclerViewItemStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
58         {
59             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
60             RecyclerViewItemStyle.isEnabled = (bool?)newValue;
61         },
62         defaultValueCreator: (bindable) =>
63         {
64             var RecyclerViewItemStyle = (RecyclerViewItemStyle)bindable;
65             return RecyclerViewItemStyle.isEnabled;
66         });
67
68         private bool? isSelectable;
69         private bool? isSelected;
70         private bool? isEnabled;
71
72         static RecyclerViewItemStyle() { }
73
74         /// <summary>
75         /// Creates a new instance of a RecyclerViewItemStyle.
76         /// </summary>
77         /// <since_tizen> 8 </since_tizen>
78         public RecyclerViewItemStyle() : base()
79         {
80         }
81
82         /// <summary>
83         /// Creates a new instance of a RecyclerViewItemStyle with style.
84         /// </summary>
85         /// <param name="style">Create RecyclerViewItemStyle by style customized by user.</param>
86         [EditorBrowsable(EditorBrowsableState.Never)]
87         public RecyclerViewItemStyle(RecyclerViewItemStyle style) : base(style)
88         {
89         }
90
91         /// <summary>
92         /// Flag to decide RecyclerViewItem can be selected or not.
93         /// </summary>
94         [EditorBrowsable(EditorBrowsableState.Never)]
95         public bool? IsSelectable
96         {
97             get => (bool?)GetValue(IsSelectableProperty);
98             set => SetValue(IsSelectableProperty, value);
99         }
100
101         /// <summary>
102         /// Flag to decide selected state in RecyclerViewItem.
103         /// </summary>
104         [EditorBrowsable(EditorBrowsableState.Never)]
105         public bool? IsSelected
106         {
107             get => (bool?)GetValue(IsSelectedProperty);
108             set => SetValue(IsSelectedProperty, value);
109         }
110
111         /// <summary>
112         /// Flag to decide RecyclerViewItem can be selected or not.
113         /// </summary>
114         [EditorBrowsable(EditorBrowsableState.Never)]
115         public bool? IsEnabled
116         {
117             get => (bool?)GetValue(IsEnabledProperty);
118             set => SetValue(IsEnabledProperty, value);
119         }
120
121         /// <summary>
122         /// Style's clone function.
123         /// </summary>
124         /// <param name="bindableObject">The style that need to copy.</param>
125         [EditorBrowsable(EditorBrowsableState.Never)]
126         public override void CopyFrom(BindableObject bindableObject)
127         {
128             base.CopyFrom(bindableObject);
129
130             /*
131             if (bindableObject is RecyclerViewItemStyle RecyclerViewItemStyle)
132             {
133                 //
134             }
135             */
136         }
137     }
138 }