/
LineEdit.hx
431 lines (322 loc) · 12.3 KB
/
LineEdit.hx
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
// Automatically generated Godot externs: DO NOT EDIT
// MIT licensed, see LICENSE.md
package godot;
import cs.system.*;
/**
LineEdit provides a single-line string editor, used for text fields.
It features many built-in shortcuts which will always be available (`Ctrl` here maps to `Command` on macOS):
- Ctrl + C: Copy
- Ctrl + X: Cut
- Ctrl + V or Ctrl + Y: Paste/"yank"
- Ctrl + Z: Undo
- Ctrl + Shift + Z: Redo
- Ctrl + U: Delete text from the cursor position to the beginning of the line
- Ctrl + K: Delete text from the cursor position to the end of the line
- Ctrl + A: Select all text
- Up/Down arrow: Move the cursor to the beginning/end of the line
On macOS, some extra keyboard shortcuts are available:
- Ctrl + F: Like the right arrow key, move the cursor one character right
- Ctrl + B: Like the left arrow key, move the cursor one character left
- Ctrl + P: Like the up arrow key, move the cursor to the previous line
- Ctrl + N: Like the down arrow key, move the cursor to the next line
- Ctrl + D: Like the Delete key, delete the character on the right side of cursor
- Ctrl + H: Like the Backspace key, delete the character on the left side of the cursor
- Command + Left arrow: Like the Home key, move the cursor to the beginning of the line
- Command + Right arrow: Like the End key, move the cursor to the end of the line
**/
@:libType
@:csNative
@:native("Godot.LineEdit")
@:autoBuild(godot.Godot.buildUserClass())
extern class LineEdit extends godot.Control {
/**
`text_change_rejected` signal.
**/
public var onTextChangeRejected(get, never):Signal<(rejectedSubstring:std.String)->Void>;
@:dox(hide) @:noCompletion inline function get_onTextChangeRejected():Signal<(rejectedSubstring:std.String)->Void> {
return new Signal(this, "text_change_rejected", Signal.SignalHandlerStringVoid.connectSignal, Signal.SignalHandlerStringVoid.disconnectSignal, Signal.SignalHandlerStringVoid.isSignalConnected);
}
/**
`text_changed` signal.
**/
public var onTextChanged(get, never):Signal<(newText:std.String)->Void>;
@:dox(hide) @:noCompletion inline function get_onTextChanged():Signal<(newText:std.String)->Void> {
return new Signal(this, "text_changed", Signal.SignalHandlerStringVoid.connectSignal, Signal.SignalHandlerStringVoid.disconnectSignal, Signal.SignalHandlerStringVoid.isSignalConnected);
}
/**
`text_entered` signal.
**/
public var onTextEntered(get, never):Signal<(newText:std.String)->Void>;
@:dox(hide) @:noCompletion inline function get_onTextEntered():Signal<(newText:std.String)->Void> {
return new Signal(this, "text_entered", Signal.SignalHandlerStringVoid.connectSignal, Signal.SignalHandlerStringVoid.disconnectSignal, Signal.SignalHandlerStringVoid.isSignalConnected);
}
/**
The cursor's position inside the `godot.LineEdit`. When set, the text may scroll to accommodate it.
**/
@:native("CaretPosition")
public var caretPosition:Int;
/**
Duration (in seconds) of a caret's blinking cycle.
**/
@:native("CaretBlinkSpeed")
public var caretBlinkSpeed:Single;
/**
If `true`, the caret (visual cursor) blinks.
**/
@:native("CaretBlink")
public var caretBlink:Bool;
/**
Opacity of the `godot.LineEdit.placeholderText`. From `0` to `1`.
**/
@:native("PlaceholderAlpha")
public var placeholderAlpha:Single;
/**
Text shown when the `godot.LineEdit` is empty. It is not the `godot.LineEdit`'s default value (see `godot.LineEdit.text`).
**/
@:native("PlaceholderText")
public var placeholderText:std.String;
/**
Sets the icon that will appear in the right end of the `godot.LineEdit` if there's no `godot.LineEdit.text`, or always, if `godot.LineEdit.clearButtonEnabled` is set to `false`.
**/
@:native("RightIcon")
public var rightIcon:godot.Texture;
/**
If `false`, it's impossible to select the text using mouse nor keyboard.
**/
@:native("SelectingEnabled")
public var selectingEnabled:Bool;
/**
If `false`, using shortcuts will be disabled.
**/
@:native("ShortcutKeysEnabled")
public var shortcutKeysEnabled:Bool;
/**
If `true`, the `godot.LineEdit` will show a clear button if `text` is not empty, which can be used to clear the text quickly.
**/
@:native("ClearButtonEnabled")
public var clearButtonEnabled:Bool;
/**
If `true`, the native virtual keyboard is shown when focused on platforms that support it.
**/
@:native("VirtualKeyboardEnabled")
public var virtualKeyboardEnabled:Bool;
/**
If `true`, the context menu will appear when right-clicked.
**/
@:native("ContextMenuEnabled")
public var contextMenuEnabled:Bool;
/**
If `true`, the `godot.LineEdit` width will increase to stay longer than the `godot.LineEdit.text`. It will not compress if the `godot.LineEdit.text` is shortened.
**/
@:native("ExpandToTextLength")
public var expandToTextLength:Bool;
/**
The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.
**/
@:native("SecretCharacter")
public var secretCharacter:std.String;
/**
If `true`, every character is replaced with the secret character (see `godot.LineEdit.secretCharacter`).
**/
@:native("Secret")
public var secret:Bool;
/**
If `false`, existing text cannot be modified and new text cannot be added.
**/
@:native("Editable")
public var editable:Bool;
/**
Maximum amount of characters that can be entered inside the `godot.LineEdit`. If `0`, there is no limit.
When a limit is defined, characters that would exceed `godot.LineEdit.maxLength` are truncated. This happens both for existing `godot.LineEdit.text` contents when setting the max length, or for new text inserted in the `godot.LineEdit`, including pasting. If any input text is truncated, the `text_change_rejected` signal is emitted with the truncated substring as parameter.
Example:
```
text = "Hello world"
max_length = 5
# `text` becomes "Hello".
max_length = 10
text += " goodbye"
# `text` becomes "Hello good".
# `text_change_rejected` is emitted with "bye" as parameter.
```
**/
@:native("MaxLength")
public var maxLength:Int;
/**
Text alignment as defined in the `godot.LineEdit_AlignEnum` enum.
**/
@:native("Align")
public var align:godot.LineEdit_AlignEnum;
/**
String value of the `godot.LineEdit`.
Note: Changing text using this property won't emit the `text_changed` signal.
**/
@:native("Text")
public var text:std.String;
@:native("new")
public function new():Void;
@:native("SetAlign")
public function setAlign(align:godot.LineEdit_AlignEnum):Void;
@:native("GetAlign")
public function getAlign():godot.LineEdit_AlignEnum;
/**
Erases the `godot.LineEdit`'s `godot.LineEdit.text`.
**/
@:native("Clear")
public function clear():Void;
#if doc_gen
/**
Selects characters inside `godot.LineEdit` between `from` and `to`. By default, `from` is at the beginning and `to` at the end.
```
text = "Welcome"
select() # Will select "Welcome".
select(4) # Will select "ome".
select(2, 5) # Will select "lco".
```
**/
@:native("Select")
public function select(?from:Int, ?to:Int):Void;
#else
/**
Selects characters inside `godot.LineEdit` between `from` and `to`. By default, `from` is at the beginning and `to` at the end.
```
text = "Welcome"
select() # Will select "Welcome".
select(4) # Will select "ome".
select(2, 5) # Will select "lco".
```
**/
@:native("Select")
public overload function select():Void;
/**
Selects characters inside `godot.LineEdit` between `from` and `to`. By default, `from` is at the beginning and `to` at the end.
```
text = "Welcome"
select() # Will select "Welcome".
select(4) # Will select "ome".
select(2, 5) # Will select "lco".
```
**/
@:native("Select")
public overload function select(from:Int):Void;
/**
Selects characters inside `godot.LineEdit` between `from` and `to`. By default, `from` is at the beginning and `to` at the end.
```
text = "Welcome"
select() # Will select "Welcome".
select(4) # Will select "ome".
select(2, 5) # Will select "lco".
```
**/
@:native("Select")
public overload function select(from:Int, to:Int):Void;
#end
/**
Selects the whole `String`.
**/
@:native("SelectAll")
public function selectAll():Void;
/**
Clears the current selection.
**/
@:native("Deselect")
public function deselect():Void;
@:native("SetText")
public function setText(text:std.String):Void;
@:native("GetText")
public function getText():std.String;
@:native("SetPlaceholder")
public function setPlaceholder(text:std.String):Void;
@:native("GetPlaceholder")
public function getPlaceholder():std.String;
@:native("SetPlaceholderAlpha")
public function setPlaceholderAlpha(alpha:Single):Void;
@:native("GetPlaceholderAlpha")
public function getPlaceholderAlpha():Single;
@:native("SetCursorPosition")
public function setCursorPosition(position:Int):Void;
@:native("GetCursorPosition")
public function getCursorPosition():Int;
/**
Returns the scroll offset due to `godot.LineEdit.caretPosition`, as a number of characters.
**/
@:native("GetScrollOffset")
public function getScrollOffset():Int;
@:native("SetExpandToTextLength")
public function setExpandToTextLength(enabled:Bool):Void;
@:native("GetExpandToTextLength")
public function getExpandToTextLength():Bool;
@:native("CursorSetBlinkEnabled")
public function cursorSetBlinkEnabled(enabled:Bool):Void;
@:native("CursorGetBlinkEnabled")
public function cursorGetBlinkEnabled():Bool;
@:native("CursorSetBlinkSpeed")
public function cursorSetBlinkSpeed(blinkSpeed:Single):Void;
@:native("CursorGetBlinkSpeed")
public function cursorGetBlinkSpeed():Single;
@:native("SetMaxLength")
public function setMaxLength(chars:Int):Void;
@:native("GetMaxLength")
public function getMaxLength():Int;
/**
Adds `text` after the cursor. If the resulting value is longer than `godot.LineEdit.maxLength`, nothing happens.
**/
@:native("AppendAtCursor")
public function appendAtCursor(text:std.String):Void;
/**
Deletes one character at the cursor's current position (equivalent to pressing the `Delete` key).
**/
@:native("DeleteCharAtCursor")
public function deleteCharAtCursor():Void;
/**
Deletes a section of the `godot.LineEdit.text` going from position `from_column` to `to_column`. Both parameters should be within the text's length.
**/
@:native("DeleteText")
public function deleteText(fromColumn:Int, toColumn:Int):Void;
@:native("SetEditable")
public function setEditable(enabled:Bool):Void;
@:native("IsEditable")
public function isEditable():Bool;
@:native("SetSecret")
public function setSecret(enabled:Bool):Void;
@:native("IsSecret")
public function isSecret():Bool;
@:native("SetSecretCharacter")
public function setSecretCharacter(character:std.String):Void;
@:native("GetSecretCharacter")
public function getSecretCharacter():std.String;
/**
Executes a given action as defined in the `godot.LineEdit_MenuItems` enum.
**/
@:native("MenuOption")
public function menuOption(option:Int):Void;
/**
Returns the `godot.PopupMenu` of this `godot.LineEdit`. By default, this menu is displayed when right-clicking on the `godot.LineEdit`.
Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their `godot.CanvasItem.visible` property.
**/
@:native("GetMenu")
public function getMenu():godot.PopupMenu;
@:native("SetContextMenuEnabled")
public function setContextMenuEnabled(enable:Bool):Void;
@:native("IsContextMenuEnabled")
public function isContextMenuEnabled():Bool;
@:native("SetVirtualKeyboardEnabled")
public function setVirtualKeyboardEnabled(enable:Bool):Void;
@:native("IsVirtualKeyboardEnabled")
public function isVirtualKeyboardEnabled():Bool;
@:native("SetClearButtonEnabled")
public function setClearButtonEnabled(enable:Bool):Void;
@:native("IsClearButtonEnabled")
public function isClearButtonEnabled():Bool;
@:native("SetShortcutKeysEnabled")
public function setShortcutKeysEnabled(enable:Bool):Void;
@:native("IsShortcutKeysEnabled")
public function isShortcutKeysEnabled():Bool;
@:native("SetSelectingEnabled")
public function setSelectingEnabled(enable:Bool):Void;
@:native("IsSelectingEnabled")
public function isSelectingEnabled():Bool;
@:native("SetRightIcon")
public function setRightIcon(icon:godot.Texture):Void;
@:native("GetRightIcon")
public function getRightIcon():godot.Texture;
}