diff options
Diffstat (limited to 'scene/gui/line_edit.h')
-rw-r--r-- | scene/gui/line_edit.h | 75 |
1 files changed, 44 insertions, 31 deletions
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 1e7495e734..12fec2f98b 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -94,7 +94,7 @@ private: Point2 ime_selection; RID text_rid; - float full_width = 0; + float full_width = 0.0; bool selecting_enabled = true; @@ -103,9 +103,9 @@ private: PopupMenu *menu_dir = nullptr; PopupMenu *menu_ctl = nullptr; - bool mid_grapheme_caret_enabled = false; + bool caret_mid_grapheme_enabled = false; - int cursor_pos = 0; + int caret_column = 0; int scroll_offset = 0; int max_length = 0; // 0 for no maximum. @@ -129,19 +129,20 @@ private: Ref<Texture2D> right_icon; struct Selection { - int begin; - int end; - int cursor_start; - bool enabled; - bool creating; - bool doubleclick; - bool drag_attempt; + int begin = 0; + int end = 0; + int start_column = 0; + bool enabled = false; + bool creating = false; + bool double_click = false; + bool drag_attempt = false; + uint64_t last_dblclk = 0; } selection; struct TextOperation { - int cursor_pos; - int scroll_offset; - int cached_width; + int caret_column = 0; + int scroll_offset = 0; + int cached_width = 0; String text; }; List<TextOperation> undo_stack; @@ -163,6 +164,7 @@ private: void _clear_redo(); void _create_undo_state(); + int _get_menu_action_accelerator(const String &p_action); void _generate_context_menu(); void _shape(); @@ -173,12 +175,12 @@ private: void shift_selection_check_pre(bool); void shift_selection_check_post(bool); - void selection_fill_at_cursor(); + void selection_fill_at_caret(); void set_scroll_offset(int p_pos); int get_scroll_offset() const; - void set_cursor_at_pixel_pos(int p_x); - Vector2i get_cursor_pixel_pos(); + void set_caret_at_pixel_pos(int p_x); + Vector2i get_caret_pixel_pos(); void _reset_caret_blink_timer(); void _toggle_draw_caret(); @@ -188,15 +190,23 @@ private: void _editor_settings_changed(); - void _gui_input(Ref<InputEvent> p_event); - void _notification(int p_what); + void _swap_current_input_direction(); + void _move_caret_left(bool p_select, bool p_move_by_word = false); + void _move_caret_right(bool p_select, bool p_move_by_word = false); + void _move_caret_start(bool p_select); + void _move_caret_end(bool p_select); + void _backspace(bool p_word = false, bool p_all_to_left = false); + void _delete(bool p_word = false, bool p_all_to_right = false); protected: + void _notification(int p_what); static void _bind_methods(); + void _gui_input(Ref<InputEvent> p_event); bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; + void _validate_property(PropertyInfo &property) const override; public: void set_align(Align p_align); @@ -249,26 +259,26 @@ public: void set_placeholder_alpha(float p_alpha); float get_placeholder_alpha() const; - void set_cursor_position(int p_pos); - int get_cursor_position() const; + void set_caret_column(int p_column); + int get_caret_column() const; void set_max_length(int p_max_length); int get_max_length() const; - void append_at_cursor(String p_text); + void insert_text_at_caret(String p_text); void clear(); - void set_mid_grapheme_caret_enabled(const bool p_enabled); - bool get_mid_grapheme_caret_enabled() const; + void set_caret_mid_grapheme_enabled(const bool p_enabled); + bool is_caret_mid_grapheme_enabled() const; - bool cursor_get_blink_enabled() const; - void cursor_set_blink_enabled(const bool p_enabled); + bool is_caret_blink_enabled() const; + void set_caret_blink_enabled(const bool p_enabled); - float cursor_get_blink_speed() const; - void cursor_set_blink_speed(const float p_speed); + float get_caret_blink_speed() const; + void set_caret_blink_speed(const float p_speed); - bool cursor_get_force_displayed() const; - void cursor_set_force_displayed(const bool p_enabled); + void set_caret_force_displayed(const bool p_enabled); + bool is_caret_force_displayed() const; void copy_text(); void cut_text(); @@ -287,8 +297,8 @@ public: virtual Size2 get_minimum_size() const override; - void set_expand_to_text_length(bool p_enabled); - bool get_expand_to_text_length() const; + void set_expand_to_text_length_enabled(bool p_enabled); + bool is_expand_to_text_length_enabled() const; void set_clear_button_enabled(bool p_enabled); bool is_clear_button_enabled() const; @@ -306,6 +316,9 @@ public: Ref<Texture2D> get_right_icon(); virtual bool is_text_field() const override; + + void show_virtual_keyboard(); + LineEdit(); ~LineEdit(); }; |