class_basebutton.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the BaseButton.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_BaseButton:
  5. BaseButton
  6. ==========
  7. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Inherited By:** :ref:`LinkButton<class_LinkButton>`, :ref:`TextureButton<class_TextureButton>`, :ref:`Button<class_Button>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base class for different kinds of buttons.
  13. Methods
  14. -------
  15. +--------------------------------------------+-------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`_pressed<class_BaseButton__pressed>` **(** **)** virtual |
  17. +--------------------------------------------+-------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`_toggled<class_BaseButton__toggled>` **(** :ref:`bool<class_bool>` button_pressed **)** virtual |
  19. +--------------------------------------------+-------------------------------------------------------------------------------------------------------+
  20. | :ref:`DrawMode<enum_BaseButton_DrawMode>` | :ref:`get_draw_mode<class_BaseButton_get_draw_mode>` **(** **)** const |
  21. +--------------------------------------------+-------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`is_hovered<class_BaseButton_is_hovered>` **(** **)** const |
  23. +--------------------------------------------+-------------------------------------------------------------------------------------------------------+
  24. Signals
  25. -------
  26. .. _class_BaseButton_button_down:
  27. - **button_down** **(** **)**
  28. Emitted when the button starts being held down.
  29. .. _class_BaseButton_button_up:
  30. - **button_up** **(** **)**
  31. Emitted when the button stops being held down.
  32. .. _class_BaseButton_pressed:
  33. - **pressed** **(** **)**
  34. This signal is emitted every time the button is toggled or pressed (i.e. activated, so on ``button_down`` if "Click on press" is active and on ``button_up`` otherwise).
  35. .. _class_BaseButton_toggled:
  36. - **toggled** **(** :ref:`bool<class_bool>` button_pressed **)**
  37. This signal is emitted when the button was just toggled between pressed and normal states (only if toggle_mode is active). The new state is contained in the *pressed* argument.
  38. Enumerations
  39. ------------
  40. .. _enum_BaseButton_ActionMode:
  41. enum **ActionMode**
  42. - **ACTION_MODE_BUTTON_PRESS** = **0** --- Require just a press to consider the button clicked.
  43. - **ACTION_MODE_BUTTON_RELEASE** = **1** --- Require a press and a subsequent release before considering the button clicked.
  44. .. _enum_BaseButton_DrawMode:
  45. enum **DrawMode**
  46. - **DRAW_NORMAL** = **0** --- The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons.
  47. - **DRAW_PRESSED** = **1** --- The state of buttons are pressed.
  48. - **DRAW_HOVER** = **2** --- The state of buttons are hovered.
  49. - **DRAW_DISABLED** = **3** --- The state of buttons are disabled.
  50. Description
  51. -----------
  52. BaseButton is the abstract base class for buttons, so it shouldn't be used directly (it doesn't display anything). Other types of buttons inherit from it.
  53. Property Descriptions
  54. ---------------------
  55. .. _class_BaseButton_action_mode:
  56. - :ref:`ActionMode<enum_BaseButton_ActionMode>` **action_mode** - Determines when the button is considered clicked, one of the ACTION_MODE\_\* constants.
  57. .. _class_BaseButton_button_mask:
  58. - :ref:`int<class_int>` **button_mask** - Binary mask to choose which mouse buttons this button will respond to.
  59. To allow both left-click and right-click, set this to 3, because it's BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT.
  60. .. _class_BaseButton_disabled:
  61. - :ref:`bool<class_bool>` **disabled** - If ``true`` the button is in disabled state and can't be clicked or toggled.
  62. .. _class_BaseButton_enabled_focus_mode:
  63. - :ref:`FocusMode<enum_Control_FocusMode>` **enabled_focus_mode** - Focus access mode to use when switching between enabled/disabled (see :ref:`Control.set_focus_mode<class_Control_set_focus_mode>` and :ref:`disabled<class_BaseButton_disabled>`).
  64. .. _class_BaseButton_group:
  65. - :ref:`ButtonGroup<class_ButtonGroup>` **group** - :ref:`ButtonGroup<class_ButtonGroup>` associated to the button.
  66. .. _class_BaseButton_pressed:
  67. - :ref:`bool<class_bool>` **pressed** - If ``true`` the button's state is pressed. Means the button is pressed down or toggled (if toggle_mode is active).
  68. .. _class_BaseButton_shortcut:
  69. - :ref:`ShortCut<class_ShortCut>` **shortcut** - Shortcut associated to the button.
  70. .. _class_BaseButton_toggle_mode:
  71. - :ref:`bool<class_bool>` **toggle_mode** - If ``true`` the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.
  72. Method Descriptions
  73. -------------------
  74. .. _class_BaseButton__pressed:
  75. - void **_pressed** **(** **)** virtual
  76. Called when the button is pressed.
  77. .. _class_BaseButton__toggled:
  78. - void **_toggled** **(** :ref:`bool<class_bool>` button_pressed **)** virtual
  79. Called when the button is toggled (only if toggle_mode is active).
  80. .. _class_BaseButton_get_draw_mode:
  81. - :ref:`DrawMode<enum_BaseButton_DrawMode>` **get_draw_mode** **(** **)** const
  82. Return the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the button is defined by the DRAW\_\* enum.
  83. .. _class_BaseButton_is_hovered:
  84. - :ref:`bool<class_bool>` **is_hovered** **(** **)** const
  85. Return true if the mouse has entered the button and has not left it yet.