summaryrefslogtreecommitdiffstats
path: root/scene/gui/text_edit.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/text_edit.h')
-rw-r--r--scene/gui/text_edit.h70
1 files changed, 41 insertions, 29 deletions
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 28300f6ee2..6b710ae26f 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -356,9 +356,6 @@ private:
void _clear_redo();
/* Search */
- Color search_result_color = Color(1, 1, 1);
- Color search_result_border_color = Color(1, 1, 1);
-
String search_text = "";
uint32_t search_flags = 0;
@@ -413,9 +410,6 @@ private:
bool caret_pos_dirty = false;
bool caret_index_edit_dirty = true;
- Color caret_color = Color(1, 1, 1);
- Color caret_background_color = Color(0, 0, 0);
-
CaretType caret_type = CaretType::CARET_TYPE_LINE;
bool draw_caret = true;
@@ -446,8 +440,6 @@ private:
bool deselect_on_focus_loss_enabled = true;
bool drag_and_drop_selection_enabled = true;
- Color font_selected_color = Color(0, 0, 0, 0);
- Color selection_color = Color(1, 1, 1);
bool use_selected_font_color = false;
bool selection_drag_attempt = false;
@@ -543,27 +535,50 @@ private:
Dictionary _get_line_syntax_highlighting(int p_line);
/* Visual. */
- Ref<StyleBox> style_normal;
- Ref<StyleBox> style_focus;
- Ref<StyleBox> style_readonly;
+ struct ThemeCache {
+ float base_scale = 1.0;
+
+ /* Internal API for CodeEdit */
+ Color brace_mismatch_color;
+ Color code_folding_color = Color(1, 1, 1);
+ Ref<Texture2D> folded_eol_icon;
- Ref<Texture2D> tab_icon;
- Ref<Texture2D> space_icon;
+ /* Search */
+ Color search_result_color = Color(1, 1, 1);
+ Color search_result_border_color = Color(1, 1, 1);
- Ref<Font> font;
- int font_size = 16;
- Color font_color = Color(1, 1, 1);
- Color font_readonly_color = Color(1, 1, 1);
- Color font_placeholder_color = Color(1, 1, 1, 0.6);
+ /* Caret */
+ int caret_width = 1;
+ Color caret_color = Color(1, 1, 1);
+ Color caret_background_color = Color(0, 0, 0);
- int outline_size = 0;
- Color outline_color = Color(1, 1, 1);
+ /* Selection */
+ Color font_selected_color = Color(0, 0, 0, 0);
+ Color selection_color = Color(1, 1, 1);
- int line_spacing = 1;
+ /* Other visuals */
+ Ref<StyleBox> style_normal;
+ Ref<StyleBox> style_focus;
+ Ref<StyleBox> style_readonly;
+
+ Ref<Texture2D> tab_icon;
+ Ref<Texture2D> space_icon;
+
+ Ref<Font> font;
+ int font_size = 16;
+ Color font_color = Color(1, 1, 1);
+ Color font_readonly_color = Color(1, 1, 1);
+ Color font_placeholder_color = Color(1, 1, 1, 0.6);
- Color background_color = Color(1, 1, 1);
- Color current_line_color = Color(1, 1, 1);
- Color word_highlighted_color = Color(1, 1, 1);
+ int outline_size = 0;
+ Color outline_color = Color(1, 1, 1);
+
+ int line_spacing = 1;
+
+ Color background_color = Color(1, 1, 1);
+ Color current_line_color = Color(1, 1, 1);
+ Color word_highlighted_color = Color(1, 1, 1);
+ } theme_cache;
bool window_has_focus = true;
bool first_draw = true;
@@ -607,9 +622,10 @@ private:
protected:
void _notification(int p_what);
-
static void _bind_methods();
+ virtual void _update_theme_item_cache() override;
+
/* Internal API for CodeEdit, pending public API. */
// brace matching
struct BraceMatchingData {
@@ -624,12 +640,8 @@ protected:
};
bool highlight_matching_braces_enabled = false;
- Color brace_mismatch_color;
// Line hiding.
- Color code_folding_color = Color(1, 1, 1);
- Ref<Texture2D> folded_eol_icon;
-
bool hiding_enabled = false;
void _set_hiding_enabled(bool p_enabled);