Add wxDataViewCtrl::GetTopItem() and GetCountPerPage()

Add methods doing the same thing for wxDataViewCtrl as the existing wxListBox
methods.

Closes #17498.
This commit is contained in:
Andreas Falkenhahn
2017-04-07 00:04:27 +02:00
committed by Vadim Zeitlin
parent e77cb6f31f
commit eb035485d7
12 changed files with 149 additions and 0 deletions

View File

@@ -751,6 +751,7 @@ public:
int GetCountPerPage() const;
int GetEndOfLastCol() const;
unsigned int GetFirstVisibleRow() const;
wxDataViewItem GetTopItem() const;
// I change this method to un const because in the tree view,
// the displaying number of the tree are changing along with the
@@ -2842,6 +2843,27 @@ int wxDataViewMainWindow::GetCountPerPage() const
return size.y / m_lineHeight;
}
wxDataViewItem wxDataViewMainWindow::GetTopItem() const
{
unsigned int item = GetFirstVisibleRow();
wxDataViewTreeNode *node = NULL;
wxDataViewItem dataitem;
if ( !IsVirtualList() )
{
node = GetTreeNodeByRow(item);
if( node == NULL ) return wxDataViewItem(0);
dataitem = node->GetItem();
}
else
{
dataitem = wxDataViewItem( wxUIntToPtr(item+1) );
}
return dataitem;
}
int wxDataViewMainWindow::GetEndOfLastCol() const
{
int width = 0;
@@ -5386,6 +5408,16 @@ int wxDataViewCtrl::GetSelectedItemsCount() const
return m_clientArea->GetSelections().GetSelectedCount();
}
wxDataViewItem wxDataViewCtrl::GetTopItem() const
{
return m_clientArea->GetTopItem();
}
int wxDataViewCtrl::GetCountPerPage() const
{
return m_clientArea->GetCountPerPage();
}
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
{
sel.Empty();