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:
@@ -519,7 +519,7 @@ public:
|
|||||||
unsigned int GetRowCount();
|
unsigned int GetRowCount();
|
||||||
|
|
||||||
wxDataViewItem GetSelection() const;
|
wxDataViewItem GetSelection() const;
|
||||||
wxDataViewSelection GetSelections(){ return m_selection; }
|
const wxDataViewSelection& GetSelections() const { return m_selection; }
|
||||||
void SetSelections( const wxDataViewSelection & sel )
|
void SetSelections( const wxDataViewSelection & sel )
|
||||||
{ m_selection = sel; UpdateDisplay(); }
|
{ m_selection = sel; UpdateDisplay(); }
|
||||||
void Select( const wxArrayInt& aSelections );
|
void Select( const wxArrayInt& aSelections );
|
||||||
@@ -4488,12 +4488,12 @@ wxDataViewItem wxDataViewCtrl::GetSelection() const
|
|||||||
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
|
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
|
||||||
{
|
{
|
||||||
sel.Empty();
|
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() )
|
if ( item.IsOk() )
|
||||||
{
|
{
|
||||||
sel.Add(item);
|
sel.Add(item);
|
||||||
|
Reference in New Issue
Block a user