LineEdit.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="LineEdit" inherits="Control" category="Core" version="3.1">
  3. <brief_description>
  4. Control that provides single line string editing.
  5. </brief_description>
  6. <description>
  7. LineEdit provides a single line string editor, used for text fields.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="append_at_cursor">
  15. <return type="void">
  16. </return>
  17. <argument index="0" name="text" type="String">
  18. </argument>
  19. <description>
  20. Adds [code]text[/code] after the cursor. If the resulting value is longer than [member max_length], nothing happens.
  21. </description>
  22. </method>
  23. <method name="clear">
  24. <return type="void">
  25. </return>
  26. <description>
  27. Erases the [LineEdit] text.
  28. </description>
  29. </method>
  30. <method name="deselect">
  31. <return type="void">
  32. </return>
  33. <description>
  34. Clears the current selection.
  35. </description>
  36. </method>
  37. <method name="get_menu" qualifiers="const">
  38. <return type="PopupMenu">
  39. </return>
  40. <description>
  41. Returns the [PopupMenu] of this [code]LineEdit[/code]. By default, this menu is displayed when right-clicking on the [LineEdit].
  42. </description>
  43. </method>
  44. <method name="menu_option">
  45. <return type="void">
  46. </return>
  47. <argument index="0" name="option" type="int">
  48. </argument>
  49. <description>
  50. Executes a given action as defined in the MENU_* enum.
  51. </description>
  52. </method>
  53. <method name="select">
  54. <return type="void">
  55. </return>
  56. <argument index="0" name="from" type="int" default="0">
  57. </argument>
  58. <argument index="1" name="to" type="int" default="-1">
  59. </argument>
  60. <description>
  61. Selects characters inside [LineEdit] between [code]from[/code] and [code]to[/code]. By default [code]from[/code] is at the beginning and [code]to[/code] at the end.
  62. [codeblock]
  63. text = "Welcome"
  64. select() # Welcome
  65. select(4) # ome
  66. select(2, 5) # lco
  67. [/codeblock]
  68. </description>
  69. </method>
  70. <method name="select_all">
  71. <return type="void">
  72. </return>
  73. <description>
  74. Selects the whole [String].
  75. </description>
  76. </method>
  77. </methods>
  78. <members>
  79. <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align">
  80. Text alignment as defined in the ALIGN_* enum.
  81. </member>
  82. <member name="caret_blink" type="bool" setter="cursor_set_blink_enabled" getter="cursor_get_blink_enabled">
  83. If [code]true[/code], the caret (visual cursor) blinks.
  84. </member>
  85. <member name="caret_blink_speed" type="float" setter="cursor_set_blink_speed" getter="cursor_get_blink_speed">
  86. Duration (in seconds) of a caret's blinking cycle.
  87. </member>
  88. <member name="caret_position" type="int" setter="set_cursor_position" getter="get_cursor_position">
  89. The cursor's position inside the [code]LineEdit[/code]. When set, the text may scroll to accommodate it.
  90. </member>
  91. <member name="clear_button_enabled" type="bool" setter="set_clear_button_enabled" getter="is_clear_button_enabled">
  92. If [code]true[/code], the [code]LineEdit[/code] will show a clear button if [code]text[/code] is not empty.
  93. </member>
  94. <member name="context_menu_enabled" type="bool" setter="set_context_menu_enabled" getter="is_context_menu_enabled">
  95. If [code]true[/code], the context menu will appear when right clicked.
  96. </member>
  97. <member name="editable" type="bool" setter="set_editable" getter="is_editable">
  98. If [code]false[/code], existing text cannot be modified and new text cannot be added.
  99. </member>
  100. <member name="expand_to_text_length" type="bool" setter="set_expand_to_text_length" getter="get_expand_to_text_length">
  101. If [code]true[/code], the [LineEdit] width will increase to stay longer than the [member text]. It will [b]not[/b] compress if the [member text] is shortened.
  102. </member>
  103. <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" enum="Control.FocusMode">
  104. Defines how the [LineEdit] can grab focus (Keyboard and mouse, only keyboard, or none). See [code]enum FocusMode[/code] in [Control] for details.
  105. </member>
  106. <member name="max_length" type="int" setter="set_max_length" getter="get_max_length">
  107. Maximum amount of characters that can be entered inside the [LineEdit]. If [code]0[/code], there is no limit.
  108. </member>
  109. <member name="placeholder_alpha" type="float" setter="set_placeholder_alpha" getter="get_placeholder_alpha">
  110. Opacity of the [member placeholder_text]. From [code]0[/code] to [code]1[/code].
  111. </member>
  112. <member name="placeholder_text" type="String" setter="set_placeholder" getter="get_placeholder">
  113. Text shown when the [LineEdit] is empty. It is [b]not[/b] the [LineEdit]'s default value (see [member text]).
  114. </member>
  115. <member name="secret" type="bool" setter="set_secret" getter="is_secret">
  116. If [code]true[/code], every character is replaced with the secret character (see [member secret_character]).
  117. </member>
  118. <member name="secret_character" type="String" setter="set_secret_character" getter="get_secret_character">
  119. The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.
  120. </member>
  121. <member name="text" type="String" setter="set_text" getter="get_text">
  122. String value of the [LineEdit].
  123. </member>
  124. </members>
  125. <signals>
  126. <signal name="text_changed">
  127. <argument index="0" name="new_text" type="String">
  128. </argument>
  129. <description>
  130. Emitted when the text changes.
  131. </description>
  132. </signal>
  133. <signal name="text_entered">
  134. <argument index="0" name="new_text" type="String">
  135. </argument>
  136. <description>
  137. Emitted when the user presses KEY_ENTER on the [code]LineEdit[/code].
  138. </description>
  139. </signal>
  140. </signals>
  141. <constants>
  142. <constant name="ALIGN_LEFT" value="0" enum="Align">
  143. Aligns the text on the left hand side of the [LineEdit].
  144. </constant>
  145. <constant name="ALIGN_CENTER" value="1" enum="Align">
  146. Centers the text in the middle of the [LineEdit].
  147. </constant>
  148. <constant name="ALIGN_RIGHT" value="2" enum="Align">
  149. Aligns the text on the right hand side of the [LineEdit].
  150. </constant>
  151. <constant name="ALIGN_FILL" value="3" enum="Align">
  152. Stretches whitespaces to fit the [LineEdit]'s width.
  153. </constant>
  154. <constant name="MENU_CUT" value="0" enum="MenuItems">
  155. Cuts (Copies and clears) the selected text.
  156. </constant>
  157. <constant name="MENU_COPY" value="1" enum="MenuItems">
  158. Copies the selected text.
  159. </constant>
  160. <constant name="MENU_PASTE" value="2" enum="MenuItems">
  161. Pastes the clipboard text over the selected text (or at the cursor's position).
  162. </constant>
  163. <constant name="MENU_CLEAR" value="3" enum="MenuItems">
  164. Erases the whole [Linedit] text.
  165. </constant>
  166. <constant name="MENU_SELECT_ALL" value="4" enum="MenuItems">
  167. Selects the whole [Linedit] text.
  168. </constant>
  169. <constant name="MENU_UNDO" value="5" enum="MenuItems">
  170. Undoes the previous action.
  171. </constant>
  172. <constant name="MENU_REDO" value="6" enum="MenuItems">
  173. Reverse the last undo action.
  174. </constant>
  175. <constant name="MENU_MAX" value="7" enum="MenuItems">
  176. </constant>
  177. </constants>
  178. <theme_items>
  179. <theme_item name="clear" type="Texture">
  180. </theme_item>
  181. <theme_item name="clear_button_color" type="Color">
  182. </theme_item>
  183. <theme_item name="clear_button_color_pressed" type="Color">
  184. </theme_item>
  185. <theme_item name="cursor_color" type="Color">
  186. </theme_item>
  187. <theme_item name="focus" type="StyleBox">
  188. </theme_item>
  189. <theme_item name="font" type="Font">
  190. </theme_item>
  191. <theme_item name="font_color" type="Color">
  192. </theme_item>
  193. <theme_item name="font_color_selected" type="Color">
  194. </theme_item>
  195. <theme_item name="minimum_spaces" type="int">
  196. </theme_item>
  197. <theme_item name="normal" type="StyleBox">
  198. </theme_item>
  199. <theme_item name="read_only" type="StyleBox">
  200. </theme_item>
  201. <theme_item name="selection_color" type="Color">
  202. </theme_item>
  203. </theme_items>
  204. </class>