Apply wxListCtrl patch which fixes some crashes

and let the generic wxListCtrl show context
    menus like the MSW one.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2006-03-28 08:13:48 +00:00
parent b260e323ea
commit 8b1464af32

View File

@ -2858,6 +2858,7 @@ void wxListMainWindow::OnRenameCancelled(size_t itemEdit)
void wxListMainWindow::OnMouse( wxMouseEvent &event )
{
#ifdef __WXMAC__
// On wxMac we can't depend on the EVT_KILL_FOCUS event to properly
// shutdown the edit control when the mouse is clicked elsewhere on the
@ -2879,7 +2880,15 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
}
if ( !HasCurrent() || IsEmpty() )
{
if (event.RightDown())
{
SendNotify( (size_t)-1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition() );
// Allow generation of context menu event
event.Skip();
}
return;
}
if (m_dirty)
return;
@ -2949,8 +2958,19 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
if ( !hitResult )
{
// outside of any item, reset the selection and bail out
HighlightAll(false);
// outside of any item
if (event.RightDown())
{
SendNotify( (size_t) -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition() );
// Allow generation of context menu event
event.Skip();
}
else
{
// reset the selection and bail out
HighlightAll(false);
}
return;
}
@ -3264,6 +3284,10 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
case WXK_PAGEUP:
{
// we get a floating point exception without this
if (m_linesPerPage == 0)
m_linesPerPage = 1;
int steps = InReportView() ? m_linesPerPage - 1 : m_current % m_linesPerPage;
int index = m_current - steps;
@ -3276,6 +3300,10 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
case WXK_PAGEDOWN:
{
// we get a floating point exception without this
if (m_linesPerPage == 0)
m_linesPerPage = 1;
int steps = InReportView()
? m_linesPerPage - 1
: m_linesPerPage - (m_current % m_linesPerPage) - 1;
@ -4588,7 +4616,13 @@ void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data )
void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
{
// update our idea of which lines are shown when we redraw the window the
int cw, ch, vw, vh;
GetVirtualSize(&vw, &vh);
GetClientSize(&cw, &ch);
if( event.GetOrientation() == wxVERTICAL && ch >= vh)
return;
// update our idea of which lines are shown when we redraw the window the
// next time
ResetVisibleLinesRange();