Class GenGrid
Definition
- Namespace:
- ElmSharp
- Assembly:
- ElmSharp.dll
It inherits Layout. The GenGrid is a widget that aims to position objects in a grid layout, while actually creating and rendering only the visible ones. It has two directions in which a given GenGrid widget expands while placing its items, horizontal and vertical. The gengrid items are represented through the GenItemClass definition field details.
public class GenGrid : Layout, IAccessibleObject
- Inheritance
- Implements
Constructors
View SourceGenGrid(EvasObject)
Creates and initializes a new instance of the GenGrid class.
Declaration
public GenGrid(EvasObject parent)
Parameters
Type | Name | Description |
---|---|---|
EvasObject | parent | The parent is a given container which will be attached by GenGrid as a child. It's the EvasObject type. |
Properties
View SourceFillItems
Gets or sets the manner in which the items grid is filled within a given GenGrid widget. It is filled if true, otherwise not filled if false.
Declaration
public bool FillItems { get; set; }
Property Value
Type | Description |
---|---|
bool |
FirstItem
Gets the first item in a given GenGrid widget.
Declaration
public GenGridItem FirstItem { get; }
Property Value
Type | Description |
---|---|
GenGridItem |
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 gengrid items should be highlighted when an item is selected.
Declaration
public bool IsHighlight { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsHorizontal
Gets or sets the direction for which a given GenGrid widget expands while placing its items.
Declaration
public bool IsHorizontal { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If true, items are placed in columns from top to bottom and when the space for a column is filled, another one is started on the right, thus expanding the grid horizontally. If false, items are placed in rows from left to right, and when the space for a row is filled, another one is started below, thus expanding the grid vertically.
ItemAlignmentX
Gets or sets the item's grid alignment along X-axis within a given GenGrid widget. Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify "justify" or "fill" by some users. By default, value is 0.0, meaning that the gengrid has its items grid placed exactly in the left along X-axis.
Declaration
public double ItemAlignmentX { get; set; }
Property Value
Type | Description |
---|---|
double |
ItemAlignmentY
Gets or sets the item's grid alignment on Y-axis within a given GenGrid widget. Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify "justify" or "fill" by some users. By default, value is 0.0, meaning that the gengrid has its items grid placed exactly in the top along Y-axis.
Declaration
public double ItemAlignmentY { get; set; }
Property Value
Type | Description |
---|---|
double |
ItemCount
Gets the items count in a given GenGrid widget.
Declaration
public uint ItemCount { get; }
Property Value
Type | Description |
---|---|
uint |
ItemHeight
Gets or sets the height for the items of a given GenGrid widget.
Declaration
public int ItemHeight { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
A gengrid, after creation, still has no information on the size to give to each of its cells. The default width and height just are one finger wide. Use this property to force a custom height for your items, making them as big as you wish.
ItemWidth
Gets or sets the width for the items of a given GenGrid widget.
Declaration
public int ItemWidth { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
A gengrid, after creation, still has no information on the size to give to each of its cells. The default width and height just are one finger wide. Use this property to force a custom width for your items, making them as big as you wish.
LastItem
Gets the last item in a given GenGrid widget.
Declaration
public GenGridItem LastItem { get; }
Property Value
Type | Description |
---|---|
GenGridItem |
MultipleSelection
Gets or sets whether multi-selection is enabled or disabled for a given GenGrid widget.
Declaration
public bool MultipleSelection { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Multi-selection is the ability to have more than one item selected, on a given gengrid, simultaneously. When it is enabled, a sequence of clicks on different items makes them all selected, progressively. A click on an already selected item unselects it. If interacting via the keyboard, multi-selection is enabled while holding the "Shift" key. By default, multi-selection is disabled.
ReorderMode
Gets or sets whether a given GenGrid widget is able to or not able to have items reordered.
Declaration
public bool ReorderMode { get; set; }
Property Value
Type | Description |
---|---|
bool |
SelectedItem
Gets the selected item in a given GenGrid widget.
Declaration
public GenGridItem SelectedItem { get; }
Property Value
Type | Description |
---|---|
GenGridItem |
SelectionMode
Gets or sets the gengrid 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)
Appends a new item to a given GenGrid widget. This adds an item to the end of the gengrid.
Declaration
public GenGridItem 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 |
---|---|
GenGridItem | Return a gengrid item that contains the data and itemClass. |
See Also
View SourceClear()
Removes all the items from a given GenGrid widget. This removes (and deletes) all the items in the object, making it empty.
Declaration
public void Clear()
Remarks
Delete() to delete just one item.
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 SourceGetItemByPosition(int, int, out int, out int)
Gets the item that is at the X, Y canvas coordinates.
Declaration
public GenGridItem GetItemByPosition(int x, int y, out int portionX, out int portionY)
Parameters
Type | Name | Description |
---|---|---|
int | x | The input X coordinate. |
int | y | The input Y coordinate. |
int | portionX | The position relative to the item returned here. -1, 0, or 1, depending if the coordinate is on the left portion of that item(-1), on the middle section(0), or on the right part(1). |
int | portionY | The position relative to the item returned here. -1, 0, or 1, depending if the coordinate is on the upper portion of that item (-1), on the middle section (0), or on the lower part (1). |
Returns
Type | Description |
---|---|
GenGridItem |
InsertAfter(GenItemClass, object, GenGridItem)
Inserts an item after another in a GenGrid widget. This inserts an item after another in the gengrid.
Declaration
public GenGridItem InsertAfter(GenItemClass itemClass, object data, GenGridItem after)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenGridItem | after | The item after which to place this new one. |
Returns
Type | Description |
---|---|
GenGridItem | Return a gengrid item that contains the data and itemClass. |
See Also
View SourceInsertBefore(GenItemClass, object, GenGridItem)
Inserts an item before another in a GenGrid widget. This inserts an item before another in the gengrid.
Declaration
public GenGridItem InsertBefore(GenItemClass itemClass, object data, GenGridItem before)
Parameters
Type | Name | Description |
---|---|---|
GenItemClass | itemClass | The itemClass defines how to display the data. |
object | data | The item data. |
GenGridItem | before | The item before which to place this new one. |
Returns
Type | Description |
---|---|
GenGridItem | Return a gengrid item that contains the data and itemClass. |
See Also
View SourceInsertSorted(GenItemClass, object, Comparison<object>)
Inserts an item in a GenGrid widget using a user-defined sort function.
Declaration
public GenGridItem InsertSorted(GenItemClass itemClass, object data, Comparison<object> comparison)
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 gengrid item and its data. |
Returns
Type | Description |
---|---|
GenGridItem | Return a gengrid item that contains the data and itemClass. |
Prepend(GenItemClass, object)
Prepends a new item to a given GenGrid widget. This adds an item to the beginning of the gengrid.
Declaration
public GenGridItem 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 |
---|---|
GenGridItem | Return a gengrid item that contains the data and itemClass. |
See Also
View SourceScrollTo(GenGridItem, ScrollToPosition, bool)
Shows a given item to the visible area of a gengrid.
Declaration
public void ScrollTo(GenGridItem item, ScrollToPosition position, bool animated)
Parameters
Type | Name | Description |
---|---|---|
GenGridItem | item | The gengrid item to display. |
ScrollToPosition | position | The position of the item in the viewport. |
bool | animated | The type of how to show the item. |
Remarks
If animated is true, the gengrid shows the item by scrolling if it's not fully visible. If animated is false, the gengrid shows the item by jumping if it's not fully visible.
See Also
View SourceUpdateRealizedItems()
Updates the contents of all the realized items. This updates all realized items by calling all the 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.
Declaration
public void UpdateRealizedItems()
Remarks
Update() to update just one item.
Events
View SourceChanged
Changed is raised when an item is added, removed, resized or moved and when the gengrid is resized or gets "horizontal" property changes.
Declaration
public event EventHandler Changed
Event Type
Type | Description |
---|---|
System.EventHandler |
ItemActivated
ItemActivated is raised when a new gengrid item is double-clicked or pressed (enter|return|spacebar).
Declaration
public event EventHandler<GenGridItemEventArgs> ItemActivated
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemDoubleClicked
ItemDoubleClicked is raised when a new gengrid item is double-clicked.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemDoubleClicked
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemFocused
ItemFocussed is raised when a gengrid item has received focus.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemFocused
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemLongPressed
ItemLongPressed is raised when a gengrid item is pressed for a certain amount of time. By default it's 1 second.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemLongPressed
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemPressed
ItemPressed is raised when a new gengrid item is pressed.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemPressed
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemRealized
ItemRealized is raised when a gengrid item is implemented through GenItemClass.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemRealized
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemReleased
ItemReleased is raised when a new gengrid item is released.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemReleased
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemSelected
ItemSelected is raised when a new GenGrid item is selected.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemSelected
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemUnfocused
ItemUnfocussed is raised when a gengrid item has lost focus.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemUnfocused
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemUnrealized
ItemUnrealized is raised when the gengrid item is deleted.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemUnrealized
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |
ItemUnselected
ItemUnselected is raised when the gengrid item is unselected.
Declaration
public event EventHandler<GenGridItemEventArgs> ItemUnselected
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><GenGridItemEventArgs> |