.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_OptionButton: OptionButton ============ **Inherits:** :ref:`Button` **<** :ref:`BaseButton` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Button control that provides selectable options when pressed. Member Functions ---------------- +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_item` **(** :ref:`String` label, :ref:`int` id=-1 **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_icon_item` **(** :ref:`Texture` texture, :ref:`String` label, :ref:`int` id **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_item_text` **(** :ref:`int` idx, :ref:`String` text **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_item_icon` **(** :ref:`int` idx, :ref:`Texture` texture **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_item_disabled` **(** :ref:`int` idx, :ref:`bool` disabled **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_item_ID` **(** :ref:`int` idx, :ref:`int` id **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_item_metadata` **(** :ref:`int` idx, var metadata **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_item_text` **(** :ref:`int` idx **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`get_item_icon` **(** :ref:`int` idx **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_item_ID` **(** :ref:`int` idx **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`get_item_metadata` **(** :ref:`int` idx **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_item_disabled` **(** :ref:`int` idx **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_item_count` **(** **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_separator` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`select` **(** :ref:`int` idx **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_selected` **(** **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_selected_ID` **(** **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`get_selected_metadata` **(** **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_item` **(** :ref:`int` idx **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **item_selected** **(** :ref:`int` ID **)** 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. Member Function Description --------------------------- .. _class_OptionButton_add_item: - void **add_item** **(** :ref:`String` label, :ref:`int` id=-1 **)** Add an item, with text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end. .. _class_OptionButton_add_icon_item: - void **add_icon_item** **(** :ref:`Texture` texture, :ref:`String` label, :ref:`int` id **)** Add an item, with a "texture" icon, text "label" and (optionally) id. If no "id" is passed, "id" becomes the item index. New items are appended at the end. .. _class_OptionButton_set_item_text: - void **set_item_text** **(** :ref:`int` idx, :ref:`String` text **)** Set the text of an item at index "idx". .. _class_OptionButton_set_item_icon: - void **set_item_icon** **(** :ref:`int` idx, :ref:`Texture` texture **)** Set the icon of an item at index "idx". .. _class_OptionButton_set_item_disabled: - void **set_item_disabled** **(** :ref:`int` idx, :ref:`bool` disabled **)** .. _class_OptionButton_set_item_ID: - void **set_item_ID** **(** :ref:`int` idx, :ref:`int` id **)** Set the ID of an item at index "idx". .. _class_OptionButton_set_item_metadata: - void **set_item_metadata** **(** :ref:`int` idx, var metadata **)** .. _class_OptionButton_get_item_text: - :ref:`String` **get_item_text** **(** :ref:`int` idx **)** const Return the text of the item at index "idx". .. _class_OptionButton_get_item_icon: - :ref:`Texture` **get_item_icon** **(** :ref:`int` idx **)** const Return the icon of the item at index "idx". .. _class_OptionButton_get_item_ID: - :ref:`int` **get_item_ID** **(** :ref:`int` idx **)** const Return the ID of the item at index "idx". .. _class_OptionButton_get_item_metadata: - void **get_item_metadata** **(** :ref:`int` idx **)** const .. _class_OptionButton_is_item_disabled: - :ref:`bool` **is_item_disabled** **(** :ref:`int` idx **)** const .. _class_OptionButton_get_item_count: - :ref:`int` **get_item_count** **(** **)** const Return the amount of items in the OptionButton. .. _class_OptionButton_add_separator: - void **add_separator** **(** **)** Add a separator to the list of items. Separators help to group items. Separator also takes up an index and is appended at the end. .. _class_OptionButton_clear: - void **clear** **(** **)** Clear all the items in the :ref:`OptionButton`. .. _class_OptionButton_select: - void **select** **(** :ref:`int` idx **)** Select an item by index and make it the current item. .. _class_OptionButton_get_selected: - :ref:`int` **get_selected** **(** **)** const Return the current item index .. _class_OptionButton_get_selected_ID: - :ref:`int` **get_selected_ID** **(** **)** const .. _class_OptionButton_get_selected_metadata: - void **get_selected_metadata** **(** **)** const .. _class_OptionButton_remove_item: - void **remove_item** **(** :ref:`int` idx **)**