diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2016-04-05 17:06:56 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2016-04-05 17:06:56 +0100 |
commit | c7519f091d6c4bd3f7edc1b8213fb4aa418fad3a (patch) | |
tree | fd3a265a6e2b9f3f798ab6ab7a8c7cd920b247e6 /scene/gui | |
parent | 868872392379aa5c90c3d199a2cfee32b8f593f2 (diff) |
Ability to change the caret color
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 9 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 425a88fc0e..321bbb9338 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -910,9 +910,9 @@ void TextEdit::_notification(int p_what) { cursor_pos = Point2i( char_ofs+char_margin, ofs_y ); if (insert_mode) { cursor_pos.y += get_row_height(); - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); } @@ -927,9 +927,9 @@ void TextEdit::_notification(int p_what) { if (insert_mode) { cursor_pos.y += get_row_height(); int char_w = cache.font->get_char_size(' ').width; - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.font_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); } } } @@ -3045,6 +3045,7 @@ void TextEdit::_update_caches() { cache.style_normal=get_stylebox("normal"); cache.style_focus=get_stylebox("focus"); cache.font=get_font("font"); + cache.caret_color=get_color("caret_color"); cache.font_color=get_color("font_color"); cache.font_selected_color=get_color("font_selected_color"); cache.keyword_color=get_color("keyword_color"); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 43a24bf3c0..cd27469914 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -73,6 +73,7 @@ class TextEdit : public Control { Ref<StyleBox> style_normal; Ref<StyleBox> style_focus; Ref<Font> font; + Color caret_color; Color font_color; Color font_selected_color; Color keyword_color; |