X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bde9072f68db1fed276e2ca376a1d95b4b8998d2..b53e38fed51f88117e571676b3d12d7da86310f0:/src/generic/listctrl.cpp?ds=inline diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b3680c13d5..b4c6644be4 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1879,7 +1879,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) int numColumns = m_owner->GetColumnCount(); wxListItem item; - for (int i = 0; i < numColumns; i++) + for ( int i = 0; i < numColumns && x < w; i++ ) { m_owner->GetColumn( i, item ); int wCol = item.m_width; @@ -1923,11 +1923,9 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.DrawText( item.GetText(), x + EXTRA_WIDTH, HEADER_OFFSET_Y + EXTRA_HEIGHT ); - if ( x > w - wCol + 5 ) - break; - x += wCol; } + dc.EndDrawing(); } @@ -2648,7 +2646,7 @@ void wxListMainWindow::RefreshSelected() for ( size_t line = from; line <= to; line++ ) { - if ( IsHighlighted(line) ) + if ( IsHighlighted(line) || (line == m_current) ) { if ( line < selMin ) selMin = line; @@ -3244,7 +3242,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) nevent.SetDirection( !event.ShiftDown() ); nevent.SetEventObject( GetParent()->GetParent() ); nevent.SetCurrentFocus( m_parent ); - if (GetParent()->GetParent()->GetEventHandler()->ProcessEvent( nevent )) return; + if (GetParent()->GetParent()->GetEventHandler()->ProcessEvent( nevent )) + return; } /* no item -> nothing to do */ @@ -3344,12 +3343,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) case WXK_SPACE: if ( IsSingleSel() ) { - wxListEvent le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, - GetParent()->GetId() ); - le.SetEventObject( GetParent() ); - le.m_itemIndex = m_current; - GetLine(m_current)->GetItem( 0, le.m_item ); - GetParent()->GetEventHandler()->ProcessEvent( le ); + SendNotify( m_current, wxEVT_COMMAND_LIST_ITEM_ACTIVATED ); if ( IsHighlighted(m_current) ) { @@ -3364,14 +3358,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) case WXK_RETURN: case WXK_EXECUTE: - { - wxListEvent le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, - GetParent()->GetId() ); - le.SetEventObject( GetParent() ); - le.m_itemIndex = m_current; - GetLine(m_current)->GetItem( 0, le.m_item ); - GetParent()->GetEventHandler()->ProcessEvent( le ); - } + SendNotify( m_current, wxEVT_COMMAND_LIST_ITEM_ACTIVATED ); break; default: @@ -3393,16 +3380,16 @@ void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) ) // EVT_KILL_FOCUS before which means that we finish by redrawing the items // which are already drawn correctly resulting in horrible flicker - avoid // it - if ( m_hasFocus ) - return; + if ( !m_hasFocus ) + { + m_hasFocus = TRUE; - m_hasFocus = TRUE; + RefreshSelected(); + } - if (!GetParent()) + if ( !GetParent() ) return; - RefreshSelected(); - #ifdef __WXGTK__ g_focusWindow = GetParent(); #endif @@ -4904,7 +4891,7 @@ bool wxListCtrl::DeleteAllColumns() { size_t count = m_mainWin->m_columns.GetCount(); for ( size_t n = 0; n < count; n++ ) - DeleteColumn(n); + DeleteColumn(0); return TRUE; }