FreeBSD/contrib/dialog/checklist.c
/*
 * Print list item.  The 'selected' parameter is true if 'choice' is the
 * current item.  That one is colored differently from the other items.
 */
Print list item.  The 'selected' parameter is true if 'choice' is the
current item.  That one is colored differently from the other items.
Print list item . The ' selected ' parameter is true if ' choice ' is the current item . That one is colored differently from the other items .
static void
print_item(ALL_DATA * data,
	   WINDOW *win,
	   DIALOG_LISTITEM * item,
	   const char *states,
	   int choice,
	   int selected)
{
    chtype save = dlg_get_attrs(win);
    int i;
    bool both = (!dialog_vars.no_tags && !dialog_vars.no_items);
    bool first = TRUE;
    int climit = (getmaxx(win) - data->check_x + 1);
    const char *show = (dialog_vars.no_items
			? item->name
			: item->text);
    (void) wattrset(win, menubox_attr);
    (void) wmove(win, choice, 0);
    for (i = 0; i < data->use_width; i++)
	(void) waddch(win, ' ');
    (void) wmove(win, choice, data->check_x);
    (void) wattrset(win, selected ? check_selected_attr : check_attr);
    (void) wprintw(win,
		   (data->checkflag == FLAG_CHECK) ? "[%c]" : "(%c)",
		   states[item->state]);
    (void) wattrset(win, menubox_attr);
    (void) waddch(win, ' ');
    if (both) {
	dlg_print_listitem(win, item->name, climit, first, selected);
	first = FALSE;
    }
    (void) wmove(win, choice, data->item_x);
    dlg_print_listitem(win, show, climit, first, selected);
    if (selected) {
	dlg_item_help(item->help);
    }
    (void) wattrset(win, save);
}
static void print_item ( ALL_DATA * data , WINDOW * win , DIALOG_LISTITEM * item , const char * states , int choice , int selected ) { chtype save = dlg_get_attrs ( win ) ; int i ; bool both = ( ! dialog_vars . no_tags && ! dialog_vars . no_items ) ; bool first = TRUE ; int climit = ( getmaxx ( win ) - data -> check_x + 1 ) ; const char * show = ( dialog_vars . no_items ? item -> name : item -> text ) ; ( void ) wattrset ( win , menubox_attr ) ; ( void ) wmove ( win , choice , 0 ) ; for ( i = 0 ; i < data -> use_width ; i ++ ) ( void ) waddch ( win , ' ' ) ; ( void ) wmove ( win , choice , data -> check_x ) ; ( void ) wattrset ( win , selected ? check_selected_attr : check_attr ) ; ( void ) wprintw ( win , ( data -> checkflag == FLAG_CHECK ) ? " " : " " , states [ item -> state ] ) ; ( void ) wattrset ( win , menubox_attr ) ; ( void ) waddch ( win , ' ' ) ; if ( both ) { dlg_print_listitem ( win , item -> name , climit , first , selected ) ; first = FALSE ; } ( void ) wmove ( win , choice , data -> item_x ) ; dlg_print_listitem ( win , show , climit , first , selected ) ; if ( selected ) { dlg_item_help ( item -> help ) ; } ( void ) wattrset ( win , save ) ; }
Print list item.
Print list item .
/* Clear 'residue' of last item */