Button control that provides selectable options when pressed.
</brief_description>
<description>
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.
[b]Note:[/b] The ID values used for items are limited to 32 bits, not full 64 bits of [int]. This has a range of [code]-2^32[/code] to [code]2^32 - 1[/code], i.e. [code]-2147483648[/code] to [code]2147483647[/code].
Adds an item, with a [code]texture[/code] icon, text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, the item index will be used as the item's ID. New items are appended at the end.
Adds an item, with text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, the item index will be used as the item's ID. New items are appended at the end.
</description>
</method>
<methodname="add_separator">
<returntype="void"/>
<description>
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.
</description>
</method>
<methodname="clear">
<returntype="void"/>
<description>
Clears all the items in the [OptionButton].
</description>
</method>
<methodname="get_item_count"qualifiers="const">
<returntype="int"/>
<description>
Returns the amount of items in the OptionButton, including separators.
</description>
</method>
<methodname="get_item_icon"qualifiers="const">
<returntype="Texture"/>
<argumentindex="0"name="idx"type="int"/>
<description>
Returns the icon of the item at index [code]idx[/code].
</description>
</method>
<methodname="get_item_id"qualifiers="const">
<returntype="int"/>
<argumentindex="0"name="idx"type="int"/>
<description>
Returns the ID of the item at index [code]idx[/code].
</description>
</method>
<methodname="get_item_index"qualifiers="const">
<returntype="int"/>
<argumentindex="0"name="id"type="int"/>
<description>
Returns the index of the item with the given [code]id[/code].
[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.
Sets whether the item at index [code]idx[/code] 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.
</description>
</method>
<methodname="set_item_icon">
<returntype="void"/>
<argumentindex="0"name="idx"type="int"/>
<argumentindex="1"name="texture"type="Texture"/>
<description>
Sets the icon of the item at index [code]idx[/code].
</description>
</method>
<methodname="set_item_id">
<returntype="void"/>
<argumentindex="0"name="idx"type="int"/>
<argumentindex="1"name="id"type="int"/>
<description>
Sets the ID of the item at index [code]idx[/code].
</description>
</method>
<methodname="set_item_metadata">
<returntype="void"/>
<argumentindex="0"name="idx"type="int"/>
<argumentindex="1"name="metadata"type="Variant"/>
<description>
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.
</description>
</method>
<methodname="set_item_text">
<returntype="void"/>
<argumentindex="0"name="idx"type="int"/>
<argumentindex="1"name="text"type="String"/>
<description>
Sets the text of the item at index [code]idx[/code].
Emitted when the user navigates to an item using the [code]ui_up[/code] or [code]ui_down[/code] actions. The index of the item selected is passed as argument.
</description>
</signal>
<signalname="item_selected">
<argumentindex="0"name="index"type="int"/>
<description>
Emitted when the current item has been changed by the user. The index of the item selected is passed as argument.
Text [Color] used when the [OptionButton] is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
[StyleBox] used when the [OptionButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.