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

Function ExtCmdDlgProc

outdated/sys/wince/mhdlg.c:186–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186LRESULT CALLBACK
187ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
188{
189 struct extcmd_data *data;
190 RECT main_rt, dlg_rt;
191 SIZE dlg_sz;
192 int i;
193 const char *ptr;
194 TCHAR wbuf[255];
195
196 switch (message) {
197 case WM_INITDIALOG:
198 data = (struct extcmd_data *) lParam;
199 SetWindowLong(hWnd, GWL_USERDATA, lParam);
200
201 /* center dialog in the main window */
202 GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
203 GetWindowRect(hWnd, &dlg_rt);
204 dlg_sz.cx = dlg_rt.right - dlg_rt.left;
205 dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
206
207 dlg_rt.left = (main_rt.left + main_rt.right - dlg_sz.cx) / 2;
208 dlg_rt.right = dlg_rt.left + dlg_sz.cx;
209 dlg_rt.top = (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2;
210 dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
211 MoveWindow(hWnd, (main_rt.left + main_rt.right - dlg_sz.cx) / 2,
212 (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2, dlg_sz.cx,
213 dlg_sz.cy, TRUE);
214
215 /* fill combobox with extended commands */
216 for (i = 0; (ptr = extcmdlist[i].ef_txt); i++) {
217 SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING,
218 (WPARAM) 0,
219 (LPARAM) NH_A2W(ptr, wbuf, sizeof(wbuf)));
220 }
221
222#if defined(WIN_CE_SMARTPHONE)
223 NHSPhoneDialogSetup(hWnd, IDC_SPHONE_DIALOGBAR, FALSE, FALSE);
224
225 GetClientRect(hWnd, &dlg_rt);
226 MoveWindow(GetDlgItem(hWnd, IDC_EXTCMD_LIST), dlg_rt.left, dlg_rt.top,
227 dlg_rt.right - dlg_rt.left, dlg_rt.bottom - dlg_rt.top,
228 TRUE);
229#endif
230
231 /* set focus to the list control */
232 SetFocus(GetDlgItem(hWnd, IDC_EXTCMD_LIST));
233
234 /* tell windows we set the focus */
235 return FALSE;
236 break;
237
238 case WM_COMMAND:
239 data = (struct extcmd_data *) GetWindowLong(hWnd, GWL_USERDATA);
240 switch (LOWORD(wParam)) {
241 /* OK button ws clicked */
242 case IDOK:
243 *data->selection = SendDlgItemMessage(

Callers

nothing calls this directly

Calls 2

NHSPhoneDialogSetupFunction · 0.85
GetNHAppFunction · 0.70

Tested by

no test coverage detected