Commit 01a52881 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- TBN_DRAGOUT and NM_RDBLCLK notifications.

- Remove unneeded member of private toolbar struct.
parent cb27ab8b
...@@ -52,8 +52,6 @@ ...@@ -52,8 +52,6 @@
* - Notifications: * - Notifications:
* - NM_CHAR * - NM_CHAR
* - NM_KEYDOWN * - NM_KEYDOWN
* - NM_RDBLCLICK
* - TBN_DRAGOUT
* - TBN_GETOBJECT * - TBN_GETOBJECT
* - TBN_RESTORE * - TBN_RESTORE
* - TBN_SAVE * - TBN_SAVE
...@@ -163,12 +161,12 @@ typedef struct ...@@ -163,12 +161,12 @@ typedef struct
HWND hwndToolTip; /* handle to tool tip control */ HWND hwndToolTip; /* handle to tool tip control */
HWND hwndNotify; /* handle to the window that gets notifications */ HWND hwndNotify; /* handle to the window that gets notifications */
HWND hwndSelf; /* my own handle */ HWND hwndSelf; /* my own handle */
BOOL bTransparent; /* background transparency flag */
BOOL bBtnTranspnt; /* button transparency flag */ BOOL bBtnTranspnt; /* button transparency flag */
BOOL bAutoSize; /* auto size deadlock indicator */ BOOL bAutoSize; /* auto size deadlock indicator */
BOOL bAnchor; /* anchor highlight enabled */ BOOL bAnchor; /* anchor highlight enabled */
BOOL bNtfUnicode; /* TRUE if NOTIFYs use {W} */ BOOL bNtfUnicode; /* TRUE if NOTIFYs use {W} */
BOOL bDoRedraw; /* Redraw status */ BOOL bDoRedraw; /* Redraw status */
BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */
DWORD dwStyle; /* regular toolbar style */ DWORD dwStyle; /* regular toolbar style */
DWORD dwExStyle; /* extended toolbar style */ DWORD dwExStyle; /* extended toolbar style */
DWORD dwDTFlags; /* DrawText flags */ DWORD dwDTFlags; /* DrawText flags */
...@@ -5106,10 +5104,10 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5106,10 +5104,10 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nOldHit = -1; infoPtr->nOldHit = -1;
infoPtr->nHotItem = -1; infoPtr->nHotItem = -1;
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->bTransparent = (dwStyle & TBSTYLE_TRANSPARENT);
infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST)); infoPtr->bBtnTranspnt = (dwStyle & (TBSTYLE_FLAT | TBSTYLE_LIST));
infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS; infoPtr->dwDTFlags = (dwStyle & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
infoPtr->bAnchor = FALSE; /* no anchor highlighting */ infoPtr->bAnchor = FALSE; /* no anchor highlighting */
infoPtr->bDragOutSent = FALSE;
infoPtr->iVersion = 0; infoPtr->iVersion = 0;
infoPtr->hwndSelf = hwnd; infoPtr->hwndSelf = hwnd;
infoPtr->bDoRedraw = TRUE; infoPtr->bDoRedraw = TRUE;
...@@ -5232,7 +5230,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5232,7 +5230,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* If the toolbar is "transparent" then pass the WM_ERASEBKGND up /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up
* to my parent for processing. * to my parent for processing.
*/ */
if (infoPtr->bTransparent) { if (infoPtr->dwStyle & TBSTYLE_TRANSPARENT) {
POINT pt, ptorig; POINT pt, ptorig;
HDC hdc = (HDC)wParam; HDC hdc = (HDC)wParam;
HWND parent; HWND parent;
...@@ -5391,6 +5389,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5391,6 +5389,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
infoPtr->bCaptured = TRUE; infoPtr->bCaptured = TRUE;
infoPtr->nButtonDown = nHit; infoPtr->nButtonDown = nHit;
infoPtr->bDragOutSent = FALSE;
btnPtr->fsState |= TBSTATE_PRESSED; btnPtr->fsState |= TBSTATE_PRESSED;
...@@ -5565,7 +5564,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5565,7 +5564,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd); MAKEWPARAM(infoPtr->buttons[nHit].idCommand, 0), (LPARAM)hwnd);
/* !!! Undocumented - toolbar at 4.71 level and above sends /* !!! Undocumented - toolbar at 4.71 level and above sends
* either NMRCLICK or NM_CLICK with the NMMOUSE structure. * either NM_RCLICK or NM_CLICK with the NMMOUSE structure.
* Only NM_RCLICK is documented. * Only NM_RCLICK is documented.
*/ */
nmmouse.dwItemSpec = btnPtr->idCommand; nmmouse.dwItemSpec = btnPtr->idCommand;
...@@ -5586,7 +5585,7 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5586,7 +5585,7 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
pt.x = LOWORD(lParam); pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam); pt.y = HIWORD(lParam);
nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt); nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt);
if (nmmouse.dwHitInfo < 0) { if (nmmouse.dwHitInfo < 0) {
...@@ -5605,6 +5604,34 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5605,6 +5604,34 @@ TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
TOOLBAR_RButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
NMMOUSE nmmouse;
POINT pt;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt);
if (nmmouse.dwHitInfo < 0)
nmmouse.dwItemSpec = -1;
else {
nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand;
nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData;
}
ClientToScreen(hwnd, &pt);
memcpy(&nmmouse.pt, &pt, sizeof(POINT));
TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RDBLCLK);
return 0;
}
static LRESULT
TOOLBAR_CaptureChanged(HWND hwnd) TOOLBAR_CaptureChanged(HWND hwnd)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
...@@ -5652,6 +5679,15 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5652,6 +5679,15 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
InvalidateRect (hwnd, &rc1, TRUE); InvalidateRect (hwnd, &rc1, TRUE);
} }
if (infoPtr->bCaptured && !infoPtr->bDragOutSent)
{
NMTOOLBARW nmt;
ZeroMemory(&nmt, sizeof(nmt));
nmt.iItem = infoPtr->buttons[infoPtr->nButtonDown].idCommand;
TOOLBAR_SendNotify(&nmt.hdr, infoPtr, TBN_DRAGOUT);
infoPtr->bDragOutSent = TRUE;
}
infoPtr->nOldHit = -1; /* reset the old hit index as we've left the toolbar */ infoPtr->nOldHit = -1; /* reset the old hit index as we've left the toolbar */
return TRUE; return TRUE;
...@@ -5699,6 +5735,15 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -5699,6 +5735,15 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
if (infoPtr->bCaptured) if (infoPtr->bCaptured)
{ {
if (!infoPtr->bDragOutSent)
{
NMTOOLBARW nmt;
ZeroMemory(&nmt, sizeof(nmt));
nmt.iItem = infoPtr->buttons[infoPtr->nButtonDown].idCommand;
TOOLBAR_SendNotify(&nmt.hdr, infoPtr, TBN_DRAGOUT);
infoPtr->bDragOutSent = TRUE;
}
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;
...@@ -6256,7 +6301,6 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle) ...@@ -6256,7 +6301,6 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
else { else {
infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS; infoPtr->dwDTFlags = DT_CENTER | DT_END_ELLIPSIS;
} }
infoPtr->bTransparent = (lpStyle->styleNew & TBSTYLE_TRANSPARENT);
infoPtr->bBtnTranspnt = (lpStyle->styleNew & infoPtr->bBtnTranspnt = (lpStyle->styleNew &
(TBSTYLE_FLAT | TBSTYLE_LIST)); (TBSTYLE_FLAT | TBSTYLE_LIST));
TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew); TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
...@@ -6619,6 +6663,9 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -6619,6 +6663,9 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONUP: case WM_RBUTTONUP:
return TOOLBAR_RButtonUp (hwnd, wParam, lParam); return TOOLBAR_RButtonUp (hwnd, wParam, lParam);
case WM_RBUTTONDBLCLK:
return TOOLBAR_RButtonDblClk (hwnd, wParam, lParam);
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
return TOOLBAR_MouseMove (hwnd, wParam, lParam); return TOOLBAR_MouseMove (hwnd, wParam, lParam);
......
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