class_basebutton.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. Member Functions
  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:`int<class_int>` | :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. Member Variables
  39. ----------------
  40. .. _class_BaseButton_action_mode:
  41. - :ref:`ActionMode<enum_basebutton_actionmode>` **action_mode** - Determines when the button is considered clicked, one of the ACTION_MODE\_\* constants.
  42. .. _class_BaseButton_disabled:
  43. - :ref:`bool<class_bool>` **disabled** - If ``true`` the button is in disabled state and can't be clicked or toggled.
  44. .. _class_BaseButton_enabled_focus_mode:
  45. - :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>`).
  46. .. _class_BaseButton_group:
  47. - :ref:`ButtonGroup<class_buttongroup>` **group** - :ref:`ButtonGroup<class_buttongroup>` associated to the button.
  48. .. _class_BaseButton_pressed:
  49. - :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).
  50. .. _class_BaseButton_shortcut:
  51. - :ref:`ShortCut<class_shortcut>` **shortcut** - Shortcut associated to the button.
  52. .. _class_BaseButton_toggle_mode:
  53. - :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.
  54. Enums
  55. -----
  56. .. _enum_BaseButton_ActionMode:
  57. enum **ActionMode**
  58. - **ACTION_MODE_BUTTON_PRESS** = **0** --- Require just a press to consider the button clicked.
  59. - **ACTION_MODE_BUTTON_RELEASE** = **1** --- Require a press and a subsequent release before considering the button clicked.
  60. .. _enum_BaseButton_DrawMode:
  61. enum **DrawMode**
  62. - **DRAW_NORMAL** = **0** --- The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons.
  63. - **DRAW_PRESSED** = **1** --- The state of buttons are pressed.
  64. - **DRAW_HOVER** = **2** --- The state of buttons are hovered.
  65. - **DRAW_DISABLED** = **3** --- The state of buttons are disabled.
  66. Description
  67. -----------
  68. 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.
  69. Member Function Description
  70. ---------------------------
  71. .. _class_BaseButton__pressed:
  72. - void **_pressed** **(** **)** virtual
  73. Called when button is pressed.
  74. .. _class_BaseButton__toggled:
  75. - void **_toggled** **(** :ref:`bool<class_bool>` button_pressed **)** virtual
  76. Called when button is toggled (only if toggle_mode is active).
  77. .. _class_BaseButton_get_draw_mode:
  78. - :ref:`int<class_int>` **get_draw_mode** **(** **)** const
  79. 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.
  80. .. _class_BaseButton_is_hovered:
  81. - :ref:`bool<class_bool>` **is_hovered** **(** **)** const
  82. Return true if mouse entered the button before it exit.