mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
428 lines
20 KiB
ReStructuredText
428 lines
20 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. DO NOT EDIT THIS FILE!!!
|
||
.. Generated automatically from Godot engine sources.
|
||
.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
|
||
.. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/LinkButton.xml.
|
||
|
||
.. _class_LinkButton:
|
||
|
||
LinkButton
|
||
==========
|
||
|
||
**继承:** :ref:`BaseButton<class_BaseButton>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
||
|
||
代表链接的按钮。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
描述
|
||
----
|
||
|
||
代表链接的按钮。这种按钮主要用于与按钮的交互引起上下文变化时(如链接到网页)。
|
||
|
||
另见 :ref:`BaseButton<class_BaseButton>`\ ,它包含了该节点相关的常用属性和方法。
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
属性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``0`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`String<class_String>` | :ref:`language<class_LinkButton_property_language>` | ``""`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`CursorShape<enum_Control_CursorShape>` | mouse_default_cursor_shape | ``2`` (overrides :ref:`Control<class_Control_property_mouse_default_cursor_shape>`) |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_LinkButton_property_structured_text_bidi_override>` | ``0`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_LinkButton_property_structured_text_bidi_override_options>` | ``[]`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`String<class_String>` | :ref:`text<class_LinkButton_property_text>` | ``""`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`text_direction<class_LinkButton_property_text_direction>` | ``0`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` | :ref:`underline<class_LinkButton_property_underline>` | ``0`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
| :ref:`String<class_String>` | :ref:`uri<class_LinkButton_property_uri>` | ``""`` |
|
||
+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
主题属性
|
||
--------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_color<class_LinkButton_theme_color_font_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_LinkButton_theme_color_font_disabled_color>` | ``Color(0, 0, 0, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_focus_color<class_LinkButton_theme_color_font_focus_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_hover_color<class_LinkButton_theme_color_font_hover_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_hover_pressed_color<class_LinkButton_theme_color_font_hover_pressed_color>` | ``Color(0, 0, 0, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_outline_color<class_LinkButton_theme_color_font_outline_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Color<class_Color>` | :ref:`font_pressed_color<class_LinkButton_theme_color_font_pressed_color>` | ``Color(1, 1, 1, 1)`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`outline_size<class_LinkButton_theme_constant_outline_size>` | ``0`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`underline_spacing<class_LinkButton_theme_constant_underline_spacing>` | ``2`` |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`Font<class_Font>` | :ref:`font<class_LinkButton_theme_font_font>` | |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`font_size<class_LinkButton_theme_font_size_font_size>` | |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_LinkButton_theme_style_focus>` | |
|
||
+---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
枚举
|
||
----
|
||
|
||
.. _enum_LinkButton_UnderlineMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **UnderlineMode**:
|
||
|
||
.. _class_LinkButton_constant_UNDERLINE_MODE_ALWAYS:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **UNDERLINE_MODE_ALWAYS** = ``0``
|
||
|
||
LinkButton 将始终在其文本底部显示下划线。
|
||
|
||
.. _class_LinkButton_constant_UNDERLINE_MODE_ON_HOVER:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **UNDERLINE_MODE_ON_HOVER** = ``1``
|
||
|
||
LinkButton 将在鼠标光标悬停时,在文本底部显示下划线。
|
||
|
||
.. _class_LinkButton_constant_UNDERLINE_MODE_NEVER:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **UNDERLINE_MODE_NEVER** = ``2``
|
||
|
||
LinkButton 永远不会在其文本底部显示下划线。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
属性说明
|
||
--------
|
||
|
||
.. _class_LinkButton_property_language:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **language** = ``""``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_language** **(** :ref:`String<class_String>` value **)**
|
||
- :ref:`String<class_String>` **get_language** **(** **)**
|
||
|
||
语言代码,用于断行和文本塑形算法,如果留空则使用当前区域设置。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_property_structured_text_bidi_override:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_structured_text_bidi_override** **(** :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` value **)**
|
||
- :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override** **(** **)**
|
||
|
||
为结构化文本设置 BiDi 算法覆盖。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_property_structured_text_bidi_override_options:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_structured_text_bidi_override_options** **(** :ref:`Array<class_Array>` value **)**
|
||
- :ref:`Array<class_Array>` **get_structured_text_bidi_override_options** **(** **)**
|
||
|
||
设置 BiDi 覆盖的附加选项。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_property_text:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **text** = ``""``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_text** **(** :ref:`String<class_String>` value **)**
|
||
- :ref:`String<class_String>` **get_text** **(** **)**
|
||
|
||
该按钮的文本,将显示在按钮的区域内。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_property_text_direction:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`TextDirection<enum_Control_TextDirection>` **text_direction** = ``0``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_text_direction** **(** :ref:`TextDirection<enum_Control_TextDirection>` value **)**
|
||
- :ref:`TextDirection<enum_Control_TextDirection>` **get_text_direction** **(** **)**
|
||
|
||
基础文本书写方向。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_property_underline:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **underline** = ``0``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_underline_mode** **(** :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` value **)**
|
||
- :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **get_underline_mode** **(** **)**
|
||
|
||
文本的下划线模式。可用模式见 :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_property_uri:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`String<class_String>` **uri** = ``""``
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- void **set_uri** **(** :ref:`String<class_String>` value **)**
|
||
- :ref:`String<class_String>` **get_uri** **(** **)**
|
||
|
||
这个 **LinkButton** 的 `URI <https://zh.wikipedia.org/wiki/%E7%BB%9F%E4%B8%80%E8%B5%84%E6%BA%90%E6%A0%87%E5%BF%97%E7%AC%A6>`__\ 。如果设置为有效的 URI,按下按钮就会使用操作系统中与该协议对应的默认程序打开该 URI(使用 :ref:`OS.shell_open<class_OS_method_shell_open>`\ )。HTTP 和 HTTPS 的 URL 会打开默认的浏览器。
|
||
|
||
\ **示例:**\
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
uri = "https://godotengine.org" # 在默认浏览器中打开 URL。
|
||
uri = "C:\SomeFolder" # 将文件浏览器打开到给定的路径。
|
||
uri = "C:\SomeImage.png" # 在默认查看应用中打开给定的图像。
|
||
|
||
.. code-tab:: csharp
|
||
|
||
Uri = "https://godotengine.org"; // 在默认浏览器中打开 URL。
|
||
Uri = "C:\SomeFolder"; // 将文件浏览器打开到给定的路径。
|
||
Uri = "C:\SomeImage.png"; // 在默认查看应用中打开给定的图像。
|
||
|
||
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
主题属性说明
|
||
------------
|
||
|
||
.. _class_LinkButton_theme_color_font_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_color** = ``Color(0.875, 0.875, 0.875, 1)``
|
||
|
||
**LinkButton** 默认的字体颜色 :ref:`Color<class_Color>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_color_font_disabled_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_disabled_color** = ``Color(0, 0, 0, 1)``
|
||
|
||
该 **LinkButton** 处于禁用状态时,使用的文本 :ref:`Color<class_Color>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_color_font_focus_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_focus_color** = ``Color(0.95, 0.95, 0.95, 1)``
|
||
|
||
当 **LinkButton** 获得焦点时使用的文本 :ref:`Color<class_Color>`\ 。只替换按钮的正常文本颜色。禁用、悬停和按下状态优先于这个颜色。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_color_font_hover_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_hover_color** = ``Color(0.95, 0.95, 0.95, 1)``
|
||
|
||
当 **LinkButton** 被悬停时使用的文本颜色 :ref:`Color<class_Color>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_color_font_hover_pressed_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_hover_pressed_color** = ``Color(0, 0, 0, 1)``
|
||
|
||
该 **LinkButton** 处于悬停并按下状态时,使用的文本 :ref:`Color<class_Color>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_color_font_outline_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
|
||
|
||
**LinkButton** 的文本轮廓的色调。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_color_font_pressed_color:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Color<class_Color>` **font_pressed_color** = ``Color(1, 1, 1, 1)``
|
||
|
||
当 **LinkButton** 被按下时使用的文本颜色 :ref:`Color<class_Color>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_constant_outline_size:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **outline_size** = ``0``
|
||
|
||
文字轮廓的大小。
|
||
|
||
\ **注意:**\ 如果使用启用了 :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_LinkButton_theme_constant_outline_size>` 的\ *两倍*\ ,轮廓渲染才能看起来正确。否则,轮廓可能会比预期的更早被切断。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_constant_underline_spacing:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **underline_spacing** = ``2``
|
||
|
||
文本基线和下划线之间的垂直空间。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_font_font:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Font<class_Font>` **font**
|
||
|
||
该 **LinkButton** 文本的字体 :ref:`Font<class_Font>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_font_size_font_size:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **font_size**
|
||
|
||
该 **LinkButton** 文本的字体大小。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_LinkButton_theme_style_focus:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **focus**
|
||
|
||
该 **LinkButton** 处于聚焦状态时使用的 :ref:`StyleBox<class_StyleBox>`\ 。\ :ref:`focus<class_LinkButton_theme_style_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>` 资源。请注意,禁用聚焦的视觉效果会影响使用键盘/手柄进行导航的可用性,所以出于可访问性的原因,不建议这样做。
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
||
.. |const| replace:: :abbr:`const (本方法没有副作用。不会修改该实例的任何成员变量。)`
|
||
.. |vararg| replace:: :abbr:`vararg (本方法除了在此处描述的参数外,还能够继续接受任意数量的参数。)`
|
||
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
|
||
.. |static| replace:: :abbr:`static (调用本方法无需实例,所以可以直接使用类名调用。)`
|
||
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效操作符。)`
|
||
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列标志构成的位掩码整数。)`
|