Fix generic wxDVC::EnsureVisible() to show full row
Generic wxDataViewCtrl's EnsureVisible() previously only ensured that at least some part of the item (even if just 1px of it) was visible, instead of being fully shown.
This commit is contained in:
parent
195df9af7f
commit
1f56389e8b
@ -756,6 +756,7 @@ public:
|
||||
// the displaying number of the tree are changing along with the
|
||||
// expanding/collapsing of the tree nodes
|
||||
unsigned int GetLastVisibleRow();
|
||||
unsigned int GetLastFullyVisibleRow();
|
||||
unsigned int GetRowCount() const;
|
||||
|
||||
const wxSelectionStore& GetSelections() const { return m_selection; }
|
||||
@ -2872,6 +2873,19 @@ unsigned int wxDataViewMainWindow::GetLastVisibleRow()
|
||||
return wxMin( GetRowCount()-1, row );
|
||||
}
|
||||
|
||||
unsigned int wxDataViewMainWindow::GetLastFullyVisibleRow()
|
||||
{
|
||||
unsigned int row = GetLastVisibleRow();
|
||||
|
||||
int bottom = GetLineStart(row) + GetLineHeight(row);
|
||||
m_owner->CalcScrolledPosition(-1, bottom, NULL, &bottom);
|
||||
|
||||
if ( bottom > GetClientSize().y )
|
||||
return wxMax(0, row - 1);
|
||||
else
|
||||
return row;
|
||||
}
|
||||
|
||||
unsigned int wxDataViewMainWindow::GetRowCount() const
|
||||
{
|
||||
if ( m_count == -1 )
|
||||
@ -5491,7 +5505,7 @@ void wxDataViewCtrl::EnsureVisibleRowCol( int row, int column )
|
||||
row = m_clientArea->GetRowCount();
|
||||
|
||||
int first = m_clientArea->GetFirstVisibleRow();
|
||||
int last = m_clientArea->GetLastVisibleRow();
|
||||
int last = m_clientArea->GetLastFullyVisibleRow();
|
||||
if( row < first )
|
||||
m_clientArea->ScrollTo( row, column );
|
||||
else if( row > last )
|
||||
@ -6178,7 +6192,7 @@ wxAccStatus wxDataViewCtrlAccessible::GetState(int childId, long* state)
|
||||
if ( !dvWnd->IsSingleSel() )
|
||||
st |= wxACC_STATE_SYSTEM_MULTISELECTABLE | wxACC_STATE_SYSTEM_EXTSELECTABLE;
|
||||
|
||||
if ( rowNum < dvWnd->GetFirstVisibleRow() || rowNum > dvWnd->GetLastVisibleRow() )
|
||||
if ( rowNum < dvWnd->GetFirstVisibleRow() || rowNum > dvWnd->GetLastFullyVisibleRow() )
|
||||
st |= wxACC_STATE_SYSTEM_OFFSCREEN;
|
||||
if ( dvWnd->GetCurrentRow() == rowNum )
|
||||
st |= wxACC_STATE_SYSTEM_FOCUSED;
|
||||
|
Loading…
Reference in New Issue
Block a user