MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / DrawItem

Function DrawItem

Libraries/PropertyGrid/PropertyGrid.h:1168–1243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1166 // Overridables
1167
1168 void DrawItem(CDCHandle dc, int iItem, int iSubItem, UINT iState)
1169 {
1170 bool bIsAppendActionItem = _IsAppendActionItem(iItem);
1171 if( bIsAppendActionItem && iSubItem != 0 ) return;
1172
1173 IProperty* prop = GetProperty(iItem, iSubItem);
1174 if( prop == NULL ) return;
1175
1176 // Figure out rectangle
1177 RECT rc = { 0 };
1178 _GetSubItemRect(iItem, iSubItem, &rc);
1179
1180 // Draw properties
1181 PROPERTYDRAWINFO di = m_di;
1182 di.hDC = dc;
1183 di.rcItem = rc;
1184
1185 di.state = 0;
1186 if( iItem == m_iSelectedRow && iSubItem == m_iSelectedCol ) di.state |= ODS_SELECTED;
1187 if( iItem == m_iInplaceRow && iSubItem == m_iInplaceCol ) di.state |= ODS_COMBOBOXEDIT;
1188 if( !prop->IsEnabled() ) di.state |= ODS_DISABLED;
1189
1190 if( iItem == m_iSelectedRow ) {
1191 // Full row-select feature
1192 if( (m_di.dwExtStyle & PGS_EX_FULLROWSELECT) != 0 ) {
1193 di.clrBack = di.clrDisabledBack;
1194 }
1195 // Is this the selected sub-item
1196 if( iSubItem == m_iSelectedCol ) {
1197 di.state |= ODS_SELECTED;
1198 // Selection inverted feature
1199 if( (m_di.dwExtStyle & PGS_EX_INVERTSELECTION) != 0 ) {
1200 di.clrBack = di.clrSelBack;
1201 di.clrText = di.clrSelText;
1202 }
1203 }
1204 }
1205
1206 // A disabled ListView control is painted grey on Win2000
1207 // but the text remains black...
1208 DWORD dwStyle = GetStyle();
1209 if( (dwStyle & WS_DISABLED) != 0 ) di.clrBack = di.clrDisabledBack;
1210
1211 // Erase background
1212 dc.FillSolidRect(&rc, di.clrBack);
1213
1214 // Draw item
1215 HFONT hOldFont = dc.SelectFont(di.TextFont);
1216 prop->DrawValue(di);
1217 dc.SelectFont(hOldFont);
1218
1219 // Draw borders
1220 if( (di.dwExtStyle & PGS_EX_NOGRID) == 0 ) {
1221 CPen pen;
1222 pen.CreatePen(PS_SOLID, 1, di.clrBorder);
1223 HPEN hOldPen = dc.SelectPen(pen);
1224 dc.MoveTo(rc.left, rc.bottom-1);
1225 dc.LineTo(rc.right - 1, rc.bottom - 1);

Callers

nothing calls this directly

Calls 5

_IsAppendActionItemFunction · 0.85
_GetSubItemRectFunction · 0.85
IsEnabledMethod · 0.80
GetPropertyFunction · 0.70
DrawValueMethod · 0.45

Tested by

no test coverage detected