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,35 +2083,44 @@ 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() ); NM_TREEVIEW tv;
if ( pWnd ) wxZeroMemory(tv);
{
NM_TREEVIEW tv;
tv.hdr.hwndFrom = GetHwnd(); tv.hdr.hwndFrom = GetHwnd();
tv.hdr.idFrom = ::GetWindowLong( GetHwnd(), GWL_ID ); tv.hdr.idFrom = ::GetWindowLong(GetHwnd(), GWL_ID);
tv.hdr.code = TVN_BEGINDRAG; tv.hdr.code = TVN_BEGINDRAG;
tv.itemNew.hItem = HITEM(m_htClickedItem); tv.itemNew.hItem = HITEM(m_htClickedItem);
TVITEM tviAux;
ZeroMemory(&tviAux, sizeof(tviAux));
tviAux.hItem = HITEM(m_htClickedItem);
tviAux.mask = TVIF_STATE | TVIF_PARAM;
tviAux.stateMask = 0xffffffff;
TreeView_GetItem( GetHwnd(), &tviAux );
tv.itemNew.state = tviAux.state; TVITEM tviAux;
tv.itemNew.lParam = tviAux.lParam; wxZeroMemory(tviAux);
tv.ptDrag.x = x; tviAux.hItem = HITEM(m_htClickedItem);
tv.ptDrag.y = y; tviAux.mask = TVIF_STATE | TVIF_PARAM;
tviAux.stateMask = 0xffffffff;
TreeView_GetItem(GetHwnd(), &tviAux);
::SendMessage( pWnd, WM_NOTIFY, tv.hdr.idFrom, (LPARAM)&tv ); tv.itemNew.state = tviAux.state;
} tv.itemNew.lParam = tviAux.lParam;
tv.ptDrag.x = x;
tv.ptDrag.y = y;
// 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__