Add support for drawing highlighted decoration
This allows for drawing selected scroll windows and list boxes with a highlighted border. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
fbd0651615
commit
4210fdd38a
@ -822,7 +822,7 @@ void listbox_delete(struct listbox *);
|
||||
void listbox_resize(struct listbox *, int, int, int, int);
|
||||
void listbox_set_cb_data(struct listbox *, void *);
|
||||
void listbox_load_items(struct listbox *, int);
|
||||
void listbox_draw_deco(struct listbox *);
|
||||
void listbox_draw_deco(struct listbox *, int);
|
||||
void listbox_display(struct listbox *);
|
||||
int listbox_get_sel(struct listbox *);
|
||||
void listbox_set_sel(struct listbox *, unsigned);
|
||||
@ -1081,7 +1081,7 @@ void wins_scrollwin_init(struct scrollwin *, int, int, int, int, const char *);
|
||||
void wins_scrollwin_resize(struct scrollwin *, int, int, int, int);
|
||||
void wins_scrollwin_set_linecount(struct scrollwin *, unsigned);
|
||||
void wins_scrollwin_delete(struct scrollwin *);
|
||||
void wins_scrollwin_draw_deco(struct scrollwin *);
|
||||
void wins_scrollwin_draw_deco(struct scrollwin *, int);
|
||||
void wins_scrollwin_display(struct scrollwin *);
|
||||
void wins_scrollwin_up(struct scrollwin *, int);
|
||||
void wins_scrollwin_down(struct scrollwin *, int);
|
||||
|
@ -774,7 +774,7 @@ void custom_general_config(void)
|
||||
_("general options"), general_option_height,
|
||||
print_general_option);
|
||||
listbox_load_items(&lb, 10);
|
||||
listbox_draw_deco(&lb);
|
||||
listbox_draw_deco(&lb, 0);
|
||||
status_mesg("", "");
|
||||
listbox_display(&lb);
|
||||
|
||||
@ -795,7 +795,7 @@ void custom_general_config(void)
|
||||
resize = 0;
|
||||
wins_reset_noupdate();
|
||||
listbox_resize(&lb, 0, 0, notify_bar() ? row - 3 : row - 2, col);
|
||||
listbox_draw_deco(&lb);
|
||||
listbox_draw_deco(&lb, 0);
|
||||
delwin(win[STA].p);
|
||||
win[STA].p = newwin(win[STA].h, win[STA].w, win[STA].y, win[STA].x);
|
||||
keypad(win[STA].p, TRUE);
|
||||
@ -910,7 +910,7 @@ void custom_keys_config(void)
|
||||
nbdisplayed = ((notify_bar() ? row - 3 : row - 2) - LABELLINES) / LINESPERKEY;
|
||||
wins_scrollwin_init(&kwin, 0, 0, notify_bar() ? row - 3 : row - 2, col, _("keys configuration"));
|
||||
wins_scrollwin_set_linecount(&kwin, NBKEYS * LINESPERKEY);
|
||||
wins_scrollwin_draw_deco(&kwin);
|
||||
wins_scrollwin_draw_deco(&kwin, 0);
|
||||
custom_keys_config_bar();
|
||||
selrow = selelm = 0;
|
||||
nbrowelm = print_keys_bindings(kwin.inner, selrow, selelm, LINESPERKEY);
|
||||
|
@ -89,9 +89,9 @@ void listbox_load_items(struct listbox *lb, int item_count)
|
||||
wins_scrollwin_set_linecount(&(lb->sw), ch);
|
||||
}
|
||||
|
||||
void listbox_draw_deco(struct listbox *lb)
|
||||
void listbox_draw_deco(struct listbox *lb, int hilt)
|
||||
{
|
||||
wins_scrollwin_draw_deco(&(lb->sw));
|
||||
wins_scrollwin_draw_deco(&(lb->sw), hilt);
|
||||
}
|
||||
|
||||
void listbox_display(struct listbox *lb)
|
||||
|
@ -763,7 +763,7 @@ void notify_config_bar(void)
|
||||
clear();
|
||||
listbox_init(&lb, 0, 0, notify_bar() ? row - 3 : row - 2, col, _("notification options"), config_option_height, print_config_option);
|
||||
listbox_load_items(&lb, 8);
|
||||
listbox_draw_deco(&lb);
|
||||
listbox_draw_deco(&lb, 0);
|
||||
status_mesg("", "");
|
||||
listbox_display(&lb);
|
||||
|
||||
@ -785,7 +785,7 @@ void notify_config_bar(void)
|
||||
wins_get_config();
|
||||
wins_reset_noupdate();
|
||||
listbox_resize(&lb, 0, 0, notify_bar() ? row - 3 : row - 2, col);
|
||||
listbox_draw_deco(&lb);
|
||||
listbox_draw_deco(&lb, 0);
|
||||
delwin(win[STA].p);
|
||||
win[STA].p =
|
||||
newwin(win[STA].h, win[STA].w, win[STA].y,
|
||||
|
13
src/wins.c
13
src/wins.c
@ -325,17 +325,24 @@ void wins_scrollwin_delete(struct scrollwin *sw)
|
||||
}
|
||||
|
||||
/* Draw window border and label. */
|
||||
void wins_scrollwin_draw_deco(struct scrollwin *sw)
|
||||
void wins_scrollwin_draw_deco(struct scrollwin *sw, int hilt)
|
||||
{
|
||||
if (hilt)
|
||||
wattron(sw->win, A_BOLD | COLOR_PAIR(COLR_CUSTOM));
|
||||
|
||||
box(sw->win, 0, 0);
|
||||
|
||||
if (!conf.compact_panels) {
|
||||
mvwaddch(sw->win, 2, 0, ACS_LTEE);
|
||||
mvwhline(sw->win, 2, 1, ACS_HLINE, sw->w - 2);
|
||||
mvwaddch(sw->win, 2, sw->w - 1, ACS_RTEE);
|
||||
|
||||
print_in_middle(sw->win, 1, 0, sw->w, sw->label);
|
||||
}
|
||||
|
||||
if (hilt)
|
||||
wattroff(sw->win, A_BOLD | COLOR_PAIR(COLR_CUSTOM));
|
||||
|
||||
if (!conf.compact_panels)
|
||||
print_in_middle(sw->win, 1, 0, sw->w, sw->label);
|
||||
}
|
||||
|
||||
/* Display a scrolling window. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user