class_buttonarray.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. | :ref:`bool<class_bool>` | :ref:`is_flat<class_ButtonArray_is_flat>` **(** **)** const |
  36. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_button_icon<class_ButtonArray_set_button_icon>` **(** :ref:`int<class_int>` button_idx, :ref:`Texture<class_texture>` icon **)** |
  38. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_button_text<class_ButtonArray_set_button_text>` **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)** |
  40. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_button_tooltip<class_ButtonArray_set_button_tooltip>` **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)** |
  42. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_flat<class_ButtonArray_set_flat>` **(** :ref:`bool<class_bool>` enabled **)** |
  44. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`set_selected<class_ButtonArray_set_selected>` **(** :ref:`int<class_int>` button_idx **)** |
  46. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. Signals
  48. -------
  49. - **button_selected** **(** :ref:`int<class_int>` button_idx **)**
  50. A button has been selected, its index is given as the argument.
  51. Numeric Constants
  52. -----------------
  53. - **ALIGN_BEGIN** = **0** --- Align buttons at the beginning.
  54. - **ALIGN_CENTER** = **1** --- Align buttons in the middle.
  55. - **ALIGN_END** = **2** --- Align buttons at the end.
  56. - **ALIGN_FILL** = **3** --- Spread the buttons, but keep them small.
  57. - **ALIGN_EXPAND_FILL** = **4** --- Spread the buttons, but expand them.
  58. Description
  59. -----------
  60. 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.).
  61. This is useful *e.g.* for joypad-friendly interfaces and option menus.
  62. Member Function Description
  63. ---------------------------
  64. .. _class_ButtonArray_add_button:
  65. - void **add_button** **(** :ref:`String<class_string>` text, :ref:`String<class_string>` tooltip="" **)**
  66. Append a new button to the array, with the specified text.
  67. .. _class_ButtonArray_add_icon_button:
  68. - void **add_icon_button** **(** :ref:`Texture<class_texture>` icon, :ref:`String<class_string>` text="", :ref:`String<class_string>` tooltip="" **)**
  69. Append a new button to the array, with the specified icon and text.
  70. .. _class_ButtonArray_clear:
  71. - void **clear** **(** **)**
  72. Remove all buttons from the array.
  73. .. _class_ButtonArray_erase_button:
  74. - void **erase_button** **(** :ref:`int<class_int>` button_idx **)**
  75. Remove the specified button in the array.
  76. .. _class_ButtonArray_get_button_count:
  77. - :ref:`int<class_int>` **get_button_count** **(** **)** const
  78. Return the amount of buttons in the array.
  79. .. _class_ButtonArray_get_button_icon:
  80. - :ref:`Texture<class_texture>` **get_button_icon** **(** :ref:`int<class_int>` button_idx **)** const
  81. Return the icon of the specified button.
  82. .. _class_ButtonArray_get_button_text:
  83. - :ref:`String<class_string>` **get_button_text** **(** :ref:`int<class_int>` button_idx **)** const
  84. Return the text of the specified button.
  85. .. _class_ButtonArray_get_button_tooltip:
  86. - :ref:`String<class_string>` **get_button_tooltip** **(** :ref:`int<class_int>` button_idx **)** const
  87. .. _class_ButtonArray_get_hovered:
  88. - :ref:`int<class_int>` **get_hovered** **(** **)** const
  89. Return the index of the currently hovered button in the array.
  90. .. _class_ButtonArray_get_selected:
  91. - :ref:`int<class_int>` **get_selected** **(** **)** const
  92. Return the index of the currently selected button in the array.
  93. .. _class_ButtonArray_is_flat:
  94. - :ref:`bool<class_bool>` **is_flat** **(** **)** const
  95. .. _class_ButtonArray_set_button_icon:
  96. - void **set_button_icon** **(** :ref:`int<class_int>` button_idx, :ref:`Texture<class_texture>` icon **)**
  97. Set the icon of the specified button.
  98. .. _class_ButtonArray_set_button_text:
  99. - void **set_button_text** **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)**
  100. Define the text of the specified button.
  101. .. _class_ButtonArray_set_button_tooltip:
  102. - void **set_button_tooltip** **(** :ref:`int<class_int>` button_idx, :ref:`String<class_string>` text **)**
  103. .. _class_ButtonArray_set_flat:
  104. - void **set_flat** **(** :ref:`bool<class_bool>` enabled **)**
  105. .. _class_ButtonArray_set_selected:
  106. - void **set_selected** **(** :ref:`int<class_int>` button_idx **)**
  107. Select a button in the array based on the given index.