class_button.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Button.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Button:
  6. Button
  7. ======
  8. **Inherits:** :ref:`BaseButton<class_BaseButton>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`CheckBox<class_CheckBox>`, :ref:`CheckButton<class_CheckButton>`, :ref:`ColorPickerButton<class_ColorPickerButton>`, :ref:`MenuButton<class_MenuButton>`, :ref:`OptionButton<class_OptionButton>`, :ref:`ToolButton<class_ToolButton>`
  10. **Category:** Core
  11. Brief Description
  12. -----------------
  13. Standard themed Button.
  14. Properties
  15. ----------
  16. +-----------------------------------------+---------------------------------------------------+
  17. | :ref:`TextAlign<enum_Button_TextAlign>` | :ref:`align<class_Button_property_align>` |
  18. +-----------------------------------------+---------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`clip_text<class_Button_property_clip_text>` |
  20. +-----------------------------------------+---------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`flat<class_Button_property_flat>` |
  22. +-----------------------------------------+---------------------------------------------------+
  23. | :ref:`Texture<class_Texture>` | :ref:`icon<class_Button_property_icon>` |
  24. +-----------------------------------------+---------------------------------------------------+
  25. | :ref:`String<class_String>` | :ref:`text<class_Button_property_text>` |
  26. +-----------------------------------------+---------------------------------------------------+
  27. Theme Properties
  28. ----------------
  29. +---------------------------------+---------------------+
  30. | :ref:`StyleBox<class_StyleBox>` | disabled |
  31. +---------------------------------+---------------------+
  32. | :ref:`StyleBox<class_StyleBox>` | focus |
  33. +---------------------------------+---------------------+
  34. | :ref:`Font<class_Font>` | font |
  35. +---------------------------------+---------------------+
  36. | :ref:`Color<class_Color>` | font_color |
  37. +---------------------------------+---------------------+
  38. | :ref:`Color<class_Color>` | font_color_disabled |
  39. +---------------------------------+---------------------+
  40. | :ref:`Color<class_Color>` | font_color_hover |
  41. +---------------------------------+---------------------+
  42. | :ref:`Color<class_Color>` | font_color_pressed |
  43. +---------------------------------+---------------------+
  44. | :ref:`StyleBox<class_StyleBox>` | hover |
  45. +---------------------------------+---------------------+
  46. | :ref:`int<class_int>` | hseparation |
  47. +---------------------------------+---------------------+
  48. | :ref:`StyleBox<class_StyleBox>` | normal |
  49. +---------------------------------+---------------------+
  50. | :ref:`StyleBox<class_StyleBox>` | pressed |
  51. +---------------------------------+---------------------+
  52. Enumerations
  53. ------------
  54. .. _enum_Button_TextAlign:
  55. .. _class_Button_constant_ALIGN_LEFT:
  56. .. _class_Button_constant_ALIGN_CENTER:
  57. .. _class_Button_constant_ALIGN_RIGHT:
  58. enum **TextAlign**:
  59. - **ALIGN_LEFT** = **0** --- Align the text to the left.
  60. - **ALIGN_CENTER** = **1** --- Align the text to the center.
  61. - **ALIGN_RIGHT** = **2** --- Align the text to the right.
  62. Description
  63. -----------
  64. 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>`.
  65. Property Descriptions
  66. ---------------------
  67. .. _class_Button_property_align:
  68. - :ref:`TextAlign<enum_Button_TextAlign>` **align**
  69. +----------+-----------------------+
  70. | *Setter* | set_text_align(value) |
  71. +----------+-----------------------+
  72. | *Getter* | get_text_align() |
  73. +----------+-----------------------+
  74. Text alignment policy for the button's text, use one of the ALIGN\_\* constants.
  75. ----
  76. .. _class_Button_property_clip_text:
  77. - :ref:`bool<class_bool>` **clip_text**
  78. +----------+----------------------+
  79. | *Setter* | set_clip_text(value) |
  80. +----------+----------------------+
  81. | *Getter* | get_clip_text() |
  82. +----------+----------------------+
  83. 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.
  84. ----
  85. .. _class_Button_property_flat:
  86. - :ref:`bool<class_bool>` **flat**
  87. +----------+-----------------+
  88. | *Setter* | set_flat(value) |
  89. +----------+-----------------+
  90. | *Getter* | is_flat() |
  91. +----------+-----------------+
  92. Flat buttons don't display decoration.
  93. ----
  94. .. _class_Button_property_icon:
  95. - :ref:`Texture<class_Texture>` **icon**
  96. +----------+------------------------+
  97. | *Setter* | set_button_icon(value) |
  98. +----------+------------------------+
  99. | *Getter* | get_button_icon() |
  100. +----------+------------------------+
  101. Button's icon, if text is present the icon will be placed before the text.
  102. ----
  103. .. _class_Button_property_text:
  104. - :ref:`String<class_String>` **text**
  105. +----------+-----------------+
  106. | *Setter* | set_text(value) |
  107. +----------+-----------------+
  108. | *Getter* | get_text() |
  109. +----------+-----------------+
  110. The button's text that will be displayed inside the button's area.