-
Notifications
You must be signed in to change notification settings - Fork 0
ItemList
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.ItemList |
| Namespace | Electron2D |
| Kind | class |
| Category | UI and Text |
Displays a selectable flat list of text and optional icon items.
public class Electron2D.ItemList : Electron2D.ControlProfile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: ItemList
Flat selectable UI list with item text, optional icons, disabled/selectable flags, single/multi selection, pointer activation and selection signals.
ItemList is a runtime UI control for menus, inspectors and debug
panels that need a compact list of selectable rows.
The 0.1.0 Preview implementation supports item storage, single and multi selection, pointer activation, keyboard activation and simple canvas drawing. Scrolling and text search are reserved for later UI tasks.
This type is not synchronized. Create and mutate item lists on the main scene thread.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.ControlElectron2D.PopupMenu
| Member | Kind | Summary |
|---|---|---|
AllowReselect |
Property | Gets or sets whether selecting the current item again still emits signals. |
AllowRmbSelect |
Property | Gets or sets whether right mouse button input may select rows. |
FixedColumnWidth |
Property | Gets or sets the requested fixed column width. |
FixedIconSize |
Property | Gets or sets the requested fixed icon size. |
ItemCount |
Property | Gets the number of items stored in this list. |
MaxColumns |
Property | Gets or sets the maximum number of visual columns requested by the list. |
SelectMode |
Property | Gets or sets the selection mode used by this list. |
Electron2D.ItemList() |
Constructor | Initializes a new instance of the Electron2D.ItemList class. |
AddIconItem(Electron2D.Texture2D, System.Boolean) |
Method | Adds an item that displays only an icon. |
AddItem(System.String, Electron2D.Texture2D, System.Boolean) |
Method | Adds an item with optional text and icon. |
Clear() |
Method | Removes every item and clears selection. |
Deselect(System.Int32) |
Method | Clears selection from one item. |
DeselectAll() |
Method | Clears selection from every item. |
GetItemAtPosition(Electron2D.Vector2, System.Boolean) |
Method | Gets the item index at a local position. |
GetItemCount() |
Method | Gets the number of stored items. |
GetItemIcon(System.Int32) |
Method | Gets the icon displayed by an item. |
GetItemText(System.Int32) |
Method | Gets the text displayed by an item. |
GetSelectedItems() |
Method | Gets the indices of selected items. |
IsItemDisabled(System.Int32) |
Method | Reports whether an item is disabled. |
IsItemSelectable(System.Int32) |
Method | Reports whether an item can be selected. |
IsSelected(System.Int32) |
Method | Reports whether an item is selected. |
Select(System.Int32, System.Boolean) |
Method | Selects an item. |
SetItemDisabled(System.Int32, System.Boolean) |
Method | Sets whether an item ignores user selection and activation. |
SetItemIcon(System.Int32, Electron2D.Texture2D) |
Method | Sets the icon displayed by an item. |
SetItemSelectable(System.Int32, System.Boolean) |
Method | Sets whether an item can be selected. |
SetItemText(System.Int32, System.String) |
Method | Sets the text displayed by an item. |
_Draw() |
Method | Draws the list rows, selection backgrounds and text. |
_GetMinimumSize() |
Method | Gets the minimum size requested by this list. |
_GuiInput(Electron2D.InputEvent) |
Method | Handles GUI input routed to this list. |
Kind: Property
public System.Boolean AllowReselect { get; set; }Gets or sets whether selecting the current item again still emits signals.
This property affects user input and Electron2D.ItemList.Select(System.Int32,System.Boolean).
true to emit selection signals for already selected items;
otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.Select(System.Int32,System.Boolean)
Kind: Property
public System.Boolean AllowRmbSelect { get; set; }Gets or sets whether right mouse button input may select rows.
Right-click activation is useful for context menus. The preview still emits normal selection signals when selection succeeds.
true to allow right-click selection; otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList._GuiInput(Electron2D.InputEvent)
Kind: Property
public System.Int32 FixedColumnWidth { get; set; }Gets or sets the requested fixed column width.
The preview drawing path stores the value and keeps row hit-testing simple.
0 for automatic width, or a positive width in UI units.
-
System.ArgumentOutOfRangeException: Thrown when the assigned value is negative.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.MaxColumns
Kind: Property
public Electron2D.Vector2I FixedIconSize { get; set; }Gets or sets the requested fixed icon size.
The preview stores this value and uses it for minimum-size estimation.
A non-negative icon size. Electron2D.Vector2I.Zero means icons use
their resource size.
-
System.ArgumentOutOfRangeException: Thrown when any component is negative.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Texture2D.GetSize
Kind: Property
public System.Int32 ItemCount { get; }Gets the number of items stored in this list.
The value changes through Electron2D.ItemList.AddItem(System.String,Electron2D.Texture2D,System.Boolean),
Electron2D.ItemList.AddIconItem(Electron2D.Texture2D,System.Boolean) and Electron2D.ItemList.Clear.
The current item count.
This property is not synchronized. Read it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.GetItemCount
Kind: Property
public System.Int32 MaxColumns { get; set; }Gets or sets the maximum number of visual columns requested by the list.
The 0.1.0 Preview stores this value for layout consumers. Pointer hit-testing remains row-based.
A positive number of columns. The default is 1.
-
System.ArgumentOutOfRangeException: Thrown when the assigned value is less than1.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.FixedColumnWidth
Kind: Property
public Electron2D.ItemList.SelectModeEnum SelectMode { get; set; }Gets or sets the selection mode used by this list.
Changing from multi selection to single selection keeps the first selected item and clears the rest.
The current Electron2D.ItemList.SelectModeEnum. The default is
Electron2D.ItemList.SelectModeEnum.Single.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.Select(System.Int32,System.Boolean)
Kind: Constructor
public Electron2D.ItemList()Initializes a new instance of the Electron2D.ItemList class.
The constructor enables focus and registers item_selected,
multi_selected and item_activated signals.
This constructor is not synchronized. Call it from the main scene thread.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList
Kind: Method
public System.Int32 AddIconItem(Electron2D.Texture2D, System.Boolean)(Electron2D.Texture2D icon, System.Boolean selectable)Adds an item that displays only an icon.
This is equivalent to adding an item with empty text and the specified icon.
-
icon: The icon texture to display. -
selectable: Whether the item can be selected.
The zero-based index of the created item.
-
System.ArgumentNullException: Thrown wheniconisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.AddItem(System.String,Electron2D.Texture2D,System.Boolean)
Kind: Method
public System.Int32 AddItem(System.String, Electron2D.Texture2D, System.Boolean)(System.String text, Electron2D.Texture2D icon, System.Boolean selectable)Adds an item with optional text and icon.
The item is enabled by default. Use Electron2D.ItemList.SetItemDisabled(System.Int32,System.Boolean) to
prevent user input from selecting it.
-
text: The text displayed by the item. -
icon: The optional icon texture. -
selectable: Whether the item can be selected.
The zero-based index of the created item.
-
System.ArgumentNullException: Thrown whentextisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.AddIconItem(Electron2D.Texture2D,System.Boolean)
Kind: Method
public System.Void Clear()()Removes every item and clears selection.
The registered signals remain available after clearing.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.AddItem(System.String,Electron2D.Texture2D,System.Boolean)
Kind: Method
public System.Void Deselect(System.Int32)(System.Int32 idx)Clears selection from one item.
Calling this method for an unselected item is a no-op.
-
idx: The item index.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.Select(System.Int32,System.Boolean)
Kind: Method
public System.Void DeselectAll()()Clears selection from every item.
Multi-selection deselect signals are emitted for items that were selected.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.GetSelectedItems
Kind: Method
public System.Int32 GetItemAtPosition(Electron2D.Vector2, System.Boolean)(Electron2D.Vector2 position, System.Boolean exact)Gets the item index at a local position.
The preview list uses one row per item. Column wrapping is stored but not used for hit-testing yet.
-
position: The local list position. -
exact: Whether positions outside the horizontal bounds should return-1.
The item index at the position, or -1 when no item is present.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList._GuiInput(Electron2D.InputEvent)
Kind: Method
public System.Int32 GetItemCount()()Gets the number of stored items.
This method mirrors the method-based API shape used by other list operations.
The same value as Electron2D.ItemList.ItemCount.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.ItemCount
Kind: Method
public Electron2D.Texture2D GetItemIcon(System.Int32)(System.Int32 idx)Gets the icon displayed by an item.
Use Electron2D.ItemList.SetItemIcon(System.Int32,Electron2D.Texture2D) to replace or clear the
icon.
-
idx: The item index.
The item icon, or null when the item has no icon.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.SetItemIcon(System.Int32,Electron2D.Texture2D)
Kind: Method
public System.String GetItemText(System.Int32)(System.Int32 idx)Gets the text displayed by an item.
The returned string is never null.
-
idx: The item index.
The item text.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.SetItemText(System.Int32,System.String)
Kind: Method
public System.Int32[] GetSelectedItems()()Gets the indices of selected items.
The returned array is detached from the list and can be mutated by the caller.
A new array containing selected item indices in ascending order.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.IsSelected(System.Int32)
Kind: Method
public System.Boolean IsItemDisabled(System.Int32)(System.Int32 idx)Reports whether an item is disabled.
Disabled items cannot be selected by user input.
-
idx: The item index.
true when the item is disabled; otherwise, false.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.SetItemDisabled(System.Int32,System.Boolean)
Kind: Method
public System.Boolean IsItemSelectable(System.Int32)(System.Int32 idx)Reports whether an item can be selected.
Disabled items are not selected even when this flag is true.
-
idx: The item index.
true when the item is selectable; otherwise, false.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.SetItemSelectable(System.Int32,System.Boolean)
Kind: Method
public System.Boolean IsSelected(System.Int32)(System.Int32 idx)Reports whether an item is selected.
Selection state can be changed by user input or by
Electron2D.ItemList.Select(System.Int32,System.Boolean).
-
idx: The item index.
true when the item is selected; otherwise, false.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.GetSelectedItems
Kind: Method
public System.Void Select(System.Int32, System.Boolean)(System.Int32 idx, System.Boolean single)Selects an item.
Disabled or non-selectable items are ignored. The method emits
item_selected and, in multi selection mode,
multi_selected when selection changes or
Electron2D.ItemList.AllowReselect is enabled.
-
idx: The item index. -
single: Whether other selected items should be cleared.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.Deselect(System.Int32)
Kind: Method
public System.Void SetItemDisabled(System.Int32, System.Boolean)(System.Int32 idx, System.Boolean disabled)Sets whether an item ignores user selection and activation.
Disabling a selected item clears its selected state.
-
idx: The item index. -
disabled:trueto disable the item; otherwise,false.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.IsItemDisabled(System.Int32)
Kind: Method
public System.Void SetItemIcon(System.Int32, Electron2D.Texture2D)(System.Int32 idx, Electron2D.Texture2D icon)Sets the icon displayed by an item.
Icons are optional and do not affect selection state.
-
idx: The item index. -
icon: The icon texture, ornullto remove it.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.GetItemIcon(System.Int32)
Kind: Method
public System.Void SetItemSelectable(System.Int32, System.Boolean)(System.Int32 idx, System.Boolean selectable)Sets whether an item can be selected.
Making an item non-selectable clears its selected state.
-
idx: The item index. -
selectable:trueto allow selection; otherwise,false.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.IsItemSelectable(System.Int32)
Kind: Method
public System.Void SetItemText(System.Int32, System.String)(System.Int32 idx, System.String text)Sets the text displayed by an item.
Assigning text queues a redraw. Empty text is valid.
-
idx: The item index. -
text: The new item text.
-
System.ArgumentOutOfRangeException: Thrown whenidxis outside the item list. -
System.ArgumentNullException: Thrown whentextisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.ItemList.GetItemText(System.Int32)
Kind: Method
public System.Void _Draw()()Draws the list rows, selection backgrounds and text.
Text drawing is skipped when no theme font is available.
This callback is invoked on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.DrawRect(Electron2D.Rect2,Electron2D.Color,System.Boolean,System.Single,System.Boolean)
Kind: Method
public Electron2D.Vector2 _GetMinimumSize()()Gets the minimum size requested by this list.
The minimum width uses Electron2D.ItemList.FixedColumnWidth when it is
positive; otherwise it uses a conservative fallback.
A size large enough to show the stored rows at the current row height.
This callback is invoked on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control.GetMinimumSize
Kind: Method
public System.Void _GuiInput(Electron2D.InputEvent)(Electron2D.InputEvent inputEvent)Handles GUI input routed to this list.
Mouse and touch press select rows. Double-click and activation keys emit
item_activated for the selected item.
-
inputEvent: The input event delivered by the viewport.
This callback is invoked on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control._GuiInput(Electron2D.InputEvent)
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.