don't let def window proc start another drag operation if we just started one ourselves for a multiselection tree (replaces patch 1702133)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45568 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-21 21:14:59 +00:00
parent 361f4288eb
commit b8e3f1cfb7

View File

@@ -2061,6 +2061,14 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
::SetFocus(GetHwnd(), htItem); ::SetFocus(GetHwnd(), htItem);
processed = true; processed = true;
} }
else // click on a single selected item
{
// don't interfere with the default processing in
// WM_MOUSEMOVE handler below as the default window
// proc will start the drag itself if we let have
// WM_LBUTTONDOWN
m_htClickedItem.Unset();
}
// reset on any click without Shift // reset on any click without Shift
m_htSelStart.Unset(); m_htSelStart.Unset();
@@ -2075,12 +2083,11 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
int cx = abs(m_ptClick.x - x); int cx = abs(m_ptClick.x - x);
int cy = abs(m_ptClick.y - y); int cy = abs(m_ptClick.y - y);
if ( cx > GetSystemMetrics( SM_CXDRAG ) || cy > GetSystemMetrics( SM_CYDRAG ) ) if ( cx > ::GetSystemMetrics(SM_CXDRAG) ||
{ cy > ::GetSystemMetrics(SM_CYDRAG) )
HWND pWnd = ::GetParent( GetHwnd() );
if ( pWnd )
{ {
NM_TREEVIEW tv; NM_TREEVIEW tv;
wxZeroMemory(tv);
tv.hdr.hwndFrom = GetHwnd(); tv.hdr.hwndFrom = GetHwnd();
tv.hdr.idFrom = ::GetWindowLong(GetHwnd(), GWL_ID); tv.hdr.idFrom = ::GetWindowLong(GetHwnd(), GWL_ID);
@@ -2088,8 +2095,10 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
tv.itemNew.hItem = HITEM(m_htClickedItem); tv.itemNew.hItem = HITEM(m_htClickedItem);
TVITEM tviAux; TVITEM tviAux;
ZeroMemory(&tviAux, sizeof(tviAux)); wxZeroMemory(tviAux);
tviAux.hItem = HITEM(m_htClickedItem); tviAux.hItem = HITEM(m_htClickedItem);
tviAux.mask = TVIF_STATE | TVIF_PARAM; tviAux.mask = TVIF_STATE | TVIF_PARAM;
tviAux.stateMask = 0xffffffff; tviAux.stateMask = 0xffffffff;
@@ -2101,9 +2110,17 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
tv.ptDrag.x = x; tv.ptDrag.x = x;
tv.ptDrag.y = y; tv.ptDrag.y = y;
::SendMessage( pWnd, WM_NOTIFY, tv.hdr.idFrom, (LPARAM)&tv ); // do it before SendMessage() call below to avoid
} // reentrancies here if there is another WM_MOUSEMOVE
// in the queue already
m_htClickedItem.Unset(); m_htClickedItem.Unset();
::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY,
tv.hdr.idFrom, (LPARAM)&tv );
// don't pass it to the default window proc, it would
// start dragging again
processed = true;
} }
} }
#endif // __WXWINCE__ #endif // __WXWINCE__