Lines Matching +full:c +full:- +full:states
2 * $Id: treeview.c,v 1.43 2020/11/23 00:38:31 tom Exp $
4 * treeview.c -- implements the treeview dialog
6 * Copyright 2012-2019,2020 Thomas E. Dickey
31 /* the outer-window */
40 /* the inner-window */
45 const char *states; member
55 const char *states, in print_item() argument
60 WINDOW *win = data->list; in print_item()
64 int climit = (getmaxx(win) - data->check_x + 1); in print_item()
66 ? item->name in print_item()
67 : item->text); in print_item()
72 for (i = 0; i < data->use_width; i++) in print_item()
75 (void) wmove(win, choice, data->check_x); in print_item()
78 data->is_check ? "[%c]" : "(%c)", in print_item()
79 states[item->state]); in print_item()
85 (void) wmove(win, choice, data->item_x + INDENT * i); in print_item()
87 for (j = INDENT - 1; j > 0; --j) in print_item()
90 (void) wmove(win, choice, data->item_x + INDENT * depths); in print_item()
95 dlg_item_help(item->help); in print_item()
109 getyx(data->dialog, cur_y, cur_x); in print_list()
113 &data->items[scrollamt + i], in print_list()
114 data->states, in print_list()
115 data->depths[scrollamt + i], in print_list()
118 (void) wnoutrefresh(data->list); in print_list()
120 dlg_draw_scrollbar(data->dialog, in print_list()
124 (long) (data->item_no), in print_list()
125 data->box_x + data->check_x, in print_list()
126 data->box_x + data->use_width, in print_list()
127 data->box_y, in print_list()
128 data->box_y + data->use_height + 1, in print_list()
132 (void) wmove(data->dialog, cur_y, cur_x); in print_list()
151 * to read the list item states back directly without putting them in the
162 const char *states, in dlg_treeview() argument
167 /* *INDENT-OFF* */ in dlg_treeview()
181 DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ), in dlg_treeview()
191 /* *INDENT-ON* */ in dlg_treeview()
200 int button = dialog_state.visit_items ? -1 : dlg_default_button(); in dlg_treeview()
213 /* we need at least two states */ in dlg_treeview()
214 if (states == 0 || strlen(states) < 2) in dlg_treeview()
215 states = " *"; in dlg_treeview()
216 num_states = (int) strlen(states); in dlg_treeview()
223 all.states = states; in dlg_treeview()
284 all.use_width = width - 4; in dlg_treeview()
287 box_x = (width - all.use_width) / 2 - 1; in dlg_treeview()
291 * Limit the list to avoid overwriting the ok-button. in dlg_treeview()
293 use_height = height - MIN_HIGH - cur_y; in dlg_treeview()
326 use_width = (all.use_width - 4); in dlg_treeview()
329 all.check_x = (use_width - tree_width) / 2; in dlg_treeview()
339 scrollamt = choice - max_choice + 1; in dlg_treeview()
340 choice = max_choice - 1; in dlg_treeview()
355 dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); in dlg_treeview()
362 if (button < 0) /* --visit-items */ in dlg_treeview()
373 key -= M_EVENT; in dlg_treeview()
376 i = (key - KEY_MAX); in dlg_treeview()
378 choice = (key - KEY_MAX); in dlg_treeview()
430 i = j - scrollamt; in dlg_treeview()
438 i = j - scrollamt; in dlg_treeview()
453 * A single digit (1-9) positions the selection to that line in the in dlg_treeview()
459 && (key - '1' < max_choice)) { in dlg_treeview()
461 i = key - '1'; in dlg_treeview()
469 i = -scrollamt; in dlg_treeview()
472 i = item_no - 1 - scrollamt; in dlg_treeview()
478 i = -MIN(scrollamt, max_choice); in dlg_treeview()
483 i = MIN(choice + max_choice, item_no - scrollamt - 1); in dlg_treeview()
486 i = choice - 1; in dlg_treeview()
492 if (scrollamt + choice >= item_no - 1) in dlg_treeview()
509 choice = max_choice - 1; in dlg_treeview()
510 scrollamt += (i - max_choice + 1); in dlg_treeview()
531 dlg_draw_buttons(dialog, height - 2, 0, buttons, button, in dlg_treeview()
536 dlg_draw_buttons(dialog, height - 2, 0, buttons, button, in dlg_treeview()