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