2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.ComponentModel;
23 /// The type of the item's part types.
25 /// <since_tizen> preview </since_tizen>
27 public enum GenListItemFieldType
35 /// The Text part type.
40 /// The Content part type.
45 /// The State part type.
56 /// It inherits <see cref="GenItem"/>.
57 /// A instance to the genlist item is added.
58 /// It contains the Update() method to update a genlist item which is given.
60 /// <since_tizen> preview </since_tizen>
61 public class GenListItem : GenItem
63 internal GenListItem(object data, GenItemClass itemClass) : base(data, itemClass)
67 internal GenListItem(object data, GenItemClass itemClass, EvasObject parent) : base(data, itemClass, parent)
72 /// Gets or sets whether a given genlist item is selected.
74 /// <since_tizen> preview </since_tizen>
75 public override bool IsSelected
79 return Interop.Elementary.elm_genlist_item_selected_get(Handle);
83 Interop.Elementary.elm_genlist_item_selected_set(Handle, value);
88 /// Gets or sets whether a given genlist item is expanded.
90 /// <since_tizen> preview </since_tizen>
91 public bool IsExpanded
95 return Interop.Elementary.elm_genlist_item_expanded_get(Handle);
99 Interop.Elementary.elm_genlist_item_expanded_set(Handle, value);
104 /// Updates the content of an item.
105 /// This updates an item by calling all <see cref="GenItemClass"/> again to get the content, text, and states.
106 /// Use this when the original item data has changed and the changes are desired to reflect.
107 /// To update the already realized items, use <see cref="GenList.UpdateRealizedItems"/>.
109 /// <seealso cref="GenList.UpdateRealizedItems"/>
110 /// <since_tizen> preview </since_tizen>
111 public override void Update()
113 Interop.Elementary.elm_genlist_item_update(Handle);
117 /// Updates the part of an item.
118 /// This updates an item's part by calling the item's fetching functions again to get the contents, texts, and states.
119 /// Use this when the original item data has changed and the changes are desired to be reflected.
120 /// To update an item's all property, use <see cref="GenList.UpdateRealizedItems"/>.
122 /// <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>
123 /// <param name="type">The type of the item's part type.</param>
124 /// <seealso cref="GenList.UpdateRealizedItems"/>
125 /// <since_tizen> preview </since_tizen>
126 public void UpdateField(string part, GenListItemFieldType type)
128 Interop.Elementary.elm_genlist_item_fields_update(Handle, part, (uint)type);
132 /// Demotes an item to the end of the list.
134 /// <since_tizen> preview </since_tizen>
135 public void DemoteItem()
137 Interop.Elementary.elm_genlist_item_demote(Handle);
141 /// Gets or sets the genlist item's select mode.
143 /// <since_tizen> preview </since_tizen>
144 public override GenItemSelectionMode SelectionMode
148 return (GenItemSelectionMode)Interop.Elementary.elm_genlist_item_select_mode_get(Handle);
152 Interop.Elementary.elm_genlist_item_select_mode_set(Handle, (Interop.Elementary.Elm_Object_Select_Mode)value);
157 /// Gets the next item in a genlist widget's internal list of items.
159 /// <seealso cref="Previous"/>
160 /// <since_tizen> preview </since_tizen>
161 public GenListItem Next
165 IntPtr next = Interop.Elementary.elm_genlist_item_next_get(Handle);
166 if (next == IntPtr.Zero)
169 return GetItemByHandle(next) as GenListItem;
174 /// Gets the previous item in a genlist widget's internal list of items.
176 /// <seealso cref="Next"/>
177 /// <since_tizen> preview </since_tizen>
178 public GenListItem Previous
182 IntPtr prev = Interop.Elementary.elm_genlist_item_prev_get(Handle);
183 if (prev == IntPtr.Zero)
186 return GetItemByHandle(prev) as GenListItem;
191 /// Sets or gets the content to be shown in the tooltip item.
193 /// <since_tizen> preview </since_tizen>
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public override string Cursor
199 return Interop.Elementary.elm_genlist_item_cursor_get(Handle);
203 if (!string.IsNullOrEmpty(value))
205 Interop.Elementary.elm_genlist_item_cursor_set(Handle, value);
209 Interop.Elementary.elm_genlist_item_cursor_unset(Handle);
215 /// Sets or gets the style for this item cursor.
217 /// <since_tizen> preview </since_tizen>
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public override string CursorStyle
223 return Interop.Elementary.elm_genlist_item_cursor_style_get(Handle);
227 Interop.Elementary.elm_genlist_item_cursor_style_set(Handle, value);
232 /// Sets or gets the cursor engine only usage for this item cursor.
234 /// <since_tizen> preview </since_tizen>
235 [EditorBrowsable(EditorBrowsableState.Never)]
236 public override bool IsUseEngineCursor
240 return Interop.Elementary.elm_genlist_item_cursor_engine_only_get(Handle);
244 Interop.Elementary.elm_genlist_item_cursor_engine_only_set(Handle, value);
249 /// Sets the text to be shown in the genlist item.
251 /// <param name="tooltip">The text to set in the content.</param>
252 /// <since_tizen> preview </since_tizen>
253 public override void SetTooltipText(string tooltip)
255 Interop.Elementary.elm_genlist_item_tooltip_text_set(Handle, tooltip);
259 /// Unsets the tooltip from the item.
261 /// <since_tizen> preview </since_tizen>
262 public override void UnsetTooltip()
264 Interop.Elementary.elm_genlist_item_tooltip_unset(Handle);
268 /// Gets or sets the style of the given genlist item's tooltip.
270 /// <since_tizen> preview </since_tizen>
271 public override string TooltipStyle
275 return Interop.Elementary.elm_genlist_item_tooltip_style_get(Handle);
279 Interop.Elementary.elm_genlist_item_tooltip_style_set(Handle, value);
284 /// Gets or sets the disable size restrictions on an object's tooltip.
286 /// <since_tizen> preview </since_tizen>
287 public bool IsTooltipWindowMode
291 return Interop.Elementary.elm_genlist_item_tooltip_window_mode_get(Handle);
295 Interop.Elementary.elm_genlist_item_tooltip_window_mode_set(Handle, value);
300 /// Gets the index of the item. It is only valid, once displayed.
302 /// <since_tizen> preview </since_tizen>
307 return Interop.Elementary.elm_genlist_item_index_get(Handle);
312 /// Gets the depth of the expanded item.
314 /// <since_tizen> preview </since_tizen>
315 public int ExpandedItemDepth
319 return Interop.Elementary.elm_genlist_item_expanded_depth_get(Handle);
324 /// Remove all the subitems (children) of the given item.
327 /// This removes the items that are the children (and their descendants) of the given item.
329 /// <since_tizen> preview </since_tizen>
330 public void ClearSubitems()
332 Interop.Elementary.elm_genlist_item_subitems_clear(Handle);
336 /// Updates the item class of the item.
337 /// 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.
339 /// <param name="itemClass">The item class for the item.</param>
340 /// <param name="data">The data for the item.</param>
341 /// <since_tizen> preview </since_tizen>
342 public void UpdateItemClass(GenItemClass itemClass, object data)
345 ItemClass = itemClass;
346 Interop.Elementary.elm_genlist_item_item_class_update((IntPtr)Handle, itemClass.UnmanagedPtr);
350 /// Sets the content to be shown in the tooltip item.
352 /// <since_tizen> preview </since_tizen>
353 protected override void UpdateTooltipDelegate()
355 Interop.Elementary.elm_genlist_item_tooltip_content_cb_set(Handle,
356 TooltipContentDelegate != null ? _tooltipCb : null,