Signal1
Signal support.
ItemList.swift:2439class Signal1
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (71) members.
Types
enum IconMode
enum SelectMode
class Signal2
Signal support.
class Signal3
Signal support.
class Signal4
Signal support.
class Signal5
Signal support.
Type members
Instance members
var allowReselect: Bool
If
true
, the currently selected item can be selected again.var allowRmbSelect: Bool
If
true
, right mouse button click can select items.var allowSearch: Bool
If
true
, allows navigating theItemList
with letter keys through incremental search.var autoHeight: Bool
If
true
, the control will automatically resize the height to fit its content.var emptyClicked: Signal2
Triggered when any mouse click is issued within the rect of the list but on empty space.
var fixedColumnWidth: Int32
The width all columns will be adjusted to.
var fixedIconSize: Vector2i
The size all icons will be adjusted to.
var iconMode: ItemList.IconMode
The icon position, whether above or to the left of the text. See the
IconMode
constants.var iconScale: Double
The scale of icon applied after
fixedIconSize
and transposing takes effect.var itemActivated: Signal5
Triggered when specified list item is activated via double-clicking or by pressing [kbd]Enter[/kbd].
var itemClicked: Signal3
Triggered when specified list item has been clicked with any mouse button.
var itemCount: Int32
The number of items currently in the list.
var itemSelected: Signal1
Triggered when specified item has been selected.
var maxColumns: Int32
Maximum columns the list will have.
var maxTextLines: Int32
Maximum lines of text allowed in each item. Space will be reserved even when there is not enough lines of text to display.
var multiSelected: Signal4
Triggered when a multiple selection is altered on a list allowing multiple selection.
var sameColumnWidth: Bool
Whether all columns will have the same width.
var selectMode: ItemList.SelectMode
Allows single or multiple item selection. See the
SelectMode
constants.var textOverrunBehavior: TextServer.OverrunBehavior
Sets the clipping behavior when the text exceeds an item’s bounding rectangle. See
TextServer.OverrunBehavior
for a description of all modes.func addIconItem(icon: Texture2D?, selectable: Bool
) -> Int32 Adds an item to the item list with no text, only an icon. Returns the index of an added item.
func addItem(text: String, icon: Texture2D?, selectable: Bool
) -> Int32 Adds an item to the item list with specified text. Returns the index of an added item.
func clear(
) Removes all items from the list.
func deselect(idx: Int32
) Ensures the item associated with the specified index is not selected.
func deselectAll(
) Ensures there are no items selected.
func ensureCurrentIsVisible(
) Ensure current selection is visible, adjusting the scroll position as necessary.
func 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
autoHeight
, change. The method can be used to trigger the update ahead of next drawing pass.func getItemAtPosition(Vector2, exact: Bool
) -> Int32 Returns the item index at the given
position
.func getItemCustomBgColor(idx: Int32
) -> Color Returns the custom background color of the item specified by
idx
index.func getItemCustomFgColor(idx: Int32
) -> Color Returns the custom foreground color of the item specified by
idx
index.func getItemIcon(idx: Int32
) -> Texture2D? Returns the icon associated with the specified index.
func getItemIconModulate(idx: Int32
) -> Color Returns a
Color
modulating item’s icon at the specified index.func getItemIconRegion(idx: Int32
) -> Rect2 Returns the region of item’s icon used. The whole icon will be used if the region has no area.
func getItemLanguage(idx: Int32
) -> String Returns item’s text language code.
func getItemMetadata(idx: Int32
) -> Variant Returns the metadata value of the specified index.
func getItemRect(idx: Int32, expand: Bool
) -> Rect2 Returns the position and size of the item with the specified index, in the coordinate system of the
ItemList
node. Ifexpand
istrue
the last column expands to fill the rest of the row.func getItemText(idx: Int32
) -> String Returns the text associated with the specified index.
func getItemTextDirection(idx: Int32
) -> Control.TextDirection Returns item’s text base writing direction.
func getItemTooltip(idx: Int32
) -> String Returns the tooltip hint associated with the specified index.
func getSelectedItems(
) -> PackedInt32Array Returns an array with the indexes of the selected items.
func getVScrollBar(
) -> VScrollBar? Returns the vertical scrollbar.
func isAnythingSelected(
) -> Bool Returns
true
if one or more items are selected.func isItemDisabled(idx: Int32
) -> Bool Returns
true
if the item at the specified index is disabled.func isItemIconTransposed(idx: Int32
) -> Bool Returns
true
if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.func isItemSelectable(idx: Int32
) -> Bool Returns
true
if the item at the specified index is selectable.func isItemTooltipEnabled(idx: Int32
) -> Bool Returns
true
if the tooltip is enabled for specified item index.func isSelected(idx: Int32
) -> Bool Returns
true
if the item at the specified index is currently selected.func moveItem(fromIdx: Int32, toIdx: Int32
) Moves item from index
fromIdx
totoIdx
.func removeItem(idx: Int32
) Removes the item specified by
idx
index from the list.func select(idx: Int32, single: Bool
) Select the item at the specified index.
func setItemCustomBgColor(idx: Int32, customBgColor: Color
) Sets the background color of the item specified by
idx
index to the specifiedColor
.func setItemCustomFgColor(idx: Int32, customFgColor: Color
) Sets the foreground color of the item specified by
idx
index to the specifiedColor
.func setItemDisabled(idx: Int32, disabled: Bool
) Disables (or enables) the item at the specified index.
func setItemIcon(idx: Int32, icon: Texture2D?
) Sets (or replaces) the icon’s
Texture2D
associated with the specified index.func setItemIconModulate(idx: Int32, modulate: Color
) Sets a modulating
Color
of the item associated with the specified index.func setItemIconRegion(idx: Int32, rect: Rect2
) Sets the region of item’s icon used. The whole icon will be used if the region has no area.
func setItemIconTransposed(idx: Int32, transposed: Bool
) Sets whether the item icon will be drawn transposed.
func setItemLanguage(idx: Int32, language: String
) Sets language code of item’s text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
func setItemMetadata(idx: Int32, metadata: Variant
) Sets a value (of any type) to be stored with the item associated with the specified index.
func setItemSelectable(idx: Int32, selectable: Bool
) Allows or disallows selection of the item associated with the specified index.
func setItemText(idx: Int32, text: String
) Sets text of the item associated with the specified index.
func setItemTextDirection(idx: Int32, direction: Control.TextDirection
) Sets item’s text base writing direction.
func setItemTooltip(idx: Int32, tooltip: String
) Sets the tooltip hint for the item associated with the specified index.
func setItemTooltipEnabled(idx: Int32, enable: Bool
) Sets whether the tooltip hint is enabled for specified item index.
func sortItemsByText(
) Sorts items in the list by their text.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ index: Int64) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)