Harmonize wxDataViewCtrl::GetSelection() behaviour in all ports.
wxDataViewCtrl::GetSelection() now always returns invalid item if more than a single item is selected in a multi-selection control. Also add HasSelection() and GetSelectedItemsCount() to allow checking if any items are selected. Updated the documentation, all ports and added a test for all these functions. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -518,7 +518,6 @@ public:
|
||||
unsigned int GetLastVisibleRow();
|
||||
unsigned int GetRowCount();
|
||||
|
||||
wxDataViewItem GetSelection() const;
|
||||
const wxDataViewSelection& GetSelections() const { return m_selection; }
|
||||
void SetSelections( const wxDataViewSelection & sel )
|
||||
{ m_selection = sel; UpdateDisplay(); }
|
||||
@@ -3962,14 +3961,6 @@ void wxDataViewMainWindow::OnKillFocus( wxFocusEvent &event )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
wxDataViewItem wxDataViewMainWindow::GetSelection() const
|
||||
{
|
||||
if( m_selection.GetCount() != 1 )
|
||||
return wxDataViewItem();
|
||||
|
||||
return GetItemByRow( m_selection.Item(0));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDataViewCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -4486,10 +4477,9 @@ void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
|
||||
}
|
||||
}
|
||||
|
||||
// Selection code with wxDataViewItem as parameters
|
||||
wxDataViewItem wxDataViewCtrl::GetSelection() const
|
||||
int wxDataViewCtrl::GetSelectedItemsCount() const
|
||||
{
|
||||
return m_clientArea->GetSelection();
|
||||
return m_clientArea->GetSelections().size();
|
||||
}
|
||||
|
||||
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
|
||||
|
Reference in New Issue
Block a user