From b1f934c5d51532c334bd2fbe513c8e9d10cd8208 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 9 Apr 2015 15:17:20 -0300 Subject: Visual tweaks: change color when following, add Broken Gray theme. --- Panel.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Panel.c') diff --git a/Panel.c b/Panel.c index 7428dda6..c4265266 100644 --- a/Panel.c +++ b/Panel.c @@ -68,6 +68,7 @@ struct Panel_ { FunctionBar* currentBar; FunctionBar* defaultBar; RichString header; + int selectionColor; }; #define Panel_setDefaultBar(this_) do{ (this_)->currentBar = (this_)->defaultBar; }while(0) @@ -123,6 +124,7 @@ void Panel_init(Panel* this, int x, int y, int w, int h, ObjectClass* type, bool RichString_beginAllocated(this->header); this->defaultBar = fuBar; this->currentBar = fuBar; + this->selectionColor = CRT_colors[PANEL_SELECTION_FOCUS]; } void Panel_done(Panel* this) { @@ -133,6 +135,10 @@ void Panel_done(Panel* this) { RichString_end(this->header); } +void Panel_setSelectionColor(Panel* this, int color) { + this->selectionColor = color; +} + RichString* Panel_getHeader(Panel* this) { assert (this != NULL); @@ -301,9 +307,9 @@ void Panel_draw(Panel* this, bool focus) { int first = this->scrollV; int upTo = MIN(first + h, size); - int highlight = focus - ? CRT_colors[PANEL_HIGHLIGHT_FOCUS] - : CRT_colors[PANEL_HIGHLIGHT_UNFOCUS]; + int selectionColor = focus + ? this->selectionColor + : CRT_colors[PANEL_SELECTION_UNFOCUS]; if (this->needsRedraw) { int line = 0; @@ -316,8 +322,8 @@ void Panel_draw(Panel* this, bool focus) { int amt = MIN(itemLen - scrollH, this->w); bool selected = (i == this->selected); if (selected) { - attrset(highlight); - RichString_setAttr(&item, highlight); + attrset(selectionColor); + RichString_setAttr(&item, selectionColor); } mvhline(y + line, x, ' ', this->w); if (amt > 0) @@ -347,9 +353,9 @@ void Panel_draw(Panel* this, bool focus) { if (scrollH < oldLen) RichString_printoffnVal(old, y+this->oldSelected - first, x, scrollH, MIN(oldLen - scrollH, this->w)); - attrset(highlight); + attrset(selectionColor); mvhline(y+this->selected - first, x+0, ' ', this->w); - RichString_setAttr(&new, highlight); + RichString_setAttr(&new, selectionColor); if (scrollH < newLen) RichString_printoffnVal(new, y+this->selected - first, x, scrollH, MIN(newLen - scrollH, this->w)); -- cgit v1.2.3