godot/doc/classes/BaseButton.xml

113 lines
4.6 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="BaseButton" inherits="Control" category="Core" version="3.0-stable">
<brief_description>
Base class for different kinds of buttons.
</brief_description>
<description>
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.
</description>
<tutorials>
</tutorials>
<demos>
</demos>
<methods>
<method name="_pressed" qualifiers="virtual">
<return type="void">
</return>
<description>
Called when button is pressed.
</description>
</method>
<method name="_toggled" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="button_pressed" type="bool">
</argument>
<description>
Called when button is toggled (only if toggle_mode is active).
</description>
</method>
<method name="get_draw_mode" qualifiers="const">
<return type="int" enum="BaseButton.DrawMode">
</return>
<description>
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.
</description>
</method>
<method name="is_hovered" qualifiers="const">
<return type="bool">
</return>
<description>
Return true if mouse entered the button before it exit.
</description>
</method>
</methods>
<members>
<member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="BaseButton.ActionMode">
Determines when the button is considered clicked, one of the ACTION_MODE_* constants.
</member>
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled">
If [code]true[/code] the button is in disabled state and can't be clicked or toggled.
</member>
<member name="enabled_focus_mode" type="int" setter="set_enabled_focus_mode" getter="get_enabled_focus_mode" enum="Control.FocusMode">
Focus access mode to use when switching between enabled/disabled (see [method Control.set_focus_mode] and [member disabled]).
</member>
<member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
[ButtonGroup] associated to the button.
</member>
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed">
If [code]true[/code] the button's state is pressed. Means the button is pressed down or toggled (if toggle_mode is active).
</member>
<member name="shortcut" type="ShortCut" setter="set_shortcut" getter="get_shortcut">
[Shortcut] associated to the button.
</member>
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode">
If [code]true[/code] the button is in toggle mode. Makes the button flip state between pressed and unpressed each time its area is clicked.
</member>
</members>
<signals>
<signal name="button_down">
<description>
Emitted when the button starts being held down.
</description>
</signal>
<signal name="button_up">
<description>
Emitted when the button stops being held down.
</description>
</signal>
<signal name="pressed">
<description>
This signal is emitted every time the button is toggled or pressed (i.e. activated, so on [code]button_down[/code] if "Click on press" is active and on [code]button_up[/code] otherwise).
</description>
</signal>
<signal name="toggled">
<argument index="0" name="button_pressed" type="bool">
</argument>
<description>
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 [i]pressed[/i] argument.
</description>
</signal>
</signals>
<constants>
<constant name="DRAW_NORMAL" value="0" enum="DrawMode">
The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons.
</constant>
<constant name="DRAW_PRESSED" value="1" enum="DrawMode">
The state of buttons are pressed.
</constant>
<constant name="DRAW_HOVER" value="2" enum="DrawMode">
The state of buttons are hovered.
</constant>
<constant name="DRAW_DISABLED" value="3" enum="DrawMode">
The state of buttons are disabled.
</constant>
<constant name="ACTION_MODE_BUTTON_PRESS" value="0" enum="ActionMode">
Require just a press to consider the button clicked.
</constant>
<constant name="ACTION_MODE_BUTTON_RELEASE" value="1" enum="ActionMode">
Require a press and a subsequent release before considering the button clicked.
</constant>
</constants>
</class>