7cfd23fdc9f6cc3ba43cd469bc35bf9e7f1ee29e
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / GenListItem.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18 using System.ComponentModel;
19
20 namespace ElmSharp
21 {
22     /// <summary>
23     /// The type of the item's part types.
24     /// </summary>
25     /// <since_tizen> preview </since_tizen>
26     [Obsolete("This has been deprecated in API12")]
27     [Flags]
28     public enum GenListItemFieldType
29     {
30         /// <summary>
31         /// All item's parts.
32         /// </summary>
33         All = 0,
34
35         /// <summary>
36         /// The Text part type.
37         /// </summary>
38         Text = (1 << 0),
39
40         /// <summary>
41         /// The Content part type.
42         /// </summary>
43         Content = (1 << 1),
44
45         /// <summary>
46         /// The State part type.
47         /// </summary>
48         State = (1 << 2),
49
50         /// <summary>
51         /// No part type.
52         /// </summary>
53         None = (1 << 3)
54     };
55
56     /// <summary>
57     /// It inherits <see cref="GenItem"/>.
58     /// A instance to the genlist item is added.
59     /// It contains the Update() method to update a genlist item which is given.
60     /// </summary>
61     /// <since_tizen> preview </since_tizen>
62     [Obsolete("This has been deprecated in API12")]
63     public class GenListItem : GenItem
64     {
65         internal GenListItem(object data, GenItemClass itemClass) : base(data, itemClass)
66         {
67         }
68
69         internal GenListItem(object data, GenItemClass itemClass, EvasObject parent) : base(data, itemClass, parent)
70         {
71         }
72
73         /// <summary>
74         /// Gets or sets whether a given genlist item is selected.
75         /// </summary>
76         /// <since_tizen> preview </since_tizen>
77         [Obsolete("This has been deprecated in API12")]
78         public override bool IsSelected
79         {
80             get
81             {
82                 return Interop.Elementary.elm_genlist_item_selected_get(Handle);
83             }
84             set
85             {
86                 Interop.Elementary.elm_genlist_item_selected_set(Handle, value);
87             }
88         }
89
90         /// <summary>
91         /// Gets or sets whether a given genlist item is expanded.
92         /// </summary>
93         /// <since_tizen> preview </since_tizen>
94         [Obsolete("This has been deprecated in API12")]
95         public bool IsExpanded
96         {
97             get
98             {
99                 return Interop.Elementary.elm_genlist_item_expanded_get(Handle);
100             }
101             set
102             {
103                 Interop.Elementary.elm_genlist_item_expanded_set(Handle, value);
104             }
105         }
106
107         /// <summary>
108         /// Updates the content of an item.
109         /// This updates an item by calling all <see cref="GenItemClass"/> again to get the content, text, and states.
110         /// Use this when the original item data has changed and the changes are desired to reflect.
111         /// To update the already realized items, use <see cref="GenList.UpdateRealizedItems"/>.
112         /// </summary>
113         /// <seealso cref="GenList.UpdateRealizedItems"/>
114         /// <since_tizen> preview </since_tizen>
115         [Obsolete("This has been deprecated in API12")]
116         public override void Update()
117         {
118             Interop.Elementary.elm_genlist_item_update(Handle);
119         }
120
121         /// <summary>
122         /// Updates the part of an item.
123         /// This updates an item's part by calling the item's fetching functions again to get the contents, texts, and states.
124         /// Use this when the original item data has changed and the changes are desired to be reflected.
125         /// To update an item's all property, use <see cref="GenList.UpdateRealizedItems"/>.
126         /// </summary>
127         /// <param name="part">The part could be "elm.text", "elm.swalllow.icon", "elm.swallow.end", "elm.swallow.content", and so on. It is also used for globbing to match '*', '?', and '.'. It can be used for updating multi-fields.</param>
128         /// <param name="type">The type of the item's part type.</param>
129         /// <seealso cref="GenList.UpdateRealizedItems"/>
130         /// <since_tizen> preview </since_tizen>
131         [Obsolete("This has been deprecated in API12")]
132         public void UpdateField(string part, GenListItemFieldType type)
133         {
134             Interop.Elementary.elm_genlist_item_fields_update(Handle, part, (uint)type);
135         }
136
137         /// <summary>
138         /// Demotes an item to the end of the list.
139         /// </summary>
140         /// <since_tizen> preview </since_tizen>
141         [Obsolete("This has been deprecated in API12")]
142         public void DemoteItem()
143         {
144             Interop.Elementary.elm_genlist_item_demote(Handle);
145         }
146
147         /// <summary>
148         /// Gets or sets the genlist item's select mode.
149         /// </summary>
150         /// <since_tizen> preview </since_tizen>
151         [Obsolete("This has been deprecated in API12")]
152         public override GenItemSelectionMode SelectionMode
153         {
154             get
155             {
156                 return (GenItemSelectionMode)Interop.Elementary.elm_genlist_item_select_mode_get(Handle);
157             }
158             set
159             {
160                 Interop.Elementary.elm_genlist_item_select_mode_set(Handle, (Interop.Elementary.Elm_Object_Select_Mode)value);
161             }
162         }
163
164         /// <summary>
165         /// Gets the next item in a genlist widget's internal list of items.
166         /// </summary>
167         /// <seealso cref="Previous"/>
168         /// <since_tizen> preview </since_tizen>
169         [Obsolete("This has been deprecated in API12")]
170         public GenListItem Next
171         {
172             get
173             {
174                 IntPtr next = Interop.Elementary.elm_genlist_item_next_get(Handle);
175                 if (next == IntPtr.Zero)
176                     return null;
177                 else
178                     return GetItemByHandle(next) as GenListItem;
179             }
180         }
181
182         /// <summary>
183         /// Gets the previous item in a genlist widget's internal list of items.
184         /// </summary>
185         /// <seealso cref="Next"/>
186         /// <since_tizen> preview </since_tizen>
187         [Obsolete("This has been deprecated in API12")]
188         public GenListItem Previous
189         {
190             get
191             {
192                 IntPtr prev = Interop.Elementary.elm_genlist_item_prev_get(Handle);
193                 if (prev == IntPtr.Zero)
194                     return null;
195                 else
196                     return GetItemByHandle(prev) as GenListItem;
197             }
198         }
199
200         /// <summary>
201         /// Sets or gets the content to be shown in the tooltip item.
202         /// </summary>
203         /// <since_tizen> preview </since_tizen>
204         [Obsolete("This has been deprecated in API12")]
205         [EditorBrowsable(EditorBrowsableState.Never)]
206         public override string Cursor
207         {
208             get
209             {
210                 return Interop.Elementary.elm_genlist_item_cursor_get(Handle);
211             }
212             set
213             {
214                 if (!string.IsNullOrEmpty(value))
215                 {
216                     Interop.Elementary.elm_genlist_item_cursor_set(Handle, value);
217                 }
218                 else
219                 {
220                     Interop.Elementary.elm_genlist_item_cursor_unset(Handle);
221                 }
222             }
223         }
224
225         /// <summary>
226         /// Sets or gets the style for this item cursor.
227         /// </summary>
228         /// <since_tizen> preview </since_tizen>
229         [Obsolete("This has been deprecated in API12")]
230         [EditorBrowsable(EditorBrowsableState.Never)]
231         public override string CursorStyle
232         {
233             get
234             {
235                 return Interop.Elementary.elm_genlist_item_cursor_style_get(Handle);
236             }
237             set
238             {
239                 Interop.Elementary.elm_genlist_item_cursor_style_set(Handle, value);
240             }
241         }
242
243         /// <summary>
244         /// Sets or gets the cursor engine only usage for this item cursor.
245         /// </summary>
246         /// <since_tizen> preview </since_tizen>
247         [Obsolete("This has been deprecated in API12")]
248         [EditorBrowsable(EditorBrowsableState.Never)]
249         public override bool IsUseEngineCursor
250         {
251             get
252             {
253                 return Interop.Elementary.elm_genlist_item_cursor_engine_only_get(Handle);
254             }
255             set
256             {
257                 Interop.Elementary.elm_genlist_item_cursor_engine_only_set(Handle, value);
258             }
259         }
260
261         /// <summary>
262         /// Sets the text to be shown in the genlist item.
263         /// </summary>
264         /// <param name="tooltip">The text to set in the content.</param>
265         /// <since_tizen> preview </since_tizen>
266         [Obsolete("This has been deprecated in API12")]
267         public override void SetTooltipText(string tooltip)
268         {
269             Interop.Elementary.elm_genlist_item_tooltip_text_set(Handle, tooltip);
270         }
271
272         /// <summary>
273         /// Unsets the tooltip from the item.
274         /// </summary>
275         /// <since_tizen> preview </since_tizen>
276         [Obsolete("This has been deprecated in API12")]
277         public override void UnsetTooltip()
278         {
279             Interop.Elementary.elm_genlist_item_tooltip_unset(Handle);
280         }
281
282         /// <summary>
283         /// Gets or sets the style of the given genlist item's tooltip.
284         /// </summary>
285         /// <since_tizen> preview </since_tizen>
286         [Obsolete("This has been deprecated in API12")]
287         public override string TooltipStyle
288         {
289             get
290             {
291                 return Interop.Elementary.elm_genlist_item_tooltip_style_get(Handle);
292             }
293             set
294             {
295                 Interop.Elementary.elm_genlist_item_tooltip_style_set(Handle, value);
296             }
297         }
298
299         /// <summary>
300         /// Gets or sets the disable size restrictions on an object's tooltip.
301         /// </summary>
302         /// <since_tizen> preview </since_tizen>
303         [Obsolete("This has been deprecated in API12")]
304         public bool IsTooltipWindowMode
305         {
306             get
307             {
308                 return Interop.Elementary.elm_genlist_item_tooltip_window_mode_get(Handle);
309             }
310             set
311             {
312                 Interop.Elementary.elm_genlist_item_tooltip_window_mode_set(Handle, value);
313             }
314         }
315
316         /// <summary>
317         /// Gets the index of the item. It is only valid, once displayed.
318         /// </summary>
319         /// <since_tizen> preview </since_tizen>
320         [Obsolete("This has been deprecated in API12")]
321         public int Index
322         {
323             get
324             {
325                 return Interop.Elementary.elm_genlist_item_index_get(Handle);
326             }
327         }
328
329         /// <summary>
330         /// Gets the depth of the expanded item.
331         /// </summary>
332         /// <since_tizen> preview </since_tizen>
333         [Obsolete("This has been deprecated in API12")]
334         public int ExpandedItemDepth
335         {
336             get
337             {
338                 return Interop.Elementary.elm_genlist_item_expanded_depth_get(Handle);
339             }
340         }
341
342         /// <summary>
343         /// Remove all the subitems (children) of the given item.
344         /// </summary>
345         /// <remarks>
346         /// This removes the items that are the children (and their descendants) of the given item.
347         /// </remarks>
348         /// <since_tizen> preview </since_tizen>
349         [Obsolete("This has been deprecated in API12")]
350         public void ClearSubitems()
351         {
352             Interop.Elementary.elm_genlist_item_subitems_clear(Handle);
353         }
354
355         /// <summary>
356         /// Updates the item class of the item.
357         /// This sets another class of the item, changing the way that it is displayed. After changing the item class, <see cref="Update"/> is called on the item.
358         /// </summary>
359         /// <param name="itemClass">The item class for the item.</param>
360         /// <param name="data">The data for the item.</param>
361         /// <since_tizen> preview </since_tizen>
362         [Obsolete("This has been deprecated in API12")]
363         public void UpdateItemClass(GenItemClass itemClass, object data)
364         {
365             Data = data;
366             ItemClass = itemClass;
367             Interop.Elementary.elm_genlist_item_item_class_update((IntPtr)Handle, itemClass.UnmanagedPtr);
368         }
369
370         /// <summary>
371         /// Sets the content to be shown in the tooltip item.
372         /// </summary>
373         /// <since_tizen> preview </since_tizen>
374         [Obsolete("This has been deprecated in API12")]
375         protected override void UpdateTooltipDelegate()
376         {
377             Interop.Elementary.elm_genlist_item_tooltip_content_cb_set(Handle,
378                 TooltipContentDelegate != null ? _tooltipCb : null,
379                 IntPtr.Zero,
380                 null);
381         }
382     }
383 }