MCPcopy Index your code
hub / github.com/NetHack/NetHack / mac_select_menu

Function mac_select_menu

outdated/sys/mac/macwin.c:2035–2083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2033}
2034
2035int
2036mac_select_menu(winid win, int how, menu_item **selected_list)
2037{
2038 int c;
2039 NhWindow *aWin = &theWindows[win];
2040 WindowPtr theWin = aWin->its_window;
2041
2042 inSelect = win;
2043
2044 mac_display_nhwindow(win, FALSE);
2045
2046 aWin->how = (short) how;
2047 for (;;) {
2048 c = map_menu_cmd(mac_nhgetch());
2049 if (c == CHAR_ESC) {
2050 /* deselect everything */
2051 aWin->miSelLen = 0;
2052 break;
2053 } else if (ClosingWindowChar(c)) {
2054 break;
2055 } else {
2056 nhbell();
2057 }
2058 }
2059
2060 HideWindow(theWin);
2061
2062 if (aWin->miSelLen) {
2063 menu_item *mp;
2064 MacMHMenuItem *mi;
2065 *selected_list = mp =
2066 (menu_item *) alloc(aWin->miSelLen * sizeof(menu_item));
2067 HLock((char **) aWin->menuInfo);
2068 HLock((char **) aWin->menuSelected);
2069 for (c = 0; c < aWin->miSelLen; c++) {
2070 mi = &(*aWin->menuInfo)[(*aWin->menuSelected)[c]];
2071 mp->item = mi->id;
2072 mp->count = -1L;
2073 mp++;
2074 }
2075 HUnlock((char **) aWin->menuInfo);
2076 HUnlock((char **) aWin->menuSelected);
2077 } else
2078 *selected_list = 0;
2079
2080 inSelect = WIN_ERR;
2081
2082 return aWin->miSelLen;
2083}
2084
2085#include "dlb.h"
2086

Callers

nothing calls this directly

Calls 5

mac_display_nhwindowFunction · 0.85
map_menu_cmdFunction · 0.85
mac_nhgetchFunction · 0.85
ClosingWindowCharFunction · 0.85
allocFunction · 0.50

Tested by

no test coverage detected