- m_bChecked = FALSE;
- m_pParent = pParent;
- m_nIndex = nIndex;
-
- // we don't initialize m_nCheckHeight/Width vars because it's
- // done in OnMeasure while they are used only in OnDraw and we
- // know that there will always be OnMeasure before OnDraw
-
- // fix appearance
- SetMarginWidth(GetDefaultMarginWidth());
-}
-
-/*
- * JACS - I've got the owner-draw stuff partially working with WIN16,
- * with a really horrible-looking cross for wxCheckListBox instead of a
- * check - could use a bitmap check-mark instead, defined in wx.rc.
- * Also there's a refresh problem whereby it doesn't always draw the
- * check until you click to the right of it, which is OK for WIN32.
- */
-
-bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
- wxODAction act, wxODStatus stat)
-{
- if ( IsChecked() )
- stat = (wxOwnerDrawn::wxODStatus)(stat | wxOwnerDrawn::wxODChecked);
-
-// TODO:
-/*
-
- if ( wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) ) {
- // ## using native API for performance and precision
- size_t nCheckWidth = GetDefaultMarginWidth(),
- nCheckHeight = m_pParent->GetItemHeight();
-
- int x = rc.GetX(),
- y = rc.GetY();
-
- HDC hdc = (HDC)dc.GetHDC();
-
- // create pens
- HPEN hpenBack = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_WINDOW)),
- hpenGray = CreatePen(PS_SOLID, 0, RGB(128, 128, 128)),
- hpenPrev = (HPEN)SelectObject(hdc, hpenBack);
-
- // we erase the 1-pixel border
- Rectangle(hdc, x, y, x + nCheckWidth, y + nCheckHeight);
-
- // shift check mark 1 pixel to the right (it looks better like this)
- x++;
-
- if ( IsChecked() ) {
- // first create a monochrome bitmap in a memory DC
- HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hbmpCheck = CreateBitmap(nCheckWidth, nCheckHeight, 1, 1, 0);
- HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpCheck);
-
- // then draw a check mark into it
- RECT rect ;
- rect.left = 0 ;
- rect.top = 0 ;
- rect.right = nCheckWidth ;
- rect.bottom = nCheckHeight ;
-
-#ifdef __WIN32__
-#ifndef __SC__
- DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
-#endif
-#else
- // In WIN16, draw a cross
- HPEN blackPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
- HPEN whiteBrush = (HPEN)GetStockObject(WHITE_BRUSH);
- HPEN hPenOld = (HPEN)::SelectObject(hdcMem, blackPen);
- HPEN hBrushOld = (HPEN)::SelectObject(hdcMem, whiteBrush);
- ::SetROP2(hdcMem, R2_COPYPEN);
- Rectangle(hdcMem, 0, 0, nCheckWidth, nCheckHeight);
- MoveTo(hdcMem, 0, 0);
- LineTo(hdcMem, nCheckWidth, nCheckHeight);
- MoveTo(hdcMem, nCheckWidth, 0);
- LineTo(hdcMem, 0, nCheckHeight);
- ::SelectObject(hdcMem, hPenOld);
- ::SelectObject(hdcMem, hBrushOld);
- ::DeleteObject(blackPen);
-#endif
-
- // 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);
- }