MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / DrawItem

Method DrawItem

Ext2Mgr/TreeList.cpp:100–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void CTreeList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
101{
102 PULONG pMagic = (PULONG) lpDrawItemStruct->itemData;
103
104 TCHAR lpBuffer[256];
105 LV_ITEM lvi;
106 LV_COLUMN lvc, lvcprev ;
107
108 memset(lpBuffer, 0, 256);
109 lvi.mask = LVIF_TEXT | LVIF_PARAM ;
110 lvi.iItem = lpDrawItemStruct->itemID ;
111 lvi.iSubItem = 0;
112 lvi.pszText = lpBuffer ;
113 lvi.cchTextMax = sizeof(lpBuffer);
114 GetItem(&lvi);
115 ::ZeroMemory(&lvc, sizeof(lvc));
116 ::ZeroMemory(&lvcprev, sizeof(lvcprev));
117 lvc.mask = LVCF_WIDTH |LVCF_FMT;
118 lvcprev.mask = LVCF_WIDTH | LVCF_FMT;
119
120 CDC* pDC;
121 pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
122 int nCol;
123 CRect rcText = lpDrawItemStruct->rcItem;
124
125 CFont Fnt, *pOldFont = NULL;
126 LOGFONT lf;
127
128 int cyPixels = pDC->GetDeviceCaps(LOGPIXELSY);
129 memset(&lf, 0, sizeof(LOGFONT));
130
131 if (pMagic == NULL) {
132 return;
133 }
134
135 if (*pMagic == EXT2_CDROM_DEVICE_MAGIC || *pMagic == EXT2_DISK_MAGIC) {
136
137 if (IsVistaOrAbove()) {
138 lstrcpy(lf.lfFaceName, "MS Sans Serif"); /*Courier New*/
139 lf.lfHeight = -MulDiv(8, cyPixels, 72);
140 lf.lfWeight = TRUE;
141 } else {
142 lstrcpy(lf.lfFaceName, "Arial Black"); /*Courier New*/
143 lf.lfHeight = -MulDiv(8, cyPixels, 72);
144 lf.lfWeight = TRUE;
145 }
146 } else {
147 lstrcpy(lf.lfFaceName, "MS Sans Serif");
148 lf.lfHeight = -MulDiv(8, cyPixels, 72);
149 }
150
151 Fnt.CreateFontIndirect(&lf);
152 pOldFont = (CFont *) pDC->SelectObject(&Fnt);
153
154 /* loading bitmap */
155 if (m_hBitmap == NULL) {
156 m_hBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL),
157 MAKEINTRESOURCE(IDB_LINE_SEP),

Callers

nothing calls this directly

Calls 1

IsVistaOrAboveFunction · 0.85

Tested by

no test coverage detected