class_button.rst 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. .. _class_Button:
  2. Button
  3. ======
  4. **Inherits:** :ref:`BaseButton<class_basebutton>`
  5. **Category:** Core
  6. Standard themed Button.
  7. Member Functions
  8. ----------------
  9. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  10. | void | :ref:`set_text<class_Button_set_text>` **(** :ref:`String<class_string>` text **)** |
  11. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  12. | :ref:`String<class_string>` | :ref:`get_text<class_Button_get_text>` **(** **)** const |
  13. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`set_button_icon<class_Button_set_button_icon>` **(** :ref:`Texture<class_texture>` texture **)** |
  15. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  16. | :ref:`Texture<class_texture>` | :ref:`get_button_icon<class_Button_get_button_icon>` **(** **)** const |
  17. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`set_flat<class_Button_set_flat>` **(** :ref:`bool<class_bool>` enabled **)** |
  19. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`set_clip_text<class_Button_set_clip_text>` **(** :ref:`bool<class_bool>` enabled **)** |
  21. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`get_clip_text<class_Button_get_clip_text>` **(** **)** const |
  23. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`set_text_align<class_Button_set_text_align>` **(** :ref:`int<class_int>` align **)** |
  25. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_text_align<class_Button_get_text_align>` **(** **)** const |
  27. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_flat<class_Button_is_flat>` **(** **)** const |
  29. +--------------------------------+----------------------------------------------------------------------------------------------------------+
  30. Description
  31. -----------
  32. 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>`.
  33. Member Function Description
  34. ---------------------------
  35. .. _class_Button_set_text:
  36. - void **set_text** **(** :ref:`String<class_string>` text **)**
  37. Set the button text, which will be displayed inside the button area.
  38. .. _class_Button_get_text:
  39. - :ref:`String<class_string>` **get_text** **(** **)** const
  40. Return the button text.
  41. .. _class_Button_set_button_icon:
  42. - void **set_button_icon** **(** :ref:`Texture<class_texture>` texture **)**
  43. .. _class_Button_get_button_icon:
  44. - :ref:`Texture<class_texture>` **get_button_icon** **(** **)** const
  45. .. _class_Button_set_flat:
  46. - void **set_flat** **(** :ref:`bool<class_bool>` enabled **)**
  47. Set the *flat* property of a Button. Flat buttons don't display decoration unless hoevered or pressed.
  48. .. _class_Button_set_clip_text:
  49. - void **set_clip_text** **(** :ref:`bool<class_bool>` enabled **)**
  50. 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.
  51. .. _class_Button_get_clip_text:
  52. - :ref:`bool<class_bool>` **get_clip_text** **(** **)** const
  53. Return the state of the *clip_text* property (see :ref:`set_clip_text<Button_set_clip_text>`)
  54. .. _class_Button_set_text_align:
  55. - void **set_text_align** **(** :ref:`int<class_int>` align **)**
  56. .. _class_Button_get_text_align:
  57. - :ref:`int<class_int>` **get_text_align** **(** **)** const
  58. .. _class_Button_is_flat:
  59. - :ref:`bool<class_bool>` **is_flat** **(** **)** const
  60. Return the state of the *flat* property (see :ref:`set_flat<Button_set_flat>`)