class_buttonarray.rst 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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, :ref:`String<class_string>` tooltip="" **)** |
  16. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`add_icon_button<class_ButtonArray_add_icon_button>` **(** :ref:`Texture<class_texture>` icon, :ref:`String<class_string>` text="", :ref:`String<class_string>` tooltip="" **)** |
  18. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`clear<class_ButtonArray_clear>` **(** **)** |
  20. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`erase_button<class_ButtonArray_erase_button>` **(** :ref:`int<class_int>` button_idx **)** |
  22. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_button_count<class_ButtonArray_get_button_count>` **(** **)** 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:`String<class_string>` | :ref:`get_button_text<class_ButtonArray_get_button_text>` **(** :ref:`int<class_int>` button_idx **)** const |
  28. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_string>` | :ref:`get_button_tooltip<class_ButtonArray_get_button_tooltip>` **(** :ref:`int<class_int>` button_idx **)** const |
  30. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_hovered<class_ButtonArray_get_hovered>` **(** **)** const |
  32. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`get_selected<class_ButtonArray_get_selected>` **(** **)** const |
  34. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_button_icon<class_ButtonArray_set_button_icon>` **(** :ref:`int<class_int>` button_idx, :ref:`Texture<class_texture>` icon **)** |
  36. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_button_text<class_ButtonArray_set_button_text>` **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)** |
  38. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_button_tooltip<class_ButtonArray_set_button_tooltip>` **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)** |
  40. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_selected<class_ButtonArray_set_selected>` **(** :ref:`int<class_int>` button_idx **)** |
  42. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. Signals
  44. -------
  45. - **button_selected** **(** :ref:`int<class_int>` button_idx **)**
  46. Numeric Constants
  47. -----------------
  48. - **ALIGN_BEGIN** = **0** --- Align buttons at the beginning.
  49. - **ALIGN_CENTER** = **1** --- Align buttons in the middle.
  50. - **ALIGN_END** = **2** --- Align buttons at the end.
  51. - **ALIGN_FILL** = **3** --- Spread the buttons, but keep them small.
  52. - **ALIGN_EXPAND_FILL** = **4** --- Spread the buttons, but expand them.
  53. Description
  54. -----------
  55. 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.).
  56. This is useful *e.g.* for joypad-friendly interfaces and option menus.
  57. Member Function Description
  58. ---------------------------
  59. .. _class_ButtonArray_add_button:
  60. - void **add_button** **(** :ref:`String<class_string>` text, :ref:`String<class_string>` tooltip="" **)**
  61. Append a new button to the array, with the specified text.
  62. .. _class_ButtonArray_add_icon_button:
  63. - void **add_icon_button** **(** :ref:`Texture<class_texture>` icon, :ref:`String<class_string>` text="", :ref:`String<class_string>` tooltip="" **)**
  64. Append a new button to the array, with the specified icon and text.
  65. .. _class_ButtonArray_clear:
  66. - void **clear** **(** **)**
  67. Remove all buttons from the array.
  68. .. _class_ButtonArray_erase_button:
  69. - void **erase_button** **(** :ref:`int<class_int>` button_idx **)**
  70. Remove the specified button in the array.
  71. .. _class_ButtonArray_get_button_count:
  72. - :ref:`int<class_int>` **get_button_count** **(** **)** const
  73. Return the amount of buttons in the array.
  74. .. _class_ButtonArray_get_button_icon:
  75. - :ref:`Texture<class_texture>` **get_button_icon** **(** :ref:`int<class_int>` button_idx **)** const
  76. Return the icon of the specified button.
  77. .. _class_ButtonArray_get_button_text:
  78. - :ref:`String<class_string>` **get_button_text** **(** :ref:`int<class_int>` button_idx **)** const
  79. Return the text of the specified button.
  80. .. _class_ButtonArray_get_button_tooltip:
  81. - :ref:`String<class_string>` **get_button_tooltip** **(** :ref:`int<class_int>` button_idx **)** const
  82. .. _class_ButtonArray_get_hovered:
  83. - :ref:`int<class_int>` **get_hovered** **(** **)** const
  84. Return the index of the currently hovered button in the array.
  85. .. _class_ButtonArray_get_selected:
  86. - :ref:`int<class_int>` **get_selected** **(** **)** const
  87. Return the index of the currently selected button in the array.
  88. .. _class_ButtonArray_set_button_icon:
  89. - void **set_button_icon** **(** :ref:`int<class_int>` button_idx, :ref:`Texture<class_texture>` icon **)**
  90. Set the icon of the specified button.
  91. .. _class_ButtonArray_set_button_text:
  92. - void **set_button_text** **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)**
  93. Define the text of the specified button.
  94. .. _class_ButtonArray_set_button_tooltip:
  95. - void **set_button_tooltip** **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)**
  96. .. _class_ButtonArray_set_selected:
  97. - void **set_selected** **(** :ref:`int<class_int>` button_idx **)**
  98. Select a button in the array based on the given index.