.. 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_ButtonArray: ButtonArray =========== **Inherits:** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`HButtonArray`, :ref:`VButtonArray` **Category:** Core Brief Description ----------------- Array of Buttons. Member Functions ---------------- +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_button` **(** :ref:`String` text, :ref:`String` tooltip="" **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_icon_button` **(** :ref:`Texture` icon, :ref:`String` text="", :ref:`String` tooltip="" **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`erase_button` **(** :ref:`int` button_idx **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_button_count` **(** **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`get_button_icon` **(** :ref:`int` button_idx **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_button_text` **(** :ref:`int` button_idx **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_button_tooltip` **(** :ref:`int` button_idx **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_hovered` **(** **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_selected` **(** **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_flat` **(** **)** const | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_button_icon` **(** :ref:`int` button_idx, :ref:`Texture` icon **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_button_text` **(** :ref:`int` button_idx, :ref:`String` text **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_button_tooltip` **(** :ref:`int` button_idx, :ref:`String` text **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_flat` **(** :ref:`bool` enabled **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_selected` **(** :ref:`int` button_idx **)** | +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **button_selected** **(** :ref:`int` button_idx **)** A button has been selected, its index is given as the argument. Numeric Constants ----------------- - **ALIGN_BEGIN** = **0** --- Align buttons at the beginning. - **ALIGN_CENTER** = **1** --- Align buttons in the middle. - **ALIGN_END** = **2** --- Align buttons at the end. - **ALIGN_FILL** = **3** --- Spread the buttons, but keep them small. - **ALIGN_EXPAND_FILL** = **4** --- Spread the buttons, but expand them. Description ----------- Array of Buttons. A ButtonArray is useful to have an array of buttons laid out vertically or horizontally. Only one button can be selected, and is referenced by its index in the array (first button is 0, second button is 1, etc.). This is useful *e.g.* for joypad-friendly interfaces and option menus. Member Function Description --------------------------- .. _class_ButtonArray_add_button: - void **add_button** **(** :ref:`String` text, :ref:`String` tooltip="" **)** Append a new button to the array, with the specified text. .. _class_ButtonArray_add_icon_button: - void **add_icon_button** **(** :ref:`Texture` icon, :ref:`String` text="", :ref:`String` tooltip="" **)** Append a new button to the array, with the specified icon and text. .. _class_ButtonArray_clear: - void **clear** **(** **)** Remove all buttons from the array. .. _class_ButtonArray_erase_button: - void **erase_button** **(** :ref:`int` button_idx **)** Remove the specified button in the array. .. _class_ButtonArray_get_button_count: - :ref:`int` **get_button_count** **(** **)** const Return the amount of buttons in the array. .. _class_ButtonArray_get_button_icon: - :ref:`Texture` **get_button_icon** **(** :ref:`int` button_idx **)** const Return the icon of the specified button. .. _class_ButtonArray_get_button_text: - :ref:`String` **get_button_text** **(** :ref:`int` button_idx **)** const Return the text of the specified button. .. _class_ButtonArray_get_button_tooltip: - :ref:`String` **get_button_tooltip** **(** :ref:`int` button_idx **)** const .. _class_ButtonArray_get_hovered: - :ref:`int` **get_hovered** **(** **)** const Return the index of the currently hovered button in the array. .. _class_ButtonArray_get_selected: - :ref:`int` **get_selected** **(** **)** const Return the index of the currently selected button in the array. .. _class_ButtonArray_is_flat: - :ref:`bool` **is_flat** **(** **)** const .. _class_ButtonArray_set_button_icon: - void **set_button_icon** **(** :ref:`int` button_idx, :ref:`Texture` icon **)** Set the icon of the specified button. .. _class_ButtonArray_set_button_text: - void **set_button_text** **(** :ref:`int` button_idx, :ref:`String` text **)** Define the text of the specified button. .. _class_ButtonArray_set_button_tooltip: - void **set_button_tooltip** **(** :ref:`int` button_idx, :ref:`String` text **)** .. _class_ButtonArray_set_flat: - void **set_flat** **(** :ref:`bool` enabled **)** .. _class_ButtonArray_set_selected: - void **set_selected** **(** :ref:`int` button_idx **)** Select a button in the array based on the given index.