summaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-04-09 15:17:20 -0300
committerHisham Muhammad <hisham@gobolinux.org>2015-04-09 15:17:20 -0300
commitb1f934c5d51532c334bd2fbe513c8e9d10cd8208 (patch)
tree94ca9aad126276fd7e12bf7cb416742bb6996805 /Panel.c
parent01a29f02674af95e6967cec8c5d1659886931f77 (diff)
Visual tweaks: change color when following, add Broken Gray theme.
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c20
1 files changed, 13 insertions, 7 deletions
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));

© 2014-2024 Faster IT GmbH | imprint | privacy policy