2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 02:03:48 +01:00
<class name= "BaseButton" inherits= "Control" version= "4.0" >
2017-09-12 22:42:36 +02:00
<brief_description >
2017-10-23 00:17:02 +02:00
Base class for different kinds of buttons.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2017-10-23 00:17:02 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "_pressed" qualifiers= "virtual" >
<return type= "void" >
</return>
<description >
2020-07-17 00:01:24 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "_toggled" qualifiers= "virtual" >
<return type= "void" >
</return>
2018-01-09 16:39:43 +01:00
<argument index= "0" name= "button_pressed" type= "bool" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
2019-12-06 23:09:20 +01:00
Called when the button is toggled (only if [member toggle_mode] is active).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_draw_mode" qualifiers= "const" >
<return type= "int" enum= "BaseButton.DrawMode" >
</return>
<description >
2019-12-06 23:09:20 +01:00
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.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "is_hovered" qualifiers= "const" >
<return type= "bool" >
</return>
<description >
2019-05-24 04:15:43 +02:00
Returns [code]true[/code] if the mouse has entered the button and has not left it yet.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
<members >
2019-06-29 12:38:01 +02:00
<member name= "action_mode" type= "int" setter= "set_action_mode" getter= "get_action_mode" enum= "BaseButton.ActionMode" default= "1" >
2019-12-06 23:09:20 +01:00
Determines when the button is considered clicked, one of the [enum ActionMode] constants.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "button_mask" type= "int" setter= "set_button_mask" getter= "get_button_mask" default= "1" >
2018-03-11 18:19:18 +01:00
Binary mask to choose which mouse buttons this button will respond to.
2019-03-27 20:01:16 +01:00
To allow both left-click and right-click, use [code]BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT[/code].
2018-03-11 18:19:18 +01:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "disabled" type= "bool" setter= "set_disabled" getter= "is_disabled" default= "false" >
2018-12-20 13:46:54 +01:00
If [code]true[/code], the button is in disabled state and can't be clicked or toggled.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "enabled_focus_mode" type= "int" setter= "set_enabled_focus_mode" getter= "get_enabled_focus_mode" enum= "Control.FocusMode" default= "2" >
2019-01-07 11:46:26 +01:00
Focus access mode to use when switching between enabled/disabled (see [member Control.focus_mode] and [member disabled]).
2017-09-12 22:42:36 +02:00
</member>
2019-09-24 13:34:03 +02:00
<member name= "focus_mode" type= "int" setter= "set_focus_mode" getter= "get_focus_mode" override= "true" enum= "Control.FocusMode" default= "2" />
2019-07-15 20:42:47 +02:00
<member name= "group" type= "ButtonGroup" setter= "set_button_group" getter= "get_button_group" >
2017-10-23 00:17:02 +02:00
[ButtonGroup] associated to the button.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "keep_pressed_outside" type= "bool" setter= "set_keep_pressed_outside" getter= "is_keep_pressed_outside" default= "false" >
2019-06-29 15:24:23 +02:00
If [code]true[/code], the button stays pressed when moving the cursor outside the button while pressing it.
2020-04-13 21:56:47 +02:00
[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.
2019-05-15 12:51:58 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "pressed" type= "bool" setter= "set_pressed" getter= "is_pressed" default= "false" >
2019-12-06 23:09:20 +01:00
If [code]true[/code], the button's state is pressed. Means the button is pressed down or toggled (if [member toggle_mode] is active).
2017-09-12 22:42:36 +02:00
</member>
2019-07-15 20:42:47 +02:00
<member name= "shortcut" type= "ShortCut" setter= "set_shortcut" getter= "get_shortcut" >
2019-01-07 10:02:04 +01:00
[ShortCut] associated to the button.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "shortcut_in_tooltip" type= "bool" setter= "set_shortcut_in_tooltip" getter= "is_shortcut_in_tooltip_enabled" default= "true" >
2018-12-20 13:46:54 +01:00
If [code]true[/code], the button will add information about its shortcut in the tooltip.
2018-11-19 14:30:59 +01:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "toggle_mode" type= "bool" setter= "set_toggle_mode" getter= "is_toggle_mode" default= "false" >
2018-12-20 13:46:54 +01:00
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.
2018-11-23 01:06:24 +01:00
</member>
2017-09-12 22:42:36 +02:00
</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 >
2019-06-22 01:04:47 +02:00
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.
2020-07-17 00:01:24 +02:00
If you need to know the button's pressed state (and [member toggle_mode] is active), use [signal toggled] instead.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "toggled" >
2018-01-09 16:39:43 +01:00
<argument index= "0" name= "button_pressed" type= "bool" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
2019-06-22 01:04:47 +02:00
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.
2017-09-12 22:42:36 +02:00
</description>
</signal>
</signals>
<constants >
2017-11-24 23:16:30 +01:00
<constant name= "DRAW_NORMAL" value= "0" enum= "DrawMode" >
2017-09-12 22:42:36 +02:00
The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "DRAW_PRESSED" value= "1" enum= "DrawMode" >
2017-09-12 22:42:36 +02:00
The state of buttons are pressed.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "DRAW_HOVER" value= "2" enum= "DrawMode" >
2017-09-12 22:42:36 +02:00
The state of buttons are hovered.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "DRAW_DISABLED" value= "3" enum= "DrawMode" >
2017-09-12 22:42:36 +02:00
The state of buttons are disabled.
</constant>
2018-10-07 15:52:07 +02:00
<constant name= "DRAW_HOVER_PRESSED" value= "4" enum= "DrawMode" >
2020-01-13 23:08:42 +01:00
The state of buttons are both hovered and pressed.
2018-10-07 15:52:07 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "ACTION_MODE_BUTTON_PRESS" value= "0" enum= "ActionMode" >
2017-09-12 22:42:36 +02:00
Require just a press to consider the button clicked.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "ACTION_MODE_BUTTON_RELEASE" value= "1" enum= "ActionMode" >
2017-09-12 22:42:36 +02:00
Require a press and a subsequent release before considering the button clicked.
</constant>
</constants>
</class>