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)
68 /// Gets or sets whether a given genlist item is selected.
70 /// <since_tizen> preview </since_tizen>
71 public override bool IsSelected
75 return Interop.Elementary.elm_genlist_item_selected_get(Handle);
79 Interop.Elementary.elm_genlist_item_selected_set(Handle, value);
84 /// Gets or sets whether a given genlist item is expanded.
86 /// <since_tizen> preview </since_tizen>
87 public bool IsExpanded
91 return Interop.Elementary.elm_genlist_item_expanded_get(Handle);
95 Interop.Elementary.elm_genlist_item_expanded_set(Handle, value);
100 /// Updates the content of an item.
101 /// This updates an item by calling all <see cref="GenItemClass"/> again to get the content, text, and states.
102 /// Use this when the original item data has changed and the changes are desired to reflect.
103 /// To update the already realized items, use <see cref="GenList.UpdateRealizedItems"/>.
105 /// <seealso cref="GenList.UpdateRealizedItems"/>
106 /// <since_tizen> preview </since_tizen>
107 public override void Update()
109 Interop.Elementary.elm_genlist_item_update(Handle);
113 /// Updates the part of an item.
114 /// This updates an item's part by calling the item's fetching functions again to get the contents, texts, and states.
115 /// Use this when the original item data has changed and the changes are desired to be reflected.
116 /// To update an item's all property, use <see cref="GenList.UpdateRealizedItems"/>.
118 /// <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>
119 /// <param name="type">The type of the item's part type.</param>
120 /// <seealso cref="GenList.UpdateRealizedItems"/>
121 /// <since_tizen> preview </since_tizen>
122 public void UpdateField(string part, GenListItemFieldType type)
124 Interop.Elementary.elm_genlist_item_fields_update(Handle, part, (uint)type);
128 /// Demotes an item to the end of the list.
130 /// <since_tizen> preview </since_tizen>
131 public void DemoteItem()
133 Interop.Elementary.elm_genlist_item_demote(Handle);
137 /// Gets or sets the genlist item's select mode.
139 /// <since_tizen> preview </since_tizen>
140 public override GenItemSelectionMode SelectionMode
144 return (GenItemSelectionMode)Interop.Elementary.elm_genlist_item_select_mode_get(Handle);
148 Interop.Elementary.elm_genlist_item_select_mode_set(Handle, (Interop.Elementary.Elm_Object_Select_Mode)value);
153 /// Gets the next item in a genlist widget's internal list of items.
155 /// <seealso cref="Previous"/>
156 /// <since_tizen> preview </since_tizen>
157 public GenListItem Next
161 IntPtr next = Interop.Elementary.elm_genlist_item_next_get(Handle);
162 if (next == IntPtr.Zero)
165 return GetItemByHandle(next) as GenListItem;
170 /// Gets the previous item in a genlist widget's internal list of items.
172 /// <seealso cref="Next"/>
173 /// <since_tizen> preview </since_tizen>
174 public GenListItem Previous
178 IntPtr prev = Interop.Elementary.elm_genlist_item_prev_get(Handle);
179 if (prev == IntPtr.Zero)
182 return GetItemByHandle(prev) as GenListItem;
187 /// Sets or gets the content to be shown in the tooltip item.
189 /// <since_tizen> preview </since_tizen>
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public override string Cursor
195 return Interop.Elementary.elm_genlist_item_cursor_get(Handle);
199 if (!string.IsNullOrEmpty(value))
201 Interop.Elementary.elm_genlist_item_cursor_set(Handle, value);
205 Interop.Elementary.elm_genlist_item_cursor_unset(Handle);
211 /// Sets or gets the style for this item cursor.
213 /// <since_tizen> preview </since_tizen>
214 [EditorBrowsable(EditorBrowsableState.Never)]
215 public override string CursorStyle
219 return Interop.Elementary.elm_genlist_item_cursor_style_get(Handle);
223 Interop.Elementary.elm_genlist_item_cursor_style_set(Handle, value);
228 /// Sets or gets the cursor engine only usage for this item cursor.
230 /// <since_tizen> preview </since_tizen>
231 [EditorBrowsable(EditorBrowsableState.Never)]
232 public override bool IsUseEngineCursor
236 return Interop.Elementary.elm_genlist_item_cursor_engine_only_get(Handle);
240 Interop.Elementary.elm_genlist_item_cursor_engine_only_set(Handle, value);
245 /// Sets the text to be shown in the genlist item.
247 /// <param name="tooltip">The text to set in the content.</param>
248 /// <since_tizen> preview </since_tizen>
249 public override void SetTooltipText(string tooltip)
251 Interop.Elementary.elm_genlist_item_tooltip_text_set(Handle, tooltip);
255 /// Unsets the tooltip from the item.
257 /// <since_tizen> preview </since_tizen>
258 public override void UnsetTooltip()
260 Interop.Elementary.elm_genlist_item_tooltip_unset(Handle);
264 /// Gets or sets the style of the given genlist item's tooltip.
266 /// <since_tizen> preview </since_tizen>
267 public override string TooltipStyle
271 return Interop.Elementary.elm_genlist_item_tooltip_style_get(Handle);
275 Interop.Elementary.elm_genlist_item_tooltip_style_set(Handle, value);
280 /// Gets or sets the disable size restrictions on an object's tooltip.
282 /// <since_tizen> preview </since_tizen>
283 public bool IsTooltipWindowMode
287 return Interop.Elementary.elm_genlist_item_tooltip_window_mode_get(Handle);
291 Interop.Elementary.elm_genlist_item_tooltip_window_mode_set(Handle, value);
296 /// Gets the index of the item. It is only valid, once displayed.
298 /// <since_tizen> preview </since_tizen>
303 return Interop.Elementary.elm_genlist_item_index_get(Handle);
308 /// Gets the depth of the expanded item.
310 /// <since_tizen> preview </since_tizen>
311 public int ExpandedItemDepth
315 return Interop.Elementary.elm_genlist_item_expanded_depth_get(Handle);
320 /// Remove all the subitems (children) of the given item.
323 /// This removes the items that are the children (and their descendants) of the given item.
325 /// <since_tizen> preview </since_tizen>
326 public void ClearSubitems()
328 Interop.Elementary.elm_genlist_item_subitems_clear(Handle);
332 /// Updates the item class of the item.
333 /// 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.
335 /// <param name="itemClass">The item class for the item.</param>
336 /// <param name="data">The data for the item.</param>
337 /// <since_tizen> preview </since_tizen>
338 public void UpdateItemClass(GenItemClass itemClass, object data)
341 ItemClass = itemClass;
342 Interop.Elementary.elm_genlist_item_item_class_update((IntPtr)Handle, itemClass.UnmanagedPtr);
346 /// Sets the content to be shown in the tooltip item.
348 /// <since_tizen> preview </since_tizen>
349 protected override void UpdateTooltipDelegate()
351 Interop.Elementary.elm_genlist_item_tooltip_content_cb_set(Handle,
352 TooltipContentDelegate != null ? _tooltipCb : null,