- // wxColor <-> RGB
- #define ToRGB(col) RGB(col.Red(), col.Green(), col.Blue())
- #define UnRGB(col) GetRValue(col), GetGValue(col), GetBValue(col)
-
- // set the colors
- // --------------
- DWORD colBack, colText;
- if ( st & wxODSelected ) {
- colBack = GetSysColor(COLOR_HIGHLIGHT);
- colText = GetSysColor(COLOR_HIGHLIGHTTEXT);
- }
- else {
- // fall back to default colors if none explicitly specified
- colBack = m_colBack.Ok() ? ToRGB(m_colBack) : GetSysColor(COLOR_WINDOW);
- colText = m_colText.Ok() ? ToRGB(m_colText) : GetSysColor(COLOR_WINDOWTEXT);
- }
-
- dc.SetTextForeground(wxColor(UnRGB(colText)));
- dc.SetTextBackground(wxColor(UnRGB(colBack)));
-
- // select the font and draw the text
- // ---------------------------------
-
- // determine where to draw and leave space for a check-mark.
- int x = rc.x + GetMarginWidth();
-
- dc.SetFont(GetFont());
- dc.DrawText(m_strName, x, rc.y);
-
- // draw the bitmap
- // ---------------
- if ( IsCheckable() && !m_bmpChecked.Ok() ) {
- if ( st & wxODChecked ) {
- // using native APIs for performance and simplicity
-// TODO:
-/*
- 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 };
-
- // finally copy it to screen DC and clean up
- BitBlt(hdc, rc.x, rc.y, GetMarginWidth(), m_nHeight,
- hdcMem, 0, 0, SRCCOPY);
- DeleteDC(hdcMem);
-*/
-#else
- // #### to do: perhaps using Marlett font (create equiv. font under X)
-// wxFAIL("not implemented");
-#endif //O_DRAW_NATIVE_API
+ //
+ // 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
+ );
+ }