class_linkbutton.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/LinkButton.xml.
  6. .. _class_LinkButton:
  7. LinkButton
  8. ==========
  9. **Inherits:** :ref:`BaseButton<class_BaseButton>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A button that represents a link.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A button that represents a link. This type of button is primarily used for interactions that cause a context change (like linking to a web page).
  15. See also :ref:`BaseButton<class_BaseButton>` which contains common properties and methods associated with this node.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  22. | :ref:`String<class_String>` | :ref:`ellipsis_char<class_LinkButton_property_ellipsis_char>` | ``"…"`` |
  23. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  24. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``3`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  25. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`language<class_LinkButton_property_language>` | ``""`` |
  27. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  28. | :ref:`CursorShape<enum_Control_CursorShape>` | mouse_default_cursor_shape | ``2`` (overrides :ref:`Control<class_Control_property_mouse_default_cursor_shape>`) |
  29. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  30. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_LinkButton_property_structured_text_bidi_override>` | ``0`` |
  31. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  32. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_LinkButton_property_structured_text_bidi_override_options>` | ``[]`` |
  33. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  34. | :ref:`String<class_String>` | :ref:`text<class_LinkButton_property_text>` | ``""`` |
  35. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  36. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`text_direction<class_LinkButton_property_text_direction>` | ``0`` |
  37. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  38. | :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_LinkButton_property_text_overrun_behavior>` | ``0`` |
  39. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  40. | :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` | :ref:`underline<class_LinkButton_property_underline>` | ``0`` |
  41. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  42. | :ref:`String<class_String>` | :ref:`uri<class_LinkButton_property_uri>` | ``""`` |
  43. +-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  44. .. rst-class:: classref-reftable-group
  45. Theme Properties
  46. ----------------
  47. .. table::
  48. :widths: auto
  49. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  50. | :ref:`Color<class_Color>` | :ref:`font_color<class_LinkButton_theme_color_font_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  51. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  52. | :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_LinkButton_theme_color_font_disabled_color>` | ``Color(0, 0, 0, 1)`` |
  53. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  54. | :ref:`Color<class_Color>` | :ref:`font_focus_color<class_LinkButton_theme_color_font_focus_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  55. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  56. | :ref:`Color<class_Color>` | :ref:`font_hover_color<class_LinkButton_theme_color_font_hover_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  57. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  58. | :ref:`Color<class_Color>` | :ref:`font_hover_pressed_color<class_LinkButton_theme_color_font_hover_pressed_color>` | ``Color(0, 0, 0, 1)`` |
  59. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  60. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_LinkButton_theme_color_font_outline_color>` | ``Color(0, 0, 0, 1)`` |
  61. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  62. | :ref:`Color<class_Color>` | :ref:`font_pressed_color<class_LinkButton_theme_color_font_pressed_color>` | ``Color(1, 1, 1, 1)`` |
  63. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  64. | :ref:`int<class_int>` | :ref:`outline_size<class_LinkButton_theme_constant_outline_size>` | ``0`` |
  65. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  66. | :ref:`int<class_int>` | :ref:`underline_spacing<class_LinkButton_theme_constant_underline_spacing>` | ``2`` |
  67. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  68. | :ref:`Font<class_Font>` | :ref:`font<class_LinkButton_theme_font_font>` | |
  69. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  70. | :ref:`int<class_int>` | :ref:`font_size<class_LinkButton_theme_font_size_font_size>` | |
  71. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  72. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_LinkButton_theme_style_focus>` | |
  73. +---------------------------------+----------------------------------------------------------------------------------------+-----------------------------------+
  74. .. rst-class:: classref-section-separator
  75. ----
  76. .. rst-class:: classref-descriptions-group
  77. Enumerations
  78. ------------
  79. .. _enum_LinkButton_UnderlineMode:
  80. .. rst-class:: classref-enumeration
  81. enum **UnderlineMode**: :ref:`🔗<enum_LinkButton_UnderlineMode>`
  82. .. _class_LinkButton_constant_UNDERLINE_MODE_ALWAYS:
  83. .. rst-class:: classref-enumeration-constant
  84. :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **UNDERLINE_MODE_ALWAYS** = ``0``
  85. The LinkButton will always show an underline at the bottom of its text.
  86. .. _class_LinkButton_constant_UNDERLINE_MODE_ON_HOVER:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **UNDERLINE_MODE_ON_HOVER** = ``1``
  89. The LinkButton will show an underline at the bottom of its text when the mouse cursor is over it.
  90. .. _class_LinkButton_constant_UNDERLINE_MODE_NEVER:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **UNDERLINE_MODE_NEVER** = ``2``
  93. The LinkButton will never show an underline at the bottom of its text.
  94. .. rst-class:: classref-section-separator
  95. ----
  96. .. rst-class:: classref-descriptions-group
  97. Property Descriptions
  98. ---------------------
  99. .. _class_LinkButton_property_ellipsis_char:
  100. .. rst-class:: classref-property
  101. :ref:`String<class_String>` **ellipsis_char** = ``"…"`` :ref:`🔗<class_LinkButton_property_ellipsis_char>`
  102. .. rst-class:: classref-property-setget
  103. - |void| **set_ellipsis_char**\ (\ value\: :ref:`String<class_String>`\ )
  104. - :ref:`String<class_String>` **get_ellipsis_char**\ (\ )
  105. Ellipsis character used for text clipping.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_LinkButton_property_language:
  109. .. rst-class:: classref-property
  110. :ref:`String<class_String>` **language** = ``""`` :ref:`🔗<class_LinkButton_property_language>`
  111. .. rst-class:: classref-property-setget
  112. - |void| **set_language**\ (\ value\: :ref:`String<class_String>`\ )
  113. - :ref:`String<class_String>` **get_language**\ (\ )
  114. Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_LinkButton_property_structured_text_bidi_override:
  118. .. rst-class:: classref-property
  119. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0`` :ref:`🔗<class_LinkButton_property_structured_text_bidi_override>`
  120. .. rst-class:: classref-property-setget
  121. - |void| **set_structured_text_bidi_override**\ (\ value\: :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>`\ )
  122. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override**\ (\ )
  123. Set BiDi algorithm override for the structured text.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_LinkButton_property_structured_text_bidi_override_options:
  127. .. rst-class:: classref-property
  128. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]`` :ref:`🔗<class_LinkButton_property_structured_text_bidi_override_options>`
  129. .. rst-class:: classref-property-setget
  130. - |void| **set_structured_text_bidi_override_options**\ (\ value\: :ref:`Array<class_Array>`\ )
  131. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options**\ (\ )
  132. Set additional options for BiDi override.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_LinkButton_property_text:
  136. .. rst-class:: classref-property
  137. :ref:`String<class_String>` **text** = ``""`` :ref:`🔗<class_LinkButton_property_text>`
  138. .. rst-class:: classref-property-setget
  139. - |void| **set_text**\ (\ value\: :ref:`String<class_String>`\ )
  140. - :ref:`String<class_String>` **get_text**\ (\ )
  141. The button's text that will be displayed inside the button's area.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_LinkButton_property_text_direction:
  145. .. rst-class:: classref-property
  146. :ref:`TextDirection<enum_Control_TextDirection>` **text_direction** = ``0`` :ref:`🔗<class_LinkButton_property_text_direction>`
  147. .. rst-class:: classref-property-setget
  148. - |void| **set_text_direction**\ (\ value\: :ref:`TextDirection<enum_Control_TextDirection>`\ )
  149. - :ref:`TextDirection<enum_Control_TextDirection>` **get_text_direction**\ (\ )
  150. Base text writing direction.
  151. .. rst-class:: classref-item-separator
  152. ----
  153. .. _class_LinkButton_property_text_overrun_behavior:
  154. .. rst-class:: classref-property
  155. :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``0`` :ref:`🔗<class_LinkButton_property_text_overrun_behavior>`
  156. .. rst-class:: classref-property-setget
  157. - |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>`\ )
  158. - :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior**\ (\ )
  159. Sets the clipping behavior when the text exceeds the node's bounding rectangle.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_LinkButton_property_underline:
  163. .. rst-class:: classref-property
  164. :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **underline** = ``0`` :ref:`🔗<class_LinkButton_property_underline>`
  165. .. rst-class:: classref-property-setget
  166. - |void| **set_underline_mode**\ (\ value\: :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>`\ )
  167. - :ref:`UnderlineMode<enum_LinkButton_UnderlineMode>` **get_underline_mode**\ (\ )
  168. The underline mode to use for the text.
  169. .. rst-class:: classref-item-separator
  170. ----
  171. .. _class_LinkButton_property_uri:
  172. .. rst-class:: classref-property
  173. :ref:`String<class_String>` **uri** = ``""`` :ref:`🔗<class_LinkButton_property_uri>`
  174. .. rst-class:: classref-property-setget
  175. - |void| **set_uri**\ (\ value\: :ref:`String<class_String>`\ )
  176. - :ref:`String<class_String>` **get_uri**\ (\ )
  177. The `URI <https://en.wikipedia.org/wiki/Uniform_Resource_Identifier>`__ for this **LinkButton**. If set to a valid URI, pressing the button opens the URI using the operating system's default program for the protocol (via :ref:`OS.shell_open()<class_OS_method_shell_open>`). HTTP and HTTPS URLs open the default web browser.
  178. .. tabs::
  179. .. code-tab:: gdscript
  180. uri = "https://godotengine.org" # Opens the URL in the default web browser.
  181. uri = "C:\SomeFolder" # Opens the file explorer at the given path.
  182. uri = "C:\SomeImage.png" # Opens the given image in the default viewing app.
  183. .. code-tab:: csharp
  184. Uri = "https://godotengine.org"; // Opens the URL in the default web browser.
  185. Uri = "C:\SomeFolder"; // Opens the file explorer at the given path.
  186. Uri = "C:\SomeImage.png"; // Opens the given image in the default viewing app.
  187. .. rst-class:: classref-section-separator
  188. ----
  189. .. rst-class:: classref-descriptions-group
  190. Theme Property Descriptions
  191. ---------------------------
  192. .. _class_LinkButton_theme_color_font_color:
  193. .. rst-class:: classref-themeproperty
  194. :ref:`Color<class_Color>` **font_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_color>`
  195. Default text :ref:`Color<class_Color>` of the **LinkButton**.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_LinkButton_theme_color_font_disabled_color:
  199. .. rst-class:: classref-themeproperty
  200. :ref:`Color<class_Color>` **font_disabled_color** = ``Color(0, 0, 0, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_disabled_color>`
  201. Text :ref:`Color<class_Color>` used when the **LinkButton** is disabled.
  202. .. rst-class:: classref-item-separator
  203. ----
  204. .. _class_LinkButton_theme_color_font_focus_color:
  205. .. rst-class:: classref-themeproperty
  206. :ref:`Color<class_Color>` **font_focus_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_focus_color>`
  207. Text :ref:`Color<class_Color>` used when the **LinkButton** is focused. Only replaces the normal text color of the button. Disabled, hovered, and pressed states take precedence over this color.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_LinkButton_theme_color_font_hover_color:
  211. .. rst-class:: classref-themeproperty
  212. :ref:`Color<class_Color>` **font_hover_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_hover_color>`
  213. Text :ref:`Color<class_Color>` used when the **LinkButton** is being hovered.
  214. .. rst-class:: classref-item-separator
  215. ----
  216. .. _class_LinkButton_theme_color_font_hover_pressed_color:
  217. .. rst-class:: classref-themeproperty
  218. :ref:`Color<class_Color>` **font_hover_pressed_color** = ``Color(0, 0, 0, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_hover_pressed_color>`
  219. Text :ref:`Color<class_Color>` used when the **LinkButton** is being hovered and pressed.
  220. .. rst-class:: classref-item-separator
  221. ----
  222. .. _class_LinkButton_theme_color_font_outline_color:
  223. .. rst-class:: classref-themeproperty
  224. :ref:`Color<class_Color>` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_outline_color>`
  225. The tint of text outline of the **LinkButton**.
  226. .. rst-class:: classref-item-separator
  227. ----
  228. .. _class_LinkButton_theme_color_font_pressed_color:
  229. .. rst-class:: classref-themeproperty
  230. :ref:`Color<class_Color>` **font_pressed_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_LinkButton_theme_color_font_pressed_color>`
  231. Text :ref:`Color<class_Color>` used when the **LinkButton** is being pressed.
  232. .. rst-class:: classref-item-separator
  233. ----
  234. .. _class_LinkButton_theme_constant_outline_size:
  235. .. rst-class:: classref-themeproperty
  236. :ref:`int<class_int>` **outline_size** = ``0`` :ref:`🔗<class_LinkButton_theme_constant_outline_size>`
  237. The size of the text outline.
  238. \ **Note:** If using a font with :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` enabled, its :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` must be set to at least *twice* the value of :ref:`outline_size<class_LinkButton_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  239. .. rst-class:: classref-item-separator
  240. ----
  241. .. _class_LinkButton_theme_constant_underline_spacing:
  242. .. rst-class:: classref-themeproperty
  243. :ref:`int<class_int>` **underline_spacing** = ``2`` :ref:`🔗<class_LinkButton_theme_constant_underline_spacing>`
  244. The vertical space between the baseline of text and the underline.
  245. .. rst-class:: classref-item-separator
  246. ----
  247. .. _class_LinkButton_theme_font_font:
  248. .. rst-class:: classref-themeproperty
  249. :ref:`Font<class_Font>` **font** :ref:`🔗<class_LinkButton_theme_font_font>`
  250. :ref:`Font<class_Font>` of the **LinkButton**'s text.
  251. .. rst-class:: classref-item-separator
  252. ----
  253. .. _class_LinkButton_theme_font_size_font_size:
  254. .. rst-class:: classref-themeproperty
  255. :ref:`int<class_int>` **font_size** :ref:`🔗<class_LinkButton_theme_font_size_font_size>`
  256. Font size of the **LinkButton**'s text.
  257. .. rst-class:: classref-item-separator
  258. ----
  259. .. _class_LinkButton_theme_style_focus:
  260. .. rst-class:: classref-themeproperty
  261. :ref:`StyleBox<class_StyleBox>` **focus** :ref:`🔗<class_LinkButton_theme_style_focus>`
  262. :ref:`StyleBox<class_StyleBox>` used when the **LinkButton** is focused. The :ref:`focus<class_LinkButton_theme_style_focus>` :ref:`StyleBox<class_StyleBox>` is displayed *over* the base :ref:`StyleBox<class_StyleBox>`, so a partially transparent :ref:`StyleBox<class_StyleBox>` should be used to ensure the base :ref:`StyleBox<class_StyleBox>` remains visible. A :ref:`StyleBox<class_StyleBox>` that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a :ref:`StyleBoxEmpty<class_StyleBoxEmpty>` resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
  263. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  264. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  265. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  266. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  267. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  268. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  269. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  270. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  271. .. |void| replace:: :abbr:`void (No return value.)`