mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
805 lines
43 KiB
ReStructuredText
805 lines
43 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_Button:
|
||
|
||
Button
|
||
======
|
||
|
||
**Наследует:** :ref:`BaseButton<class_BaseButton>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
||
|
||
**Наследуется от:** :ref:`CheckBox<class_CheckBox>`, :ref:`CheckButton<class_CheckButton>`, :ref:`ColorPickerButton<class_ColorPickerButton>`, :ref:`MenuButton<class_MenuButton>`, :ref:`OptionButton<class_OptionButton>`
|
||
|
||
Тематическая кнопка, которая может содержать текст и значок.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Описание
|
||
----------------
|
||
|
||
**Button** — это стандартная тематическая кнопка. Она может содержать текст и значок, и она будет отображать их в соответствии с текущей :ref:`Theme<class_Theme>`.
|
||
|
||
\ **Пример:** Создайте кнопку и подключите метод, который будет вызываться при нажатии кнопки:
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
func _ready():
|
||
var button = Button.new()
|
||
button.text = "Click me"
|
||
button.pressed.connect(_button_pressed)
|
||
add_child(button)
|
||
|
||
func _button_pressed():
|
||
print("Hello world!")
|
||
|
||
.. code-tab:: csharp
|
||
|
||
public override void _Ready()
|
||
{
|
||
var button = new Button();
|
||
button.Text = "Click me";
|
||
button.Pressed += ButtonPressed;
|
||
AddChild(button);
|
||
}
|
||
|
||
private void ButtonPressed()
|
||
{
|
||
GD.Print("Hello world!");
|
||
}
|
||
|
||
|
||
|
||
См. также :ref:`BaseButton<class_BaseButton>`, который содержит общие свойства и методы, связанные с этим узлом.
|
||
|
||
\ **Примечание:** Кнопки не обнаруживают сенсорный ввод и, следовательно, не поддерживают мультитач, поскольку эмуляция мыши может нажимать только одну кнопку в определенный момент времени. Используйте :ref:`TouchScreenButton<class_TouchScreenButton>` для кнопок, которые запускают игровое движение или действия.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Обучающие материалы
|
||
--------------------------------------
|
||
|
||
- `2D Dodge The Creeps Демо <https://godotengine.org/asset-library/asset/2712>`__
|
||
|
||
- `Демонстрация тестирования операционной системы <https://godotengine.org/asset-library/asset/2789>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Свойства
|
||
----------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`alignment<class_Button_property_alignment>` | ``1`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` | :ref:`autowrap_mode<class_Button_property_autowrap_mode>` | ``0`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] | :ref:`autowrap_trim_flags<class_Button_property_autowrap_trim_flags>` | ``128`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`clip_text<class_Button_property_clip_text>` | ``false`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`expand_icon<class_Button_property_expand_icon>` | ``false`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`flat<class_Button_property_flat>` | ``false`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`Texture2D<class_Texture2D>` | :ref:`icon<class_Button_property_icon>` | |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`icon_alignment<class_Button_property_icon_alignment>` | ``0`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`String<class_String>` | :ref:`language<class_Button_property_language>` | ``""`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`String<class_String>` | :ref:`text<class_Button_property_text>` | ``""`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`text_direction<class_Button_property_text_direction>` | ``0`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_Button_property_text_overrun_behavior>` | ``0`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
| :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` | :ref:`vertical_icon_alignment<class_Button_property_vertical_icon_alignment>` | ``1`` |
|
||
+-------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Свойства темы
|
||
--------------------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_color<class_Button_theme_color_font_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_Button_theme_color_font_disabled_color>` | ``Color(0.875, 0.875, 0.875, 0.5)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_focus_color<class_Button_theme_color_font_focus_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_hover_color<class_Button_theme_color_font_hover_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_hover_pressed_color<class_Button_theme_color_font_hover_pressed_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_outline_color<class_Button_theme_color_font_outline_color>` | ``Color(0, 0, 0, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_pressed_color<class_Button_theme_color_font_pressed_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`icon_disabled_color<class_Button_theme_color_icon_disabled_color>` | ``Color(1, 1, 1, 0.4)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`icon_focus_color<class_Button_theme_color_icon_focus_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`icon_hover_color<class_Button_theme_color_icon_hover_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`icon_hover_pressed_color<class_Button_theme_color_icon_hover_pressed_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`icon_normal_color<class_Button_theme_color_icon_normal_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`icon_pressed_color<class_Button_theme_color_icon_pressed_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`align_to_largest_stylebox<class_Button_theme_constant_align_to_largest_stylebox>` | ``0`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`h_separation<class_Button_theme_constant_h_separation>` | ``4`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`icon_max_width<class_Button_theme_constant_icon_max_width>` | ``0`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`line_spacing<class_Button_theme_constant_line_spacing>` | ``0`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`outline_size<class_Button_theme_constant_outline_size>` | ``0`` |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Font<class_Font>` | :ref:`font<class_Button_theme_font_font>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`font_size<class_Button_theme_font_size_font_size>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`Texture2D<class_Texture2D>` | :ref:`icon<class_Button_theme_icon_icon>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`disabled<class_Button_theme_style_disabled>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`disabled_mirrored<class_Button_theme_style_disabled_mirrored>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_Button_theme_style_focus>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_Button_theme_style_hover>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`hover_mirrored<class_Button_theme_style_hover_mirrored>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`hover_pressed<class_Button_theme_style_hover_pressed>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`hover_pressed_mirrored<class_Button_theme_style_hover_pressed_mirrored>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_Button_theme_style_normal>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`normal_mirrored<class_Button_theme_style_normal_mirrored>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`pressed<class_Button_theme_style_pressed>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`pressed_mirrored<class_Button_theme_style_pressed_mirrored>` | |
|
||
+-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Описания свойств
|
||
--------------------------------
|
||
|
||
.. _class_Button_property_alignment:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **alignment** = ``1`` :ref:`🔗<class_Button_property_alignment>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_text_alignment**\ (\ value\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`\ )
|
||
- :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_text_alignment**\ (\ )
|
||
|
||
Правила выравнивания текста кнопки.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_autowrap_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **autowrap_mode** = ``0`` :ref:`🔗<class_Button_property_autowrap_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_autowrap_mode**\ (\ value\: :ref:`AutowrapMode<enum_TextServer_AutowrapMode>`\ )
|
||
- :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **get_autowrap_mode**\ (\ )
|
||
|
||
Если задано значение, отличное от :ref:`TextServer.AUTOWRAP_OFF<class_TextServer_constant_AUTOWRAP_OFF>`, текст будет заключен внутри ограничивающего прямоугольника узла.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_autowrap_trim_flags:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
|bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] **autowrap_trim_flags** = ``128`` :ref:`🔗<class_Button_property_autowrap_trim_flags>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_autowrap_trim_flags**\ (\ value\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\]\ )
|
||
- |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] **get_autowrap_trim_flags**\ (\ )
|
||
|
||
Флаги обрезки пространства автопереноса. См. :ref:`TextServer.BREAK_TRIM_START_EDGE_SPACES<class_TextServer_constant_BREAK_TRIM_START_EDGE_SPACES>` и :ref:`TextServer.BREAK_TRIM_END_EDGE_SPACES<class_TextServer_constant_BREAK_TRIM_END_EDGE_SPACES>` для получения дополнительной информации.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_clip_text:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **clip_text** = ``false`` :ref:`🔗<class_Button_property_clip_text>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_clip_text**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_clip_text**\ (\ )
|
||
|
||
Если ``true``, текст, который слишком велик для кнопки, обрезается по горизонтали. Если ``false``, кнопка всегда будет достаточно широкой, чтобы вместить текст. Текст не обрезается по вертикали, и высота кнопки не зависит от этого свойства.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_expand_icon:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **expand_icon** = ``false`` :ref:`🔗<class_Button_property_expand_icon>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_expand_icon**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_expand_icon**\ (\ )
|
||
|
||
При включении значок кнопки будет расширяться/уменьшаться, чтобы соответствовать размеру кнопки, сохраняя при этом ее аспект. См. также :ref:`icon_max_width<class_Button_theme_constant_icon_max_width>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_flat:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **flat** = ``false`` :ref:`🔗<class_Button_property_flat>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_flat**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_flat**\ (\ )
|
||
|
||
На плоских кнопках не отображается оформление.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_icon:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Texture2D<class_Texture2D>` **icon** :ref:`🔗<class_Button_property_icon>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_button_icon**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
|
||
- :ref:`Texture2D<class_Texture2D>` **get_button_icon**\ (\ )
|
||
|
||
Значок кнопки, если текст присутствует, значок будет помещен перед текстом.
|
||
|
||
Чтобы изменить поле и интервал значка, используйте свойство темы :ref:`h_separation<class_Button_theme_constant_h_separation>` и свойства ``content_margin_*`` используемых :ref:`StyleBox<class_StyleBox>`\ es.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_icon_alignment:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **icon_alignment** = ``0`` :ref:`🔗<class_Button_property_icon_alignment>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_icon_alignment**\ (\ value\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`\ )
|
||
- :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_icon_alignment**\ (\ )
|
||
|
||
Указывает, должен ли значок быть выровнен горизонтально по левому, правому или центру кнопки. Использует те же константы :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`, что и выравнивание текста. Если центрировать по горизонтали и вертикали, текст будет отрисован поверх значка.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_language:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **language** = ``""`` :ref:`🔗<class_Button_property_language>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_language**\ (\ value\: :ref:`String<class_String>`\ )
|
||
- :ref:`String<class_String>` **get_language**\ (\ )
|
||
|
||
Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_text:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **text** = ``""`` :ref:`🔗<class_Button_property_text>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_text**\ (\ value\: :ref:`String<class_String>`\ )
|
||
- :ref:`String<class_String>` **get_text**\ (\ )
|
||
|
||
Текст кнопки, который будет отображаться внутри области кнопки.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_text_direction:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`TextDirection<enum_Control_TextDirection>` **text_direction** = ``0`` :ref:`🔗<class_Button_property_text_direction>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_text_direction**\ (\ value\: :ref:`TextDirection<enum_Control_TextDirection>`\ )
|
||
- :ref:`TextDirection<enum_Control_TextDirection>` **get_text_direction**\ (\ )
|
||
|
||
Направление написания базового текста.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_text_overrun_behavior:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``0`` :ref:`🔗<class_Button_property_text_overrun_behavior>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>`\ )
|
||
- :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior**\ (\ )
|
||
|
||
Устанавливает поведение обрезки, когда текст выходит за пределы ограничивающего прямоугольника узла.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_property_vertical_icon_alignment:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **vertical_icon_alignment** = ``1`` :ref:`🔗<class_Button_property_vertical_icon_alignment>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_vertical_icon_alignment**\ (\ value\: :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>`\ )
|
||
- :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **get_vertical_icon_alignment**\ (\ )
|
||
|
||
Указывает, должен ли значок быть выровнен вертикально по верху, низу или центру кнопки. Использует те же константы :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>`, что и выравнивание текста. Если центрировать по горизонтали и вертикали, текст будет отрисован поверх значка.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Описания свойств темы
|
||
------------------------------------------
|
||
|
||
.. _class_Button_theme_color_font_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`🔗<class_Button_theme_color_font_color>`
|
||
|
||
Текст по умолчанию :ref:`Color<class_Color>` **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_font_disabled_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_disabled_color** = ``Color(0.875, 0.875, 0.875, 0.5)`` :ref:`🔗<class_Button_theme_color_font_disabled_color>`
|
||
|
||
Текст :ref:`Color<class_Color>` используется, когда **Button** отключена.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_font_focus_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_focus_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗<class_Button_theme_color_font_focus_color>`
|
||
|
||
Текст :ref:`Color<class_Color>`, используемый, когда **Button** находится в фокусе. Заменяет только обычный цвет текста кнопки. Отключенные, наведенные и нажатые состояния имеют приоритет над этим цветом.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_font_hover_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_hover_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗<class_Button_theme_color_font_hover_color>`
|
||
|
||
Текст :ref:`Color<class_Color>`, используемый при наведении курсора на **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_font_hover_pressed_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_hover_pressed_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_font_hover_pressed_color>`
|
||
|
||
:ref:`Color<class_Color>` текста, используемый при наведении и нажатии **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_font_outline_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`🔗<class_Button_theme_color_font_outline_color>`
|
||
|
||
Оттенок контура текста **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_font_pressed_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_pressed_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_font_pressed_color>`
|
||
|
||
Текст ``Цвет``, используемый при нажатии ``Кнопки``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_icon_disabled_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **icon_disabled_color** = ``Color(1, 1, 1, 0.4)`` :ref:`🔗<class_Button_theme_color_icon_disabled_color>`
|
||
|
||
Значок модуляции ``Цвета`` используется, когда ``Кнопка`` отключена.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_icon_focus_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **icon_focus_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_icon_focus_color>`
|
||
|
||
Значок modulate :ref:`Color<class_Color>` используется, когда **Button** находится в фокусе. Заменяет только обычный цвет modulate кнопки. Отключенные, наведенные и нажатые состояния имеют приоритет над этим цветом.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_icon_hover_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **icon_hover_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_icon_hover_color>`
|
||
|
||
Значок модуляции :ref:`Color<class_Color>`, используемый при наведении курсора на **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_icon_hover_pressed_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **icon_hover_pressed_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_icon_hover_pressed_color>`
|
||
|
||
Значок модуляции :ref:`Color<class_Color>`, используемый при наведении и нажатии **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_icon_normal_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **icon_normal_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_icon_normal_color>`
|
||
|
||
Значок по умолчанию модулирует :ref:`Color<class_Color>` **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_color_icon_pressed_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **icon_pressed_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_Button_theme_color_icon_pressed_color>`
|
||
|
||
Модуляция иконки :ref:`Color<class_Color>`, используемый при нажатии **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_constant_align_to_largest_stylebox:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **align_to_largest_stylebox** = ``0`` :ref:`🔗<class_Button_theme_constant_align_to_largest_stylebox>`
|
||
|
||
Эта константа действует как логическое значение. Если ``true``, минимальный размер кнопки и выравнивание текста/значка всегда основаны на самых больших полях stylebox, в противном случае они основаны на полях stylebox текущего состояния кнопки.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_constant_h_separation:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **h_separation** = ``4`` :ref:`🔗<class_Button_theme_constant_h_separation>`
|
||
|
||
Горизонтальное пространство между значком **Button** и текстом. Отрицательные значения будут рассматриваться как ``0`` при использовании.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_constant_icon_max_width:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **icon_max_width** = ``0`` :ref:`🔗<class_Button_theme_constant_icon_max_width>`
|
||
|
||
Максимально допустимая ширина значка **Button**. Это ограничение применяется поверх размера значка по умолчанию или его расширенного размера, если :ref:`expand_icon<class_Button_property_expand_icon>` равно ``true``. Высота регулируется в соответствии с соотношением значка. Если у кнопки есть дополнительные значки (например, :ref:`CheckBox<class_CheckBox>`), они также будут ограничены.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_constant_line_spacing:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **line_spacing** = ``0`` :ref:`🔗<class_Button_theme_constant_line_spacing>`
|
||
|
||
Дополнительный вертикальный интервал между строками (в пикселях), интервал добавляется к спуску строки. Это значение может быть отрицательным.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_constant_outline_size:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **outline_size** = ``0`` :ref:`🔗<class_Button_theme_constant_outline_size>`
|
||
|
||
Размер контура текста.
|
||
|
||
\ **Примечание:** При использовании шрифта с включенным :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` его :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` должен быть установлен как минимум в *дважды* значения :ref:`outline_size<class_Button_theme_constant_outline_size>`, чтобы контур выглядел правильно. В противном случае контур может оказаться обрезанным раньше, чем предполагалось.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_font_font:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Font<class_Font>` **font** :ref:`🔗<class_Button_theme_font_font>`
|
||
|
||
:ref:`Font<class_Font>` текста **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_font_size_font_size:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **font_size** :ref:`🔗<class_Button_theme_font_size_font_size>`
|
||
|
||
Размер шрифта текста **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_icon_icon:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Texture2D<class_Texture2D>` **icon** :ref:`🔗<class_Button_theme_icon_icon>`
|
||
|
||
Значок по умолчанию для **Button**. Появляется только если :ref:`icon<class_Button_property_icon>` не назначен.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_disabled:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **disabled** :ref:`🔗<class_Button_theme_style_disabled>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется, когда **Button** отключена.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_disabled_mirrored:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **disabled_mirrored** :ref:`🔗<class_Button_theme_style_disabled_mirrored>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется, когда **Button** отключена (для макетов текста справа налево).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_focus:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **focus** :ref:`🔗<class_Button_theme_style_focus>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется, когда **Button** находится в фокусе. ``Theme_item focus`` :ref:`StyleBox<class_StyleBox>` отображается *над* базовым :ref:`StyleBox<class_StyleBox>`, поэтому следует использовать частично прозрачный :ref:`StyleBox<class_StyleBox>`, чтобы базовый :ref:`StyleBox<class_StyleBox>` оставался видимым. :ref:`StyleBox<class_StyleBox>`, представляющий контур или подчеркивание, хорошо подходит для этой цели. Чтобы отключить визуальный эффект фокуса, назначьте ресурс :ref:`StyleBoxEmpty<class_StyleBoxEmpty>`. Обратите внимание, что отключение визуального эффекта фокуса навредит удобству использования навигации с помощью клавиатуры/контроллера, поэтому это не рекомендуется по соображениям доступности.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_hover:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **hover** :ref:`🔗<class_Button_theme_style_hover>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется при наведении курсора на **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_hover_mirrored:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **hover_mirrored** :ref:`🔗<class_Button_theme_style_hover_mirrored>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется при наведении курсора на **Button** (для макетов с направлением справа налево).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_hover_pressed:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **hover_pressed** :ref:`🔗<class_Button_theme_style_hover_pressed>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется, когда **Button** нажата и одновременно находится под курсором.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_hover_pressed_mirrored:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **hover_pressed_mirrored** :ref:`🔗<class_Button_theme_style_hover_pressed_mirrored>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется при одновременном нажатии и наведении курсора на ``Кнопка`` (для макетов с направлением справа налево).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_normal:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **normal** :ref:`🔗<class_Button_theme_style_normal>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` по умолчанию для ``Кнопки``.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_normal_mirrored:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **normal_mirrored** :ref:`🔗<class_Button_theme_style_normal_mirrored>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` по умолчанию для **Button** (для макетов справа налево).
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_pressed:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **pressed** :ref:`🔗<class_Button_theme_style_pressed>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется при нажатии **Button**.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Button_theme_style_pressed_mirrored:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **pressed_mirrored** :ref:`🔗<class_Button_theme_style_pressed_mirrored>`
|
||
|
||
:ref:`StyleBox<class_StyleBox>` используется при нажатии **Button** (для макетов с направлением справа налево).
|
||
|
||
.. |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 (Нет возвращаемого значения.)`
|