+ //
+ // Base on the status of the menu item pick the right colors
+ //
+ if (eStatus & wxODSelected)
+ {
+ wxColour vCol2("WHITE");
+ vColBack.Set( (unsigned char)0
+ ,(unsigned char)0
+ ,(unsigned char)160
+ ); // no dark blue in color table
+ vColText = vCol2;
+ }
+ else if (eStatus & wxODDisabled)
+ {
+ vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+ ,SYSCLR_MENU // Light gray
+ ,0L
+ );
+ vColBack.Set( GetRValue(vRef)
+ ,GetGValue(vRef)
+ ,GetBValue(vRef)
+ );
+ vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+ ,SYSCLR_MENUDISABLEDTEXT // dark gray
+ ,0L
+ );
+ vColText.Set( GetRValue(vRef)
+ ,GetGValue(vRef)
+ ,GetBValue(vRef)
+ );
+ }
+ else
+ {
+ //
+ // Fall back to default colors if none explicitly specified
+ //
+ vRef = ::WinQuerySysColor( HWND_DESKTOP
+ ,SYSCLR_MENU // we are using gray for all our window backgrounds in wxWindows
+ ,0L
+ );
+ vColBack.Set( GetRValue(vRef)
+ ,GetGValue(vRef)
+ ,GetBValue(vRef)
+ );
+ vRef = ::WinQuerySysColor( HWND_DESKTOP
+ ,SYSCLR_WINDOWTEXT // Black
+ ,0L
+ );
+ vColText.Set( GetRValue(vRef)
+ ,GetGValue(vRef)
+ ,GetBValue(vRef)
+ );
+ }
+ rDC.SetTextBackground(vColBack);
+ rDC.SetTextForeground(vColText);
+ rDC.SetBackgroundMode(wxTRANSPARENT);
+
+ //
+ // Paint the background
+ //
+ ::WinFillRect(hPS, &vRect, vColBack.GetPixel());
+
+ //
+ // Determine where to draw and leave space for a check-mark.
+ //
+ int nX = rRect.x + GetMarginWidth();
+
+ //
+ // Unfortunately, unlike Win32, PM has no owner drawn specific text
+ // drawing methods like ::DrawState that can cleanly handle accel
+ // pneumonics and deal, automatically, with various states, so we have
+ // to handle them ourselves. Notice Win32 can't handle \t in ownerdrawn
+ // strings either. We cannot handle mneumonics either. We display
+ // it, though, in hopes we can figure it out some day.
+ //
+
+ //
+ // Display main text and accel text separately to allign better
+ //
+ wxString sTgt = "\t";
+ wxString sFullString = m_strName; // need to save the original text
+ wxString sAccel;
+ size_t nIndex;
+ size_t nWidth;
+ size_t nCharWidth;
+ size_t nHeight;
+ bool bFoundMneumonic = FALSE;
+ bool bFoundAccel = FALSE;
+
+ //
+ // Deal with the tab, extracting the Accel text
+ //
+ nIndex = sFullString.Find(sTgt.c_str());
+ if (nIndex != -1)
+ {
+ bFoundAccel = TRUE;
+ sAccel = sFullString.Mid(nIndex + 1);
+ sFullString.Remove(nIndex);
+ }