mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 12:26:59 +01:00
34cda4b11b
This allows backporting documentation from the `master` branch more easily, as it already features the `[kbd]` tag. Co-authored-by: Yuri Sizov <11782833+YuriSizov@users.noreply.github.com>
325 lines
16 KiB
XML
325 lines
16 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="LineEdit" inherits="Control" version="3.8">
|
|
<brief_description>
|
|
Control that provides single-line string editing.
|
|
</brief_description>
|
|
<description>
|
|
LineEdit provides a single-line string editor, used for text fields.
|
|
It features many built-in shortcuts which will always be available ([code]Ctrl[/code] here maps to [code]Command[/code] on macOS):
|
|
- [kbd]Ctrl + C[/kbd]: Copy
|
|
- [kbd]Ctrl + X[/kbd]: Cut
|
|
- [kbd]Ctrl + V or Ctrl + Y[/kbd]: Paste/"yank"
|
|
- [kbd]Ctrl + Z[/kbd]: Undo
|
|
- [kbd]Ctrl + Shift + Z[/kbd]: Redo
|
|
- [kbd]Ctrl + U[/kbd]: Delete text from the cursor position to the beginning of the line
|
|
- [kbd]Ctrl + K[/kbd]: Delete text from the cursor position to the end of the line
|
|
- [kbd]Ctrl + A[/kbd]: Select all text
|
|
- [kbd]Up Arrow[/kbd]/[kbd]Down arrow[/kbd]: Move the cursor to the beginning/end of the line
|
|
On macOS, some extra keyboard shortcuts are available:
|
|
- [kbd]Ctrl + F[/kbd]: Same as [kbd]Right Arrow[/kbd], move the cursor one character right
|
|
- [kbd]Ctrl + B[/kbd]: Same as [kbd]Left Arrow[/kbd], move the cursor one character left
|
|
- [kbd]Ctrl + P[/kbd]: Same as [kbd]Up Arrow[/kbd], move the cursor to the previous line
|
|
- [kbd]Ctrl + N[/kbd]: Same as [kbd]Down Arrow[/kbd], move the cursor to the next line
|
|
- [kbd]Ctrl + D[/kbd]: Same as [kbd]Delete[/kbd], delete the character on the right side of cursor
|
|
- [kbd]Ctrl + H[/kbd]: Same as [kbd]Backspace[/kbd], delete the character on the left side of the cursor
|
|
- [kbd]Cmd + Left arrow[/kbd]: Same as [kbd]Home[/kbd], move the cursor to the beginning of the line
|
|
- [kbd]Cmd + Right arrow[/kbd]: Same as [kbd]End[/kbd], move the cursor to the end of the line
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="append_at_cursor">
|
|
<return type="void" />
|
|
<argument index="0" name="text" type="String" />
|
|
<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" />
|
|
<description>
|
|
Erases the [LineEdit]'s [member text].
|
|
</description>
|
|
</method>
|
|
<method name="delete_char_at_cursor">
|
|
<return type="void" />
|
|
<description>
|
|
Deletes one character at the cursor's current position (equivalent to pressing the [code]Delete[/code] key).
|
|
</description>
|
|
</method>
|
|
<method name="delete_text">
|
|
<return type="void" />
|
|
<argument index="0" name="from_column" type="int" />
|
|
<argument index="1" name="to_column" type="int" />
|
|
<description>
|
|
Deletes a section of the [member text] going from position [code]from_column[/code] to [code]to_column[/code]. Both parameters should be within the text's length.
|
|
</description>
|
|
</method>
|
|
<method name="deselect">
|
|
<return type="void" />
|
|
<description>
|
|
Clears the current selection.
|
|
</description>
|
|
</method>
|
|
<method name="get_menu" qualifiers="const">
|
|
<return type="PopupMenu" />
|
|
<description>
|
|
Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit].
|
|
[b]Warning:[/b] 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 [member CanvasItem.visible] property.
|
|
</description>
|
|
</method>
|
|
<method name="get_scroll_offset" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the scroll offset due to [member caret_position], as a number of characters.
|
|
</description>
|
|
</method>
|
|
<method name="get_selection_from_column" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the selection begin column.
|
|
</description>
|
|
</method>
|
|
<method name="get_selection_to_column" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the selection end column.
|
|
</description>
|
|
</method>
|
|
<method name="has_selection" qualifiers="const">
|
|
<return type="bool" />
|
|
<description>
|
|
Returns [code]true[/code] if the user has selected text.
|
|
</description>
|
|
</method>
|
|
<method name="menu_option">
|
|
<return type="void" />
|
|
<argument index="0" name="option" type="int" />
|
|
<description>
|
|
Executes a given action as defined in the [enum MenuItems] enum.
|
|
</description>
|
|
</method>
|
|
<method name="select">
|
|
<return type="void" />
|
|
<argument index="0" name="from" type="int" default="0" />
|
|
<argument index="1" name="to" type="int" default="-1" />
|
|
<description>
|
|
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.
|
|
[codeblock]
|
|
text = "Welcome"
|
|
select() # Will select "Welcome".
|
|
select(4) # Will select "ome".
|
|
select(2, 5) # Will select "lco".
|
|
[/codeblock]
|
|
</description>
|
|
</method>
|
|
<method name="select_all">
|
|
<return type="void" />
|
|
<description>
|
|
Selects the whole [String].
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0">
|
|
Text alignment as defined in the [enum Align] enum.
|
|
</member>
|
|
<member name="caret_blink" type="bool" setter="cursor_set_blink_enabled" getter="cursor_get_blink_enabled" default="false">
|
|
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" default="0.65">
|
|
Duration (in seconds) of a caret's blinking cycle.
|
|
</member>
|
|
<member name="caret_position" type="int" setter="set_cursor_position" getter="get_cursor_position" default="0">
|
|
The cursor's position inside the [LineEdit]. 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" default="false">
|
|
If [code]true[/code], the [LineEdit] will show a clear button if [code]text[/code] is not empty, which can be used to clear the text quickly.
|
|
</member>
|
|
<member name="context_menu_enabled" type="bool" setter="set_context_menu_enabled" getter="is_context_menu_enabled" default="true">
|
|
If [code]true[/code], the context menu will appear when right-clicked.
|
|
</member>
|
|
<member name="deselect_on_focus_loss_enabled" type="bool" setter="set_deselect_on_focus_loss_enabled" getter="is_deselect_on_focus_loss_enabled" default="true">
|
|
If [code]true[/code], the selected text will be deselected when focus is lost.
|
|
</member>
|
|
<member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true">
|
|
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" default="false">
|
|
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.
|
|
</member>
|
|
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="2" />
|
|
<member name="max_length" type="int" setter="set_max_length" getter="get_max_length" default="0">
|
|
Maximum amount of characters that can be entered inside the [LineEdit]. If [code]0[/code], there is no limit.
|
|
When a limit is defined, characters that would exceed [member max_length] are truncated. This happens both for existing [member text] contents when setting the max length, or for new text inserted in the [LineEdit], including pasting. If any input text is truncated, the [signal text_change_rejected] signal is emitted with the truncated substring as parameter.
|
|
[b]Example:[/b]
|
|
[codeblock]
|
|
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.
|
|
[/codeblock]
|
|
</member>
|
|
<member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" overrides="Control" enum="Control.CursorShape" default="1" />
|
|
<member name="placeholder_alpha" type="float" setter="set_placeholder_alpha" getter="get_placeholder_alpha" default="0.6">
|
|
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" default="""">
|
|
Text shown when the [LineEdit] is empty. It is [b]not[/b] the [LineEdit]'s default value (see [member text]).
|
|
</member>
|
|
<member name="right_icon" type="Texture" setter="set_right_icon" getter="get_right_icon">
|
|
Sets the icon that will appear in the right end of the [LineEdit] if there's no [member text], or always, if [member clear_button_enabled] is set to [code]false[/code].
|
|
</member>
|
|
<member name="secret" type="bool" setter="set_secret" getter="is_secret" default="false">
|
|
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" default=""*"">
|
|
The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.
|
|
</member>
|
|
<member name="selecting_enabled" type="bool" setter="set_selecting_enabled" getter="is_selecting_enabled" default="true">
|
|
If [code]false[/code], it's impossible to select the text using mouse nor keyboard.
|
|
</member>
|
|
<member name="shortcut_keys_enabled" type="bool" setter="set_shortcut_keys_enabled" getter="is_shortcut_keys_enabled" default="true">
|
|
If [code]false[/code], using shortcuts will be disabled.
|
|
</member>
|
|
<member name="text" type="String" setter="set_text" getter="get_text" default="""">
|
|
String value of the [LineEdit].
|
|
[b]Note:[/b] Changing text using this property won't emit the [signal text_changed] signal.
|
|
</member>
|
|
<member name="virtual_keyboard_enabled" type="bool" setter="set_virtual_keyboard_enabled" getter="is_virtual_keyboard_enabled" default="true">
|
|
If [code]true[/code], the native virtual keyboard is shown when focused on platforms that support it.
|
|
</member>
|
|
<member name="virtual_keyboard_type" type="int" setter="set_virtual_keyboard_type" getter="get_virtual_keyboard_type" enum="LineEdit.VirtualKeyboardType" default="0">
|
|
Specifies the type of virtual keyboard to show.
|
|
</member>
|
|
</members>
|
|
<signals>
|
|
<signal name="text_change_rejected">
|
|
<argument index="0" name="rejected_substring" type="String" />
|
|
<description>
|
|
Emitted when appending text that overflows the [member max_length]. The appended text is truncated to fit [member max_length], and the part that couldn't fit is passed as the [code]rejected_substring[/code] argument.
|
|
</description>
|
|
</signal>
|
|
<signal name="text_changed">
|
|
<argument index="0" name="new_text" type="String" />
|
|
<description>
|
|
Emitted when the text changes.
|
|
</description>
|
|
</signal>
|
|
<signal name="text_entered">
|
|
<argument index="0" name="new_text" type="String" />
|
|
<description>
|
|
Emitted when the user presses [constant KEY_ENTER] on the [LineEdit].
|
|
</description>
|
|
</signal>
|
|
</signals>
|
|
<constants>
|
|
<constant name="ALIGN_LEFT" value="0" enum="Align">
|
|
Aligns the text on the left-hand side of the [LineEdit].
|
|
</constant>
|
|
<constant name="ALIGN_CENTER" value="1" enum="Align">
|
|
Centers the text in the middle of the [LineEdit].
|
|
</constant>
|
|
<constant name="ALIGN_RIGHT" value="2" enum="Align">
|
|
Aligns the text on the right-hand side of the [LineEdit].
|
|
</constant>
|
|
<constant name="ALIGN_FILL" value="3" enum="Align">
|
|
Stretches whitespaces to fit the [LineEdit]'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).
|
|
Non-printable escape characters are automatically stripped from the OS clipboard via [method String.strip_escapes].
|
|
</constant>
|
|
<constant name="MENU_CLEAR" value="3" enum="MenuItems">
|
|
Erases the whole [LineEdit] text.
|
|
</constant>
|
|
<constant name="MENU_SELECT_ALL" value="4" enum="MenuItems">
|
|
Selects the whole [LineEdit] 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">
|
|
Represents the size of the [enum MenuItems] enum.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_DEFAULT" value="0" enum="VirtualKeyboardType">
|
|
Default text virtual keyboard.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_MULTILINE" value="1" enum="VirtualKeyboardType">
|
|
Multiline virtual keyboard.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_NUMBER" value="2" enum="VirtualKeyboardType">
|
|
Virtual number keypad, useful for PIN entry.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_NUMBER_DECIMAL" value="3" enum="VirtualKeyboardType">
|
|
Virtual number keypad, useful for entering fractional numbers.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_PHONE" value="4" enum="VirtualKeyboardType">
|
|
Virtual phone number keypad.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_EMAIL_ADDRESS" value="5" enum="VirtualKeyboardType">
|
|
Virtual keyboard with additional keys to assist with typing email addresses.
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_PASSWORD" value="6" enum="VirtualKeyboardType">
|
|
Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization.
|
|
[b]Note:[/b] This is not supported on HTML5 or below iOS version 11.0. Instead, this will behave identically to [constant KEYBOARD_TYPE_DEFAULT].
|
|
</constant>
|
|
<constant name="KEYBOARD_TYPE_URL" value="7" enum="VirtualKeyboardType">
|
|
Virtual keyboard with additional keys to assist with typing URLs.
|
|
</constant>
|
|
</constants>
|
|
<theme_items>
|
|
<theme_item name="clear_button_color" data_type="color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
|
|
Color used as default tint for the clear button.
|
|
</theme_item>
|
|
<theme_item name="clear_button_color_pressed" data_type="color" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
Color used for the clear button when it's pressed.
|
|
</theme_item>
|
|
<theme_item name="cursor_color" data_type="color" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )">
|
|
Color of the [LineEdit]'s visual cursor (caret).
|
|
</theme_item>
|
|
<theme_item name="font_color" data_type="color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
|
|
Default font color.
|
|
</theme_item>
|
|
<theme_item name="font_color_selected" data_type="color" type="Color" default="Color( 0, 0, 0, 1 )">
|
|
Font color for selected text (inside the selection rectangle).
|
|
</theme_item>
|
|
<theme_item name="font_color_uneditable" data_type="color" type="Color" default="Color( 0.88, 0.88, 0.88, 0.5 )">
|
|
Font color when editing is disabled.
|
|
</theme_item>
|
|
<theme_item name="selection_color" data_type="color" type="Color" default="Color( 0.49, 0.49, 0.49, 1 )">
|
|
Color of the selection rectangle.
|
|
</theme_item>
|
|
<theme_item name="minimum_spaces" data_type="constant" type="int" default="12">
|
|
Minimum horizontal space for the text (not counting the clear button and content margins). This value is measured in count of space characters (i.e. this amount of space characters can be displayed without scrolling).
|
|
</theme_item>
|
|
<theme_item name="font" data_type="font" type="Font">
|
|
Font used for the text.
|
|
</theme_item>
|
|
<theme_item name="clear" data_type="icon" type="Texture">
|
|
Texture for the clear button. See [member clear_button_enabled].
|
|
</theme_item>
|
|
<theme_item name="focus" data_type="style" type="StyleBox">
|
|
Background used when [LineEdit] has GUI focus.
|
|
</theme_item>
|
|
<theme_item name="normal" data_type="style" type="StyleBox">
|
|
Default background for the [LineEdit].
|
|
</theme_item>
|
|
<theme_item name="read_only" data_type="style" type="StyleBox">
|
|
Background used when [LineEdit] is in read-only mode ([member editable] is set to [code]false[/code]).
|
|
</theme_item>
|
|
</theme_items>
|
|
</class>
|