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.Collections.Generic;
23 /// Enumeration for setting genlist item type.
25 public enum GenListItemType
28 /// if Normal is set then this item is normal item.
33 /// If tree is set then this item is displayed as an item that is able to expand and have child items.
38 /// if Group is set then this item is group index item that is displayed at the top until the next group comes.
44 /// Enumeration for setting genlist's resizing behavior, transverse axis scrolling and items cropping.
46 public enum GenListMode
49 /// The genlist won't set any of its size hints to inform how a possible container should resize it.
50 /// Then, if it's not created as a "resize object", it might end with zeroed dimensions.
51 /// The genlist will respect the container's geometry and, if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction.
56 /// This is the same as Compress, with the exception that if any of its items won't fit into its transverse axis, one will be able to scroll it in that direction.
61 /// Sets a minimum size hint on the genlist object, so that containers may respect it (and resize itself to fit the child properly).
62 /// More specifically, a minimum size hint will be set for its transverse axis, so that the largest item in that direction fits well.
63 /// This is naturally bound by the genlist object's maximum size hints, set externally.
68 /// Besides setting a minimum size on the transverse axis, just like on Limit, the genlist will set a minimum size on th longitudinal axis, trying to reserve space to all its children to be visible at a time.
69 /// This is naturally bound by the genlist object's maximum size hints, set externally.
75 /// It inherits System.EventArgs.
76 /// It contains Item which is <see cref="GenListItem"/> type.
77 /// All events of GenList contain GenListItemEventArgs as a parameter.
79 public class GenListItemEventArgs : EventArgs
82 /// Gets or sets GenList item. The return type is <see cref="GenListItem"/>.
84 public GenListItem Item { get; set; }
86 internal static GenListItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
88 GenListItem item = ItemObject.GetItemByHandle(info) as GenListItem;
89 return new GenListItemEventArgs() { Item = item };
94 /// Enumeration that defines where to position the item in the genlist.
96 public enum ScrollToPosition
99 /// Scrolls to nowhere.
104 /// Scrolls to the nearest viewport.
109 /// Scrolls to the top of the viewport.
114 /// Scrolls to the middle of the viewport.
119 /// Scrolls to the bottom of the viewport.
125 /// It inherits <see cref="Layout"/>.
126 /// The GenList is a widget that aims to have more expansive list than the simple <see cref="List"/> in ElmSharp that could have more flexible items and allow many more entries while still being fast and low on memory usage.
127 /// At the same time it was also made to be able to do tree structures.
128 /// But the price to pay is more complexity when it comes to usage.
129 /// If all you want is a simple list with icons and a single text, use the <see cref="List"/> widget.
131 public class GenList : Layout
133 HashSet<GenListItem> _children = new HashSet<GenListItem>();
135 SmartEvent<GenListItemEventArgs> _selected;
136 SmartEvent<GenListItemEventArgs> _unselected;
137 SmartEvent<GenListItemEventArgs> _activated;
138 SmartEvent<GenListItemEventArgs> _pressed;
139 SmartEvent<GenListItemEventArgs> _released;
140 SmartEvent<GenListItemEventArgs> _doubleClicked;
141 SmartEvent<GenListItemEventArgs> _expanded;
142 SmartEvent<GenListItemEventArgs> _realized;
143 SmartEvent<GenListItemEventArgs> _unrealized;
144 SmartEvent<GenListItemEventArgs> _longpressed;
145 SmartEvent<GenListItemEventArgs> _moved;
146 SmartEvent<GenListItemEventArgs> _movedAfter;
147 SmartEvent<GenListItemEventArgs> _movedBefore;
148 SmartEvent _scrollAnimationStarted;
149 SmartEvent _scrollAnimationStopped;
153 /// Creates and initializes a new instance of the GenList class.
155 /// <param name="parent">The parent is a given container which will be attached by GenList as a child. It's <see cref="EvasObject"/> type.</param>
156 public GenList(EvasObject parent) : base(parent)
161 /// Creates and initializes a new instance of GenList class.
163 protected GenList() : base()
168 /// Gets or sets whether the homogeneous mode is enabled.
171 /// If true, the genlist items have same height and width.
173 public bool Homogeneous
177 return Interop.Elementary.elm_genlist_homogeneous_get(RealHandle);
181 Interop.Elementary.elm_genlist_homogeneous_set(RealHandle, value);
186 /// Gets or sets the horizontal stretching mode. This mode used for sizing items horizontally.
187 /// The default value is <see cref="GenListMode.Scroll"/> which means that if items are too wide to fit, the scroller scrolls horizontally.
188 /// If set <see cref="GenListMode.Compress"/> which means that the item width is fixed (restricted to a minimum of) to the list width when calculating its size in order to allow the height to be calculated based on it.
189 /// If set <see cref="GenListMode.Limit"/> which means that items are expanded to the viewport width and limited to that size.
190 /// if set <see cref="GenListMode.Expand"/> which means that genlist try to reserve space to all its items to be visible at a time.
193 /// Compress makes genlist resize slower as it recalculates every item height again whenever the list width changes.
194 /// The homogeneous mode is so that all items in the genlist are of the same width/height. With Compress, genlist items are initialized fast.
195 /// However, there are no sub-objects in the genlist which can be on the flying resizable (such as TEXTBLOCK).
196 /// If so, then some dynamic resizable objects in the genlist would not be diplayed properly.
198 public GenListMode ListMode
202 return (GenListMode)Interop.Elementary.elm_genlist_mode_get(RealHandle);
206 Interop.Elementary.elm_genlist_mode_set(RealHandle, (int)value);
211 /// Gets the first item in the genlist.
213 public GenListItem FirstItem
217 IntPtr handle = Interop.Elementary.elm_genlist_first_item_get(RealHandle);
218 return ItemObject.GetItemByHandle(handle) as GenListItem;
223 /// Gets the last item in the genlist.
225 public GenListItem LastItem
229 IntPtr handle = Interop.Elementary.elm_genlist_last_item_get(RealHandle);
230 return ItemObject.GetItemByHandle(handle) as GenListItem;
235 /// Gets or sets the reorder mode.
236 /// After turning on the reorder mode, longpress on a normal item triggers reordering of the item.
237 /// You can move the item up and down. However, reordering does not work with group items.
239 public bool ReorderMode
243 return Interop.Elementary.elm_genlist_reorder_mode_get(RealHandle);
247 Interop.Elementary.elm_genlist_reorder_mode_set(RealHandle, value);
252 /// Gets or set the maximum number of items within an item block.
254 public int BlockCount
258 return Interop.Elementary.elm_genlist_block_count_get(RealHandle);
262 Interop.Elementary.elm_genlist_block_count_set(RealHandle, value);
267 /// Gets or sets whether the genlist items should be highlighted when an item is selected.
269 public bool IsHighlight
273 return Interop.Elementary.elm_genlist_highlight_mode_get(RealHandle);
277 Interop.Elementary.elm_genlist_highlight_mode_set(RealHandle, value);
282 /// Gets or sets the timeout in seconds for the longpress event.
284 public double LongPressTimeout
288 return Interop.Elementary.elm_genlist_longpress_timeout_get(RealHandle);
292 Interop.Elementary.elm_genlist_longpress_timeout_set(RealHandle, value);
297 /// Gets or Sets focus upon items selection mode.
300 /// When enabled, every selection of an item inside the <see cref="GenList"/> will automatically set focus to its first focusable widget from the left.
301 /// This is true of course if the selection was made by clicking an unfocusable area in an item or selecting it with a key movement.
302 /// Clicking on a focusable widget inside an item will couse this particular item to get focus as usual.
304 public bool FocusOnSelection
308 return Interop.Elementary.elm_genlist_focus_on_selection_get(RealHandle);
312 Interop.Elementary.elm_genlist_focus_on_selection_set(RealHandle, value);
317 /// Gets or sets whether enable multi-selection in the genlist.
319 public bool IsMultiSelection
323 return Interop.Elementary.elm_genlist_multi_select_get(RealHandle);
327 Interop.Elementary.elm_genlist_multi_select_set(RealHandle, value);
332 /// Gets the selected item in a given genlist widget.
334 public GenListItem SelectedItem
338 IntPtr handle = Interop.Elementary.elm_genlist_selected_item_get(RealHandle);
339 return ItemObject.GetItemByHandle(handle) as GenListItem;
344 /// Gets or sets the genlist select mode by <see cref="GenItemSelectionMode"/>.
346 public GenItemSelectionMode SelectionMode
350 return (GenItemSelectionMode)Interop.Elementary.elm_genlist_select_mode_get(RealHandle);
354 Interop.Elementary.elm_genlist_select_mode_set(RealHandle, (int)value);
359 /// ItemSelected is raised when a new genlist item is selected.
361 public event EventHandler<GenListItemEventArgs> ItemSelected;
364 /// ItemUnselected is raised when the genlist item is Unselected.
366 public event EventHandler<GenListItemEventArgs> ItemUnselected;
369 /// ItemPressed is raised when a new genlist item is pressed.
371 public event EventHandler<GenListItemEventArgs> ItemPressed;
374 /// ItemReleased is raised when a new genlist item is released.
376 public event EventHandler<GenListItemEventArgs> ItemReleased;
379 /// ItemActivated is raised when a new genlist item is double clicked or pressed (enter|return|spacebar).
381 public event EventHandler<GenListItemEventArgs> ItemActivated;
384 /// ItemDoubleClicked is raised when a new genlist item is double clicked.
386 public event EventHandler<GenListItemEventArgs> ItemDoubleClicked;
389 /// ItemExpanded is raised when a new genlist item is indicated to expand.
391 public event EventHandler<GenListItemEventArgs> ItemExpanded;
394 /// ItemRealized is raised when a new genlist item is created as a real object.
396 public event EventHandler<GenListItemEventArgs> ItemRealized;
399 /// ItemUnrealized is raised when a new genlist item is unrealized.
400 /// After calling unrealize, the item's content objects are deleted and the item object itself is deleted or is put into a floating cache.
402 public event EventHandler<GenListItemEventArgs> ItemUnrealized;
405 /// ItemLongPressed is raised when a genlist item is pressed for a certain amount of time. By default it's 1 second.
407 public event EventHandler<GenListItemEventArgs> ItemLongPressed;
410 /// ItemMoved is raised when a genlist item is moved in the reorder mode.
412 public event EventHandler<GenListItemEventArgs> ItemMoved;
415 /// ItemMovedAfter is raised when a genlist item is moved after another item in the reorder mode.
416 /// To get the relative previous item, use <see cref="GenListItem.Previous"/>.
418 public event EventHandler<GenListItemEventArgs> ItemMovedAfter;
421 /// ItemMovedBefore is raised when a genlist item is moved before another item in the reorder mode.
422 /// To get the relative next item, use <see cref="GenListItem.Next"/>.
424 public event EventHandler<GenListItemEventArgs> ItemMovedBefore;
427 /// Changed is raised when genlist is changed.
429 public event EventHandler Changed
431 add { _changed.On += value; }
432 remove { _changed.On -= value; }
436 /// ScrollAnimationStarted is raised when scrolling animation has started.
438 public event EventHandler ScrollAnimationStarted
440 add { _scrollAnimationStarted.On += value; }
441 remove { _scrollAnimationStarted.On -= value; }
445 /// ScrollAnimationStopped is raised when scrolling animation has stopped.
447 public event EventHandler ScrollAnimationStopped
449 add { _scrollAnimationStopped.On += value; }
450 remove { _scrollAnimationStopped.On -= value; }
454 /// Appends a new item to the end of a given genlist widget.
456 /// <param name="itemClass">The itemClass defines how to display the data.</param>
457 /// <param name="data">The item data.</param>
458 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
459 /// <seealso cref="GenItemClass"/>
460 /// <seealso cref="GenListItem"/>
461 public GenListItem Append(GenItemClass itemClass, object data)
463 return Append(itemClass, data, GenListItemType.Normal);
467 /// Appends a new item with <see cref="GenListItemType"/> to the end of a given genlist widget.
469 /// <param name="itemClass">The itemClass defines how to display the data.</param>
470 /// <param name="data">The item data.</param>
471 /// <param name="type">The genlist item type.</param>
472 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
473 public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type)
475 return Append(itemClass, data, type, null);
479 /// Appends a new item with <see cref="GenListItemType"/> to the end of a given genlist widget or the end of the children list if the parent is given.
481 /// <param name="itemClass">The itemClass defines how to display the data.</param>
482 /// <param name="data">The item data.</param>
483 /// <param name="type">The genlist item type.</param>
484 /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
485 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
486 public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
488 GenListItem item = new GenListItem(data, itemClass);
489 IntPtr handle = Interop.Elementary.elm_genlist_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
490 item.Handle = handle;
496 /// Prepends a new item to the beginning of a given genlist widget.
498 /// <param name="itemClass">The itemClass defines how to display the data.</param>
499 /// <param name="data">The item data.</param>
500 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
501 public GenListItem Prepend(GenItemClass itemClass, object data)
503 return Prepend(itemClass, data, GenListItemType.Normal);
507 /// Prepends a new item with <see cref="GenListItemType"/> to the beginning of a given genlist widget.
509 /// <param name="itemClass">The itemClass defines how to display the data.</param>
510 /// <param name="data">The item data.</param>
511 /// <param name="type">The genlist item type.</param>
512 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
513 public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type)
515 return Prepend(itemClass, data, type, null);
519 /// Prepends a new item with <see cref="GenListItemType"/> to the beginning of a given genlist widget or the beginning of the children list if the parent is given.
521 /// <param name="itemClass">The itemClass defines how to display the data.</param>
522 /// <param name="data">The item data.</param>
523 /// <param name="type">The genlist item type.</param>
524 /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
525 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
526 public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
528 GenListItem item = new GenListItem(data, itemClass);
529 IntPtr handle = Interop.Elementary.elm_genlist_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
530 item.Handle = handle;
536 /// Inserts an item before another item in a genlist widget.
537 /// It is the same tree level or group as the item before which it is inserted.????
539 /// <param name="itemClass">The itemClass defines how to display the data.</param>
540 /// <param name="data">The item data.</param>
541 /// <param name="before">The item before which to place this new one.</param>
542 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
543 public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before)
545 return InsertBefore(itemClass, data, before, GenListItemType.Normal);
549 /// Inserts an item with <see cref="GenListItemType"/> before another item in a genlist widget.
550 /// It is the same tree level or group as the item before which it is inserted.????
552 /// <param name="itemClass">The itemClass defines how to display the data.</param>
553 /// <param name="data">The item data.</param>
554 /// <param name="before">The item before which to place this new one.</param>
555 /// <param name="type">The genlist item type.</param>
556 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
557 public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type)
559 return InsertBefore(itemClass, data, before, type, null);
563 /// Inserts an item with <see cref="GenListItemType"/> before another item under a parent in a genlist widget.
565 /// <param name="itemClass">The itemClass defines how to display the data.</param>
566 /// <param name="data">The item data.</param>
567 /// <param name="before">The item before which to place this new one.</param>
568 /// <param name="type">The genlist item type.</param>
569 /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
570 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
571 public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type, GenListItem parent)
573 GenListItem item = new GenListItem(data, itemClass);
574 // insert before the `before` list item
575 IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before(
576 RealHandle, // genlist handle
577 itemClass.UnmanagedPtr, // item class
578 (IntPtr)item.Id, // data
581 (int)type, // item type
582 null, // select callback
583 (IntPtr)item.Id); // callback data
584 item.Handle = handle;
590 /// Inserts an item with <see cref="GenListItemType"/> after another item under a parent in a genlist widget.
592 /// <param name="itemClass">The itemClass defines how to display the data.</param>
593 /// <param name="data">The item data.</param>
594 /// <param name="after">The item after which to place this new one.</param>
595 /// <param name="type">The genlist item type.</param>
596 /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
597 /// <returns>Return a new added genlist item that contains data and itemClass.</returns>
598 public GenListItem InsertAfter(GenItemClass itemClass, object data, GenListItem after, GenListItemType type, GenListItem parent)
600 GenListItem item = new GenListItem(data, itemClass);
601 // insert before the `before` list item
602 IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before(
603 RealHandle, // genlist handle
604 itemClass.UnmanagedPtr, // item class
605 (IntPtr)item.Id, // data
608 (int)type, // item type
609 null, // select callback
610 (IntPtr)item.Id); // callback data
611 item.Handle = handle;
617 /// Insert an item in a genlist widget using a user-defined sort function.
619 /// <param name="itemClass">The itemClass defines how to display the data.</param>
620 /// <param name="data">The item data.</param>
621 /// <param name="comparison">User defined comparison function that defines the sort order based on genlist item and its data.</param>
622 /// <param name="type">The genlist item type.</param>
623 /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
624 /// <returns>Return a genlist item that contains data and itemClass.</returns>
625 public GenListItem InsertSorted(GenItemClass itemClass, object data, Comparison<object> comparison, GenListItemType type, GenListItem parent)
627 GenListItem item = new GenListItem(data, itemClass);
629 Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) =>
631 GenListItem first = (ItemObject.GetItemByHandle(handle1) as GenListItem) ?? item;
632 GenListItem second = (ItemObject.GetItemByHandle(handle2) as GenListItem) ?? item;
633 return comparison(first.Data, second.Data);
636 IntPtr handle = Interop.Elementary.elm_genlist_item_sorted_insert(
637 RealHandle, // genlist handle
638 itemClass.UnmanagedPtr, // item clas
639 (IntPtr)item.Id, // data
641 (int)type, // item type
642 compareCallback, // compare callback
643 null, //select callback
644 (IntPtr)item.Id); // callback data
645 item.Handle = handle;
651 /// Shows the given item with position type in a genlist.
652 /// When animated is true, genlist will jump to the given item and display it (by animatedly scrolling), if it is not fully visible. This may use animation and may take some time.
653 /// When animated is false, genlist will jump to the given item and display it (by jumping to that position), if it is not fully visible.
655 /// <param name="item">The item to display.</param>
656 /// <param name="position">The position to show the given item to <see cref="ScrollToPosition"/>.</param>
657 /// <param name="animated">The animated indicates how to display the item, by scrolling or by jumping.</param>
658 public void ScrollTo(GenListItem item, ScrollToPosition position, bool animated)
662 Interop.Elementary.elm_genlist_item_bring_in(item.Handle, (Interop.Elementary.Elm_Genlist_Item_Scrollto_Type)position);
666 Interop.Elementary.elm_genlist_item_show(item.Handle, (Interop.Elementary.Elm_Genlist_Item_Scrollto_Type)position);
671 /// Updates the content of all the realized items.
672 /// This updates all the realized items by calling all the <see cref="GenItemClass"/> again to get the content, text and states.
673 /// Use this when the original item data has changed and the changes are desired to reflect.
674 /// To update just one item, use <see cref="GenListItem.Update"/>.
676 /// <seealso cref="GenListItem.Update"/>
677 public void UpdateRealizedItems()
679 Interop.Elementary.elm_genlist_realized_items_update(RealHandle);
683 /// Removes all items from a given genlist widget.
684 /// This removes (and deletes) all items in obj, making it empty.
685 /// To delete just one item, use <see cref="ItemObject.Delete"/>.
687 /// <seealso cref="ItemObject.Delete"/>
690 Interop.Elementary.elm_genlist_clear(RealHandle);
694 /// Get the item that is at the x, y canvas coords.
696 /// <param name="x">The input x coordinate</param>
697 /// <param name="y">The input y coordinate</param>
698 /// <param name="pos">The position relative to the item returned here
699 /// -1, 0, or 1, depending on whether the coordinate is on the upper portion of that item (-1), in the middle section (0), or on the lower part (1).
701 /// <returns></returns>
702 public GenListItem GetItemByPosition(int x, int y, out int pos)
704 IntPtr handle = Interop.Elementary.elm_genlist_at_xy_item_get(RealHandle, x, y, out pos);
705 return ItemObject.GetItemByHandle(handle) as GenListItem;
709 /// Gets the nth item in a given genlist widget, placed at position nth, in its internal items list.
711 /// <param name="index">The number of the item to grab (0 being the first)</param>
712 /// <returns></returns>
713 public GenListItem GetItemByIndex(int index)
715 IntPtr handle = Interop.Elementary.elm_genlist_nth_item_get(RealHandle, index);
716 return ItemObject.GetItemByHandle(handle) as GenListItem;
720 /// The callback of Unrealize Event
722 protected override void OnRealized()
725 ListMode = GenListMode.Compress;
726 InitializeSmartEvent();
730 /// Creates a widget handle.
732 /// <param name="parent">Parent EvasObject</param>
733 /// <returns>Handle IntPtr</returns>
734 protected override IntPtr CreateHandle(EvasObject parent)
736 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
737 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
739 RealHandle = Interop.Elementary.elm_genlist_add(handle);
740 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
745 void InitializeSmartEvent()
747 _selected = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "selected", GenListItemEventArgs.CreateFromSmartEvent);
748 _unselected = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "unselected", GenListItemEventArgs.CreateFromSmartEvent);
749 _activated = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "activated", GenListItemEventArgs.CreateFromSmartEvent);
750 _pressed = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "pressed", GenListItemEventArgs.CreateFromSmartEvent);
751 _released = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "released", GenListItemEventArgs.CreateFromSmartEvent);
752 _doubleClicked = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "clicked,double", GenListItemEventArgs.CreateFromSmartEvent);
753 _expanded = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "expanded", GenListItemEventArgs.CreateFromSmartEvent);
754 _realized = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "realized", GenListItemEventArgs.CreateFromSmartEvent);
755 _unrealized = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "unrealized", GenListItemEventArgs.CreateFromSmartEvent);
756 _longpressed = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "longpressed", GenListItemEventArgs.CreateFromSmartEvent);
757 _moved = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "moved", GenListItemEventArgs.CreateFromSmartEvent);
758 _movedAfter = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "moved,after", GenListItemEventArgs.CreateFromSmartEvent);
759 _movedBefore = new SmartEvent<GenListItemEventArgs>(this, this.RealHandle, "moved,before", GenListItemEventArgs.CreateFromSmartEvent);
760 _scrollAnimationStarted = new SmartEvent(this, this.RealHandle, "scroll,anim,start");
761 _scrollAnimationStopped = new SmartEvent(this, this.RealHandle, "scroll,anim,stop");
762 _changed = new SmartEvent(this, this.RealHandle, "changed");
764 _selected.On += (s, e) => { if (e.Item != null) ItemSelected?.Invoke(this, e); };
765 _unselected.On += (s, e) => { if (e.Item != null) ItemUnselected?.Invoke(this, e); };
766 _activated.On += (s, e) => { if (e.Item != null) ItemActivated?.Invoke(this, e); };
767 _pressed.On += (s, e) => { if (e.Item != null) ItemPressed?.Invoke(this, e); };
768 _released.On += (s, e) => { if (e.Item != null) ItemReleased?.Invoke(this, e); };
769 _doubleClicked.On += (s, e) => { if (e.Item != null) ItemDoubleClicked?.Invoke(this, e); };
770 _expanded.On += (s, e) => { if (e.Item != null) ItemExpanded?.Invoke(this, e); };
771 _realized.On += (s, e) => { if (e.Item != null) ItemRealized?.Invoke(this, e); };
772 _unrealized.On += (s, e) => { if (e.Item != null) ItemUnrealized?.Invoke(this, e); };
773 _longpressed.On += (s, e) => { if (e.Item != null) ItemLongPressed?.Invoke(this, e); };
774 _moved.On += (s, e) => { if (e.Item != null) ItemMoved?.Invoke(this, e); };
775 _movedAfter.On += (s, e) => { if (e.Item != null) ItemMovedAfter?.Invoke(this, e); };
776 _movedBefore.On += (s, e) => { if (e.Item != null) ItemMovedBefore?.Invoke(this, e); };
779 void AddInternal(GenListItem item)
782 item.Deleted += Item_Deleted;
785 void Item_Deleted(object sender, EventArgs e)
787 _children.Remove((GenListItem)sender);