TOOLBAR_DrawString: catch index== -1 (but not yet handled).

This commit is contained in:
Uwe Bonnes 2000-06-07 02:10:51 +00:00 committed by Alexandre Julliard
parent 45fccb8c0c
commit cf50ffbf0a

View file

@ -79,13 +79,15 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
COLORREF clrOld; COLORREF clrOld;
LPWSTR lpText = NULL; LPWSTR lpText = NULL;
TRACE ("iString: %lx\n", btnPtr->iString); TRACE ("iString: %x\n", btnPtr->iString);
/* get a pointer to the text */ /* get a pointer to the text */
if (HIWORD(btnPtr->iString) != 0) if (btnPtr->iString == -1)
lpText = (LPWSTR)btnPtr->iString; FIXME("Undocumented Index -1\n");
else if (HIWORD(btnPtr->iString) != 0)
lpText = (LPWSTR)btnPtr->iString;
else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))
lpText = infoPtr->strings[btnPtr->iString]; lpText = infoPtr->strings[btnPtr->iString];
TRACE ("lpText: \"%s\"\n", debugstr_w(lpText)); TRACE ("lpText: \"%s\"\n", debugstr_w(lpText));
@ -1527,7 +1529,7 @@ TOOLBAR_ChangeBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
btnPtr->iBitmap = LOWORD(lParam); btnPtr->iBitmap = LOWORD(lParam);
RedrawWindow(hwnd,&btnPtr->rect,NULL,RDW_ERASE|RDW_INVALIDATE); RedrawWindow(hwnd,&btnPtr->rect,0,RDW_ERASE|RDW_INVALIDATE);
return TRUE; return TRUE;
} }
@ -1570,9 +1572,9 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
if( bChecked != LOWORD(lParam) ) if( bChecked != LOWORD(lParam) )
{ {
if (nOldIndex != -1) if (nOldIndex != -1)
RedrawWindow(hwnd,&infoPtr->buttons[nOldIndex].rect,NULL, RedrawWindow(hwnd,&infoPtr->buttons[nOldIndex].rect,(HRGN)NULL,
RDW_ERASE|RDW_INVALIDATE); RDW_ERASE|RDW_INVALIDATE);
RedrawWindow(hwnd,&btnPtr->rect,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RedrawWindow(hwnd,&btnPtr->rect,0,RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
/* FIXME: Send a WM_NOTIFY?? */ /* FIXME: Send a WM_NOTIFY?? */
@ -1710,7 +1712,7 @@ TOOLBAR_EnableButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* redraw the button only if the state of the button changed */ /* redraw the button only if the state of the button changed */
if(bState != (btnPtr->fsState & TBSTATE_ENABLED)) { if(bState != (btnPtr->fsState & TBSTATE_ENABLED)) {
RedrawWindow(hwnd,&btnPtr->rect,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RedrawWindow(hwnd,&btnPtr->rect,0,RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
return TRUE; return TRUE;
@ -2200,7 +2202,7 @@ TOOLBAR_Indeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
else else
btnPtr->fsState |= TBSTATE_INDETERMINATE; btnPtr->fsState |= TBSTATE_INDETERMINATE;
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
return TRUE; return TRUE;
@ -2467,7 +2469,7 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
else else
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
return TRUE; return TRUE;
@ -2928,7 +2930,7 @@ TOOLBAR_SetState (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
btnPtr->fsState = LOWORD(lParam); btnPtr->fsState = LOWORD(lParam);
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
return TRUE; return TRUE;
@ -2949,7 +2951,7 @@ TOOLBAR_SetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr = &infoPtr->buttons[nIndex]; btnPtr = &infoPtr->buttons[nIndex];
btnPtr->fsStyle = LOWORD(lParam); btnPtr->fsStyle = LOWORD(lParam);
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
if (infoPtr->hwndToolTip) { if (infoPtr->hwndToolTip) {
@ -3143,7 +3145,7 @@ TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE)
@ -3195,7 +3197,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
btnPtr->bHot = FALSE; btnPtr->bHot = FALSE;
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
@ -3254,9 +3256,9 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
bSendMessage = FALSE; bSendMessage = FALSE;
if (nOldIndex != -1) if (nOldIndex != -1)
RedrawWindow(hwnd,&infoPtr->buttons[nOldIndex].rect,NULL, RedrawWindow(hwnd,&infoPtr->buttons[nOldIndex].rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
if (bSendMessage) { if (bSendMessage) {
@ -3387,7 +3389,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* only enabled buttons show hot effect */ /* only enabled buttons show hot effect */
if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED)
{ {
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
} }
@ -3396,12 +3398,12 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
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;
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
else if (nHit == infoPtr->nButtonDown) { else if (nHit == infoPtr->nButtonDown) {
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
RedrawWindow(hwnd,&btnPtr->rect,NULL, RedrawWindow(hwnd,&btnPtr->rect,0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
} }
} }