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

Function MapWndProc

win/win32/mhmap.c:549–664  ·  view source on GitHub ↗

map window procedure */

Source from the content-addressed store, hash-verified

547
548/* map window procedure */
549LRESULT CALLBACK
550MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
551{
552 PNHMapWindow data;
553
554 data = (PNHMapWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
555 switch (message) {
556 case WM_CREATE:
557 onCreate(hWnd, wParam, lParam);
558 break;
559
560 case WM_MSNH_COMMAND:
561 onMSNHCommand(hWnd, wParam, lParam);
562 break;
563
564 case WM_PAINT:
565 onPaint(hWnd);
566 break;
567
568 case WM_SETFOCUS:
569 /* transfer focus back to the main window */
570 SetFocus(GetNHApp()->hMainWnd);
571 break;
572
573 case WM_HSCROLL:
574 onMSNH_HScroll(hWnd, wParam, lParam);
575 break;
576
577 case WM_VSCROLL:
578 onMSNH_VScroll(hWnd, wParam, lParam);
579 break;
580
581 case WM_SIZE: {
582 RECT rt;
583 SIZE size;
584
585 if (data->bFitToScreenMode) {
586 size.cx = LOWORD(lParam);
587 size.cy = HIWORD(lParam);
588 } else {
589 /* mapping factor is unchanged we just need to adjust scroll bars
590 */
591 size.cx = data->xFrontTile * COLNO;
592 size.cy = data->yFrontTile * ROWNO;
593 }
594 mswin_map_layout(hWnd, &size);
595
596 /* update window placement */
597 GetWindowRect(hWnd, &rt);
598 ScreenToClient(GetNHApp()->hMainWnd, (LPPOINT) &rt);
599 ScreenToClient(GetNHApp()->hMainWnd, ((LPPOINT) &rt) + 1);
600 mswin_update_window_placement(NHW_MAP, &rt);
601 } break;
602
603 case WM_MOVE: {
604 RECT rt;
605 GetWindowRect(hWnd, &rt);
606 ScreenToClient(GetNHApp()->hMainWnd, (LPPOINT) &rt);

Callers

nothing calls this directly

Calls 9

mswin_map_layoutFunction · 0.85
dirtyFunction · 0.85
onCreateFunction · 0.70
onMSNHCommandFunction · 0.70
onPaintFunction · 0.70
GetNHAppFunction · 0.70
onMSNH_HScrollFunction · 0.70
onMSNH_VScrollFunction · 0.70

Tested by

no test coverage detected