class_buttonarray.rst 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_ButtonArray:
  4. ButtonArray
  5. ===========
  6. **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`HButtonArray<class_hbuttonarray>`, :ref:`VButtonArray<class_vbuttonarray>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Array of Buttons.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_button<class_ButtonArray_add_button>` **(** :ref:`String<class_string>` text **)** |
  16. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`add_icon_button<class_ButtonArray_add_icon_button>` **(** :ref:`Texture<class_texture>` icon, :ref:`String<class_string>` text="" **)** |
  18. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`set_button_text<class_ButtonArray_set_button_text>` **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)** |
  20. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`set_button_icon<class_ButtonArray_set_button_icon>` **(** :ref:`int<class_int>` button_idx, :ref:`Texture<class_texture>` icon **)** |
  22. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_string>` | :ref:`get_button_text<class_ButtonArray_get_button_text>` **(** :ref:`int<class_int>` button_idx **)** const |
  24. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Texture<class_texture>` | :ref:`get_button_icon<class_ButtonArray_get_button_icon>` **(** :ref:`int<class_int>` button_idx **)** const |
  26. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_button_count<class_ButtonArray_get_button_count>` **(** **)** const |
  28. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_selected<class_ButtonArray_get_selected>` **(** **)** const |
  30. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_hovered<class_ButtonArray_get_hovered>` **(** **)** const |
  32. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_selected<class_ButtonArray_set_selected>` **(** :ref:`int<class_int>` button_idx **)** |
  34. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`erase_button<class_ButtonArray_erase_button>` **(** :ref:`int<class_int>` button_idx **)** |
  36. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`clear<class_ButtonArray_clear>` **(** **)** |
  38. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  39. Signals
  40. -------
  41. - **button_selected** **(** :ref:`int<class_int>` button_idx **)**
  42. Numeric Constants
  43. -----------------
  44. - **ALIGN_BEGIN** = **0** --- Align buttons at the beginning.
  45. - **ALIGN_CENTER** = **1** --- Align buttons in the middle.
  46. - **ALIGN_END** = **2** --- Align buttons at the end.
  47. - **ALIGN_FILL** = **3** --- Spread the buttons, but keep them small.
  48. - **ALIGN_EXPAND_FILL** = **4** --- Spread the buttons, but expand them.
  49. Description
  50. -----------
  51. 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.).
  52. This is useful *e.g.* for joypad-friendly interfaces and option menus.
  53. Member Function Description
  54. ---------------------------
  55. .. _class_ButtonArray_add_button:
  56. - void **add_button** **(** :ref:`String<class_string>` text **)**
  57. Append a new button to the array, with the specified text.
  58. .. _class_ButtonArray_add_icon_button:
  59. - void **add_icon_button** **(** :ref:`Texture<class_texture>` icon, :ref:`String<class_string>` text="" **)**
  60. Append a new button to the array, with the specified icon and text.
  61. .. _class_ButtonArray_set_button_text:
  62. - void **set_button_text** **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)**
  63. Define the text of the specified button.
  64. .. _class_ButtonArray_set_button_icon:
  65. - void **set_button_icon** **(** :ref:`int<class_int>` button_idx, :ref:`Texture<class_texture>` icon **)**
  66. Set the icon of the specified button.
  67. .. _class_ButtonArray_get_button_text:
  68. - :ref:`String<class_string>` **get_button_text** **(** :ref:`int<class_int>` button_idx **)** const
  69. Return the text of the specified button.
  70. .. _class_ButtonArray_get_button_icon:
  71. - :ref:`Texture<class_texture>` **get_button_icon** **(** :ref:`int<class_int>` button_idx **)** const
  72. Return the icon of the specified button.
  73. .. _class_ButtonArray_get_button_count:
  74. - :ref:`int<class_int>` **get_button_count** **(** **)** const
  75. Return the amount of buttons in the array.
  76. .. _class_ButtonArray_get_selected:
  77. - :ref:`int<class_int>` **get_selected** **(** **)** const
  78. Return the index of the currently selected button in the array.
  79. .. _class_ButtonArray_get_hovered:
  80. - :ref:`int<class_int>` **get_hovered** **(** **)** const
  81. Return the index of the currently hovered button in the array.
  82. .. _class_ButtonArray_set_selected:
  83. - void **set_selected** **(** :ref:`int<class_int>` button_idx **)**
  84. Select a button in the array based on the given index.
  85. .. _class_ButtonArray_erase_button:
  86. - void **erase_button** **(** :ref:`int<class_int>` button_idx **)**
  87. Remove the specified button in the array.
  88. .. _class_ButtonArray_clear:
  89. - void **clear** **(** **)**
  90. Remove all buttons from the array.