- (void)SelectObject(hdc, hPrevBrush);
- (void)SelectObject(hdc, hPrevFont);
- (void)SetBkMode(hdc, nPrevMode);
- #else
- dc.SetFont(GetFont());
- dc.DrawText(m_strName, x, rc.y);
- #endif //O_DRAW_NATIVE_API
-
- // draw the bitmap
- // ---------------
- if ( IsCheckable() && !m_bmpChecked.Ok() ) {
- if ( st & wxODChecked ) {
- // using native APIs for performance and simplicity
-#ifdef O_DRAW_NATIVE_API
- // what goes on: DrawFrameControl creates a b/w mask,
- // then we copy it to screen to have right colors
-
- // first create a monochrome bitmap in a memory DC
- HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hbmpCheck = CreateBitmap(GetMarginWidth(), m_nHeight, 1, 1, 0);
- SelectObject(hdcMem, hbmpCheck);
-
- // then draw a check mark into it
- RECT rect = { 0, 0, GetMarginWidth(), m_nHeight };
- if ( m_nHeight > 0 )
- {
-#ifndef __SC__
- DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
-#endif
- }
-
- // finally copy it to screen DC and clean up
- BitBlt(hdc, rc.x, rc.y, GetMarginWidth(), m_nHeight,
- hdcMem, 0, 0, SRCCOPY);
-
- DeleteDC(hdcMem);
- DeleteObject(hbmpCheck);
-#else
- // #### to do: perhaps using Marlett font (create equiv. font under X)
-// wxFAIL("not implemented");
-#endif //O_DRAW_NATIVE_API
- }
- }
- else {
- // for uncheckable item we use only the 'checked' bitmap
- wxBitmap bmp(GetBitmap(IsCheckable() ? ((st & wxODChecked) != 0) : TRUE));
- if ( bmp.Ok() ) {
- wxMemoryDC dcMem(&dc);
- dcMem.SelectObject(bmp);
-
- // center bitmap
- int nBmpWidth = bmp.GetWidth(),
- nBmpHeight = bmp.GetHeight();
-
- // there should be enough place!
- wxASSERT((nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight()));
-
- int heightDiff = (m_nHeight - nBmpHeight);
-// if (heightDiff = -1)
-// heightDiff = -2;
-
- //MT: blit with mask enabled.
- dc.Blit(rc.x + (GetMarginWidth() - nBmpWidth) / 2,
- rc.y + heightDiff / 2,
- nBmpWidth, nBmpHeight,
- &dcMem, 0, 0, wxCOPY, TRUE);
-
- if ( st & wxODSelected ) {
- #ifdef O_DRAW_NATIVE_API
- RECT rectBmp = { rc.GetLeft(), rc.GetTop(),
- rc.GetLeft() + GetMarginWidth(),
- rc.GetTop() + m_nHeight };
- SetBkColor(hdc, colBack);
- DrawEdge(hdc, &rectBmp, EDGE_RAISED, BF_SOFT | BF_RECT);
- #else
- // ## to write portable DrawEdge
- #endif //O_DRAW_NATIVE_API
- }
- }
- }