X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/473d087e563d557a572ee85dd12778f37f8f18ec..80a58c9968cc740b50fb92cd95d6a014a1c6e9bf:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 6f14abfd3e..cb0696824c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -952,11 +952,11 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) m_minX = 0; bool hit_border = FALSE; int xpos = 0; - for (int j = 0; j < m_owner->GetColumnCount()-1; j++) + for (int j = 0; j < m_owner->GetColumnCount(); j++) { xpos += m_owner->GetColumnWidth( j ); m_column = j; - if ((abs(x-xpos) < 3) && (y < 22)) + if ((abs(x-xpos) < 3) && (y < 22) && (m_column < m_owner->GetColumnCount()-1)) { hit_border = TRUE; break; @@ -1171,6 +1171,8 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent, wxWindowID id, wxListMainWindow::~wxListMainWindow() { + DeleteEverything(); + if (m_hilightBrush) delete m_hilightBrush; delete m_renameTimer; @@ -2392,7 +2394,7 @@ void wxListMainWindow::DeleteColumn( int col ) if (node) m_columns.DeleteNode( node ); } -void wxListMainWindow::DeleteAllItems( void ) +void wxListMainWindow::DeleteAllItems() { m_dirty = TRUE; m_current = (wxListLineData *) NULL; @@ -2400,34 +2402,18 @@ void wxListMainWindow::DeleteAllItems( void ) // to make the deletion of all items faster, we don't send the // notifications in this case: this is compatible with wxMSW and // documented in DeleteAllItems() description -#if 0 - wxNode *node = m_lines.First(); - while (node) - { - wxListLineData *line = (wxListLineData*)node->Data(); - DeleteLine( line ); - - node = node->Next(); - } -#endif // 0 + wxListEvent event( wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, GetParent()->GetId() ); + event.SetEventObject( GetParent() ); + GetParent()->GetEventHandler()->ProcessEvent( event ); m_lines.Clear(); } -void wxListMainWindow::DeleteEverything( void ) +void wxListMainWindow::DeleteEverything() { - m_dirty = TRUE; - m_current = (wxListLineData *) NULL; - wxNode *node = m_lines.First(); - while (node) - { - wxListLineData *line = (wxListLineData*)node->Data(); - DeleteLine( line ); - node = node->Next(); - } - m_lines.Clear(); - m_current = (wxListLineData *) NULL; + DeleteAllItems(); + m_columns.Clear(); }