Commit b81934c2 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Don't draw whole button pressed when separate dropdown pressed, just

the separate dropdown itself.
parent f86e64e1
...@@ -98,9 +98,10 @@ typedef struct ...@@ -98,9 +98,10 @@ typedef struct
INT idCommand; INT idCommand;
BYTE fsState; BYTE fsState;
BYTE fsStyle; BYTE fsStyle;
BYTE bHot;
BYTE bDropDownPressed;
DWORD dwData; DWORD dwData;
INT iString; INT iString;
BOOL bHot;
INT nRow; INT nRow;
RECT rect; RECT rect;
INT cx; /* manually set size */ INT cx; /* manually set size */
...@@ -786,14 +787,16 @@ TOOLBAR_DrawFrame(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMDRAW * ...@@ -786,14 +787,16 @@ TOOLBAR_DrawFrame(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMDRAW *
} }
static void static void
TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMDRAW *tbcd, RECT *rcArrow) TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, const NMTBCUSTOMDRAW *tbcd, RECT *rcArrow, BOOL bDropDownPressed)
{ {
HDC hdc = tbcd->nmcd.hdc; HDC hdc = tbcd->nmcd.hdc;
int offset = 0; int offset = 0;
BOOL pressed = bDropDownPressed ||
(tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED));
if (flat) if (infoPtr->dwStyle & TBSTYLE_FLAT)
{ {
if ((tbcd->nmcd.uItemState & CDIS_SELECTED) || (tbcd->nmcd.uItemState & CDIS_CHECKED)) if (pressed)
DrawEdge (hdc, rcArrow, BDR_SUNKENOUTER, BF_RECT); DrawEdge (hdc, rcArrow, BDR_SUNKENOUTER, BF_RECT);
else if ( (tbcd->nmcd.uItemState & CDIS_HOT) && else if ( (tbcd->nmcd.uItemState & CDIS_HOT) &&
!(tbcd->nmcd.uItemState & CDIS_DISABLED) && !(tbcd->nmcd.uItemState & CDIS_DISABLED) &&
...@@ -802,14 +805,14 @@ TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMD ...@@ -802,14 +805,14 @@ TOOLBAR_DrawSepDDArrow(const TOOLBAR_INFO *infoPtr, BOOL flat, const NMTBCUSTOMD
} }
else else
{ {
if ((tbcd->nmcd.uItemState & CDIS_SELECTED) || (tbcd->nmcd.uItemState & CDIS_CHECKED)) if (pressed)
DrawEdge (hdc, rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE); DrawEdge (hdc, rcArrow, EDGE_SUNKEN, BF_RECT | BF_MIDDLE);
else else
DrawEdge (hdc, rcArrow, EDGE_RAISED, DrawEdge (hdc, rcArrow, EDGE_RAISED,
BF_SOFT | BF_RECT | BF_MIDDLE); BF_SOFT | BF_RECT | BF_MIDDLE);
} }
if (tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED)) if (pressed)
offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1; offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE)) if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
...@@ -995,7 +998,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) ...@@ -995,7 +998,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
TOOLBAR_DrawFrame(infoPtr, dwStyle & TBSTYLE_FLAT, &tbcd); TOOLBAR_DrawFrame(infoPtr, dwStyle & TBSTYLE_FLAT, &tbcd);
if (drawSepDropDownArrow) if (drawSepDropDownArrow)
TOOLBAR_DrawSepDDArrow(infoPtr, dwStyle & TBSTYLE_FLAT, &tbcd, &rcArrow); TOOLBAR_DrawSepDDArrow(infoPtr, &tbcd, &rcArrow, btnPtr->bDropDownPressed);
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT)) if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd); TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
...@@ -5350,7 +5353,10 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5350,7 +5353,10 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
LRESULT res; LRESULT res;
/* draw in pressed state */ /* draw in pressed state */
btnPtr->fsState |= TBSTATE_PRESSED; if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
btnPtr->fsState |= TBSTATE_PRESSED;
else
btnPtr->bDropDownPressed = TRUE;
RedrawWindow(hwnd,&btnPtr->rect,0, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
...@@ -5368,7 +5374,10 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5368,7 +5374,10 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
MSG msg; MSG msg;
/* redraw button in unpressed state */ /* redraw button in unpressed state */
btnPtr->fsState &= ~TBSTATE_PRESSED; if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
btnPtr->fsState &= ~TBSTATE_PRESSED;
else
btnPtr->bDropDownPressed = FALSE;
InvalidateRect(hwnd, &btnPtr->rect, TRUE); InvalidateRect(hwnd, &btnPtr->rect, TRUE);
/* find and set hot item /* find and set hot item
...@@ -5378,9 +5387,10 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5378,9 +5387,10 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
nHit = TOOLBAR_InternalHitTest(hwnd, &pt); nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
/* remove any left mouse button down messages so that we can /* remove any left mouse button down or double-click messages
* get a toggle effect on the button */ * so that we can get a toggle effect on the button */
while (PeekMessageW(&msg, hwnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE)) while (PeekMessageW(&msg, hwnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
PeekMessageW(&msg, hwnd, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
; ;
return 0; return 0;
...@@ -5656,20 +5666,24 @@ static LRESULT ...@@ -5656,20 +5666,24 @@ static LRESULT
TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *hotBtnPtr, *btnPtr; TBUTTON_INFO *hotBtnPtr;
RECT rc1;
hotBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
TOOLBAR_SetHotItemEx(infoPtr, -1, HICF_MOUSE); /* don't remove hot effects when in drop-down */
if (infoPtr->nOldHit < 0 || !hotBtnPtr->bDropDownPressed)
TOOLBAR_SetHotItemEx(infoPtr, -1, HICF_MOUSE);
if (infoPtr->nOldHit < 0) if (infoPtr->nOldHit < 0)
return TRUE; return TRUE;
hotBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
/* If the last button we were over is depressed then make it not */ /* If the last button we were over is depressed then make it not */
/* depressed and redraw it */ /* depressed and redraw it */
if(infoPtr->nOldHit == infoPtr->nButtonDown) if(infoPtr->nOldHit == infoPtr->nButtonDown)
{ {
TBUTTON_INFO *btnPtr;
RECT rc1;
btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
btnPtr->fsState &= ~TBSTATE_PRESSED; btnPtr->fsState &= ~TBSTATE_PRESSED;
......
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