f5836b40d4
For the time being we don't support writing a description for those, preferring
having all details in the method's description.
Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.
(cherry picked from commit 7adf4cc9b5
)
130 lines
6.8 KiB
XML
130 lines
6.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="BaseButton" inherits="Control" version="3.4">
|
|
<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>
|
|
<methods>
|
|
<method name="_pressed" qualifiers="virtual">
|
|
<return type="void" />
|
|
<description>
|
|
Called when the button is pressed. If you need to know the button's pressed state (and [member toggle_mode] is active), use [method _toggled] instead.
|
|
</description>
|
|
</method>
|
|
<method name="_toggled" qualifiers="virtual">
|
|
<return type="void" />
|
|
<argument index="0" name="button_pressed" type="bool" />
|
|
<description>
|
|
Called when the button is toggled (only if [member toggle_mode] is active).
|
|
</description>
|
|
</method>
|
|
<method name="get_draw_mode" qualifiers="const">
|
|
<return type="int" enum="BaseButton.DrawMode" />
|
|
<description>
|
|
Returns 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 [enum DrawMode] enum.
|
|
</description>
|
|
</method>
|
|
<method name="is_hovered" qualifiers="const">
|
|
<return type="bool" />
|
|
<description>
|
|
Returns [code]true[/code] if the mouse has entered the button and has not left it yet.
|
|
</description>
|
|
</method>
|
|
<method name="set_pressed_no_signal">
|
|
<return type="void" />
|
|
<argument index="0" name="pressed" type="bool" />
|
|
<description>
|
|
Changes the [member pressed] state of the button, without emitting [signal toggled]. Use when you just want to change the state of the button without sending the pressed event (e.g. when initializing scene). Only works if [member toggle_mode] is [code]true[/code].
|
|
[b]Note:[/b] This method doesn't unpress other buttons in its button [member group].
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" enum="BaseButton.ActionMode" default="1">
|
|
Determines when the button is considered clicked, one of the [enum ActionMode] constants.
|
|
</member>
|
|
<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" default="1">
|
|
Binary mask to choose which mouse buttons this button will respond to.
|
|
To allow both left-click and right-click, use [code]BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT[/code].
|
|
</member>
|
|
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
|
|
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" default="2">
|
|
[i]Deprecated.[/i] This property has been deprecated due to redundancy and no longer has any effect when set. Please use [member Control.focus_mode] instead.
|
|
</member>
|
|
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" />
|
|
<member name="group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
|
|
[ButtonGroup] associated to the button.
|
|
</member>
|
|
<member name="keep_pressed_outside" type="bool" setter="set_keep_pressed_outside" getter="is_keep_pressed_outside" default="false">
|
|
If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it.
|
|
[b]Note:[/b] This property only affects the button's visual appearance. Signals will be emitted at the same moment regardless of this property's value.
|
|
</member>
|
|
<member name="pressed" type="bool" setter="set_pressed" getter="is_pressed" default="false">
|
|
If [code]true[/code], the button's state is pressed. Means the button is pressed down or toggled (if [member toggle_mode] is active). Only works if [member toggle_mode] is [code]true[/code].
|
|
[b]Note:[/b] Setting [member pressed] will result in [signal toggled] to be emitted. If you want to change the pressed state without emitting that signal, use [method set_pressed_no_signal].
|
|
</member>
|
|
<member name="shortcut" type="ShortCut" setter="set_shortcut" getter="get_shortcut">
|
|
[ShortCut] associated to the button.
|
|
</member>
|
|
<member name="shortcut_in_tooltip" type="bool" setter="set_shortcut_in_tooltip" getter="is_shortcut_in_tooltip_enabled" default="true">
|
|
If [code]true[/code], the button will add information about its shortcut in the tooltip.
|
|
</member>
|
|
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" default="false">
|
|
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>
|
|
Emitted when the button is toggled or pressed. This is on [signal button_down] if [member action_mode] is [constant ACTION_MODE_BUTTON_PRESS] and on [signal button_up] otherwise.
|
|
If you need to know the button's pressed state (and [member toggle_mode] is active), use [signal toggled] instead.
|
|
</description>
|
|
</signal>
|
|
<signal name="toggled">
|
|
<argument index="0" name="button_pressed" type="bool" />
|
|
<description>
|
|
Emitted when the button was just toggled between pressed and normal states (only if [member toggle_mode] is active). The new state is contained in the [code]button_pressed[/code] 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="DRAW_HOVER_PRESSED" value="4" enum="DrawMode">
|
|
The state of buttons are both hovered and pressed.
|
|
</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>
|