Merge pull request #34412 from flyingpimonster/docs-optionbutton

Docs: OptionButton
This commit is contained in:
Rémi Verschelde
2019-12-18 07:59:32 +01:00
committed by GitHub

View File

@ -19,7 +19,7 @@
<argument index="2" name="id" type="int" default="-1"> <argument index="2" name="id" type="int" default="-1">
</argument> </argument>
<description> <description>
Adds an item, with a [code]texture[/code] icon, text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, [code]id[/code] becomes the item index. New items are appended at the end. Adds an item, with a [code]texture[/code] icon, text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, the item index will be used as the item's ID. New items are appended at the end.
</description> </description>
</method> </method>
<method name="add_item"> <method name="add_item">
@ -30,7 +30,7 @@
<argument index="1" name="id" type="int" default="-1"> <argument index="1" name="id" type="int" default="-1">
</argument> </argument>
<description> <description>
Adds an item, with text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, [code]id[/code] becomes the item index. New items are appended at the end. Adds an item, with text [code]label[/code] and (optionally) [code]id[/code]. If no [code]id[/code] is passed, the item index will be used as the item's ID. New items are appended at the end.
</description> </description>
</method> </method>
<method name="add_separator"> <method name="add_separator">
@ -44,14 +44,14 @@
<return type="void"> <return type="void">
</return> </return>
<description> <description>
Clear all the items in the [OptionButton]. Clears all the items in the [OptionButton].
</description> </description>
</method> </method>
<method name="get_item_count" qualifiers="const"> <method name="get_item_count" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Returns the amount of items in the OptionButton. Returns the amount of items in the OptionButton, including separators.
</description> </description>
</method> </method>
<method name="get_item_icon" qualifiers="const"> <method name="get_item_icon" qualifiers="const">
@ -87,6 +87,7 @@
<argument index="0" name="idx" type="int"> <argument index="0" name="idx" type="int">
</argument> </argument>
<description> <description>
Retrieves the metadata of an item. Metadata may be any type and can be used to store extra information about an item, such as an external string ID.
</description> </description>
</method> </method>
<method name="get_item_text" qualifiers="const"> <method name="get_item_text" qualifiers="const">
@ -109,12 +110,14 @@
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Returns the ID of the selected item, or [code]0[/code] if no item is selected.
</description> </description>
</method> </method>
<method name="get_selected_metadata" qualifiers="const"> <method name="get_selected_metadata" qualifiers="const">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Gets the metadata of the selected item. Metadata for items can be set using [method set_item_metadata].
</description> </description>
</method> </method>
<method name="is_item_disabled" qualifiers="const"> <method name="is_item_disabled" qualifiers="const">
@ -123,6 +126,7 @@
<argument index="0" name="idx" type="int"> <argument index="0" name="idx" type="int">
</argument> </argument>
<description> <description>
Returns [code]true[/code] if the item at index [code]idx[/code] is disabled.
</description> </description>
</method> </method>
<method name="remove_item"> <method name="remove_item">
@ -131,6 +135,7 @@
<argument index="0" name="idx" type="int"> <argument index="0" name="idx" type="int">
</argument> </argument>
<description> <description>
Removes the item at index [code]idx[/code].
</description> </description>
</method> </method>
<method name="select"> <method name="select">
@ -139,7 +144,7 @@
<argument index="0" name="idx" type="int"> <argument index="0" name="idx" type="int">
</argument> </argument>
<description> <description>
Select an item by index and make it the current item. Selects an item by index and makes it the current item. This will work even if the item is disabled.
</description> </description>
</method> </method>
<method name="set_item_disabled"> <method name="set_item_disabled">
@ -150,6 +155,8 @@
<argument index="1" name="disabled" type="bool"> <argument index="1" name="disabled" type="bool">
</argument> </argument>
<description> <description>
Sets whether the item at index [code]idx[/code] is disabled.
Disabled items are drawn differently in the dropdown and are not selectable by the user. If the current selected item is set as disabled, it will remain selected.
</description> </description>
</method> </method>
<method name="set_item_icon"> <method name="set_item_icon">
@ -160,7 +167,7 @@
<argument index="1" name="texture" type="Texture"> <argument index="1" name="texture" type="Texture">
</argument> </argument>
<description> <description>
Sets the icon of an item at index [code]idx[/code]. Sets the icon of the item at index [code]idx[/code].
</description> </description>
</method> </method>
<method name="set_item_id"> <method name="set_item_id">
@ -171,7 +178,7 @@
<argument index="1" name="id" type="int"> <argument index="1" name="id" type="int">
</argument> </argument>
<description> <description>
Sets the ID of an item at index [code]idx[/code]. Sets the ID of the item at index [code]idx[/code].
</description> </description>
</method> </method>
<method name="set_item_metadata"> <method name="set_item_metadata">
@ -182,6 +189,7 @@
<argument index="1" name="metadata" type="Variant"> <argument index="1" name="metadata" type="Variant">
</argument> </argument>
<description> <description>
Sets the metadata of an item. Metadata may be of any type and can be used to store extra information about an item, such as an external string ID.
</description> </description>
</method> </method>
<method name="set_item_text"> <method name="set_item_text">
@ -192,7 +200,7 @@
<argument index="1" name="text" type="String"> <argument index="1" name="text" type="String">
</argument> </argument>
<description> <description>
Sets the text of an item at index [code]idx[/code]. Sets the text of the item at index [code]idx[/code].
</description> </description>
</method> </method>
</methods> </methods>
@ -200,6 +208,7 @@
<member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" override="true" enum="BaseButton.ActionMode" default="0" /> <member name="action_mode" type="int" setter="set_action_mode" getter="get_action_mode" override="true" enum="BaseButton.ActionMode" default="0" />
<member name="align" type="int" setter="set_text_align" getter="get_text_align" override="true" enum="Button.TextAlign" default="0" /> <member name="align" type="int" setter="set_text_align" getter="get_text_align" override="true" enum="Button.TextAlign" default="0" />
<member name="selected" type="int" setter="_select_int" getter="get_selected" default="-1"> <member name="selected" type="int" setter="_select_int" getter="get_selected" default="-1">
The index of the currently selected item, or [code]-1[/code] if no item is selected.
</member> </member>
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" override="true" default="true" /> <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" override="true" default="true" />
</members> </members>