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

Function mswin_status_window_size

win/win32/mhstatus.c:483–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483void
484mswin_status_window_size(HWND hWnd, LPSIZE sz)
485{
486 RECT rt;
487
488 GetClientRect(hWnd, &rt);
489
490 PNHStatusWindow data = (PNHStatusWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
491 if (data) {
492 HDC hdc = GetDC(hWnd);
493 cached_font * font = mswin_get_font(NHW_STATUS, ATR_NONE, hdc, FALSE);
494 HGDIOBJ saveFont = SelectObject(hdc, font->hFont);
495
496 SIZE text_sz;
497 GetTextExtentPoint32(hdc, _T("W"), 1, &text_sz);
498
499 TEXTMETRIC tm;
500 GetTextMetrics(hdc, &tm);
501
502 rt.bottom = rt.top + text_sz.cy * NHSW_LINES;
503
504 SelectObject(hdc, saveFont);
505 ReleaseDC(hWnd, hdc);
506 }
507 AdjustWindowRect(&rt, GetWindowLong(hWnd, GWL_STYLE), FALSE);
508 sz->cx = rt.right - rt.left;
509 sz->cy = rt.bottom - rt.top;
510}

Callers 1

mswin_layout_main_windowFunction · 0.70

Calls 1

mswin_get_fontFunction · 0.70

Tested by

no test coverage detected