- Improve I_IMAGECALLBACK handling and support I_IMAGENONE.

- Implement TBN_HOTITEMCHANGE in the mouse move routine.
This commit is contained in:
Guy L. Albertelli 2002-04-24 21:22:17 +00:00 committed by Alexandre Julliard
parent 69494b8763
commit 14a913c28d
1 changed files with 29 additions and 11 deletions

View File

@ -330,13 +330,15 @@ TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST h
if (!himl) return FALSE; if (!himl) return FALSE;
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
ERR("index %d is not valid, max %d\n", ERR("index %d is not valid, max %d\n",
btnPtr->iBitmap, infoPtr->nNumBitmaps); btnPtr->iBitmap, infoPtr->nNumBitmaps);
return FALSE; return FALSE;
} }
if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) { if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) {
if (index == -1) return FALSE; if ((index == I_IMAGECALLBACK) ||
(index == I_IMAGENONE)) return FALSE;
ERR("TBN_GETDISPINFO returned invalid index %d\n", ERR("TBN_GETDISPINFO returned invalid index %d\n",
index); index);
return FALSE; return FALSE;
@ -363,13 +365,15 @@ TOOLBAR_TestImageExist (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST
if (!himl) return FALSE; if (!himl) return FALSE;
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
ERR("index %d is not valid, max %d\n", ERR("index %d is not valid, max %d\n",
btnPtr->iBitmap, infoPtr->nNumBitmaps); btnPtr->iBitmap, infoPtr->nNumBitmaps);
return FALSE; return FALSE;
} }
if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) { if ((index = TOOLBAR_GetBitmapIndex(infoPtr, btnPtr)) < 0) {
if (index == -1) return FALSE; if ((index == I_IMAGECALLBACK) ||
(index == I_IMAGENONE)) return FALSE;
ERR("TBN_GETDISPINFO returned invalid index %d\n", ERR("TBN_GETDISPINFO returned invalid index %d\n",
index); index);
return FALSE; return FALSE;
@ -4870,11 +4874,12 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TBUTTON_INFO *btnPtr, *oldBtnPtr; TBUTTON_INFO *btnPtr = NULL, *oldBtnPtr = NULL;
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
POINT pt; POINT pt;
INT nHit; INT nHit;
TRACKMOUSEEVENT trackinfo; TRACKMOUSEEVENT trackinfo;
NMTBHOTITEM nmhotitem;
/* fill in the TRACKMOUSEEVENT struct */ /* fill in the TRACKMOUSEEVENT struct */
trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
@ -4912,10 +4917,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit]; oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
oldBtnPtr->bHot = FALSE; oldBtnPtr->bHot = FALSE;
}
InvalidateRect (hwnd, &oldBtnPtr->rect,
TOOLBAR_HasText(infoPtr, oldBtnPtr));
}
/* It's not a separator or in nowhere. It's a hot button. */ /* It's not a separator or in nowhere. It's a hot button. */
if (nHit >= 0) if (nHit >= 0)
@ -4928,13 +4930,29 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED)
{ {
btnPtr->bHot = TRUE; btnPtr->bHot = TRUE;
InvalidateRect(hwnd, &btnPtr->rect,
TOOLBAR_HasText(infoPtr, btnPtr));
} }
} }
if (infoPtr->bCaptured) { nmhotitem.dwFlags = HICF_MOUSE;
if (oldBtnPtr)
nmhotitem.idOld = oldBtnPtr->idCommand;
else
nmhotitem.dwFlags |= HICF_ENTERING;
if (btnPtr)
nmhotitem.idNew = btnPtr->idCommand;
else
nmhotitem.dwFlags |= HICF_LEAVING;
TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE);
/* now invalidate the old and new buttons so they will be painted */
if (oldBtnPtr)
InvalidateRect (hwnd, &oldBtnPtr->rect,
TOOLBAR_HasText(infoPtr, oldBtnPtr));
if (btnPtr && (btnPtr->fsState & TBSTATE_ENABLED))
InvalidateRect(hwnd, &btnPtr->rect,
TOOLBAR_HasText(infoPtr, btnPtr));
if (infoPtr->bCaptured) {
btnPtr = &infoPtr->buttons[infoPtr->nButtonDown]; btnPtr = &infoPtr->buttons[infoPtr->nButtonDown];
if (infoPtr->nOldHit == infoPtr->nButtonDown) { if (infoPtr->nOldHit == infoPtr->nButtonDown) {
btnPtr->fsState &= ~TBSTATE_PRESSED; btnPtr->fsState &= ~TBSTATE_PRESSED;