Documentation ¶
Overview ¶
Package ItemList provides methods for working with ItemList object instances.
Index ¶
- type Advanced
- type Any
- type IconMode
- type Instance
- func (self Instance) AddIconItem(icon [1]gdclass.Texture2D) int
- func (self Instance) AddItem(text string) int
- func (self Instance) AllowReselect() bool
- func (self Instance) AllowRmbSelect() bool
- func (self Instance) AllowSearch() bool
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsItemList() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AutoHeight() bool
- func (self Instance) Clear()
- func (self Instance) Deselect(idx int)
- func (self Instance) DeselectAll()
- func (self Instance) EnsureCurrentIsVisible()
- func (self Instance) FixedColumnWidth() int
- func (self Instance) FixedIconSize() Vector2i.XY
- func (self Instance) ForceUpdateListSize()
- func (self Instance) GetItemAtPosition(position Vector2.XY) int
- func (self Instance) GetItemCustomBgColor(idx int) Color.RGBA
- func (self Instance) GetItemCustomFgColor(idx int) Color.RGBA
- func (self Instance) GetItemIcon(idx int) [1]gdclass.Texture2D
- func (self Instance) GetItemIconModulate(idx int) Color.RGBA
- func (self Instance) GetItemIconRegion(idx int) Rect2.PositionSize
- func (self Instance) GetItemLanguage(idx int) string
- func (self Instance) GetItemMetadata(idx int) any
- func (self Instance) GetItemRect(idx int) Rect2.PositionSize
- func (self Instance) GetItemText(idx int) string
- func (self Instance) GetItemTextDirection(idx int) gdclass.ControlTextDirection
- func (self Instance) GetItemTooltip(idx int) string
- func (self Instance) GetSelectedItems() []int32
- func (self Instance) GetVScrollBar() [1]gdclass.VScrollBar
- func (self Instance) IconMode() gdclass.ItemListIconMode
- func (self Instance) IconScale() Float.X
- func (self Instance) IsAnythingSelected() bool
- func (self Instance) IsItemDisabled(idx int) bool
- func (self Instance) IsItemIconTransposed(idx int) bool
- func (self Instance) IsItemSelectable(idx int) bool
- func (self Instance) IsItemTooltipEnabled(idx int) bool
- func (self Instance) IsSelected(idx int) bool
- func (self Instance) ItemCount() int
- func (self Instance) MaxColumns() int
- func (self Instance) MaxTextLines() int
- func (self Instance) MoveItem(from_idx int, to_idx int)
- func (self Instance) OnEmptyClicked(cb func(at_position Vector2.XY, mouse_button_index int))
- func (self Instance) OnItemActivated(cb func(index int))
- func (self Instance) OnItemClicked(cb func(index int, at_position Vector2.XY, mouse_button_index int))
- func (self Instance) OnItemSelected(cb func(index int))
- func (self Instance) OnMultiSelected(cb func(index int, selected bool))
- func (self Instance) RemoveItem(idx int)
- func (self Instance) SameColumnWidth() bool
- func (self Instance) Select(idx int)
- func (self Instance) SelectMode() gdclass.ItemListSelectMode
- func (self Instance) SetAllowReselect(value bool)
- func (self Instance) SetAllowRmbSelect(value bool)
- func (self Instance) SetAllowSearch(value bool)
- func (self Instance) SetAutoHeight(value bool)
- func (self Instance) SetFixedColumnWidth(value int)
- func (self Instance) SetFixedIconSize(value Vector2i.XY)
- func (self Instance) SetIconMode(value gdclass.ItemListIconMode)
- func (self Instance) SetIconScale(value Float.X)
- func (self Instance) SetItemCount(value int)
- func (self Instance) SetItemCustomBgColor(idx int, custom_bg_color Color.RGBA)
- func (self Instance) SetItemCustomFgColor(idx int, custom_fg_color Color.RGBA)
- func (self Instance) SetItemDisabled(idx int, disabled bool)
- func (self Instance) SetItemIcon(idx int, icon [1]gdclass.Texture2D)
- func (self Instance) SetItemIconModulate(idx int, modulate Color.RGBA)
- func (self Instance) SetItemIconRegion(idx int, rect Rect2.PositionSize)
- func (self Instance) SetItemIconTransposed(idx int, transposed bool)
- func (self Instance) SetItemLanguage(idx int, language string)
- func (self Instance) SetItemMetadata(idx int, metadata any)
- func (self Instance) SetItemSelectable(idx int, selectable bool)
- func (self Instance) SetItemText(idx int, text string)
- func (self Instance) SetItemTextDirection(idx int, direction gdclass.ControlTextDirection)
- func (self Instance) SetItemTooltip(idx int, tooltip string)
- func (self Instance) SetItemTooltipEnabled(idx int, enable bool)
- func (self Instance) SetMaxColumns(value int)
- func (self Instance) SetMaxTextLines(value int)
- func (self Instance) SetSameColumnWidth(value bool)
- func (self Instance) SetSelectMode(value gdclass.ItemListSelectMode)
- func (self Instance) SetTextOverrunBehavior(value gdclass.TextServerOverrunBehavior)
- func (self Instance) SortItemsByText()
- func (self Instance) TextOverrunBehavior() gdclass.TextServerOverrunBehavior
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type SelectMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type IconMode ¶
type IconMode = gdclass.ItemListIconMode //gd:ItemList.IconMode
type Instance ¶
This control provides a vertical list of selectable items that may be in a single or in multiple columns, with each item having options for text and an icon. Tooltips are supported and may be different for every item in the list. Selectable items in the list may be selected or deselected and multiple selection may be enabled. Selection with right mouse button may also be enabled to allow use of popup context menus. Items may also be "activated" by double-clicking them or by pressing [kbd]Enter[/kbd]. Item text only supports single-line strings. Newline characters (e.g. [code]\n[/code]) in the string won't produce a newline. Text wrapping is enabled in [constant ICON_MODE_TOP] mode, but the column's width is adjusted to fully fit its content by default. You need to set [member fixed_column_width] greater than zero to wrap the text. All [code]set_*[/code] methods allow negative item indices, i.e. [code]-1[/code] to access the last item, [code]-2[/code] to select the second-to-last item, and so on. [b]Incremental search:[/b] Like [PopupMenu] and [Tree], [ItemList] supports searching within the list while the control is focused. Press a key that matches the first letter of an item's name to select the first item starting with the given letter. After that point, there are two ways to perform incremental search: 1) Press the same key again before the timeout duration to select the next item starting with the same letter. 2) Press letter keys that match the rest of the word before the timeout duration to match to select the item in question directly. Both of these actions will be reset to the beginning of the list if the timeout duration has passed since the last keystroke was registered. You can adjust the timeout duration by changing [member ProjectSettings.gui/timers/incremental_search_max_interval_msec].
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddIconItem ¶
Adds an item to the item list with no text, only an icon. Returns the index of an added item.
func (Instance) AddItem ¶
Adds an item to the item list with specified text. Returns the index of an added item. Specify an [param icon], or use [code]null[/code] as the [param icon] for a list item with no icon. If selectable is [code]true[/code], the list item will be selectable.
func (Instance) AllowReselect ¶
func (Instance) AllowRmbSelect ¶
func (Instance) AllowSearch ¶
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsItemList ¶
func (Instance) AutoHeight ¶
func (Instance) DeselectAll ¶
func (self Instance) DeselectAll()
Ensures there are no items selected.
func (Instance) EnsureCurrentIsVisible ¶
func (self Instance) EnsureCurrentIsVisible()
Ensure current selection is visible, adjusting the scroll position as necessary.
func (Instance) FixedColumnWidth ¶
func (Instance) FixedIconSize ¶
func (Instance) ForceUpdateListSize ¶
func (self Instance) ForceUpdateListSize()
Forces an update to the list size based on its items. This happens automatically whenever size of the items, or other relevant settings like [member auto_height], change. The method can be used to trigger the update ahead of next drawing pass.
func (Instance) GetItemAtPosition ¶
Returns the item index at the given [param position]. When there is no item at that point, -1 will be returned if [param exact] is [code]true[/code], and the closest item index will be returned otherwise. [b]Note:[/b] The returned value is unreliable if called right after modifying the [ItemList], before it redraws in the next frame.
func (Instance) GetItemCustomBgColor ¶
Returns the custom background color of the item specified by [param idx] index.
func (Instance) GetItemCustomFgColor ¶
Returns the custom foreground color of the item specified by [param idx] index.
func (Instance) GetItemIcon ¶
Returns the icon associated with the specified index.
func (Instance) GetItemIconModulate ¶
Returns a [Color] modulating item's icon at the specified index.
func (Instance) GetItemIconRegion ¶
func (self Instance) GetItemIconRegion(idx int) Rect2.PositionSize
Returns the region of item's icon used. The whole icon will be used if the region has no area.
func (Instance) GetItemLanguage ¶
Returns item's text language code.
func (Instance) GetItemMetadata ¶
Returns the metadata value of the specified index.
func (Instance) GetItemRect ¶
func (self Instance) GetItemRect(idx int) Rect2.PositionSize
Returns the position and size of the item with the specified index, in the coordinate system of the [ItemList] node. If [param expand] is [code]true[/code] the last column expands to fill the rest of the row. [b]Note:[/b] The returned value is unreliable if called right after modifying the [ItemList], before it redraws in the next frame.
func (Instance) GetItemText ¶
Returns the text associated with the specified index.
func (Instance) GetItemTextDirection ¶
func (self Instance) GetItemTextDirection(idx int) gdclass.ControlTextDirection
Returns item's text base writing direction.
func (Instance) GetItemTooltip ¶
Returns the tooltip hint associated with the specified index.
func (Instance) GetSelectedItems ¶
Returns an array with the indexes of the selected items.
func (Instance) GetVScrollBar ¶
func (self Instance) GetVScrollBar() [1]gdclass.VScrollBar
Returns the vertical scrollbar. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
func (Instance) IconMode ¶
func (self Instance) IconMode() gdclass.ItemListIconMode
func (Instance) IsAnythingSelected ¶
Returns [code]true[/code] if one or more items are selected.
func (Instance) IsItemDisabled ¶
Returns [code]true[/code] if the item at the specified index is disabled.
func (Instance) IsItemIconTransposed ¶
Returns [code]true[/code] if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.
func (Instance) IsItemSelectable ¶
Returns [code]true[/code] if the item at the specified index is selectable.
func (Instance) IsItemTooltipEnabled ¶
Returns [code]true[/code] if the tooltip is enabled for specified item index.
func (Instance) IsSelected ¶
Returns [code]true[/code] if the item at the specified index is currently selected.
func (Instance) MaxColumns ¶
func (Instance) MaxTextLines ¶
func (Instance) OnEmptyClicked ¶
func (Instance) OnItemActivated ¶
func (Instance) OnItemClicked ¶
func (Instance) OnItemSelected ¶
func (Instance) OnMultiSelected ¶
func (Instance) RemoveItem ¶
Removes the item specified by [param idx] index from the list.
func (Instance) SameColumnWidth ¶
func (Instance) Select ¶
Select the item at the specified index. [b]Note:[/b] This method does not trigger the item selection signal.
func (Instance) SelectMode ¶
func (self Instance) SelectMode() gdclass.ItemListSelectMode
func (Instance) SetAllowReselect ¶
func (Instance) SetAllowRmbSelect ¶
func (Instance) SetAllowSearch ¶
func (Instance) SetAutoHeight ¶
func (Instance) SetFixedColumnWidth ¶
func (Instance) SetFixedIconSize ¶
func (Instance) SetIconMode ¶
func (self Instance) SetIconMode(value gdclass.ItemListIconMode)
func (Instance) SetIconScale ¶
func (Instance) SetItemCount ¶
func (Instance) SetItemCustomBgColor ¶
Sets the background color of the item specified by [param idx] index to the specified [Color].
func (Instance) SetItemCustomFgColor ¶
Sets the foreground color of the item specified by [param idx] index to the specified [Color].
func (Instance) SetItemDisabled ¶
Disables (or enables) the item at the specified index. Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing [kbd]Enter[/kbd]).
func (Instance) SetItemIcon ¶
Sets (or replaces) the icon's [Texture2D] associated with the specified index.
func (Instance) SetItemIconModulate ¶
Sets a modulating [Color] of the item associated with the specified index.
func (Instance) SetItemIconRegion ¶
func (self Instance) SetItemIconRegion(idx int, rect Rect2.PositionSize)
Sets the region of item's icon used. The whole icon will be used if the region has no area.
func (Instance) SetItemIconTransposed ¶
Sets whether the item icon will be drawn transposed.
func (Instance) SetItemLanguage ¶
Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
func (Instance) SetItemMetadata ¶
Sets a value (of any type) to be stored with the item associated with the specified index.
func (Instance) SetItemSelectable ¶
Allows or disallows selection of the item associated with the specified index.
func (Instance) SetItemText ¶
Sets text of the item associated with the specified index.
func (Instance) SetItemTextDirection ¶
func (self Instance) SetItemTextDirection(idx int, direction gdclass.ControlTextDirection)
Sets item's text base writing direction.
func (Instance) SetItemTooltip ¶
Sets the tooltip hint for the item associated with the specified index.
func (Instance) SetItemTooltipEnabled ¶
Sets whether the tooltip hint is enabled for specified item index.
func (Instance) SetMaxColumns ¶
func (Instance) SetMaxTextLines ¶
func (Instance) SetSameColumnWidth ¶
func (Instance) SetSelectMode ¶
func (self Instance) SetSelectMode(value gdclass.ItemListSelectMode)
func (Instance) SetTextOverrunBehavior ¶
func (self Instance) SetTextOverrunBehavior(value gdclass.TextServerOverrunBehavior)
func (Instance) SortItemsByText ¶
func (self Instance) SortItemsByText()
Sorts items in the list by their text.
func (Instance) TextOverrunBehavior ¶
func (self Instance) TextOverrunBehavior() gdclass.TextServerOverrunBehavior
func (*Instance) UnsafePointer ¶
type SelectMode ¶
type SelectMode = gdclass.ItemListSelectMode //gd:ItemList.SelectMode
const ( /*Only allow selecting a single item.*/ SelectSingle SelectMode = 0 /*Allows selecting multiple items by holding [kbd]Ctrl[/kbd] or [kbd]Shift[/kbd].*/ SelectMulti SelectMode = 1 )