patch from Mike Oliver <oliver@math.ucla.edu> to have correct position in wxTree/ListCtrl click events
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -316,7 +316,9 @@ public:
|
|||||||
void RefreshLine( wxListLineData *line );
|
void RefreshLine( wxListLineData *line );
|
||||||
void OnPaint( wxPaintEvent &event );
|
void OnPaint( wxPaintEvent &event );
|
||||||
void HilightAll( bool on );
|
void HilightAll( bool on );
|
||||||
void SendNotify( wxListLineData *line, wxEventType command );
|
void SendNotify( wxListLineData *line,
|
||||||
|
wxEventType command,
|
||||||
|
wxPoint point = wxDefaultPosition );
|
||||||
void FocusLine( wxListLineData *line );
|
void FocusLine( wxListLineData *line );
|
||||||
void UnfocusLine( wxListLineData *line );
|
void UnfocusLine( wxListLineData *line );
|
||||||
void SelectLine( wxListLineData *line );
|
void SelectLine( wxListLineData *line );
|
||||||
@@ -1747,11 +1749,18 @@ void wxListMainWindow::HilightAll( bool on )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListMainWindow::SendNotify( wxListLineData *line, wxEventType command )
|
void wxListMainWindow::SendNotify( wxListLineData *line,
|
||||||
|
wxEventType command,
|
||||||
|
wxPoint point )
|
||||||
{
|
{
|
||||||
wxListEvent le( command, GetParent()->GetId() );
|
wxListEvent le( command, GetParent()->GetId() );
|
||||||
le.SetEventObject( GetParent() );
|
le.SetEventObject( GetParent() );
|
||||||
le.m_itemIndex = GetIndexOfLine( line );
|
le.m_itemIndex = GetIndexOfLine( line );
|
||||||
|
|
||||||
|
// set only for events which have position
|
||||||
|
if ( point != wxDefaultPosition )
|
||||||
|
le.m_pointDrag = point;
|
||||||
|
|
||||||
line->GetItem( 0, le.m_item );
|
line->GetItem( 0, le.m_item );
|
||||||
GetParent()->GetEventHandler()->ProcessEvent( le );
|
GetParent()->GetEventHandler()->ProcessEvent( le );
|
||||||
// GetParent()->GetEventHandler()->AddPendingEvent( le );
|
// GetParent()->GetEventHandler()->AddPendingEvent( le );
|
||||||
@@ -1882,8 +1891,8 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
|
|
||||||
if (m_dragCount != 3) return;
|
if (m_dragCount != 3) return;
|
||||||
|
|
||||||
int command = wxEVT_COMMAND_LIST_BEGIN_DRAG;
|
int command = event.RightIsDown() ? wxEVT_COMMAND_LIST_BEGIN_RDRAG
|
||||||
if (event.RightIsDown()) command = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
|
: wxEVT_COMMAND_LIST_BEGIN_DRAG;
|
||||||
|
|
||||||
wxListEvent le( command, GetParent()->GetId() );
|
wxListEvent le( command, GetParent()->GetId() );
|
||||||
le.SetEventObject( GetParent() );
|
le.SetEventObject( GetParent() );
|
||||||
@@ -1936,7 +1945,8 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
|
|
||||||
if (event.RightDown())
|
if (event.RightDown())
|
||||||
{
|
{
|
||||||
SendNotify( line, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK );
|
SendNotify( line, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,
|
||||||
|
event.GetPosition() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2449,7 +2449,9 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
|
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, GetId());
|
||||||
nevent.m_item = (long) item;
|
nevent.m_item = (long) item;
|
||||||
nevent.m_code = 0;
|
nevent.m_code = 0;
|
||||||
nevent.m_pointDrag = wxPoint(x, y);
|
CalcScrolledPosition(x, y,
|
||||||
|
&nevent.m_pointDrag.x,
|
||||||
|
&nevent.m_pointDrag.y);
|
||||||
nevent.SetEventObject(this);
|
nevent.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(nevent);
|
GetEventHandler()->ProcessEvent(nevent);
|
||||||
}
|
}
|
||||||
@@ -2502,7 +2504,9 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
||||||
nevent.m_item = (long) item;
|
nevent.m_item = (long) item;
|
||||||
nevent.m_code = 0;
|
nevent.m_code = 0;
|
||||||
nevent.m_pointDrag = wxPoint(x, y);
|
CalcScrolledPosition(x, y,
|
||||||
|
&nevent.m_pointDrag.x,
|
||||||
|
&nevent.m_pointDrag.y);
|
||||||
nevent.SetEventObject( this );
|
nevent.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent( nevent );
|
GetEventHandler()->ProcessEvent( nevent );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user