From 7214fdfca44dc97c3d1c3ebb9340cc9e7c7a9117 Mon Sep 17 00:00:00 2001 From: Ge van Geldorp Date: Fri, 16 Apr 2004 23:30:15 +0000 Subject: [PATCH] Setup menu drawing colors before calling owner draw routine. --- controls/menu.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/controls/menu.c b/controls/menu.c index 659b15b676e..e6e269816ed 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -1116,6 +1116,30 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, return; } + /* Setup colors */ + + if (lpitem->fState & MF_HILITE) + { + if(menuBar) { + SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT)); + SetBkColor(hdc, GetSysColor(COLOR_MENU)); + } else { + if(lpitem->fState & MF_GRAYED) + SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); + else + SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); + SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); + } + } + else + { + if (lpitem->fState & MF_GRAYED) + SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) ); + else + SetTextColor( hdc, GetSysColor( COLOR_MENUTEXT ) ); + SetBkColor( hdc, GetSysColor( COLOR_MENU ) ); + } + if (lpitem->fType & MF_OWNERDRAW) { /* @@ -1195,30 +1219,6 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, } } - /* Setup colors */ - - if (lpitem->fState & MF_HILITE) - { - if(menuBar) { - SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT)); - SetBkColor(hdc, GetSysColor(COLOR_MENU)); - } else { - if(lpitem->fState & MF_GRAYED) - SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); - else - SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); - SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); - } - } - else - { - if (lpitem->fState & MF_GRAYED) - SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) ); - else - SetTextColor( hdc, GetSysColor( COLOR_MENUTEXT ) ); - SetBkColor( hdc, GetSysColor( COLOR_MENU ) ); - } - /* helper lines for debugging */ /* FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH)); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );