class_buttonarray.rst 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. .. _class_ButtonArray:
  2. ButtonArray
  3. ===========
  4. **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  5. **Inherited By:** :ref:`HButtonArray<class_hbuttonarray>`, :ref:`VButtonArray<class_vbuttonarray>`
  6. **Category:** Core
  7. Brief Description
  8. -----------------
  9. Array of Buttons.
  10. Member Functions
  11. ----------------
  12. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  13. | void | :ref:`add_button<class_ButtonArray_add_button>` **(** :ref:`String<class_string>` text **)** |
  14. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_icon_button<class_ButtonArray_add_icon_button>` **(** :ref:`Object<class_object>` icon, :ref:`String<class_string>` text="" **)** |
  16. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`set_button_text<class_ButtonArray_set_button_text>` **(** :ref:`int<class_int>` button, :ref:`String<class_string>` text **)** |
  18. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`set_button_icon<class_ButtonArray_set_button_icon>` **(** :ref:`int<class_int>` button, :ref:`Object<class_object>` icon **)** |
  20. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`String<class_string>` | :ref:`get_button_text<class_ButtonArray_get_button_text>` **(** :ref:`int<class_int>` button **)** const |
  22. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Object<class_object>` | :ref:`get_button_icon<class_ButtonArray_get_button_icon>` **(** :ref:`int<class_int>` button **)** const |
  24. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`get_button_count<class_ButtonArray_get_button_count>` **(** **)** const |
  26. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_selected<class_ButtonArray_get_selected>` **(** **)** const |
  28. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_hovered<class_ButtonArray_get_hovered>` **(** **)** const |
  30. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_selected<class_ButtonArray_set_selected>` **(** :ref:`int<class_int>` button **)** |
  32. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`erase_button<class_ButtonArray_erase_button>` **(** :ref:`int<class_int>` button **)** |
  34. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`clear<class_ButtonArray_clear>` **(** **)** |
  36. +------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  37. Signals
  38. -------
  39. - **button_selected** **(** :ref:`int<class_int>` button **)**
  40. Numeric Constants
  41. -----------------
  42. - **ALIGN_BEGIN** = **0** --- Align buttons at the begining.
  43. - **ALIGN_CENTER** = **1** --- Align buttons in the middle.
  44. - **ALIGN_END** = **2** --- Align buttons at the end.
  45. - **ALIGN_FILL** = **3** --- Spread the buttons, but keep them small.
  46. - **ALIGN_EXPAND_FILL** = **4** --- Spread the buttons, but expand them.
  47. Description
  48. -----------
  49. Array of Buttons. A Button array is useful to have an array of buttons laid out vertically or horizontally. Only one can be selected. This is useful for joypad based interfaces and option menus.
  50. Member Function Description
  51. ---------------------------
  52. .. _class_ButtonArray_add_button:
  53. - void **add_button** **(** :ref:`String<class_string>` text **)**
  54. Add a new button.
  55. .. _class_ButtonArray_add_icon_button:
  56. - void **add_icon_button** **(** :ref:`Object<class_object>` icon, :ref:`String<class_string>` text="" **)**
  57. .. _class_ButtonArray_set_button_text:
  58. - void **set_button_text** **(** :ref:`int<class_int>` button, :ref:`String<class_string>` text **)**
  59. .. _class_ButtonArray_set_button_icon:
  60. - void **set_button_icon** **(** :ref:`int<class_int>` button, :ref:`Object<class_object>` icon **)**
  61. Set the icon of an existing button.
  62. .. _class_ButtonArray_get_button_text:
  63. - :ref:`String<class_string>` **get_button_text** **(** :ref:`int<class_int>` button **)** const
  64. Return the text of an existing button.
  65. .. _class_ButtonArray_get_button_icon:
  66. - :ref:`Object<class_object>` **get_button_icon** **(** :ref:`int<class_int>` button **)** const
  67. Return the icon of an existing button.
  68. .. _class_ButtonArray_get_button_count:
  69. - :ref:`int<class_int>` **get_button_count** **(** **)** const
  70. Return the amount of buttons in the array.
  71. .. _class_ButtonArray_get_selected:
  72. - :ref:`int<class_int>` **get_selected** **(** **)** const
  73. Return the currently selected button in the array.
  74. .. _class_ButtonArray_get_hovered:
  75. - :ref:`int<class_int>` **get_hovered** **(** **)** const
  76. Return the currently hovered button in the array.
  77. .. _class_ButtonArray_set_selected:
  78. - void **set_selected** **(** :ref:`int<class_int>` button **)**
  79. Sekect a button in the array.
  80. .. _class_ButtonArray_erase_button:
  81. - void **erase_button** **(** :ref:`int<class_int>` button **)**
  82. Remove a button in the array, by index.
  83. .. _class_ButtonArray_clear:
  84. - void **clear** **(** **)**
  85. Clear the button array.