mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
1181 lines
81 KiB
ReStructuredText
1181 lines
81 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_Theme:
|
|
|
|
Theme
|
|
=====
|
|
|
|
**继承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
用于为 :ref:`Control<class_Control>` 和 :ref:`Window<class_Window>` 应用风格/外观的资源。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
描述
|
|
----
|
|
|
|
用于为 :ref:`Control<class_Control>` 和 :ref:`Window<class_Window>` 节点应用风格/外观的资源。控件可以使用本地的主题覆盖项进行单独的风格化(见 :ref:`Control.add_theme_color_override()<class_Control_method_add_theme_color_override>`\ ),而主题资源则能够存储这些设置,在所有同类型的控件之间实现共享(例如将所有 :ref:`Button<class_Button>` 都设置为相同的风格)。主题资源可以在整个项目上使用,但你也可以为单独的一个控件节点分支设置不同的主题资源。为某个控件节点分配的主题资源不仅会对它自己生效,也会对它的所有直接和间接子节点生效(只要控件链没有中断)。
|
|
|
|
项目范围的主题请使用 :ref:`ProjectSettings.gui/theme/custom<class_ProjectSettings_property_gui/theme/custom>` 设置,这样项目中的所有控件就都能够使用。
|
|
|
|
控件节点的主题请使用 :ref:`Control.theme<class_Control_property_theme>` 设置,这样该控件和它的所有直接和间接子节点就都能够使用。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
教程
|
|
----
|
|
|
|
- :doc:`GUI 外观 <../tutorials/ui/gui_skinning>`
|
|
|
|
- :doc:`使用主题编辑器 <../tutorials/ui/gui_using_theme_editor>`
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
属性
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------+--------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`default_base_scale<class_Theme_property_default_base_scale>` | ``0.0`` |
|
|
+---------------------------+--------------------------------------------------------------------+---------+
|
|
| :ref:`Font<class_Font>` | :ref:`default_font<class_Theme_property_default_font>` | |
|
|
+---------------------------+--------------------------------------------------------------------+---------+
|
|
| :ref:`int<class_int>` | :ref:`default_font_size<class_Theme_property_default_font_size>` | ``-1`` |
|
|
+---------------------------+--------------------------------------------------------------------+---------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
方法
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_type<class_Theme_method_add_type>`\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear<class_Theme_method_clear>`\ (\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_color<class_Theme_method_clear_color>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_constant<class_Theme_method_clear_constant>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_font<class_Theme_method_clear_font>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_font_size<class_Theme_method_clear_font_size>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_icon<class_Theme_method_clear_icon>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_stylebox<class_Theme_method_clear_stylebox>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_theme_item<class_Theme_method_clear_theme_item>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`clear_type_variation<class_Theme_method_clear_type_variation>`\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Color<class_Color>` | :ref:`get_color<class_Theme_method_get_color>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_color_list<class_Theme_method_get_color_list>`\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_color_type_list<class_Theme_method_get_color_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_constant<class_Theme_method_get_constant>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_constant_list<class_Theme_method_get_constant_list>`\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_constant_type_list<class_Theme_method_get_constant_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Font<class_Font>` | :ref:`get_font<class_Theme_method_get_font>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_font_list<class_Theme_method_get_font_list>`\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_font_size<class_Theme_method_get_font_size>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_font_size_list<class_Theme_method_get_font_size_list>`\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_font_size_type_list<class_Theme_method_get_font_size_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_font_type_list<class_Theme_method_get_font_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`get_icon<class_Theme_method_get_icon>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_icon_list<class_Theme_method_get_icon_list>`\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_icon_type_list<class_Theme_method_get_icon_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`StyleBox<class_StyleBox>` | :ref:`get_stylebox<class_Theme_method_get_stylebox>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_stylebox_list<class_Theme_method_get_stylebox_list>`\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_stylebox_type_list<class_Theme_method_get_stylebox_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Variant<class_Variant>` | :ref:`get_theme_item<class_Theme_method_get_theme_item>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_theme_item_list<class_Theme_method_get_theme_item_list>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, theme_type\: :ref:`String<class_String>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_theme_item_type_list<class_Theme_method_get_theme_item_type_list>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_type_list<class_Theme_method_get_type_list>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`StringName<class_StringName>` | :ref:`get_type_variation_base<class_Theme_method_get_type_variation_base>`\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_type_variation_list<class_Theme_method_get_type_variation_list>`\ (\ base_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_color<class_Theme_method_has_color>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_constant<class_Theme_method_has_constant>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_default_base_scale<class_Theme_method_has_default_base_scale>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_default_font<class_Theme_method_has_default_font>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_default_font_size<class_Theme_method_has_default_font_size>`\ (\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_font<class_Theme_method_has_font>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_font_size<class_Theme_method_has_font_size>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_icon<class_Theme_method_has_icon>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_stylebox<class_Theme_method_has_stylebox>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`has_theme_item<class_Theme_method_has_theme_item>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_type_variation<class_Theme_method_is_type_variation>`\ (\ theme_type\: :ref:`StringName<class_StringName>`, base_type\: :ref:`StringName<class_StringName>`\ ) |const| |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`merge_with<class_Theme_method_merge_with>`\ (\ other\: :ref:`Theme<class_Theme>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`remove_type<class_Theme_method_remove_type>`\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_color<class_Theme_method_rename_color>`\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_constant<class_Theme_method_rename_constant>`\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_font<class_Theme_method_rename_font>`\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_font_size<class_Theme_method_rename_font_size>`\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_icon<class_Theme_method_rename_icon>`\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_stylebox<class_Theme_method_rename_stylebox>`\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_theme_item<class_Theme_method_rename_theme_item>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`rename_type<class_Theme_method_rename_type>`\ (\ old_theme_type\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_color<class_Theme_method_set_color>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, color\: :ref:`Color<class_Color>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_constant<class_Theme_method_set_constant>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, constant\: :ref:`int<class_int>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_font<class_Theme_method_set_font>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, font\: :ref:`Font<class_Font>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_font_size<class_Theme_method_set_font_size>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, font_size\: :ref:`int<class_int>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_icon<class_Theme_method_set_icon>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, texture\: :ref:`Texture2D<class_Texture2D>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_stylebox<class_Theme_method_set_stylebox>`\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, texture\: :ref:`StyleBox<class_StyleBox>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_theme_item<class_Theme_method_set_theme_item>`\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_type_variation<class_Theme_method_set_type_variation>`\ (\ theme_type\: :ref:`StringName<class_StringName>`, base_type\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
枚举
|
|
----
|
|
|
|
.. _enum_Theme_DataType:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **DataType**: :ref:`🔗<enum_Theme_DataType>`
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_COLOR:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_COLOR** = ``0``
|
|
|
|
主题的 :ref:`Color<class_Color>` 颜色项类型。
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_CONSTANT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_CONSTANT** = ``1``
|
|
|
|
主题的常量项类型。
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_FONT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_FONT** = ``2``
|
|
|
|
主题的 :ref:`Font<class_Font>` 字体项类型。
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_FONT_SIZE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_FONT_SIZE** = ``3``
|
|
|
|
主题的字体大小项类型。
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_ICON:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_ICON** = ``4``
|
|
|
|
主题的图标 :ref:`Texture2D<class_Texture2D>` 项类型。
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_STYLEBOX:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_STYLEBOX** = ``5``
|
|
|
|
主题的 :ref:`StyleBox<class_StyleBox>` 项目类型。
|
|
|
|
.. _class_Theme_constant_DATA_TYPE_MAX:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DataType<enum_Theme_DataType>` **DATA_TYPE_MAX** = ``6``
|
|
|
|
数据类型枚举的最大值。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
属性说明
|
|
--------
|
|
|
|
.. _class_Theme_property_default_base_scale:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **default_base_scale** = ``0.0`` :ref:`🔗<class_Theme_property_default_base_scale>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_default_base_scale**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_default_base_scale**\ (\ )
|
|
|
|
该主题资源的默认基础缩放系数。部分控件会用它来根据全局缩放系数对其视觉属性进行缩放。如果该值为 ``0.0``\ ,则使用全局缩放系数(见 :ref:`ThemeDB.fallback_base_scale<class_ThemeDB_property_fallback_base_scale>`\ )。
|
|
|
|
请使用 :ref:`has_default_base_scale()<class_Theme_method_has_default_base_scale>` 来检查该值是否有效。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_property_default_font:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Font<class_Font>` **default_font** :ref:`🔗<class_Theme_property_default_font>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_default_font**\ (\ value\: :ref:`Font<class_Font>`\ )
|
|
- :ref:`Font<class_Font>` **get_default_font**\ (\ )
|
|
|
|
该主题资源的默认字体。尝试获取字体资源时,如果该主题中不存在或者为无效状态,则会用它作为默认值。如果默认字体也缺失或无效,则会使用引擎的回退值(见 :ref:`ThemeDB.fallback_font<class_ThemeDB_property_fallback_font>`\ )。
|
|
|
|
请使用 :ref:`has_default_font()<class_Theme_method_has_default_font>` 来检查该值是否有效。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_property_default_font_size:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **default_font_size** = ``-1`` :ref:`🔗<class_Theme_property_default_font_size>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_default_font_size**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_default_font_size**\ (\ )
|
|
|
|
该主题资源的默认字体大小。尝试获取字体大小时,如果该主题中不存在或者为无效状态,则会用它作为默认值。如果默认字体大小也缺失或无效,则会使用引擎的回退值(见 :ref:`ThemeDB.fallback_font_size<class_ThemeDB_property_fallback_font_size>`\ )。
|
|
|
|
小于 ``1`` 的值无效,可用于清除对该属性的设置。请使用 :ref:`has_default_font_size()<class_Theme_method_has_default_font_size>` 来检查该值是否有效。
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
方法说明
|
|
--------
|
|
|
|
.. _class_Theme_method_add_type:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **add_type**\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_add_type>`
|
|
|
|
为每一个有效的数据类型都添加一个空主题类型。
|
|
|
|
\ **注意:**\ 空类型不会随该主题保存。这个方法的存在是为了对资源执行内存中的更改。请使用 ``set_*`` 方法添加主题项目。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear**\ (\ ) :ref:`🔗<class_Theme_method_clear>`
|
|
|
|
移除在该主题资源上定义的所有主题属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_color:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_color**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_color>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 :ref:`Color<class_Color>` 属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_color()<class_Theme_method_has_color>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_constant:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_constant**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_constant>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的常量属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_constant()<class_Theme_method_has_constant>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_font:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_font**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_font>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 :ref:`Font<class_Font>` 属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_font()<class_Theme_method_has_font>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_font_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_font_size**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_font_size>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的字体大小属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_font_size()<class_Theme_method_has_font_size>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_icon:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_icon**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_icon>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的图标属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_icon()<class_Theme_method_has_icon>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_stylebox:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_stylebox**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_stylebox>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 :ref:`StyleBox<class_StyleBox>` 属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_stylebox()<class_Theme_method_has_stylebox>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_theme_item:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_theme_item**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_theme_item>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 ``data_type`` 属性,则将其移除。
|
|
|
|
如果不存在则失败。请使用 :ref:`has_theme_item()<class_Theme_method_has_theme_item>` 检查是否存在。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_clear_type_variation:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_type_variation**\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_clear_type_variation>`
|
|
|
|
取消将主题类型 ``theme_type`` 标记为任何主题类型的变种。见 :ref:`set_type_variation()<class_Theme_method_set_type_variation>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_color:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Color<class_Color>` **get_color**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_color>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 :ref:`Color<class_Color>` 属性,则将其返回。
|
|
|
|
如果不存在则返回默认颜色。请使用 :ref:`has_color()<class_Theme_method_has_color>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_color_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_color_list**\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_color_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的 :ref:`Color<class_Color>` 属性的名称列表。请使用 :ref:`get_color_type_list()<class_Theme_method_get_color_type_list>` 获取可能的主题类型名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_color_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_color_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_color_type_list>`
|
|
|
|
返回 :ref:`Color<class_Color>` 属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_constant:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_constant**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_constant>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的常量属性,则将其返回。
|
|
|
|
如果不存在则返回 ``0``\ 。请使用 :ref:`has_constant()<class_Theme_method_has_constant>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_constant_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_constant_list**\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_constant_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的常量属性的名称列表。请使用 :ref:`get_constant_type_list()<class_Theme_method_get_constant_type_list>` 获取可能的主题类型名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_constant_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_constant_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_constant_type_list>`
|
|
|
|
返回常量属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_font:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Font<class_Font>` **get_font**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_font>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 :ref:`Font<class_Font>` 属性,则将其返回。
|
|
|
|
如果不存在且存在默认主题字体,则返回默认主题字体(见 :ref:`default_font<class_Theme_property_default_font>`\ )。请使用 :ref:`has_font()<class_Theme_method_has_font>` 检查是否存在,使用 :ref:`has_default_font()<class_Theme_method_has_default_font>` 检查默认主题字体是否存在。
|
|
|
|
如果两者都不存在,则返回引擎的回退字体值(见 :ref:`ThemeDB.fallback_font<class_ThemeDB_property_fallback_font>`\ )。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_font_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_font_list**\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_font_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的 :ref:`Font<class_Font>` 属性的名称列表。请使用 :ref:`get_font_type_list()<class_Theme_method_get_font_type_list>` 获取可能的主题类型名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_font_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **get_font_size**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_font_size>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的字体大小属性,则将其返回。
|
|
|
|
如果不存在且存在默认主题字体大小,则返回默认主题字体大小(见 :ref:`default_font_size<class_Theme_property_default_font_size>`\ )。请使用 :ref:`has_font_size()<class_Theme_method_has_font_size>` 检查是否存在,使用 :ref:`has_default_font_size()<class_Theme_method_has_default_font_size>` 检查默认主题字体大小是否存在。
|
|
|
|
如果两者都不存在,则返回引擎的回退字体大小值(见 :ref:`ThemeDB.fallback_font_size<class_ThemeDB_property_fallback_font_size>`\ )。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_font_size_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_font_size_list**\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_font_size_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的字体大小属性的名称列表。请使用 :ref:`get_font_size_type_list()<class_Theme_method_get_font_size_type_list>` 获取可能的主题类型名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_font_size_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_font_size_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_font_size_type_list>`
|
|
|
|
返回字体大小属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_font_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_font_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_font_type_list>`
|
|
|
|
返回 :ref:`Font<class_Font>` 属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_icon:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **get_icon**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_icon>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的图标属性,则将其返回。
|
|
|
|
如果不存在则返回引擎的回退图标值(见 :ref:`ThemeDB.fallback_icon<class_ThemeDB_property_fallback_icon>`\ )。请使用 :ref:`has_icon()<class_Theme_method_has_icon>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_icon_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_icon_list**\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_icon_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的图标属性的名称列表。请使用 :ref:`get_icon_type_list()<class_Theme_method_get_icon_type_list>` 获取可能的主题类型名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_icon_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_icon_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_icon_type_list>`
|
|
|
|
返回图标属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_stylebox:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`StyleBox<class_StyleBox>` **get_stylebox**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_stylebox>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 :ref:`StyleBox<class_StyleBox>` 属性,则将其返回。
|
|
|
|
如果不存在则返回引擎的回退样式盒值(见 :ref:`ThemeDB.fallback_stylebox<class_ThemeDB_property_fallback_stylebox>`\ )。请使用 :ref:`has_stylebox()<class_Theme_method_has_stylebox>` 检查是否存在。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_stylebox_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_stylebox_list**\ (\ theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_stylebox_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的 :ref:`StyleBox<class_StyleBox>` 属性的名称列表。请使用 :ref:`get_stylebox_type_list()<class_Theme_method_get_stylebox_type_list>` 获取可能的主题类型名称。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_stylebox_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_stylebox_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_stylebox_type_list>`
|
|
|
|
返回 :ref:`StyleBox<class_StyleBox>` 属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_theme_item:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Variant<class_Variant>` **get_theme_item**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_theme_item>`
|
|
|
|
如果存在由 ``name`` 和 ``theme_type`` 定义的 ``data_type`` 属性,则将其返回。
|
|
|
|
如果不存在则返回引擎的回退值(见 :ref:`ThemeDB<class_ThemeDB>`\ )。请使用 :ref:`has_theme_item()<class_Theme_method_has_theme_item>` 检查是否存在。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_theme_item_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_theme_item_list**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, theme_type\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_Theme_method_get_theme_item_list>`
|
|
|
|
返回为 ``theme_type`` 类型定义的 ``data_type`` 属性的名称列表。请使用 :ref:`get_theme_item_type_list()<class_Theme_method_get_theme_item_type_list>` 获取可能的主题类型名称。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_theme_item_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_theme_item_type_list**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`\ ) |const| :ref:`🔗<class_Theme_method_get_theme_item_type_list>`
|
|
|
|
返回 ``data_type`` 属性的所有唯一主题类型名称的列表。请使用 :ref:`get_type_list()<class_Theme_method_get_type_list>` 获取所有主题类型。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_type_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_type_list**\ (\ ) |const| :ref:`🔗<class_Theme_method_get_type_list>`
|
|
|
|
返回所有唯一主题类型名称的列表。获取单一数据类型的唯一主题类型列表请使用对应的 ``get_*_type_list`` 方法。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_type_variation_base:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`StringName<class_StringName>` **get_type_variation_base**\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_type_variation_base>`
|
|
|
|
如果 ``theme_type`` 是有效的变种类型,则返回其基础主题类型的名称。否则返回空字符串。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_get_type_variation_list:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`PackedStringArray<class_PackedStringArray>` **get_type_variation_list**\ (\ base_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_get_type_variation_list>`
|
|
|
|
返回给定基础类型 ``base_type`` 的所有类型变种列表。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_color:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_color**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_color>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的 :ref:`Color<class_Color>` 属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_color()<class_Theme_method_set_color>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_constant:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_constant**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_constant>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的常量属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_constant()<class_Theme_method_set_constant>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_default_base_scale:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_default_base_scale**\ (\ ) |const| :ref:`🔗<class_Theme_method_has_default_base_scale>`
|
|
|
|
如果 :ref:`default_base_scale<class_Theme_property_default_base_scale>` 的值有效,则返回 ``true``\ 。
|
|
|
|
如果无效则返回 ``false``\ 。有效值必须大于 ``0.0``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_default_font:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_default_font**\ (\ ) |const| :ref:`🔗<class_Theme_method_has_default_font>`
|
|
|
|
如果 :ref:`default_font<class_Theme_property_default_font>` 的值有效,则返回 ``true``\ 。
|
|
|
|
如果无效则返回 ``false``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_default_font_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_default_font_size**\ (\ ) |const| :ref:`🔗<class_Theme_method_has_default_font_size>`
|
|
|
|
如果 :ref:`default_font_size<class_Theme_property_default_font_size>` 的值有效,则返回 ``true``\ 。
|
|
|
|
如果无效则返回 ``false``\ 。有效值必须大于 ``0``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_font:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_font**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_font>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的 :ref:`Font<class_Font>` 属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_font()<class_Theme_method_set_font>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_font_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_font_size**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_font_size>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的字体大小属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_font_size()<class_Theme_method_set_font_size>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_icon:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_icon**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_icon>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的图标属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_icon()<class_Theme_method_set_icon>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_stylebox:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_stylebox**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_stylebox>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的 :ref:`StyleBox<class_StyleBox>` 属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_stylebox()<class_Theme_method_set_stylebox>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_has_theme_item:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **has_theme_item**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_has_theme_item>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``name`` 的主题属性,则返回 ``true``\ 。
|
|
|
|
不存在时返回 ``false``\ 。定义请使用 :ref:`set_theme_item()<class_Theme_method_set_theme_item>`\ 。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_is_type_variation:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`bool<class_bool>` **is_type_variation**\ (\ theme_type\: :ref:`StringName<class_StringName>`, base_type\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_Theme_method_is_type_variation>`
|
|
|
|
如果主题类型 ``theme_type`` 被标记为基础类型 ``base_type`` 的变种,则返回 ``true``\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_merge_with:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **merge_with**\ (\ other\: :ref:`Theme<class_Theme>`\ ) :ref:`🔗<class_Theme_method_merge_with>`
|
|
|
|
添加缺失的定义,并使用 ``other`` 主题资源中的值覆盖已有的定义。
|
|
|
|
\ **注意:**\ 这修改了当前的主题。如果想将两个主题合并在一起且不修改任何一个,请创建一个新的空主题,并将其他两个依次合并到其中。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_remove_type:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **remove_type**\ (\ theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_remove_type>`
|
|
|
|
移除该主题类型,优雅地丢弃其中定义的主题项目。如果该类型为变种,则该信息也会被消除。如果该类型为类型变种的基础类型,则那些变种会失去其基础类型。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_color:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_color**\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_color>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的 :ref:`Color<class_Color>` 属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_color()<class_Theme_method_has_color>` 检查是否存在,使用 :ref:`clear_color()<class_Theme_method_clear_color>` 移除现有属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_constant:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_constant**\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_constant>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的常量属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_constant()<class_Theme_method_has_constant>` 检查是否存在,使用 :ref:`clear_constant()<class_Theme_method_clear_constant>` 移除现有属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_font:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_font**\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_font>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的 :ref:`Font<class_Font>` 属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_font()<class_Theme_method_has_font>` 检查是否存在,使用 :ref:`clear_font()<class_Theme_method_clear_font>` 移除现有属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_font_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_font_size**\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_font_size>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的字体大小属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_font_size()<class_Theme_method_has_font_size>` 检查是否存在,使用 :ref:`clear_font_size()<class_Theme_method_clear_font_size>` 移除现有属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_icon:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_icon**\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_icon>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的图标属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_icon()<class_Theme_method_has_icon>` 检查是否存在,使用 :ref:`clear_icon()<class_Theme_method_clear_icon>` 移除现有属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_stylebox:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_stylebox**\ (\ old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_stylebox>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的 :ref:`StyleBox<class_StyleBox>` 属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_stylebox()<class_Theme_method_has_stylebox>` 检查是否存在,使用 :ref:`clear_stylebox()<class_Theme_method_clear_stylebox>` 移除现有属性。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_theme_item:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_theme_item**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, old_name\: :ref:`StringName<class_StringName>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_theme_item>`
|
|
|
|
如果主题类型 ``theme_type`` 中存在名为 ``old_name`` 的主题属性,则将其重命名为 ``name``\ 。
|
|
|
|
不存在时失败,新名称已存在时也会失败。请使用 :ref:`has_theme_item()<class_Theme_method_has_theme_item>` 检查是否存在,使用 :ref:`clear_theme_item()<class_Theme_method_clear_theme_item>` 移除现有属性。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_rename_type:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **rename_type**\ (\ old_theme_type\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_rename_type>`
|
|
|
|
将旧的主题类型 ``old_theme_type`` 重命名为 ``theme_type``\ ,要求旧类型存在且新类型不存在。
|
|
|
|
\ **注意:**\ 如果将主题类型重命名为空的名称,或者是与内置类关联的类型变体,就会移除类型变体连接,且无法再单单通过重命名进行撤销。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_color:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_color**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_Theme_method_set_color>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的 :ref:`Color<class_Color>` 属性的值。移除该属性请使用 :ref:`clear_color()<class_Theme_method_clear_color>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_constant:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_constant**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, constant\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Theme_method_set_constant>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的常量属性的值。移除该属性请使用 :ref:`clear_constant()<class_Theme_method_clear_constant>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_font:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_font**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, font\: :ref:`Font<class_Font>`\ ) :ref:`🔗<class_Theme_method_set_font>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的 :ref:`Font<class_Font>` 属性的值。移除该属性请使用 :ref:`clear_font()<class_Theme_method_clear_font>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_font_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_font_size**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, font_size\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Theme_method_set_font_size>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的字体大小属性的值。移除该属性请使用 :ref:`clear_font_size()<class_Theme_method_clear_font_size>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_icon:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_icon**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, texture\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`🔗<class_Theme_method_set_icon>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的图标属性的值。移除该属性请使用 :ref:`clear_icon()<class_Theme_method_clear_icon>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_stylebox:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_stylebox**\ (\ name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, texture\: :ref:`StyleBox<class_StyleBox>`\ ) :ref:`🔗<class_Theme_method_set_stylebox>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的 :ref:`StyleBox<class_StyleBox>` 属性的值。移除该属性请使用 :ref:`clear_stylebox()<class_Theme_method_clear_stylebox>`\ 。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_theme_item:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_theme_item**\ (\ data_type\: :ref:`DataType<enum_Theme_DataType>`, name\: :ref:`StringName<class_StringName>`, theme_type\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Theme_method_set_theme_item>`
|
|
|
|
创建或改变由名称 ``name`` 和主题类型 ``theme_type`` 定义的主题属性的值。移除该属性请使用 :ref:`clear_theme_item()<class_Theme_method_clear_theme_item>`\ 。
|
|
|
|
如果 ``value`` 的类型不被 ``data_type`` 所接受,则失败。
|
|
|
|
\ **注意:**\ 这个方法类似于调用相应的数据类型特定方法,但可以用于更通用逻辑。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_Theme_method_set_type_variation:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_type_variation**\ (\ theme_type\: :ref:`StringName<class_StringName>`, base_type\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Theme_method_set_type_variation>`
|
|
|
|
将主题类型 ``theme_type`` 标记为基础类型 ``base_type`` 的变种。
|
|
|
|
这会将 ``theme_type`` 添加为属于 ``base_type`` 类的 :ref:`Control<class_Control>` 的 :ref:`Control.theme_type_variation<class_Control_property_theme_type_variation>` 的建议选项。
|
|
|
|
变种也可以嵌套,即 ``base_type`` 可以是另一个变种。如果变种链以匹配 :ref:`Control<class_Control>` 类的 ``base_type`` 结束,则整个链将被建议为选项。
|
|
|
|
\ **注意:**\ 仅当该主题资源被设置为项目的默认主题时才会显示建议。参见 :ref:`ProjectSettings.gui/theme/custom<class_ProjectSettings_property_gui/theme/custom>`\ 。
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
|
|
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
|
|
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
|
|
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
|
|
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
|
|
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
|
|
.. |void| replace:: :abbr:`void (无返回值。)`
|