summaryrefslogtreecommitdiff
path: root/scripts/kconfig/lxdialog/menubox.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-07-24 23:40:46 +0400
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-30 13:19:19 +0400
commit98e5a1579e7d34fe3803240750a1c48efcd9cb15 (patch)
tree433f6b354eb0bb6fa01f325237f9f4651bf5ac9f /scripts/kconfig/lxdialog/menubox.c
parentbf603625660b1742004bf86432ce3c210d14d4fd (diff)
downloadlinux-98e5a1579e7d34fe3803240750a1c48efcd9cb15.tar.xz
kconfig/lxdialog: refactor color support
Clean up and refactor color support. All color support are now in util.c including color definitions. In the process introduced a global variable named 'dlg' which is used all over to set color - thats the reason why all files are changed. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/lxdialog/menubox.c')
-rw-r--r--scripts/kconfig/lxdialog/menubox.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index bf8052f4fd4a..ff991db827bd 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -74,7 +74,7 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
j = first_alpha(menu_item, "YyNnMmHh");
/* Clear 'residue' of last item */
- wattrset(win, menubox_attr);
+ wattrset(win, dlg.menubox.atr);
wmove(win, choice, 0);
#if OLD_NCURSES
{
@@ -85,10 +85,11 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
#else
wclrtoeol(win);
#endif
- wattrset(win, selected ? item_selected_attr : item_attr);
+ wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
mvwaddstr(win, choice, item_x, menu_item);
if (hotkey) {
- wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
+ wattrset(win, selected ? dlg.tag_key_selected.atr
+ : dlg.tag_key.atr);
mvwaddch(win, choice, item_x + j, menu_item[j]);
}
if (selected) {
@@ -117,11 +118,11 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
wmove(win, y, x);
if (scroll > 0) {
- wattrset(win, uarrow_attr);
+ wattrset(win, dlg.uarrow.atr);
waddch(win, ACS_UARROW);
waddstr(win, "(-)");
} else {
- wattrset(win, menubox_attr);
+ wattrset(win, dlg.menubox.atr);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
@@ -133,11 +134,11 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
wrefresh(win);
if ((height < item_no) && (scroll + height < item_no)) {
- wattrset(win, darrow_attr);
+ wattrset(win, dlg.darrow.atr);
waddch(win, ACS_DARROW);
waddstr(win, "(+)");
} else {
- wattrset(win, menubox_border_attr);
+ wattrset(win, dlg.menubox_border.atr);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
waddch(win, ACS_HLINE);
@@ -199,18 +200,19 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
- draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
- wattrset(dialog, border_attr);
+ draw_box(dialog, 0, 0, height, width,
+ dlg.dialog.atr, dlg.border.atr);
+ wattrset(dialog, dlg.border.atr);
mvwaddch(dialog, height - 3, 0, ACS_LTEE);
for (i = 0; i < width - 2; i++)
waddch(dialog, ACS_HLINE);
- wattrset(dialog, dialog_attr);
- wbkgdset(dialog, dialog_attr & A_COLOR);
+ wattrset(dialog, dlg.dialog.atr);
+ wbkgdset(dialog, dlg.dialog.atr & A_COLOR);
waddch(dialog, ACS_RTEE);
print_title(dialog, title, width);
- wattrset(dialog, dialog_attr);
+ wattrset(dialog, dlg.dialog.atr);
print_autowrap(dialog, prompt, width - 2, 1, 3);
menu_width = width - 6;
@@ -224,7 +226,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
/* draw a box around the menu items */
draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
- menubox_border_attr, menubox_attr);
+ dlg.menubox_border.atr, dlg.menubox.atr);
item_x = (menu_width - 70) / 2;