Class GenList
Definition
- Namespace:
- ElmSharp
- Assembly:
- ElmSharp.dll
It inherits Layout. The GenList is a widget that aims to have a more expansive list than the simple List in ElmSharp that could have more flexible items and allow many more entries while still being fast and low on memory usage. At the same time it was also made to be able to do tree structures. But the price to pay is more complex when it comes to usage. If all you want is a simple list with icons and a single text, use List widget.
public class GenList : Layout, IAccessibleObject
- Inheritance
- Derived
- Implements
Constructors
View SourceGenList()
Creates and initializes a new instance of the GenList class.
Declaration
protected GenList()
GenList(EvasObject)
Creates and initializes a new instance of the GenList class.
Declaration
public GenList(EvasObject parent)
Parameters
Type | Name | Description |
---|---|---|
EvasObject | parent | The parent is a given container, which will be attached by GenList as a child. It's EvasObject type. |
Properties
View SourceBlockCount
Gets or sets the maximum number of items within an item block.
Declaration
public int BlockCount { get; set; }
Property Value
Type | Description |
---|---|
int |
Count
Gets the count of items in a this genlist widget.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
FirstItem
Gets the first item in the genlist.
Declaration
public GenListItem FirstItem { get; }
Property Value
Type | Description |
---|---|
GenListItem |
FocusOnSelection
Gets or sets the focus upon the items selection mode.
Declaration
public bool FocusOnSelection { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When enabled, every selection of an item inside GenList will automatically set focus to its first focusable widget from the left. 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. Clicking on a focusable widget inside an item will couse this particular item to get focus as usual.
Homogeneous
Gets or sets whether the homogeneous mode is enabled.
Declaration
public bool Homogeneous { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If true, the genlist items will have the same height and width.
HorizontalScrollBarVisiblePolicy
Sets or gets the value of HorizontalScrollBarVisiblePolicy.
Declaration
public ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy { get; set; }
Property Value
Type | Description |
---|---|
ScrollBarVisiblePolicy |
Remarks
ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden. ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
IsHighlight
Gets or sets whether the genlist items should be highlighted when an item is selected.
Declaration
public bool IsHighlight { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsMultiSelection
Gets or sets whether to enable multi-selection in the genlist.
Declaration
public bool IsMultiSelection { get; set; }
Property Value
Type | Description |
---|---|
bool |
LastItem
Gets the last item in the genlist.
Declaration
public GenListItem LastItem { get; }
Property Value
Type | Description |
---|---|
GenListItem |
ListMode
Gets or sets the horizontal stretching mode. This mode used for sizing items horizontally. The default value is Scroll, which means that if the items are too wide to fit, the scroller scrolls horizontally. If set to Compress, means that the item width is fixed (restricted to a minimum) to the list width when calculating its size in order to allow the height to be calculated based on it. If set to Limit, means that items are expanded to the viewport width and limited to that size. If set to Expand, means that genlist try to reserve space to all its items to be visible at a time.
Declaration
public GenListMode ListMode { get; set; }
Property Value
Type | Description |
---|---|
GenListMode |
Remarks
Compress makes the genlist resize slower, as it recalculates every item height again whenever the list width changes. The homogeneous mode is so that all items in the genlist are of the same width/height. With Compress, the genlist items are initialized fast. However, there are no subobjects in the genlist, which can be on the flying resizable (such as TEXTBLOCK). If so, then some dynamic resizable objects in the genlist would not be diplayed properly.
LongPressTimeout
Gets or sets the timeout in seconds for the longpress event.
Declaration
public double LongPressTimeout { get; set; }
Property Value
Type | Description |
---|---|
double |
ReorderMode
Gets or sets the reorder mode. After turning on the reorder mode, longpress on a normal item triggers reordering of the item. You can move the item up and down. However, reordering does not work with group items.
Declaration
public bool ReorderMode { get; set; }
Property Value
Type | Description |
---|---|
bool |
SelectedItem
Gets the selected item in a given GenList widget.
Declaration
public GenListItem SelectedItem { get; }
Property Value
Type | Description |
---|---|
GenListItem |
SelectionMode
Gets or sets the genlist select mode by GenItemSelectionMode.
Declaration
public GenItemSelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
GenItemSelectionMode |
VerticalScrollBarVisiblePolicy
Sets or gets the value of VerticalScrollBarVisiblePolicy.
Declaration
public ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy { get; set; }
Property Value
Type | Description |
---|---|
ScrollBarVisiblePolicy |
Remarks
ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
Methods
View SourceAppend(GenItemClass, object, GenListItemType, GenListItem)
Appends a new item with GenListItemType to the end of a given GenList widget or the end of the children list, if the parent is given.
Declaration
public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItemType | type | The genlist item type. |
GenListItem | parent | The parent item, otherwise null if there is no parent item. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains the data and itemClass. |
Append(GenItemClass, object, GenListItemType)
Appends a new item with GenListItemType to the end of a given GenList widget.
Declaration
public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItemType | type | The genlist item type. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains the data and itemClass. |
Append(GenItemClass, object)
Appends a new item to the end of a given GenList widget.
Declaration
public GenListItem Append(GenItemClass itemClass, object data)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains the data and itemClass. |
See Also
View SourceClear()
Removes all the items from a given genlist widget. This removes (and deletes) all items in the object, making it empty. To delete just one item, use Delete().
Declaration
public void Clear()
See Also
CreateHandle(EvasObject)
Creates a widget handle.
Declaration
protected override IntPtr CreateHandle(EvasObject parent)
Parameters
Type | Name | Description |
---|---|---|
EvasObject | parent | Parent EvasObject. |
Returns
Type | Description |
---|---|
System.IntPtr | Handle IntPtr. |
Overrides
View SourceGetItemByIndex(int)
Gets the nth item in a given genlist widget, placed at position nth, in its internal items list.
Declaration
public GenListItem GetItemByIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The number of the item to grab (0 being the first). |
Returns
Type | Description |
---|---|
GenListItem |
GetItemByPosition(int, int, out int)
Gets the item that is at the X, Y canvas coordinates.
Declaration
public GenListItem GetItemByPosition(int x, int y, out int pos)
Parameters
Type | Name | Description |
---|---|---|
int | x | The input X-coordinate. |
int | y | The input Y-coordinate. |
int | pos | The position relative to the item returned here. -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). |
Returns
Type | Description |
---|---|
GenListItem | The item at the given coordinates. |
InsertAfter(GenItemClass, object, GenListItem, GenListItemType, GenListItem)
Inserts an item with GenListItemType after another item under a parent in a GenList widget.
Declaration
public GenListItem InsertAfter(GenItemClass itemClass, object data, GenListItem after, GenListItemType type, GenListItem parent)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItem | after | The item after which to place this new one. |
GenListItemType | type | The genlist item type. |
GenListItem | parent | The parent item, otherwise null if there is no parent item. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains data and itemClass. |
InsertBefore(GenItemClass, object, GenListItem, GenListItemType, GenListItem)
Inserts an item with GenListItemType before another item under a parent in a GenList widget.
Declaration
public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type, GenListItem parent)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItem | before | The item before which to place this new one. |
GenListItemType | type | The genlist item type. |
GenListItem | parent | The parent item, otherwise null if there is no parent item. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains data and itemClass. |
InsertBefore(GenItemClass, object, GenListItem, GenListItemType)
Inserts an item with GenListItemType before another item in a GenList widget. It is the same tree level or group as the item before which it is inserted.
Declaration
public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItem | before | The item before which to place this new one. |
GenListItemType | type | The genlist item type. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains data and itemClass. |
InsertBefore(GenItemClass, object, GenListItem)
Inserts an item before another item in a genlist widget. It is the same tree level or group as the item before which it is inserted.????
Declaration
public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItem | before | The item before which to place this new one. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains data and itemClass. |
InsertSorted(GenItemClass, object, Comparison<object>, GenListItemType, GenListItem)
Inserts an item in a GenList widget using a user-defined sort function.
Declaration
public GenListItem InsertSorted(GenItemClass itemClass, object data, Comparison<object> comparison, GenListItemType type, GenListItem parent)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
System.Comparison<T><object> | comparison | User-defined comparison function that defines the sort order based on the genlist item and its data. |
GenListItemType | type | The genlist item type. |
GenListItem | parent | The parent item, otherwise null if there is no parent item. |
Returns
Type | Description |
---|---|
GenListItem | Return a genlist item that contains the data and itemClass. |
OnRealized()
The callback of the Unrealized event.
Declaration
protected override void OnRealized()
Overrides
View SourcePrepend(GenItemClass, object, GenListItemType, GenListItem)
Prepends a new item with GenListItemType to the beginning of a given GenList widget or the beginning of the children list, if the parent is given.
Declaration
public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItemType | type | The genlist item type. |
GenListItem | parent | The parent item, otherwise null if there is no parent item. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains the data and itemClass. |
Prepend(GenItemClass, object, GenListItemType)
Prepends a new item with GenListItemType to the beginning of a given genlist widget.
Declaration
public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenListItemType | type | The genlist item type. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains data and itemClass. |
Prepend(GenItemClass, object)
Prepends a new item to the beginning of a given GenList widget.
Declaration
public GenListItem Prepend(GenItemClass itemClass, object data)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
Returns
Type | Description |
---|---|
GenListItem | Return a newly added genlist item that contains data and itemClass. |
ScrollTo(GenListItem, ScrollToPosition, bool)
Shows the given item with the position type in a genlist. When animated is true, the genlist will jump to the given item and display it (by animatedly scrolling), if it is not fully visible. This may use animation and take sometime. When animated is false, the genlist will jump to the given item and display it (by jumping to that position), if it is not fully visible.
Declaration
public void ScrollTo(GenListItem item, ScrollToPosition position, bool animated)
Parameters
Type | Name | Description |
---|---|---|
GenListItem | item | The item to display. |
ScrollToPosition | position | The position to show the given item to ScrollToPosition. |
bool | animated | The animated indicates how to display the item, by scrolling or by jumping. |
UpdateRealizedItems()
Updates the content of all the realized items. This updates all the realized items by calling all GenItemClass again to get the content, text, and states. Use this when the original item data has changed and the changes are desired to reflect. To update just one item, use Update().
Declaration
public void UpdateRealizedItems()
See Also
Events
View SourceChanged
Changed is raised when the genlist has changed.
Declaration
public event EventHandler Changed
Event Type
Type | Description |
---|---|
System.EventHandler |
ItemActivated
ItemActivated is raised when a new genlist item is double-clicked or pressed (enter|return|spacebar).
Declaration
public event EventHandler<GenListItemEventArgs> ItemActivated
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemDoubleClicked
ItemDoubleClicked is raised when a new genlist item is double-clicked.
Declaration
public event EventHandler<GenListItemEventArgs> ItemDoubleClicked
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemExpanded
ItemExpanded is raised when a new genlist item is indicated to expand.
Declaration
public event EventHandler<GenListItemEventArgs> ItemExpanded
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemLongPressed
ItemLongPressed is raised when a genlist item is pressed for a certain amount of time. By default, it's 1 second.
Declaration
public event EventHandler<GenListItemEventArgs> ItemLongPressed
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemMoved
ItemMoved is raised when a genlist item is moved in the reorder mode.
Declaration
public event EventHandler<GenListItemEventArgs> ItemMoved
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemMovedAfter
ItemMovedAfter is raised when a genlist item is moved after another item in the reorder mode. To get the relative previous item, use Previous.
Declaration
public event EventHandler<GenListItemEventArgs> ItemMovedAfter
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemMovedBefore
ItemMovedBefore is raised when a genlist item is moved before another item in the reorder mode. To get the relative next item, use Next.
Declaration
public event EventHandler<GenListItemEventArgs> ItemMovedBefore
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemPressed
ItemPressed is raised when a new genlist item is pressed.
Declaration
public event EventHandler<GenListItemEventArgs> ItemPressed
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemRealized
ItemRealized is raised when a new genlist item is created as a real object.
Declaration
public event EventHandler<GenListItemEventArgs> ItemRealized
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemReleased
ItemReleased is raised when a new genlist item is released.
Declaration
public event EventHandler<GenListItemEventArgs> ItemReleased
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemSelected
ItemSelected is raised when a new genlist item is selected.
Declaration
public event EventHandler<GenListItemEventArgs> ItemSelected
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemUnrealized
ItemUnrealized is raised when a new genlist item is unrealized. After calling unrealize, the item's content objects are deleted, and the item object itself is deleted or is put into a floating cache.
Declaration
public event EventHandler<GenListItemEventArgs> ItemUnrealized
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ItemUnselected
ItemUnselected is raised when the genlist item is unselected.
Declaration
public event EventHandler<GenListItemEventArgs> ItemUnselected
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenListItemEventArgs> |
ScrollAnimationStarted
ScrollAnimationStarted is raised when the scrolling animation has started.
Declaration
public event EventHandler ScrollAnimationStarted
Event Type
Type | Description |
---|---|
System.EventHandler |
ScrollAnimationStopped
ScrollAnimationStopped is raised when the scrolling animation has stopped.
Declaration
public event EventHandler ScrollAnimationStopped
Event Type
Type | Description |
---|---|
System.EventHandler |