class_button.rst 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Button.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Button:
  5. Button
  6. ======
  7. **Inherits:** :ref:`BaseButton<class_basebutton>` **<** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`OptionButton<class_optionbutton>`, :ref:`ColorPickerButton<class_colorpickerbutton>`, :ref:`CheckButton<class_checkbutton>`, :ref:`MenuButton<class_menubutton>`, :ref:`ToolButton<class_toolbutton>`, :ref:`CheckBox<class_checkbox>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Standard themed Button.
  13. Member Functions
  14. ----------------
  15. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  16. | :ref:`Texture<class_texture>` | :ref:`get_button_icon<class_Button_get_button_icon>` **(** **)** const |
  17. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`get_clip_text<class_Button_get_clip_text>` **(** **)** const |
  19. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_string>` | :ref:`get_text<class_Button_get_text>` **(** **)** const |
  21. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  22. | :ref:`int<class_int>` | :ref:`get_text_align<class_Button_get_text_align>` **(** **)** const |
  23. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_flat<class_Button_is_flat>` **(** **)** const |
  25. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`set_button_icon<class_Button_set_button_icon>` **(** :ref:`Texture<class_texture>` texture **)** |
  27. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`set_clip_text<class_Button_set_clip_text>` **(** :ref:`bool<class_bool>` enabled **)** |
  29. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_flat<class_Button_set_flat>` **(** :ref:`bool<class_bool>` enabled **)** |
  31. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_text<class_Button_set_text>` **(** :ref:`String<class_string>` text **)** |
  33. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_text_align<class_Button_set_text_align>` **(** :ref:`int<class_int>` align **)** |
  35. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  36. Member Variables
  37. ----------------
  38. - :ref:`int<class_int>` **align** - Text alignment policy for the button's text, use one of the ALIGN\_\* constants.
  39. - :ref:`bool<class_bool>` **clip_text** - When this property is enabled, text that is too large to fit the button is clipped, when disabled the Button will always be wide enough to hold the text. This property is disabled by default.
  40. - :ref:`bool<class_bool>` **flat** - Flat buttons don't display decoration.
  41. - :ref:`Texture<class_texture>` **icon** - Button's icon, if text is present the icon will be placed before the text.
  42. - :ref:`String<class_string>` **text** - The button's text that will be displayed inside the button's area.
  43. Numeric Constants
  44. -----------------
  45. - **ALIGN_LEFT** = **0** --- Align the text to the left.
  46. - **ALIGN_CENTER** = **1** --- Align the text to the center.
  47. - **ALIGN_RIGHT** = **2** --- Align the text to the right.
  48. Description
  49. -----------
  50. Button is the standard themed button. It can contain text and an icon, and will display them according to the current :ref:`Theme<class_theme>`.
  51. Member Function Description
  52. ---------------------------
  53. .. _class_Button_get_button_icon:
  54. - :ref:`Texture<class_texture>` **get_button_icon** **(** **)** const
  55. .. _class_Button_get_clip_text:
  56. - :ref:`bool<class_bool>` **get_clip_text** **(** **)** const
  57. .. _class_Button_get_text:
  58. - :ref:`String<class_string>` **get_text** **(** **)** const
  59. .. _class_Button_get_text_align:
  60. - :ref:`int<class_int>` **get_text_align** **(** **)** const
  61. .. _class_Button_is_flat:
  62. - :ref:`bool<class_bool>` **is_flat** **(** **)** const
  63. .. _class_Button_set_button_icon:
  64. - void **set_button_icon** **(** :ref:`Texture<class_texture>` texture **)**
  65. .. _class_Button_set_clip_text:
  66. - void **set_clip_text** **(** :ref:`bool<class_bool>` enabled **)**
  67. .. _class_Button_set_flat:
  68. - void **set_flat** **(** :ref:`bool<class_bool>` enabled **)**
  69. .. _class_Button_set_text:
  70. - void **set_text** **(** :ref:`String<class_string>` text **)**
  71. .. _class_Button_set_text_align:
  72. - void **set_text_align** **(** :ref:`int<class_int>` align **)**