classref: Sync with current 3.x branch (995c24415)

This commit is contained in:
Yuri Sizov
2023-04-13 18:01:11 +02:00
parent f15871e2b2
commit 99c2ec8fb3
709 changed files with 116000 additions and 57747 deletions

View File

@@ -14,6 +14,8 @@ OptionButton
Button control that provides selectable options when pressed.
.. rst-class:: classref-introduction-group
Description
-----------
@@ -21,467 +23,629 @@ OptionButton is a type button that provides a selectable list of items when pres
See also :ref:`BaseButton<class_BaseButton>` which contains common properties and methods associated with this node.
.. rst-class:: classref-reftable-group
Properties
----------
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`ActionMode<enum_BaseButton_ActionMode>` | action_mode | ``0`` (overrides :ref:`BaseButton<class_BaseButton_property_action_mode>`) |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`TextAlign<enum_Button_TextAlign>` | align | ``0`` (overrides :ref:`Button<class_Button_property_align>`) |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`selected<class_OptionButton_property_selected>` | ``-1`` |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | toggle_mode | ``true`` (overrides :ref:`BaseButton<class_BaseButton_property_toggle_mode>`) |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
.. table::
:widths: auto
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`ActionMode<enum_BaseButton_ActionMode>` | action_mode | ``0`` (overrides :ref:`BaseButton<class_BaseButton_property_action_mode>`) |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`TextAlign<enum_Button_TextAlign>` | align | ``0`` (overrides :ref:`Button<class_Button_property_align>`) |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`selected<class_OptionButton_property_selected>` | ``-1`` |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | toggle_mode | ``true`` (overrides :ref:`BaseButton<class_BaseButton_property_toggle_mode>`) |
+-----------------------------------------------+-------------------------------------------------------+-------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_icon_item<class_OptionButton_method_add_icon_item>` **(** :ref:`Texture<class_Texture>` texture, :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_item<class_OptionButton_method_add_item>` **(** :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_separator<class_OptionButton_method_add_separator>` **(** **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear<class_OptionButton_method_clear>` **(** **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_item_count<class_OptionButton_method_get_item_count>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`get_item_icon<class_OptionButton_method_get_item_icon>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_item_id<class_OptionButton_method_get_item_id>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_item_index<class_OptionButton_method_get_item_index>` **(** :ref:`int<class_int>` id **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_item_metadata<class_OptionButton_method_get_item_metadata>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_item_text<class_OptionButton_method_get_item_text>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_item_tooltip<class_OptionButton_method_get_item_tooltip>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_popup<class_OptionButton_method_get_popup>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_selected_id<class_OptionButton_method_get_selected_id>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_selected_metadata<class_OptionButton_method_get_selected_metadata>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_OptionButton_method_is_item_disabled>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`remove_item<class_OptionButton_method_remove_item>` **(** :ref:`int<class_int>` idx **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`select<class_OptionButton_method_select>` **(** :ref:`int<class_int>` idx **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_disabled<class_OptionButton_method_set_item_disabled>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_icon<class_OptionButton_method_set_item_icon>` **(** :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` texture **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_id<class_OptionButton_method_set_item_id>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` id **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_metadata<class_OptionButton_method_set_item_metadata>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` metadata **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_text<class_OptionButton_method_set_item_text>` **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` text **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_tooltip<class_OptionButton_method_set_item_tooltip>` **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` tooltip **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. table::
:widths: auto
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_icon_item<class_OptionButton_method_add_icon_item>` **(** :ref:`Texture<class_Texture>` texture, :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_item<class_OptionButton_method_add_item>` **(** :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_separator<class_OptionButton_method_add_separator>` **(** **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear<class_OptionButton_method_clear>` **(** **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_item_count<class_OptionButton_method_get_item_count>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`get_item_icon<class_OptionButton_method_get_item_icon>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_item_id<class_OptionButton_method_get_item_id>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_item_index<class_OptionButton_method_get_item_index>` **(** :ref:`int<class_int>` id **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_item_metadata<class_OptionButton_method_get_item_metadata>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_item_text<class_OptionButton_method_get_item_text>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_item_tooltip<class_OptionButton_method_get_item_tooltip>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_popup<class_OptionButton_method_get_popup>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_selected_id<class_OptionButton_method_get_selected_id>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_selected_metadata<class_OptionButton_method_get_selected_metadata>` **(** **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_OptionButton_method_is_item_disabled>` **(** :ref:`int<class_int>` idx **)** |const| |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`remove_item<class_OptionButton_method_remove_item>` **(** :ref:`int<class_int>` idx **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`select<class_OptionButton_method_select>` **(** :ref:`int<class_int>` idx **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_disabled<class_OptionButton_method_set_item_disabled>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_icon<class_OptionButton_method_set_item_icon>` **(** :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` texture **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_id<class_OptionButton_method_set_item_id>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` id **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_metadata<class_OptionButton_method_set_item_metadata>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` metadata **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_text<class_OptionButton_method_set_item_text>` **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` text **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_item_tooltip<class_OptionButton_method_set_item_tooltip>` **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` tooltip **)** |
+-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
Theme Properties
----------------
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color<class_OptionButton_theme_color_font_color>` | ``Color( 0.88, 0.88, 0.88, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_OptionButton_theme_color_font_color_disabled>` | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_focus<class_OptionButton_theme_color_font_color_focus>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_hover<class_OptionButton_theme_color_font_color_hover>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_pressed<class_OptionButton_theme_color_font_color_pressed>` | ``Color( 1, 1, 1, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`int<class_int>` | :ref:`arrow_margin<class_OptionButton_theme_constant_arrow_margin>` | ``2`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`int<class_int>` | :ref:`hseparation<class_OptionButton_theme_constant_hseparation>` | ``2`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Font<class_Font>` | :ref:`font<class_OptionButton_theme_font_font>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`arrow<class_OptionButton_theme_icon_arrow>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_OptionButton_theme_style_disabled>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_OptionButton_theme_style_focus>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_OptionButton_theme_style_hover>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_OptionButton_theme_style_normal>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_OptionButton_theme_style_pressed>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
.. table::
:widths: auto
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color<class_OptionButton_theme_color_font_color>` | ``Color( 0.88, 0.88, 0.88, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_OptionButton_theme_color_font_color_disabled>` | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_focus<class_OptionButton_theme_color_font_color_focus>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_hover<class_OptionButton_theme_color_font_color_hover>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Color<class_Color>` | :ref:`font_color_pressed<class_OptionButton_theme_color_font_color_pressed>` | ``Color( 1, 1, 1, 1 )`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`int<class_int>` | :ref:`arrow_margin<class_OptionButton_theme_constant_arrow_margin>` | ``2`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`int<class_int>` | :ref:`hseparation<class_OptionButton_theme_constant_hseparation>` | ``2`` |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Font<class_Font>` | :ref:`font<class_OptionButton_theme_font_font>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`Texture<class_Texture>` | :ref:`arrow<class_OptionButton_theme_icon_arrow>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_OptionButton_theme_style_disabled>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_OptionButton_theme_style_focus>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_OptionButton_theme_style_hover>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_OptionButton_theme_style_normal>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_OptionButton_theme_style_pressed>` | |
+---------------------------------+--------------------------------------------------------------------------------+----------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_OptionButton_signal_item_focused:
- **item_focused** **(** :ref:`int<class_int>` index **)**
.. rst-class:: classref-signal
**item_focused** **(** :ref:`int<class_int>` index **)**
Emitted when the user navigates to an item using the ``ui_up`` or ``ui_down`` actions. The index of the item selected is passed as argument.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_signal_item_selected:
- **item_selected** **(** :ref:`int<class_int>` index **)**
.. rst-class:: classref-signal
**item_selected** **(** :ref:`int<class_int>` index **)**
Emitted when the current item has been changed by the user. The index of the item selected is passed as argument.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_OptionButton_property_selected:
- :ref:`int<class_int>` **selected**
.. rst-class:: classref-property
+-----------+----------------+
| *Default* | ``-1`` |
+-----------+----------------+
| *Getter* | get_selected() |
+-----------+----------------+
:ref:`int<class_int>` **selected** = ``-1``
.. rst-class:: classref-property-setget
- :ref:`int<class_int>` **get_selected** **(** **)**
The index of the currently selected item, or ``-1`` if no item is selected.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_OptionButton_method_add_icon_item:
- void **add_icon_item** **(** :ref:`Texture<class_Texture>` texture, :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)**
.. rst-class:: classref-method
void **add_icon_item** **(** :ref:`Texture<class_Texture>` texture, :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)**
Adds an item, with a ``texture`` icon, text ``label`` and (optionally) ``id``. If no ``id`` is passed, the item index will be used as the item's ID. New items are appended at the end.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_add_item:
- void **add_item** **(** :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)**
.. rst-class:: classref-method
void **add_item** **(** :ref:`String<class_String>` label, :ref:`int<class_int>` id=-1 **)**
Adds an item, with text ``label`` and (optionally) ``id``. If no ``id`` is passed, the item index will be used as the item's ID. New items are appended at the end.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_add_separator:
- void **add_separator** **(** **)**
.. rst-class:: classref-method
void **add_separator** **(** **)**
Adds a separator to the list of items. Separators help to group items. Separator also takes up an index and is appended at the end.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_clear:
- void **clear** **(** **)**
.. rst-class:: classref-method
Clears all the items in the ``OptionButton``.
void **clear** **(** **)**
Clears all the items in the **OptionButton**.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_count:
- :ref:`int<class_int>` **get_item_count** **(** **)** |const|
.. rst-class:: classref-method
:ref:`int<class_int>` **get_item_count** **(** **)** |const|
Returns the amount of items in the OptionButton, including separators.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_icon:
- :ref:`Texture<class_Texture>` **get_item_icon** **(** :ref:`int<class_int>` idx **)** |const|
.. rst-class:: classref-method
:ref:`Texture<class_Texture>` **get_item_icon** **(** :ref:`int<class_int>` idx **)** |const|
Returns the icon of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_id:
- :ref:`int<class_int>` **get_item_id** **(** :ref:`int<class_int>` idx **)** |const|
.. rst-class:: classref-method
:ref:`int<class_int>` **get_item_id** **(** :ref:`int<class_int>` idx **)** |const|
Returns the ID of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_index:
- :ref:`int<class_int>` **get_item_index** **(** :ref:`int<class_int>` id **)** |const|
.. rst-class:: classref-method
:ref:`int<class_int>` **get_item_index** **(** :ref:`int<class_int>` id **)** |const|
Returns the index of the item with the given ``id``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_metadata:
- :ref:`Variant<class_Variant>` **get_item_metadata** **(** :ref:`int<class_int>` idx **)** |const|
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **get_item_metadata** **(** :ref:`int<class_int>` idx **)** |const|
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.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_text:
- :ref:`String<class_String>` **get_item_text** **(** :ref:`int<class_int>` idx **)** |const|
.. rst-class:: classref-method
:ref:`String<class_String>` **get_item_text** **(** :ref:`int<class_int>` idx **)** |const|
Returns the text of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_item_tooltip:
- :ref:`String<class_String>` **get_item_tooltip** **(** :ref:`int<class_int>` idx **)** |const|
.. rst-class:: classref-method
:ref:`String<class_String>` **get_item_tooltip** **(** :ref:`int<class_int>` idx **)** |const|
Returns the tooltip of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_popup:
- :ref:`PopupMenu<class_PopupMenu>` **get_popup** **(** **)** |const|
.. rst-class:: classref-method
:ref:`PopupMenu<class_PopupMenu>` **get_popup** **(** **)** |const|
Returns the :ref:`PopupMenu<class_PopupMenu>` contained in this button.
\ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_selected_id:
- :ref:`int<class_int>` **get_selected_id** **(** **)** |const|
.. rst-class:: classref-method
:ref:`int<class_int>` **get_selected_id** **(** **)** |const|
Returns the ID of the selected item, or ``-1`` if no item is selected.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_get_selected_metadata:
- :ref:`Variant<class_Variant>` **get_selected_metadata** **(** **)** |const|
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **get_selected_metadata** **(** **)** |const|
Gets the metadata of the selected item. Metadata for items can be set using :ref:`set_item_metadata<class_OptionButton_method_set_item_metadata>`.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_is_item_disabled:
- :ref:`bool<class_bool>` **is_item_disabled** **(** :ref:`int<class_int>` idx **)** |const|
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_item_disabled** **(** :ref:`int<class_int>` idx **)** |const|
Returns ``true`` if the item at index ``idx`` is disabled.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_remove_item:
- void **remove_item** **(** :ref:`int<class_int>` idx **)**
.. rst-class:: classref-method
void **remove_item** **(** :ref:`int<class_int>` idx **)**
Removes the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_select:
- void **select** **(** :ref:`int<class_int>` idx **)**
.. rst-class:: classref-method
void **select** **(** :ref:`int<class_int>` idx **)**
Selects an item by index and makes it the current item. This will work even if the item is disabled.
Passing ``-1`` as the index deselects any currently selected item.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_set_item_disabled:
- void **set_item_disabled** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)**
.. rst-class:: classref-method
void **set_item_disabled** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)**
Sets whether the item at index ``idx`` 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.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_set_item_icon:
- void **set_item_icon** **(** :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` texture **)**
.. rst-class:: classref-method
void **set_item_icon** **(** :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` texture **)**
Sets the icon of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_set_item_id:
- void **set_item_id** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` id **)**
.. rst-class:: classref-method
void **set_item_id** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` id **)**
Sets the ID of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_set_item_metadata:
- void **set_item_metadata** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` metadata **)**
.. rst-class:: classref-method
void **set_item_metadata** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_Variant>` metadata **)**
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.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_set_item_text:
- void **set_item_text** **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` text **)**
.. rst-class:: classref-method
void **set_item_text** **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` text **)**
Sets the text of the item at index ``idx``.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_method_set_item_tooltip:
- void **set_item_tooltip** **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` tooltip **)**
.. rst-class:: classref-method
void **set_item_tooltip** **(** :ref:`int<class_int>` idx, :ref:`String<class_String>` tooltip **)**
Sets the tooltip of the item at index ``idx``.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Theme Property Descriptions
---------------------------
.. _class_OptionButton_theme_color_font_color:
- :ref:`Color<class_Color>` **font_color**
.. rst-class:: classref-themeproperty
+-----------+----------------------------------+
| *Default* | ``Color( 0.88, 0.88, 0.88, 1 )`` |
+-----------+----------------------------------+
:ref:`Color<class_Color>` **font_color** = ``Color( 0.88, 0.88, 0.88, 1 )``
Default text :ref:`Color<class_Color>` of the ``OptionButton``.
Default text :ref:`Color<class_Color>` of the **OptionButton**.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_color_font_color_disabled:
- :ref:`Color<class_Color>` **font_color_disabled**
.. rst-class:: classref-themeproperty
+-----------+---------------------------------+
| *Default* | ``Color( 0.9, 0.9, 0.9, 0.2 )`` |
+-----------+---------------------------------+
:ref:`Color<class_Color>` **font_color_disabled** = ``Color( 0.9, 0.9, 0.9, 0.2 )``
Text :ref:`Color<class_Color>` used when the ``OptionButton`` is disabled.
Text :ref:`Color<class_Color>` used when the **OptionButton** is disabled.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_color_font_color_focus:
- :ref:`Color<class_Color>` **font_color_focus**
.. rst-class:: classref-themeproperty
+-----------+----------------------------------+
| *Default* | ``Color( 0.94, 0.94, 0.94, 1 )`` |
+-----------+----------------------------------+
:ref:`Color<class_Color>` **font_color_focus** = ``Color( 0.94, 0.94, 0.94, 1 )``
Text :ref:`Color<class_Color>` used when the ``OptionButton`` is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
Text :ref:`Color<class_Color>` used when the **OptionButton** is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_color_font_color_hover:
- :ref:`Color<class_Color>` **font_color_hover**
.. rst-class:: classref-themeproperty
+-----------+----------------------------------+
| *Default* | ``Color( 0.94, 0.94, 0.94, 1 )`` |
+-----------+----------------------------------+
:ref:`Color<class_Color>` **font_color_hover** = ``Color( 0.94, 0.94, 0.94, 1 )``
Text :ref:`Color<class_Color>` used when the ``OptionButton`` is being hovered.
Text :ref:`Color<class_Color>` used when the **OptionButton** is being hovered.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_color_font_color_pressed:
- :ref:`Color<class_Color>` **font_color_pressed**
.. rst-class:: classref-themeproperty
+-----------+-------------------------+
| *Default* | ``Color( 1, 1, 1, 1 )`` |
+-----------+-------------------------+
:ref:`Color<class_Color>` **font_color_pressed** = ``Color( 1, 1, 1, 1 )``
Text :ref:`Color<class_Color>` used when the ``OptionButton`` is being pressed.
Text :ref:`Color<class_Color>` used when the **OptionButton** is being pressed.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_constant_arrow_margin:
- :ref:`int<class_int>` **arrow_margin**
.. rst-class:: classref-themeproperty
+-----------+-------+
| *Default* | ``2`` |
+-----------+-------+
:ref:`int<class_int>` **arrow_margin** = ``2``
The horizontal space between the arrow icon and the right edge of the button.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_constant_hseparation:
- :ref:`int<class_int>` **hseparation**
.. rst-class:: classref-themeproperty
+-----------+-------+
| *Default* | ``2`` |
+-----------+-------+
:ref:`int<class_int>` **hseparation** = ``2``
The horizontal space between ``OptionButton``'s icon and text.
The horizontal space between **OptionButton**'s icon and text.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_font_font:
- :ref:`Font<class_Font>` **font**
.. rst-class:: classref-themeproperty
:ref:`Font<class_Font>` of the ``OptionButton``'s text.
:ref:`Font<class_Font>` **font**
:ref:`Font<class_Font>` of the **OptionButton**'s text.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_icon_arrow:
- :ref:`Texture<class_Texture>` **arrow**
.. rst-class:: classref-themeproperty
:ref:`Texture<class_Texture>` **arrow**
The arrow icon to be drawn on the right end of the button.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_style_disabled:
- :ref:`StyleBox<class_StyleBox>` **disabled**
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` used when the ``OptionButton`` is disabled.
:ref:`StyleBox<class_StyleBox>` **disabled**
:ref:`StyleBox<class_StyleBox>` used when the **OptionButton** is disabled.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_style_focus:
- :ref:`StyleBox<class_StyleBox>` **focus**
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` used when the ``OptionButton`` is focused. It is displayed over the current :ref:`StyleBox<class_StyleBox>`, so using :ref:`StyleBoxEmpty<class_StyleBoxEmpty>` will just disable the focus visual effect.
:ref:`StyleBox<class_StyleBox>` **focus**
:ref:`StyleBox<class_StyleBox>` used when the **OptionButton** is focused. It is displayed over the current :ref:`StyleBox<class_StyleBox>`, so using :ref:`StyleBoxEmpty<class_StyleBoxEmpty>` will just disable the focus visual effect.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_style_hover:
- :ref:`StyleBox<class_StyleBox>` **hover**
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` used when the ``OptionButton`` is being hovered.
:ref:`StyleBox<class_StyleBox>` **hover**
:ref:`StyleBox<class_StyleBox>` used when the **OptionButton** is being hovered.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_style_normal:
- :ref:`StyleBox<class_StyleBox>` **normal**
.. rst-class:: classref-themeproperty
Default :ref:`StyleBox<class_StyleBox>` for the ``OptionButton``.
:ref:`StyleBox<class_StyleBox>` **normal**
Default :ref:`StyleBox<class_StyleBox>` for the **OptionButton**.
.. rst-class:: classref-item-separator
----
.. _class_OptionButton_theme_style_pressed:
- :ref:`StyleBox<class_StyleBox>` **pressed**
.. rst-class:: classref-themeproperty
:ref:`StyleBox<class_StyleBox>` used when the ``OptionButton`` is being pressed.
:ref:`StyleBox<class_StyleBox>` **pressed**
:ref:`StyleBox<class_StyleBox>` used when the **OptionButton** is being pressed.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`