- //
- // 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
- //
- vPntStart.x = rRect.width - (nWidth + 7);
- vPntStart.y = rRect.y + 4;
- ::GpiCharStringAt( rDC.GetHPS()
- ,&vPntStart
- ,sAccel.length()
- ,(PCH)sAccel.c_str()
- );
- }
-
- //
- // 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);
- wxMemoryDC* pOldDC = (wxMemoryDC*)vBmp.GetSelectedInto();
-
- if(pOldDC != NULL)
- {
- vBmp.SetSelectedInto(NULL);
- }
- 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));
-
- int nHeightDiff = m_nHeight - nBmpHeight;
-
- rDC.Blit( rRect.x + (GetMarginWidth() - nBmpWidth) / 2
- ,rRect.y + nHeightDiff / 2
- ,nBmpWidth
- ,nBmpHeight
- ,&vDCMem
- ,0
- ,0
- ,wxCOPY
- ,TRUE
- );
-
- if (eStatus & wxODSelected)
- {
- RECT vRectBmp = { rRect.x
- ,rRect.y
- ,rRect.x + GetMarginWidth() - 1
- ,rRect.y + m_nHeight - 1
- };
- POINTL vPnt1 = {rRect.x + 1, rRect.y + 3}; // 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
- );
- }
- vBmp.SetSelectedInto(NULL);
- }
- }
- return TRUE;