-----------------------------------------------------------------------------*/
| 1011 | } |
| 1012 | /*-----------------------------------------------------------------------------*/ |
| 1013 | BOOL |
| 1014 | onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) |
| 1015 | { |
| 1016 | LPDRAWITEMSTRUCT lpdis; |
| 1017 | PNHMenuItem item; |
| 1018 | PNHMenuWindow data; |
| 1019 | TEXTMETRIC tm; |
| 1020 | HGDIOBJ saveFont; |
| 1021 | HDC tileDC; |
| 1022 | short ntile; |
| 1023 | int t_x, t_y; |
| 1024 | int x, y; |
| 1025 | TCHAR wbuf[BUFSZ]; |
| 1026 | RECT drawRect; |
| 1027 | COLORREF OldBg, OldFg, NewBg; |
| 1028 | char *p, *p1; |
| 1029 | int column; |
| 1030 | int spacing = 0; |
| 1031 | double monitorScale = win10_monitor_scale(hWnd); |
| 1032 | int tileXScaled = (int) (TILE_X * monitorScale); |
| 1033 | int tileYScaled = (int) (TILE_Y * monitorScale); |
| 1034 | |
| 1035 | UNREFERENCED_PARAMETER(wParam); |
| 1036 | |
| 1037 | lpdis = (LPDRAWITEMSTRUCT) lParam; |
| 1038 | |
| 1039 | /* If there are no list box items, skip this message. */ |
| 1040 | if (lpdis->itemID == (UINT) -1) |
| 1041 | return FALSE; |
| 1042 | |
| 1043 | data = (PNHMenuWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); |
| 1044 | |
| 1045 | item = &data->menui.menu.items[lpdis->itemID]; |
| 1046 | |
| 1047 | tileDC = CreateCompatibleDC(lpdis->hDC); |
| 1048 | cached_font * font = mswin_get_font(NHW_MENU, item->attr, lpdis->hDC, FALSE); |
| 1049 | saveFont = SelectObject(lpdis->hDC, font->hFont); |
| 1050 | NewBg = menu_bg_brush ? menu_bg_color |
| 1051 | : (COLORREF) GetSysColor(DEFAULT_COLOR_BG_MENU); |
| 1052 | OldBg = SetBkColor(lpdis->hDC, NewBg); |
| 1053 | OldFg = SetTextColor(lpdis->hDC, |
| 1054 | menu_fg_brush |
| 1055 | ? menu_fg_color |
| 1056 | : (COLORREF) GetSysColor(DEFAULT_COLOR_FG_MENU)); |
| 1057 | |
| 1058 | if (item->color != NO_COLOR) |
| 1059 | (void) SetTextColor(lpdis->hDC, nhcolor_to_RGB(item->color)); |
| 1060 | |
| 1061 | GetTextMetrics(lpdis->hDC, &tm); |
| 1062 | spacing = tm.tmAveCharWidth; |
| 1063 | |
| 1064 | /* set initial offset */ |
| 1065 | x = lpdis->rcItem.left + 1; |
| 1066 | |
| 1067 | /* print check mark and letter */ |
| 1068 | if (NHMENU_IS_SELECTABLE(*item)) { |
| 1069 | char buf[2]; |
| 1070 | if (data->how != PICK_NONE) { |
no test coverage detected