comctl32: Remove redundant if (button) statements.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com>
This commit is contained in:
parent
18b7ec9479
commit
c565145b0e
|
@ -5536,95 +5536,92 @@ TOOLBAR_LButtonDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
||||||
nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
|
nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
|
||||||
|
|
||||||
if (button)
|
if (button)
|
||||||
|
{
|
||||||
btnPtr = &infoPtr->buttons[nHit];
|
btnPtr = &infoPtr->buttons[nHit];
|
||||||
|
|
||||||
if (button && bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
|
if (bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
|
||||||
{
|
{
|
||||||
infoPtr->nButtonDrag = nHit;
|
infoPtr->nButtonDrag = nHit;
|
||||||
SetCapture (infoPtr->hwndSelf);
|
SetCapture (infoPtr->hwndSelf);
|
||||||
|
|
||||||
/* If drag cursor has not been loaded, load it.
|
/* If drag cursor has not been loaded, load it.
|
||||||
* Note: it doesn't need to be freed */
|
* Note: it doesn't need to be freed */
|
||||||
if (!hCursorDrag)
|
if (!hCursorDrag)
|
||||||
hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON);
|
hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON);
|
||||||
SetCursor(hCursorDrag);
|
SetCursor(hCursorDrag);
|
||||||
}
|
}
|
||||||
else if (button)
|
else
|
||||||
{
|
{
|
||||||
RECT arrowRect;
|
RECT arrowRect;
|
||||||
infoPtr->nOldHit = nHit;
|
infoPtr->nOldHit = nHit;
|
||||||
|
|
||||||
CopyRect(&arrowRect, &btnPtr->rect);
|
CopyRect(&arrowRect, &btnPtr->rect);
|
||||||
arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
|
arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
|
||||||
|
|
||||||
/* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */
|
/* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */
|
||||||
if ((btnPtr->fsState & TBSTATE_ENABLED) &&
|
if ((btnPtr->fsState & TBSTATE_ENABLED) &&
|
||||||
((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
|
((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
|
||||||
((btnPtr->fsStyle & BTNS_DROPDOWN) &&
|
((btnPtr->fsStyle & BTNS_DROPDOWN) &&
|
||||||
((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
|
((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
|
||||||
(!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
|
(!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
|
||||||
{
|
|
||||||
LRESULT res;
|
|
||||||
|
|
||||||
/* draw in pressed state */
|
|
||||||
if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
|
|
||||||
btnPtr->fsState |= TBSTATE_PRESSED;
|
|
||||||
else
|
|
||||||
btnPtr->bDropDownPressed = TRUE;
|
|
||||||
RedrawWindow(infoPtr->hwndSelf,&btnPtr->rect,0,
|
|
||||||
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
|
|
||||||
|
|
||||||
memset(&nmtb, 0, sizeof(nmtb));
|
|
||||||
nmtb.iItem = btnPtr->idCommand;
|
|
||||||
nmtb.rcButton = btnPtr->rect;
|
|
||||||
res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
|
|
||||||
TBN_DROPDOWN);
|
|
||||||
TRACE("TBN_DROPDOWN responded with %ld\n", res);
|
|
||||||
|
|
||||||
if (res != TBDDRET_TREATPRESSED)
|
|
||||||
{
|
{
|
||||||
MSG msg;
|
LRESULT res;
|
||||||
|
|
||||||
/* redraw button in unpressed state */
|
/* draw in pressed state */
|
||||||
if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
|
if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
|
||||||
btnPtr->fsState &= ~TBSTATE_PRESSED;
|
btnPtr->fsState |= TBSTATE_PRESSED;
|
||||||
else
|
else
|
||||||
btnPtr->bDropDownPressed = FALSE;
|
btnPtr->bDropDownPressed = TRUE;
|
||||||
InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
|
RedrawWindow(infoPtr->hwndSelf, &btnPtr->rect, 0, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
|
||||||
|
|
||||||
/* find and set hot item */
|
memset(&nmtb, 0, sizeof(nmtb));
|
||||||
GetCursorPos(&pt);
|
nmtb.iItem = btnPtr->idCommand;
|
||||||
ScreenToClient(infoPtr->hwndSelf, &pt);
|
nmtb.rcButton = btnPtr->rect;
|
||||||
nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
|
res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_DROPDOWN);
|
||||||
if (!infoPtr->bAnchor || button)
|
TRACE("TBN_DROPDOWN responded with %ld\n", res);
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE | HICF_LMOUSE);
|
|
||||||
|
|
||||||
/* remove any left mouse button down or double-click messages
|
if (res != TBDDRET_TREATPRESSED)
|
||||||
* so that we can get a toggle effect on the button */
|
{
|
||||||
while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
|
MSG msg;
|
||||||
PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
|
|
||||||
;
|
|
||||||
|
|
||||||
return 0;
|
/* redraw button in unpressed state */
|
||||||
|
if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
|
||||||
|
btnPtr->fsState &= ~TBSTATE_PRESSED;
|
||||||
|
else
|
||||||
|
btnPtr->bDropDownPressed = FALSE;
|
||||||
|
InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
|
||||||
|
|
||||||
|
/* find and set hot item */
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
ScreenToClient(infoPtr->hwndSelf, &pt);
|
||||||
|
nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
|
||||||
|
if (!infoPtr->bAnchor || button)
|
||||||
|
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
|
||||||
|
|
||||||
|
/* remove any left mouse button down or double-click messages
|
||||||
|
* so that we can get a toggle effect on the button */
|
||||||
|
while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
|
||||||
|
PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
|
||||||
|
;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* otherwise drop through and process as pushed */
|
||||||
}
|
}
|
||||||
/* otherwise drop through and process as pushed */
|
infoPtr->bCaptured = TRUE;
|
||||||
}
|
infoPtr->nButtonDown = nHit;
|
||||||
infoPtr->bCaptured = TRUE;
|
infoPtr->bDragOutSent = FALSE;
|
||||||
infoPtr->nButtonDown = nHit;
|
|
||||||
infoPtr->bDragOutSent = FALSE;
|
|
||||||
|
|
||||||
btnPtr->fsState |= TBSTATE_PRESSED;
|
btnPtr->fsState |= TBSTATE_PRESSED;
|
||||||
|
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE | HICF_LMOUSE);
|
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
|
||||||
|
|
||||||
if (btnPtr->fsState & TBSTATE_ENABLED)
|
if (btnPtr->fsState & TBSTATE_ENABLED)
|
||||||
InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
|
InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
|
||||||
UpdateWindow(infoPtr->hwndSelf);
|
UpdateWindow(infoPtr->hwndSelf);
|
||||||
SetCapture (infoPtr->hwndSelf);
|
SetCapture (infoPtr->hwndSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button)
|
|
||||||
{
|
|
||||||
memset(&nmtb, 0, sizeof(nmtb));
|
memset(&nmtb, 0, sizeof(nmtb));
|
||||||
nmtb.iItem = btnPtr->idCommand;
|
nmtb.iItem = btnPtr->idCommand;
|
||||||
TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
|
TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
|
||||||
|
|
Loading…
Reference in New Issue