From bdfa9359ae530db6ba8cb310b0dc097a0c806aa2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 2 May 2022 21:43:42 +0100 Subject: [PATCH] Move wxGrid::Get{Row,Col}Pos() out of line Don't define these functions in the header file, this is unnecessary. No real changes. --- include/wx/generic/grid.h | 26 ++------------------------ src/generic/grid.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 1473973a46..f74ea6ec89 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -2129,34 +2129,12 @@ public: // return the position at which the row with the given index is // displayed: notice that this is a slow operation as we don't maintain the // reverse mapping currently - int GetRowPos(int idx) const - { - wxASSERT_MSG( idx >= 0 && idx < m_numRows, "invalid row index" ); - - if ( m_rowAt.IsEmpty() ) - return idx; - - int pos = m_rowAt.Index(idx); - wxASSERT_MSG( pos != wxNOT_FOUND, "invalid row index" ); - - return pos; - } + int GetRowPos(int idx) const; // return the position at which the column with the given index is // displayed: notice that this is a slow operation as we don't maintain the // reverse mapping currently - int GetColPos(int idx) const - { - wxASSERT_MSG( idx >= 0 && idx < m_numCols, "invalid column index" ); - - if ( m_colAt.IsEmpty() ) - return idx; - - int pos = m_colAt.Index(idx); - wxASSERT_MSG( pos != wxNOT_FOUND, "invalid column index" ); - - return pos; - } + int GetColPos(int idx) const; // reset the rows or columns positions to the default order void ResetRowPos(); diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 92cc045492..10c72ef053 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5539,6 +5539,19 @@ void wxGrid::SetRowPos(int idx, int pos) RefreshAfterRowPosChange(); } +int wxGrid::GetRowPos(int idx) const +{ + wxASSERT_MSG( idx >= 0 && idx < m_numRows, "invalid row index" ); + + if ( m_rowAt.IsEmpty() ) + return idx; + + int pos = m_rowAt.Index(idx); + wxASSERT_MSG( pos != wxNOT_FOUND, "invalid row index" ); + + return pos; +} + void wxGrid::ResetRowPos() { m_rowAt.clear(); @@ -5631,6 +5644,19 @@ void wxGrid::SetColPos(int idx, int pos) RefreshAfterColPosChange(); } +int wxGrid::GetColPos(int idx) const +{ + wxASSERT_MSG( idx >= 0 && idx < m_numCols, "invalid column index" ); + + if ( m_colAt.IsEmpty() ) + return idx; + + int pos = m_colAt.Index(idx); + wxASSERT_MSG( pos != wxNOT_FOUND, "invalid column index" ); + + return pos; +} + void wxGrid::ResetColPos() { m_colAt.clear();