- // finally copy it to screen DC and clean up
- BitBlt(hdc, x, y, nCheckWidth - 1, nCheckHeight,
- hdcMem, 0, 0, SRCCOPY);
-
- SelectObject(hdcMem, hbmpOld);
- DeleteObject(hbmpCheck);
- DeleteDC(hdcMem);
+bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc,
+ const wxRect& rRect,
+ wxODAction eAct,
+ wxODStatus eStat )
+{
+ wxRect vRect = rRect;
+
+
+ wxPMDCImpl *impl = (wxPMDCImpl*) rDc.GetImpl();
+ ::WinQueryWindowRect( m_pParent->GetHWND(), &impl->m_vRclPaint );
+ if (IsChecked())
+ eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
+
+ //
+ // Unfortunately PM doesn't quite get the text position exact. We need to alter
+ // it down and to the right, just a little bit. The coords in rRect are OS/2
+ // coords not wxWidgets coords.
+ //
+ vRect.x += 5;
+ vRect.y -= 3;
+ if (wxOwnerDrawn::OnDrawItem( rDc, vRect, eAct, eStat))
+ {
+ size_t nCheckWidth = GetDefaultMarginWidth();
+ size_t nCheckHeight = m_pParent->GetItemHeight();
+ int nParentHeight;
+ int nX = rRect.GetX();
+ int nY = rRect.GetY();
+ int nOldY = nY;
+ wxColour vColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+ wxPen vPenBack;
+ wxPen vPenPrev;
+
+ m_pParent->GetSize( NULL, &nParentHeight);
+
+ nY = nParentHeight - nY - nCheckHeight;
+ vPenBack = wxPen(vColour, 1, wxSOLID);
+
+ //
+ // Erase the 1-pixel border
+ //
+ rDc.SetPen(vPenBack);
+ rDc.DrawRectangle( nX, nY, nCheckWidth, nCheckHeight );
+
+ //
+ // Now we draw the smaller rectangle
+ //
+ nY++;
+ nCheckWidth -= 2;
+ nCheckHeight -= 2;
+
+ //
+ // Draw hollow gray rectangle
+ //
+ rDc.SetPen(*wxGREY_PEN);
+ rDc.DrawRectangle( nX, nY, nCheckWidth, nCheckHeight );
+
+ nX++;
+ if (IsChecked())
+ {
+ //
+ // Draw the check by loading the sys standard bitmap and drawing it
+ //
+ HBITMAP hChkBmp = ::WinGetSysBitmap( HWND_DESKTOP, SBMP_MENUCHECK );
+ POINTL vPoint = {nX, nOldY + 3};
+ wxPMDCImpl *impl = (wxPMDCImpl*) rDc.GetImpl();
+ ::WinDrawBitmap( impl->GetHPS(),
+ hChkBmp,
+ NULL,
+ &vPoint,
+ NULL,
+ NULL,
+ DBM_NORMAL
+ );
+ }
+ return true;