class_button.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. .. _class_Button:
  2. Button
  3. ======
  4. **Inherits:** :ref:`BaseButton<class_basebutton>` **<** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  5. **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>`
  6. **Category:** Core
  7. Brief Description
  8. -----------------
  9. Standard themed Button.
  10. Member Functions
  11. ----------------
  12. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  13. | void | :ref:`set_text<class_Button_set_text>` **(** :ref:`String<class_string>` text **)** |
  14. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  15. | :ref:`String<class_string>` | :ref:`get_text<class_Button_get_text>` **(** **)** const |
  16. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`set_button_icon<class_Button_set_button_icon>` **(** :ref:`Texture<class_texture>` texture **)** |
  18. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  19. | :ref:`Texture<class_texture>` | :ref:`get_button_icon<class_Button_get_button_icon>` **(** **)** const |
  20. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`set_flat<class_Button_set_flat>` **(** :ref:`bool<class_bool>` enabled **)** |
  22. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_clip_text<class_Button_set_clip_text>` **(** :ref:`bool<class_bool>` enabled **)** |
  24. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`get_clip_text<class_Button_get_clip_text>` **(** **)** const |
  26. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_text_align<class_Button_set_text_align>` **(** :ref:`int<class_int>` align **)** |
  28. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_text_align<class_Button_get_text_align>` **(** **)** const |
  30. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`is_flat<class_Button_is_flat>` **(** **)** const |
  32. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  33. Description
  34. -----------
  35. Button is just the standard themed button: :ref:`image src="images/button_example.png"/<class_image src="images/button_example.png"/>` It can contain text and an icon, and will display them according to the current :ref:`Theme<class_theme>`.
  36. Member Function Description
  37. ---------------------------
  38. .. _class_Button_set_text:
  39. - void **set_text** **(** :ref:`String<class_string>` text **)**
  40. Set the button text, which will be displayed inside the button area.
  41. .. _class_Button_get_text:
  42. - :ref:`String<class_string>` **get_text** **(** **)** const
  43. Return the button text.
  44. .. _class_Button_set_button_icon:
  45. - void **set_button_icon** **(** :ref:`Texture<class_texture>` texture **)**
  46. .. _class_Button_get_button_icon:
  47. - :ref:`Texture<class_texture>` **get_button_icon** **(** **)** const
  48. .. _class_Button_set_flat:
  49. - void **set_flat** **(** :ref:`bool<class_bool>` enabled **)**
  50. Set the *flat* property of a Button. Flat buttons don't display decoration unless hoevered or pressed.
  51. .. _class_Button_set_clip_text:
  52. - void **set_clip_text** **(** :ref:`bool<class_bool>` enabled **)**
  53. Set the *clip_text* property of a Button. When this property is enabled, text that is too large to fit the button is clipped, when disabled (default) the Button will always be wide enough to hold the text.
  54. .. _class_Button_get_clip_text:
  55. - :ref:`bool<class_bool>` **get_clip_text** **(** **)** const
  56. Return the state of the *clip_text* property (see :ref:`set_clip_text<class_Button_set_clip_text>`)
  57. .. _class_Button_set_text_align:
  58. - void **set_text_align** **(** :ref:`int<class_int>` align **)**
  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. Return the state of the *flat* property (see :ref:`set_flat<class_Button_set_flat>`)