diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-06-22 07:51:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-22 07:51:33 +0200 |
commit | 87cb3629f2ae34ee65b2edaa52199c302d14f4e2 (patch) | |
tree | 20922ffc27fdc1d1cfaf9a54e9e04f318c85cedb /scene | |
parent | 5974653307b56cfd8ed5a8b784f23e7f5822a6f4 (diff) | |
parent | 45f0dec55c64c62f6f47b6fc6735af33afb6e028 (diff) |
Merge pull request #5344 from Paulb23/code_completion_colors
Code completion box colors
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 15 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 3 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 7 |
3 files changed, 11 insertions, 14 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5e18da32aa..9342d077eb 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1041,11 +1041,8 @@ void TextEdit::_notification(int p_what) { if (completion_active) { // code completion box Ref<StyleBox> csb = get_stylebox("completion"); - Ref<StyleBox> csel = get_stylebox("completion_selected"); int maxlines = get_constant("completion_lines"); int cmax_width = get_constant("completion_max_width")*cache.font->get_char_size('x').x; - Color existing = get_color("completion_existing"); - existing.a=0.2; int scrollw = get_constant("completion_scroll_width"); Color scrollc = get_color("completion_scroll_color"); @@ -1089,11 +1086,12 @@ void TextEdit::_notification(int p_what) { draw_style_box(csb,Rect2(completion_rect.pos-csb->get_offset(),completion_rect.size+csb->get_minimum_size()+Size2(scrollw,0))); - + if (cache.completion_background_color.a>0.01) { + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(completion_rect.pos,completion_rect.size+Size2(scrollw,0)),cache.completion_background_color); + } int line_from = CLAMP(completion_index - lines/2, 0, completion_options.size() - lines); - draw_style_box(csel,Rect2(Point2(completion_rect.pos.x,completion_rect.pos.y+(completion_index-line_from)*get_row_height()),Size2(completion_rect.size.width,get_row_height()))); - - draw_rect(Rect2(completion_rect.pos,Size2(nofs,completion_rect.size.height)),existing); + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(Point2(completion_rect.pos.x,completion_rect.pos.y+(completion_index-line_from)*get_row_height()),Size2(completion_rect.size.width,get_row_height())),cache.completion_selected_color); + draw_rect(Rect2(completion_rect.pos,Size2(nofs,completion_rect.size.height)),cache.completion_existing_color); @@ -3287,6 +3285,9 @@ void TextEdit::_update_caches() { cache.style_normal=get_stylebox("normal"); cache.style_focus=get_stylebox("focus"); + cache.completion_background_color=get_color("completion_background_color"); + cache.completion_selected_color=get_color("completion_selected_color"); + cache.completion_existing_color=get_color("completion_existing_color"); cache.font=get_font("font"); cache.caret_color=get_color("caret_color"); cache.line_number_color=get_color("line_number_color"); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index f01e6de1c9..acac687b59 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -74,6 +74,9 @@ class TextEdit : public Control { Ref<StyleBox> style_normal; Ref<StyleBox> style_focus; Ref<Font> font; + Color completion_background_color; + Color completion_selected_color; + Color completion_existing_color; Color caret_color; Color line_number_color; Color font_color; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 53a186f0c3..db45a998c3 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -470,7 +470,6 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F t->set_font("font","TextEdit", default_font ); t->set_color("completion_scroll_color","TextEdit", control_font_color_pressed ); - t->set_color("completion_existing","TextEdit", control_font_color ); t->set_color("font_color","TextEdit", control_font_color ); t->set_color("font_color_selected","TextEdit", Color(0,0,0) ); t->set_color("selection_color","TextEdit", font_color_selection ); @@ -696,12 +695,6 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F t->set_stylebox("cursor_unfocused","ItemList", focus ); - // TextEdit - - t->set_stylebox("completion_selected","TextEdit", tree_selected ); - - - // TabContainer Ref<StyleBoxTexture> tc_sb = sb_expand( make_stylebox( tab_container_bg_png,4,4,4,4,4,4,4,4),3,3,3,3); |