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

Function mswin_menu_window_select_menu

outdated/sys/wince/mhmenu.c:103–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103int
104mswin_menu_window_select_menu(HWND hWnd, int how, MENU_ITEM_P **_selected)
105{
106 PNHMenuWindow data;
107 int ret_val;
108 MENU_ITEM_P *selected = NULL;
109 int i;
110 char *ap;
111 char accell_str[256];
112
113 assert(_selected != NULL);
114 *_selected = NULL;
115 ret_val = -1;
116
117 data = (PNHMenuWindow) GetWindowLong(hWnd, GWL_USERDATA);
118
119 /* set menu type */
120 SetMenuListType(hWnd, how);
121
122 /* Ok, now give items a unique accelerators */
123 ZeroMemory(accell_str, sizeof(accell_str));
124 ap = accell_str;
125
126#if defined(WIN_CE_SMARTPHONE)
127 if (data->menu.size > 10) {
128 *ap++ = MENU_FIRST_PAGE;
129 *ap++ = MENU_LAST_PAGE;
130 *ap++ = MENU_NEXT_PAGE;
131 *ap++ = MENU_PREVIOUS_PAGE;
132 if (data->how == PICK_ANY) {
133 *ap++ = MENU_SELECT_ALL;
134 *ap++ = MENU_UNSELECT_ALL;
135 *ap++ = MENU_INVERT_ALL;
136 *ap++ = MENU_SELECT_PAGE;
137 *ap++ = MENU_UNSELECT_PAGE;
138 *ap++ = MENU_INVERT_PAGE;
139 }
140 *ap++ = MENU_SEARCH;
141 }
142#endif
143
144 if (data->type == MENU_TYPE_MENU) {
145 char next_char = 'a';
146
147 for (i = 0; i < data->menu.size; i++) {
148 if (data->menu.items[i].accelerator != 0) {
149 *ap++ = data->menu.items[i].accelerator;
150 next_char = (char) (data->menu.items[i].accelerator + 1);
151 } else if (NHMENU_IS_SELECTABLE(data->menu.items[i])) {
152 if ((next_char >= 'a' && next_char <= 'z')
153 || (next_char >= 'A' && next_char <= 'Z')) {
154 data->menu.items[i].accelerator = next_char;
155 *ap++ = data->menu.items[i].accelerator;
156 } else {
157 if (next_char > 'z')
158 next_char = 'A';
159 else if (next_char > 'Z')
160 break;

Callers 2

mswin_display_nhwindowFunction · 0.70
mswin_select_menuFunction · 0.70

Calls 7

NHSPhoneSetKeypadDefaultFunction · 0.85
SetMenuListTypeFunction · 0.70
reset_menu_countFunction · 0.70
mswin_popup_displayFunction · 0.70
mswin_popup_destroyFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected