MCPcopy Create free account
hub / github.com/NetHack/NetHack / menu_select_deselect

Function menu_select_deselect

win/curses/cursdial.c:1662–1694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1660 page than the one currently shown. */
1661
1662static void
1663menu_select_deselect(
1664 WINDOW *win,
1665 nhmenu_item *item,
1666 menu_op operation,
1667 int current_page)
1668{
1669 int curletter = item->accelerator;
1670 boolean visible = (item->page_num == current_page);
1671
1672 if (operation == DESELECT || (item->selected && operation == INVERT)) {
1673 item->selected = FALSE;
1674 item->count = -1L;
1675 if (visible) {
1676 mvwaddch(win, item->line_num + 1, 1, ' ');
1677 curses_toggle_color_attr(win, HIGHLIGHT_COLOR, NONE, ON);
1678 mvwaddch(win, item->line_num + 1, 2, curletter);
1679 curses_toggle_color_attr(win, HIGHLIGHT_COLOR, NONE, OFF);
1680 mvwaddch(win, item->line_num + 1, 3, ')');
1681 }
1682 } else {
1683 item->selected = TRUE;
1684 if (visible) {
1685 curses_toggle_color_attr(win, HIGHLIGHT_COLOR, A_REVERSE, ON);
1686 mvwaddch(win, item->line_num + 1, 1, '<');
1687 mvwaddch(win, item->line_num + 1, 2, curletter);
1688 mvwaddch(win, item->line_num + 1, 3, '>');
1689 curses_toggle_color_attr(win, HIGHLIGHT_COLOR, A_REVERSE, OFF);
1690 }
1691 }
1692 if (visible)
1693 wrefresh(win);
1694}
1695
1696
1697/* Perform the selected operation (select, unselect, invert selection)

Callers 3

menu_get_selectionsFunction · 0.85
menu_operationFunction · 0.85

Calls 1

curses_toggle_color_attrFunction · 0.85

Tested by

no test coverage detected