Commit 24352375 authored by Guy L. Albertelli's avatar Guy L. Albertelli Committed by Alexandre Julliard

- On TB_SETIMAGELIST retrieve new values of the bitmap width and

height (fixes overlap of image and text in IE4). - Handle return codes from TBN_DROPDOWN (allows a "dropdown" to be treated like a regular button). - Implement TBN_BEGINDRAG and TBN_ENDDRAG in WM_LBUTTON{DOWN|UP} (not necessary but done by native). - Implement NM_RELEASEDCAPTURE and NM_CLICK.
parent 7f1d6d47
......@@ -230,6 +230,9 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
if (nState & (TBSTATE_PRESSED | TBSTATE_CHECKED))
OffsetRect (&rcText, 1, 1);
TRACE("string rect=(%d,%d)-(%d,%d)\n",
rcText.left, rcText.top, rcText.right, rcText.bottom);
hOldFont = SelectObject (hdc, infoPtr->hFont);
nOldBkMode = SetBkMode (hdc, TRANSPARENT);
if (!(nState & TBSTATE_ENABLED)) {
......@@ -348,7 +351,9 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
else
rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
TRACE("iBitmap: %d\n", btnPtr->iBitmap);
TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n",
btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
/* separator */
if (btnPtr->fsStyle & TBSTYLE_SEP) {
......@@ -3436,6 +3441,13 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->himlDef = (HIMAGELIST)lParam;
infoPtr->nNumBitmaps = ImageList_GetImageCount(infoPtr->himlDef);
ImageList_GetIconSize(infoPtr->himlDef, &infoPtr->nBitmapWidth,
&infoPtr->nBitmapHeight);
TRACE("hwnd %08x, new himl=%08x, bitmap w=%d, h=%d\n",
hwnd, (INT)infoPtr->himlDef,
infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
/* FIXME: redraw ? */
return (LRESULT)himlTemp;
......@@ -3804,6 +3816,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
TBUTTON_INFO *btnPtr;
POINT pt;
INT nHit;
NMTOOLBARA nmtb;
if (infoPtr->hwndToolTip)
TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
......@@ -3829,7 +3842,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
(!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))
{
NMTOOLBARA nmtb;
LRESULT res;
/*
* this time we must force a Redraw, so the btn is
* painted down before CaptureChanged repaints it up
......@@ -3841,13 +3854,18 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmtb.hdr.code = TBN_DROPDOWN;
nmtb.iItem = btnPtr->idCommand;
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
memset(&nmtb.tbButton, 0, sizeof(TBBUTTON));
nmtb.cchText = 0;
nmtb.pszText = 0;
memset(&nmtb.rcButton, 0, sizeof(RECT));
res = SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb);
if (res != TBDDRET_TREATPRESSED)
/* ??? guess (GA) */
return 0;
/* otherwise drop through and process as pushed */
}
else
{
SetCapture (hwnd);
/* SetCapture (hwnd); */
infoPtr->bCaptured = TRUE;
infoPtr->nButtonDown = nHit;
......@@ -3856,7 +3874,24 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
InvalidateRect(hwnd, &btnPtr->rect,
TOOLBAR_HasText(infoPtr, btnPtr));
}
UpdateWindow(hwnd);
SetCapture (hwnd);
/* native issues the TBN_BEGINDRAG here */
nmtb.hdr.hwndFrom = hwnd;
nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmtb.hdr.code = TBN_BEGINDRAG;
nmtb.iItem = btnPtr->idCommand;
nmtb.tbButton.iBitmap = btnPtr->iBitmap;
nmtb.tbButton.idCommand = btnPtr->idCommand;
nmtb.tbButton.fsState = btnPtr->fsState;
nmtb.tbButton.fsStyle = btnPtr->fsStyle;
nmtb.tbButton.dwData = btnPtr->dwData;
nmtb.tbButton.iString = btnPtr->iString;
nmtb.cchText = 0; /* !!! not correct */
nmtb.pszText = 0; /* !!! not correct */
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb);
}
return 0;
......@@ -3871,6 +3906,9 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nHit;
INT nOldIndex = -1;
BOOL bSendMessage = TRUE;
NMHDR hdr;
NMMOUSE nmmouse;
NMTOOLBARA nmtb;
if (infoPtr->hwndToolTip)
TOOLBAR_RelayEvent (infoPtr->hwndToolTip, hwnd,
......@@ -3925,9 +3963,47 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
*/
ReleaseCapture ();
/* Issue NM_RELEASEDCAPTURE to parent to let him know it is released */
hdr.hwndFrom = hwnd;
hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
hdr.code = NM_RELEASEDCAPTURE;
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)hdr.idFrom, (LPARAM)&hdr);
/* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the
* TBN_BEGINDRAG
*/
nmtb.hdr.hwndFrom = hwnd;
nmtb.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmtb.hdr.code = TBN_ENDDRAG;
nmtb.iItem = btnPtr->idCommand;
nmtb.tbButton.iBitmap = btnPtr->iBitmap;
nmtb.tbButton.idCommand = btnPtr->idCommand;
nmtb.tbButton.fsState = btnPtr->fsState;
nmtb.tbButton.fsStyle = btnPtr->fsStyle;
nmtb.tbButton.dwData = btnPtr->dwData;
nmtb.tbButton.iString = btnPtr->iString;
nmtb.cchText = 0; /* !!! not correct */
nmtb.pszText = 0; /* !!! not correct */
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmtb.hdr.idFrom, (LPARAM)&nmtb);
if (bSendMessage)
SendMessageA (GetParent(hwnd), WM_COMMAND,
MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd);
/* !!! Undocumented - toolbar at 4.71 level and above sends
* either NMRCLICK or NM_CLICK with the NMMOUSE structure.
* Only NM_RCLICK is documented.
*/
nmmouse.hdr.hwndFrom = hwnd;
nmmouse.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmmouse.hdr.code = NM_CLICK;
nmmouse.dwItemSpec = btnPtr->idCommand;
nmmouse.dwItemData = btnPtr->dwData;
SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmmouse.hdr.idFrom, (LPARAM)&nmmouse);
}
return 0;
......
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