- //
- // Now draw the accel text
- //
- if (bFoundAccel)
- {
- size_t nWidth;
- size_t nHeight;
-
- rDC.GetTextExtent( sAccel
- ,(long *)&nWidth
- ,(long *)&nHeight
- );
- //
- // Back off the starting position from the right edge
- //
- rDC.DrawText( sAccel
- ,rRect.width - (nWidth + 7) // this seems to mimic the default OS/2 positioning
- ,rRect.y + 4
- );
- }
-
- //
- // Draw the bitmap
- // ---------------
- //
- if (IsCheckable() && !m_bmpChecked.Ok())
- {
- if (eStatus & wxODChecked)
- {
- RECTL vRect;
- HBITMAP hBmpCheck = ::WinGetSysBitmap(HWND_DESKTOP, SBMP_MENUCHECK);
-
- vRect.xLeft = rRect.x;
- vRect.xRight = rRect.x + GetMarginWidth();
- vRect.yBottom = rRect.y;
- vRect.yTop = rRect.y + m_nHeight - 3;
-
- ::WinDrawBitmap( hPS // PS for this menuitem
- ,hBmpCheck // system checkmark
- ,NULL // draw the whole bitmap
- ,(PPOINTL)&vRect // destination -- bottom left corner of the menuitem area
- ,0L // ignored
- ,0L // draw a bitmap
- ,DBM_NORMAL // draw normal size
- );
- }
- }
- else
- {
- //
- // For uncheckable item we use only the 'checked' bitmap
- //
- wxBitmap vBmp(GetBitmap(IsCheckable() ? ((eStatus & wxODChecked) != 0) : TRUE));
-
- if (vBmp.Ok())
- {
- wxMemoryDC vDCMem(&rDC);
-
- vDCMem.SelectObject(vBmp);
-
- //
- // Center bitmap
- //
- int nBmpWidth = vBmp.GetWidth();
- int nBmpHeight = vBmp.GetHeight();
-
- //
- // There should be enough space!
- //
- wxASSERT((nBmpWidth <= rRect.width) && (nBmpHeight <= rRect.height));
-
- //
- //MT: blit with mask enabled.
- //
- rDC.Blit( rRect.x + (GetMarginWidth() - nBmpWidth) / 2
- ,rRect.y + (m_nHeight - nBmpHeight) /2
- ,nBmpWidth
- ,nBmpHeight
- ,&vDCMem
- ,0
- ,0
- ,wxCOPY
- ,TRUE
- );
-
- if (eStatus & wxODSelected)
- {
- RECT vRectBmp = { rRect.x
- ,rRect.y
- ,rRect.x + GetMarginWidth()
- ,rRect.y + m_nHeight
- };
- POINTL vPnt1 = {2, 4}; // Leave a little background border
- POINTL vPnt2 = {rRect.x + GetMarginWidth(), rRect.y + m_nHeight - 3};
- LINEBUNDLE vLine;
-
- vLine.lColor = vColBack.GetPixel();
- ::GpiSetAttrs( hPS
- ,PRIM_LINE
- ,LBB_COLOR
- ,0
- ,&vLine
- );
- ::GpiMove(hPS, &vPnt1);
- ::GpiBox( hPS
- ,DRO_OUTLINE
- ,&vPnt2
- ,0L
- ,0L
- );
- }
- }
- }
- return TRUE;