- Obey TBCDRF_NOOFFSET for the button text.
- Make anchor highlighting behave more like native version. - Don't recalculate toolbar in TOOLBAR_Unkwn460. - Obey WM_SETREDRAW for the WM_ERASEBKGND message as well as WM_PAINT.
This commit is contained in:
parent
3c3a511e8d
commit
8f870346cb
|
@ -903,8 +903,9 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
if (dwStyle & TBSTYLE_LIST)
|
if (dwStyle & TBSTYLE_LIST)
|
||||||
rcText.left += LIST_IMAGE_ABSENT_WIDTH + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap);
|
rcText.left += LIST_IMAGE_ABSENT_WIDTH + TOOLBAR_GetListTextOffset(infoPtr, infoPtr->iListGap);
|
||||||
|
|
||||||
if (btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED))
|
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) &&
|
||||||
OffsetRect (&rcText, 1, 1);
|
(btnPtr->fsState & (TBSTATE_PRESSED | TBSTATE_CHECKED)))
|
||||||
|
OffsetRect(&rcText, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize fields in all cases, because we use these later
|
/* Initialize fields in all cases, because we use these later
|
||||||
|
@ -4281,8 +4282,7 @@ TOOLBAR_SetAnchorHighlight (HWND hwnd, WPARAM wParam)
|
||||||
|
|
||||||
infoPtr->bAnchor = (BOOL)wParam;
|
infoPtr->bAnchor = (BOOL)wParam;
|
||||||
|
|
||||||
if (!infoPtr->bAnchor)
|
/* Native does not remove the hot effect from an already hot button */
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, TOOLBAR_NOWHERE, HICF_OTHER);
|
|
||||||
|
|
||||||
return (LRESULT)bOldAnchor;
|
return (LRESULT)bOldAnchor;
|
||||||
}
|
}
|
||||||
|
@ -4626,9 +4626,6 @@ TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason)
|
||||||
TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL;
|
TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL;
|
||||||
LRESULT no_highlight;
|
LRESULT no_highlight;
|
||||||
|
|
||||||
if (nHit == TOOLBAR_NOWHERE && infoPtr->bAnchor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Remove the effect of an old hot button if the button was
|
/* Remove the effect of an old hot button if the button was
|
||||||
drawn with the hot button effect */
|
drawn with the hot button effect */
|
||||||
if(infoPtr->nHotItem >= 0)
|
if(infoPtr->nHotItem >= 0)
|
||||||
|
@ -4672,8 +4669,13 @@ TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam)
|
||||||
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
|
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
|
||||||
INT nOldHotItem = infoPtr->nHotItem;
|
INT nOldHotItem = infoPtr->nHotItem;
|
||||||
|
|
||||||
|
TRACE("hwnd = %p, nHit = %d\n", hwnd, (INT)wParam);
|
||||||
|
|
||||||
if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons)
|
if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons)
|
||||||
wParam = -2;
|
wParam = -1;
|
||||||
|
|
||||||
|
/* NOTE: an application can still remove the hot item even if anchor
|
||||||
|
* highlighting is enabled */
|
||||||
|
|
||||||
if (infoPtr->dwStyle & TBSTYLE_FLAT)
|
if (infoPtr->dwStyle & TBSTYLE_FLAT)
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, wParam, HICF_OTHER);
|
TOOLBAR_SetHotItemEx(infoPtr, wParam, HICF_OTHER);
|
||||||
|
@ -5063,6 +5065,9 @@ TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons)
|
if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons)
|
||||||
wParam = -1;
|
wParam = -1;
|
||||||
|
|
||||||
|
/* NOTE: an application can still remove the hot item even if anchor
|
||||||
|
* highlighting is enabled */
|
||||||
|
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, wParam, lParam);
|
TOOLBAR_SetHotItemEx(infoPtr, wParam, lParam);
|
||||||
|
|
||||||
GetFocus();
|
GetFocus();
|
||||||
|
@ -5084,7 +5089,6 @@ static LRESULT TOOLBAR_Unkwn460(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
infoPtr->iListGap = (INT)wParam;
|
infoPtr->iListGap = (INT)wParam;
|
||||||
|
|
||||||
TOOLBAR_CalcToolbar(hwnd);
|
|
||||||
InvalidateRect(hwnd, NULL, TRUE);
|
InvalidateRect(hwnd, NULL, TRUE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5297,6 +5301,10 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
INT ret = FALSE;
|
INT ret = FALSE;
|
||||||
DWORD ntfret;
|
DWORD ntfret;
|
||||||
|
|
||||||
|
/* the app has told us not to redraw the toolbar */
|
||||||
|
if (!infoPtr->bDoRedraw)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) {
|
if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) {
|
||||||
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
|
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
|
||||||
tbcd.nmcd.dwDrawStage = CDDS_PREERASE;
|
tbcd.nmcd.dwDrawStage = CDDS_PREERASE;
|
||||||
|
@ -5475,6 +5483,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
GetCursorPos(&pt);
|
GetCursorPos(&pt);
|
||||||
ScreenToClient(hwnd, &pt);
|
ScreenToClient(hwnd, &pt);
|
||||||
nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
|
nHit = TOOLBAR_InternalHitTest(hwnd, &pt);
|
||||||
|
if (!infoPtr->bAnchor || (nHit >= 0))
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
|
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
|
||||||
|
|
||||||
/* remove any left mouse button down or double-click messages
|
/* remove any left mouse button down or double-click messages
|
||||||
|
@ -5556,6 +5565,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
pt.y = (INT)HIWORD(lParam);
|
pt.y = (INT)HIWORD(lParam);
|
||||||
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
|
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
|
||||||
|
|
||||||
|
if (!infoPtr->bAnchor || (nHit >= 0))
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
|
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
|
||||||
|
|
||||||
if (infoPtr->nButtonDrag >= 0) {
|
if (infoPtr->nButtonDrag >= 0) {
|
||||||
|
@ -5773,8 +5783,9 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
hotBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
|
hotBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
|
||||||
|
|
||||||
/* don't remove hot effects when in drop-down */
|
/* don't remove hot effects when in anchor highlighting mode or when a
|
||||||
if (infoPtr->nOldHit < 0 || !hotBtnPtr->bDropDownPressed)
|
* drop-down button is pressed */
|
||||||
|
if (!infoPtr->bAnchor && (infoPtr->nOldHit < 0 || !hotBtnPtr->bDropDownPressed))
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, TOOLBAR_NOWHERE, HICF_MOUSE);
|
TOOLBAR_SetHotItemEx(infoPtr, TOOLBAR_NOWHERE, HICF_MOUSE);
|
||||||
|
|
||||||
if (infoPtr->nOldHit < 0)
|
if (infoPtr->nOldHit < 0)
|
||||||
|
@ -5846,6 +5857,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
|
nHit = TOOLBAR_InternalHitTest (hwnd, &pt);
|
||||||
|
|
||||||
|
if (!infoPtr->bAnchor || (nHit >= 0))
|
||||||
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE);
|
TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE);
|
||||||
|
|
||||||
if (infoPtr->nOldHit != nHit)
|
if (infoPtr->nOldHit != nHit)
|
||||||
|
|
Loading…
Reference in New Issue