No changes, just remove gratuitous inefficiency from generic wxDVC.

Don't return wxDataViewMainWindow::m_selection array by value, returning a
const reference to it is enough and avoids completely unnecessary memory
allocations and copying of potentially large amounts of data.

Also make wxDataViewMainWindow::GetSelections() const.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-08-12 14:09:41 +00:00
parent 3823a15e2c
commit f23b8c0d85

View File

@@ -519,7 +519,7 @@ public:
unsigned int GetRowCount();
wxDataViewItem GetSelection() const;
wxDataViewSelection GetSelections(){ return m_selection; }
const wxDataViewSelection& GetSelections() const { return m_selection; }
void SetSelections( const wxDataViewSelection & sel )
{ m_selection = sel; UpdateDisplay(); }
void Select( const wxArrayInt& aSelections );
@@ -4488,12 +4488,12 @@ wxDataViewItem wxDataViewCtrl::GetSelection() const
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
{
sel.Empty();
wxDataViewSelection selection = m_clientArea->GetSelections();
const wxDataViewSelection& selections = m_clientArea->GetSelections();
const size_t len = selection.size();
const size_t len = selections.size();
for ( size_t i = 0; i < len; i++ )
{
wxDataViewItem item = m_clientArea->GetItemByRow(selection[i]);
wxDataViewItem item = m_clientArea->GetItemByRow(selections[i]);
if ( item.IsOk() )
{
sel.Add(item);