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
unsigned int GetRowCount();
wxDataViewItem GetSelection() const;
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 );
void SetSelections( const wxDataViewSelection & sel )
{ m_selection = sel; UpdateDisplay(); }
void Select( const wxArrayInt& aSelections );
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
{
sel.Empty();
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++ )
{
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);
if ( item.IsOk() )
{
sel.Add(item);