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

Function onMeasureItem

outdated/sys/wince/mhmenu.c:846–872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846LRESULT
847onMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
848{
849 LPMEASUREITEMSTRUCT lpmis;
850 TEXTMETRIC tm;
851 HGDIOBJ saveFont;
852 HDC hdc;
853 PNHMenuWindow data;
854 RECT list_rect;
855
856 lpmis = (LPMEASUREITEMSTRUCT) lParam;
857 data = (PNHMenuWindow) GetWindowLong(hWnd, GWL_USERDATA);
858 GetClientRect(GetMenuControl(hWnd), &list_rect);
859
860 hdc = GetDC(GetMenuControl(hWnd));
861 saveFont =
862 SelectObject(hdc, mswin_get_font(NHW_MENU, ATR_INVERSE, hdc, FALSE));
863 GetTextMetrics(hdc, &tm);
864
865 /* Set the height of the list box items. */
866 lpmis->itemHeight = max(tm.tmHeight, TILE_Y) + 2;
867 lpmis->itemWidth = list_rect.right - list_rect.left;
868
869 SelectObject(hdc, saveFont);
870 ReleaseDC(GetMenuControl(hWnd), hdc);
871 return TRUE;
872}
873
874LRESULT
875onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)

Callers 1

MenuWndProcFunction · 0.70

Calls 2

GetMenuControlFunction · 0.70
mswin_get_fontFunction · 0.70

Tested by

no test coverage detected