forked from Mirrors/wine-wine
Add support for drawing menus in "flat" style.
parent
17ed5537e7
commit
b25fa587a7
|
@ -1156,6 +1156,8 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
|
||||||
UINT height, BOOL menuBar, UINT odaction )
|
UINT height, BOOL menuBar, UINT odaction )
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
BOOL flat_menu = FALSE;
|
||||||
|
int bkgnd;
|
||||||
|
|
||||||
debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "");
|
debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "");
|
||||||
|
|
||||||
|
@ -1166,11 +1168,14 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
|
||||||
|
bkgnd = (menuBar && flat_menu) ? COLOR_MENUBAR : COLOR_MENU;
|
||||||
|
|
||||||
/* Setup colors */
|
/* Setup colors */
|
||||||
|
|
||||||
if (lpitem->fState & MF_HILITE)
|
if (lpitem->fState & MF_HILITE)
|
||||||
{
|
{
|
||||||
if(menuBar) {
|
if(menuBar && !flat_menu) {
|
||||||
SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT));
|
SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT));
|
||||||
SetBkColor(hdc, GetSysColor(COLOR_MENU));
|
SetBkColor(hdc, GetSysColor(COLOR_MENU));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1187,7 +1192,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
|
||||||
SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) );
|
SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) );
|
||||||
else
|
else
|
||||||
SetTextColor( hdc, GetSysColor( COLOR_MENUTEXT ) );
|
SetTextColor( hdc, GetSysColor( COLOR_MENUTEXT ) );
|
||||||
SetBkColor( hdc, GetSysColor( COLOR_MENU ) );
|
SetBkColor( hdc, GetSysColor( bkgnd ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpitem->fType & MF_OWNERDRAW)
|
if (lpitem->fType & MF_OWNERDRAW)
|
||||||
|
@ -1235,26 +1240,46 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
|
||||||
{
|
{
|
||||||
if (lpitem->fState & MF_HILITE)
|
if (lpitem->fState & MF_HILITE)
|
||||||
{
|
{
|
||||||
if(menuBar)
|
if (flat_menu)
|
||||||
DrawEdge(hdc, &rect, BDR_SUNKENOUTER, BF_RECT);
|
{
|
||||||
else
|
InflateRect (&rect, -1, -1);
|
||||||
FillRect(hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT));
|
FillRect(hdc, &rect, GetSysColorBrush(COLOR_MENUHILIGHT));
|
||||||
|
InflateRect (&rect, 1, 1);
|
||||||
|
FrameRect(hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(menuBar)
|
||||||
|
DrawEdge(hdc, &rect, BDR_SUNKENOUTER, BF_RECT);
|
||||||
|
else
|
||||||
|
FillRect(hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
FillRect( hdc, &rect, GetSysColorBrush(COLOR_MENU) );
|
FillRect( hdc, &rect, GetSysColorBrush(bkgnd) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetBkMode( hdc, TRANSPARENT );
|
SetBkMode( hdc, TRANSPARENT );
|
||||||
|
|
||||||
if (!(lpitem->fType & MF_OWNERDRAW))
|
if (!(lpitem->fType & MF_OWNERDRAW))
|
||||||
{
|
{
|
||||||
|
HPEN oldPen;
|
||||||
|
|
||||||
/* vertical separator */
|
/* vertical separator */
|
||||||
if (!menuBar && (lpitem->fType & MF_MENUBARBREAK))
|
if (!menuBar && (lpitem->fType & MF_MENUBARBREAK))
|
||||||
{
|
{
|
||||||
RECT rc = rect;
|
RECT rc = rect;
|
||||||
rc.top = 3;
|
rc.top = 3;
|
||||||
rc.bottom = height - 3;
|
rc.bottom = height - 3;
|
||||||
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_LEFT);
|
if (flat_menu)
|
||||||
|
{
|
||||||
|
oldPen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_BTNSHADOW) );
|
||||||
|
MoveToEx( hdc, rc.left, rc.top, NULL );
|
||||||
|
LineTo( hdc, rc.left, rc.bottom );
|
||||||
|
SelectObject( hdc, oldPen );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* horizontal separator */
|
/* horizontal separator */
|
||||||
|
@ -1264,7 +1289,15 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
|
||||||
rc.left++;
|
rc.left++;
|
||||||
rc.right--;
|
rc.right--;
|
||||||
rc.top += SEPARATOR_HEIGHT / 2;
|
rc.top += SEPARATOR_HEIGHT / 2;
|
||||||
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_TOP);
|
if (flat_menu)
|
||||||
|
{
|
||||||
|
oldPen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_BTNSHADOW) );
|
||||||
|
MoveToEx( hdc, rc.left, rc.top, NULL );
|
||||||
|
LineTo( hdc, rc.right, rc.top );
|
||||||
|
SelectObject( hdc, oldPen );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_TOP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1477,8 +1510,13 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
|
||||||
if( hPrevPen )
|
if( hPrevPen )
|
||||||
{
|
{
|
||||||
POPUPMENU *menu;
|
POPUPMENU *menu;
|
||||||
|
BOOL flat_menu = FALSE;
|
||||||
|
|
||||||
DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT);
|
SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
|
||||||
|
if (flat_menu)
|
||||||
|
FrameRect(hdc, &rect, GetSysColorBrush(COLOR_BTNSHADOW));
|
||||||
|
else
|
||||||
|
DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT);
|
||||||
|
|
||||||
/* draw menu items */
|
/* draw menu items */
|
||||||
|
|
||||||
|
@ -3859,6 +3897,9 @@ DWORD WINAPI DrawMenuBarTemp(HWND hwnd, HDC hDC, LPRECT lprect, HMENU hMenu, HFO
|
||||||
LPPOPUPMENU lppop;
|
LPPOPUPMENU lppop;
|
||||||
UINT i,retvalue;
|
UINT i,retvalue;
|
||||||
HFONT hfontOld = 0;
|
HFONT hfontOld = 0;
|
||||||
|
BOOL flat_menu = FALSE;
|
||||||
|
|
||||||
|
SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
|
||||||
|
|
||||||
if (!hMenu)
|
if (!hMenu)
|
||||||
hMenu = GetMenu(hwnd);
|
hMenu = GetMenu(hwnd);
|
||||||
|
@ -3882,7 +3923,7 @@ DWORD WINAPI DrawMenuBarTemp(HWND hwnd, HDC hDC, LPRECT lprect, HMENU hMenu, HFO
|
||||||
|
|
||||||
lprect->bottom = lprect->top + lppop->Height;
|
lprect->bottom = lprect->top + lppop->Height;
|
||||||
|
|
||||||
FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
|
FillRect(hDC, lprect, GetSysColorBrush(flat_menu ? COLOR_MENUBAR : COLOR_MENU) );
|
||||||
|
|
||||||
SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE));
|
SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE));
|
||||||
MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
|
MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
|
||||||
|
|
Loading…
Reference in New Issue