summaryrefslogtreecommitdiff
path: root/scene/gui/line_edit.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/line_edit.h')
-rw-r--r--scene/gui/line_edit.h64
1 files changed, 52 insertions, 12 deletions
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 6aa1694f1f..861c7f273b 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -70,6 +70,17 @@ public:
MENU_MAX
};
+ enum VirtualKeyboardType {
+ KEYBOARD_TYPE_DEFAULT,
+ KEYBOARD_TYPE_MULTILINE,
+ KEYBOARD_TYPE_NUMBER,
+ KEYBOARD_TYPE_NUMBER_DECIMAL,
+ KEYBOARD_TYPE_PHONE,
+ KEYBOARD_TYPE_EMAIL_ADDRESS,
+ KEYBOARD_TYPE_PASSWORD,
+ KEYBOARD_TYPE_URL
+ };
+
private:
HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT;
@@ -84,7 +95,7 @@ private:
String text;
String placeholder;
String placeholder_translated;
- String secret_character = "*";
+ String secret_character = U"•";
String ime_text;
Point2 ime_selection;
@@ -102,7 +113,7 @@ private:
bool caret_mid_grapheme_enabled = true;
int caret_column = 0;
- int scroll_offset = 0;
+ float scroll_offset = 0.0;
int max_length = 0; // 0 for no maximum.
String language;
@@ -120,6 +131,7 @@ private:
bool shortcut_keys_enabled = true;
bool virtual_keyboard_enabled = true;
+ VirtualKeyboardType virtual_keyboard_type = KEYBOARD_TYPE_DEFAULT;
bool middle_mouse_paste_enabled = true;
@@ -141,8 +153,7 @@ private:
struct TextOperation {
int caret_column = 0;
- int scroll_offset = 0;
- int cached_width = 0;
+ float scroll_offset = 0.0;
String text;
};
List<TextOperation> undo_stack;
@@ -159,11 +170,34 @@ private:
bool caret_blink_enabled = false;
bool caret_force_displayed = false;
bool draw_caret = true;
- float caret_blink_speed = 0.65;
+ float caret_blink_interval = 0.65;
double caret_blink_timer = 0.0;
bool caret_blinking = false;
- bool _is_over_clear_button(const Point2 &p_pos) const;
+ struct ThemeCache {
+ Ref<StyleBox> normal;
+ Ref<StyleBox> read_only;
+ Ref<StyleBox> focus;
+
+ Ref<Font> font;
+ int font_size = 0;
+ Color font_color;
+ Color font_uneditable_color;
+ Color font_selected_color;
+ int font_outline_size;
+ Color font_outline_color;
+ Color font_placeholder_color;
+ int caret_width = 0;
+ Color caret_color;
+ int minimum_character_width = 0;
+ Color selection_color;
+
+ Ref<Texture2D> clear_icon;
+ Color clear_button_color;
+ Color clear_button_color_pressed;
+
+ float base_scale = 1.0;
+ } theme_cache;
void _clear_undo_stack();
void _clear_redo();
@@ -180,11 +214,11 @@ private:
void shift_selection_check_post(bool);
void selection_fill_at_caret();
- void set_scroll_offset(int p_pos);
- int get_scroll_offset() const;
+ void set_scroll_offset(float p_pos);
+ float get_scroll_offset() const;
void set_caret_at_pixel_pos(int p_x);
- Vector2i get_caret_pixel_pos();
+ Vector2 get_caret_pixel_pos();
void _reset_caret_blink_timer();
void _toggle_draw_caret();
@@ -204,12 +238,14 @@ private:
void _ensure_menu();
protected:
+ bool _is_over_clear_button(const Point2 &p_pos) const;
+ virtual void _update_theme_item_cache() override;
void _notification(int p_what);
static void _bind_methods();
virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
virtual void gui_input(const Ref<InputEvent> &p_event) override;
- void _validate_property(PropertyInfo &property) const override;
+ void _validate_property(PropertyInfo &p_property) const;
public:
void set_horizontal_alignment(HorizontalAlignment p_alignment);
@@ -274,8 +310,8 @@ public:
bool is_caret_blink_enabled() const;
void set_caret_blink_enabled(const bool p_enabled);
- float get_caret_blink_speed() const;
- void set_caret_blink_speed(const float p_speed);
+ float get_caret_blink_interval() const;
+ void set_caret_blink_interval(const float p_interval);
void set_caret_force_displayed(const bool p_enabled);
bool is_caret_force_displayed() const;
@@ -311,6 +347,9 @@ public:
void set_virtual_keyboard_enabled(bool p_enable);
bool is_virtual_keyboard_enabled() const;
+ void set_virtual_keyboard_type(VirtualKeyboardType p_type);
+ VirtualKeyboardType get_virtual_keyboard_type() const;
+
void set_middle_mouse_paste_enabled(bool p_enabled);
bool is_middle_mouse_paste_enabled() const;
@@ -335,5 +374,6 @@ public:
};
VARIANT_ENUM_CAST(LineEdit::MenuItems);
+VARIANT_ENUM_CAST(LineEdit::VirtualKeyboardType);
#endif // LINE_EDIT_H