OptionButton

Button control that provides selectable options when pressed.

OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text. See also BaseButton which contains common properties and methods associated with this node.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

_focused
void _focused(long arg0)
_getItems
Array _getItems()
_selectInt
void _selectInt(long arg0)
_selected
void _selected(long arg0)
_setItems
void _setItems(Array arg0)
addIconItem
void addIconItem(Texture texture, String label, long id)

Adds an item, with a texture icon, text label and (optionally) id. If no id is passed, the item index will be used as the item's ID. New items are appended at the end.

addItem
void addItem(String label, long id)

Adds an item, with text label and (optionally) id. If no id is passed, the item index will be used as the item's ID. New items are appended at the end.

addSeparator
void addSeparator()

Adds a separator to the list of items. Separators help to group items. Separator also takes up an index and is appended at the end.

clear
void clear()

Clears all the items in the OptionButton.

getItemCount
long getItemCount()

Returns the amount of items in the OptionButton, including separators.

getItemIcon
Ref!Texture getItemIcon(long idx)

Returns the icon of the item at index idx.

getItemId
long getItemId(long idx)

Returns the ID of the item at index idx.

getItemIndex
long getItemIndex(long id)

Returns the index of the item with the given id.

getItemMetadata
Variant getItemMetadata(long idx)

Retrieves the metadata of an item. Metadata may be any type and can be used to store extra information about an item, such as an external string ID.

getItemText
String getItemText(long idx)

Returns the text of the item at index idx.

getPopup
PopupMenu getPopup()

Returns the PopupMenu contained in this button.

getSelected
long getSelected()
getSelectedId
long getSelectedId()

Returns the ID of the selected item, or 0 if no item is selected.

getSelectedMetadata
Variant getSelectedMetadata()

Gets the metadata of the selected item. Metadata for items can be set using setItemMetadata.

isItemDisabled
bool isItemDisabled(long idx)

Returns true if the item at index idx is disabled.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(OptionButton other)
opEquals
bool opEquals(typeof(null) n)
removeItem
void removeItem(long idx)

Removes the item at index idx.

select
void select(long idx)

Selects an item by index and makes it the current item. This will work even if the item is disabled.

setItemDisabled
void setItemDisabled(long idx, bool disabled)

Sets whether the item at index idx is disabled. Disabled items are drawn differently in the dropdown and are not selectable by the user. If the current selected item is set as disabled, it will remain selected.

setItemIcon
void setItemIcon(long idx, Texture texture)

Sets the icon of the item at index idx.

setItemId
void setItemId(long idx, long id)

Sets the ID of the item at index idx.

setItemMetadata
void setItemMetadata(long idx, VariantArg1 metadata)

Sets the metadata of an item. Metadata may be of any type and can be used to store extra information about an item, such as an external string ID.

setItemText
void setItemText(long idx, String text)

Sets the text of the item at index idx.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

items
Array items [@property getter]
Array items [@property setter]
selected
long selected [@property getter]
long selected [@property setter]

The index of the currently selected item, or -1 if no item is selected.

Static functions

_new
OptionButton _new()

Construct a new instance of OptionButton. Note: use memnew!OptionButton instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta