Commit 75b278e9 authored by François Gouget's avatar François Gouget Committed by Alexandre Julliard

Modify the look of bitmap menu items to match Win95 and Win98

Fix the sunken edge/bitmap overlap in the Win98 look Introduce an IS_MAGIC_ITEM macro to test if the item is 'magic'
parent da2b6a9f
...@@ -132,6 +132,7 @@ typedef struct ...@@ -132,6 +132,7 @@ typedef struct
#define IS_STRING_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_STRING) #define IS_STRING_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_STRING)
#define IS_BITMAP_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_BITMAP) #define IS_BITMAP_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_BITMAP)
#define IS_MAGIC_ITEM(text) (LOWORD((int)text)<12)
#define IS_SYSTEM_MENU(menu) \ #define IS_SYSTEM_MENU(menu) \
(!((menu)->wFlags & MF_POPUP) && (menu)->wFlags & MF_SYSMENU) (!((menu)->wFlags & MF_POPUP) && (menu)->wFlags & MF_SYSMENU)
...@@ -860,7 +861,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner, ...@@ -860,7 +861,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
HBITMAP resBmp = 0; HBITMAP resBmp = 0;
/* Check if there is a magic menu item associated with this item */ /* Check if there is a magic menu item associated with this item */
if((LOWORD((int)lpitem->text))<12) if (IS_MAGIC_ITEM(lpitem->text))
{ {
resBmp = MENU_LoadMagicItem((int)lpitem->text, (lpitem->fType & MF_HILITE), resBmp = MENU_LoadMagicItem((int)lpitem->text, (lpitem->fType & MF_HILITE),
lpitem->dwItemData); lpitem->dwItemData);
...@@ -1203,24 +1204,22 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, ...@@ -1203,24 +1204,22 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
{ {
if(TWEAK_WineLook == WIN98_LOOK) if(TWEAK_WineLook == WIN98_LOOK)
{ {
if(menuBar) if(menuBar) {
SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT)); SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT));
else SetBkColor(hdc, GetSysColor(COLOR_MENU));
{ } else {
if(lpitem->fState & MF_GRAYED) if(lpitem->fState & MF_GRAYED)
SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
else else
SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
} }
SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
} }
else /* Not Win98 Look */ else /* Not Win98 Look */
{ {
SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
if(!IS_BITMAP_ITEM(lpitem->fType)) if(!IS_BITMAP_ITEM(lpitem->fType))
SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT)); SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
else
SetBkColor(hdc, GetSysColor(COLOR_MENU));
} }
} }
else else
...@@ -1300,7 +1299,9 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, ...@@ -1300,7 +1299,9 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* Draw the item text or bitmap */ /* Draw the item text or bitmap */
if (IS_BITMAP_ITEM(lpitem->fType)) if (IS_BITMAP_ITEM(lpitem->fType))
{ int top; {
int left,top,w,h;
DWORD rop;
HBITMAP resBmp = 0; HBITMAP resBmp = 0;
...@@ -1310,7 +1311,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, ...@@ -1310,7 +1311,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
* Check if there is a magic menu item associated with this item * Check if there is a magic menu item associated with this item
* and load the appropriate bitmap * and load the appropriate bitmap
*/ */
if((LOWORD((int)lpitem->text)) < 12) if (IS_MAGIC_ITEM(lpitem->text))
{ {
resBmp = MENU_LoadMagicItem((int)lpitem->text, (lpitem->fState & MF_HILITE), resBmp = MENU_LoadMagicItem((int)lpitem->text, (lpitem->fState & MF_HILITE),
lpitem->dwItemData); lpitem->dwItemData);
...@@ -1326,12 +1327,23 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, ...@@ -1326,12 +1327,23 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
SelectObject(hdcMem,resBmp ); SelectObject(hdcMem,resBmp );
/* handle fontsize > bitmap_height */ /* handle fontsize > bitmap_height */
top = ((rect.bottom-rect.top)>bm.bmHeight) ? h=rect.bottom - rect.top;
rect.top+(rect.bottom-rect.top-bm.bmHeight)/2 : rect.top; top = (h>bm.bmHeight) ?
rect.top+(h-bm.bmHeight)/2 : rect.top;
BitBlt( hdc, rect.left, top, rect.right - rect.left, w=rect.right - rect.left;
rect.bottom - rect.top, hdcMem, 0, 0, left=rect.left;
((lpitem->fState & MF_HILITE) && !((LOWORD((DWORD)lpitem->text)) < 12)) ? NOTSRCCOPY : SRCCOPY ); if (TWEAK_WineLook == WIN95_LOOK) {
rop=((lpitem->fState & MF_HILITE) && !IS_MAGIC_ITEM(lpitem->text)) ? NOTSRCCOPY : SRCCOPY;
if ((lpitem->fState & MF_HILITE) && IS_BITMAP_ITEM(lpitem->fType))
SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
} else {
left++;
w-=2;
rop=((lpitem->fState & MF_HILITE) && !IS_MAGIC_ITEM(lpitem->text) && (!menuBar)) ? MERGEPAINT : SRCCOPY;
}
BitBlt( hdc, left, top, w,
h, hdcMem, 0, 0,
rop);
} }
DeleteDC( hdcMem ); DeleteDC( hdcMem );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment