Add wxDataViewCtrl::{Set,Get}CurrentItem().

Current item is the same as the selected item in single selection mode but in
multiple selection mode there was no way to neither get this item nor change
it before so add the new functions to allow doing this now.

The new methods are implemented for the generic, GTK and OS X/Cocoa versions
but only stubs are provided for OS X/Carbon.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-08-10 12:53:03 +00:00
parent 1e18430004
commit 80ce465c64
16 changed files with 317 additions and 7 deletions

View File

@@ -471,6 +471,7 @@ public:
void ScrollWindow( int dx, int dy, const wxRect *rect = NULL );
void ScrollTo( int rows, int column );
unsigned GetCurrentRow() const { return m_currentRow; }
bool HasCurrentRow() { return m_currentRow != (unsigned int)-1; }
void ChangeCurrentRow( unsigned int row );
@@ -4174,6 +4175,24 @@ wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const
: GetColumn(m_sortingColumnIdx);
}
wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
{
return GetItemByRow(m_clientArea->GetCurrentRow());
}
void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
{
const int row = m_clientArea->GetRowByItem(item);
const unsigned oldCurrent = m_clientArea->GetCurrentRow();
if ( static_cast<unsigned>(row) != oldCurrent )
{
m_clientArea->ChangeCurrentRow(row);
m_clientArea->RefreshRow(oldCurrent);
m_clientArea->RefreshRow(row);
}
}
// Selection code with wxDataViewItem as parameters
wxDataViewItem wxDataViewCtrl::GetSelection() const
{