X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9330d5afb6550c058ba3381a193f2ccaa66097c4..b3cec67186d678d2c3985923bdb8c787455cf369:/src/generic/datavgen.cpp diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index aba7354e03..9b6c2759cb 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1676,6 +1676,12 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) wxMin( (int)( GetLineAt( wxMax(0,update.y+update.height) ) - item_start + 1), (int)(GetRowCount( ) - item_start)); unsigned int item_last = item_start + item_count; + // Get the parent of DataViewCtrl + wxWindow *parent = GetParent()->GetParent(); + wxDataViewEvent cache_event(wxEVT_COMMAND_DATAVIEW_CACHE_HINT, parent->GetId()); + cache_event.SetEventObject(GetParent()); + cache_event.SetCache(item_start, item_last - 1); + parent->ProcessWindowEvent(cache_event); // compute which columns needs to be redrawn unsigned int cols = GetOwner()->GetColumnCount(); @@ -2030,7 +2036,9 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData { if (IsVirtualList()) { - m_count++; + wxDataViewVirtualListModel *list_model = + (wxDataViewVirtualListModel*) GetOwner()->GetModel(); + m_count = list_model->GetCount(); UpdateDisplay(); return true; } @@ -2070,7 +2078,10 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, { if (IsVirtualList()) { - m_count--; + wxDataViewVirtualListModel *list_model = + (wxDataViewVirtualListModel*) GetOwner()->GetModel(); + m_count = list_model->GetCount(); + if( m_currentRow > GetRowCount() ) m_currentRow = m_count - 1; @@ -2487,7 +2498,7 @@ void wxDataViewMainWindow::RefreshRowsAfter( unsigned int firstRow ) void wxDataViewMainWindow::OnArrowChar(unsigned int newCurrent, const wxKeyEvent& event) { wxCHECK_RET( newCurrent < GetRowCount(), - _T("invalid item index in OnArrowChar()") ); + wxT("invalid item index in OnArrowChar()") ); // if there is no selection, we cannot move it anywhere if (!HasCurrentRow()) @@ -2786,9 +2797,7 @@ wxDataViewItem wxDataViewMainWindow::GetItemByRow(unsigned int row) const { RowToItemJob job( row, -2 ); Walker( m_root , job ); - wxDataViewItem res = job.GetResult(); -// wxPrintf( "row %d, item %d\n", row, (int) res.GetID() ); - return res; + return job.GetResult(); } } @@ -3183,7 +3192,7 @@ wxRect wxDataViewMainWindow::GetItemRect( const wxDataViewItem & item, { wxDataViewTreeNode* node = GetTreeNodeByRow(row); indent = GetOwner()->GetIndent() * node->GetIndentLevel(); - indent = indent + m_lineHeight; // use m_lineHeight as the width of the expander + indent = indent + m_lineHeight; // use m_lineHeight as the width of the expander if(!node->HasChildren()) delete node; @@ -3206,6 +3215,7 @@ int wxDataViewMainWindow::RecalculateCount() { wxDataViewVirtualListModel *list_model = (wxDataViewVirtualListModel*) GetOwner()->GetModel(); + return list_model->GetCount(); } else @@ -3388,7 +3398,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) // don't use m_linesPerPage directly as it might not be computed yet const int pageSize = GetCountPerPage(); - wxCHECK_RET( pageSize, _T("should have non zero page size") ); + wxCHECK_RET( pageSize, wxT("should have non zero page size") ); switch ( event.GetKeyCode() ) { @@ -3835,7 +3845,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) else // !ctrl, !shift { // test in the enclosing if should make it impossible - wxFAIL_MSG( _T("how did we get here?") ); + wxFAIL_MSG( wxT("how did we get here?") ); } }