Rename wxGridBlockCoords::ContainsCell() and move it inline

Make the function name more grammatically correct.

No real changes.
This commit is contained in:
Vadim Zeitlin
2020-04-04 19:45:19 +02:00
parent 0a5a904d8d
commit a5952ee087
5 changed files with 13 additions and 17 deletions

View File

@@ -816,10 +816,12 @@ public:
m_leftCol <= other.m_rightCol && m_rightCol >= other.m_leftCol;
}
// Whether the block contains the cell.
// returns @true, if the block contains the cell,
// @false, otherwise
bool ContainCell(const wxGridCellCoords& cell) const;
// Return whether this block contains the given cell.
bool ContainsCell(const wxGridCellCoords& cell) const
{
return m_topRow <= cell.GetRow() && cell.GetRow() <= m_bottomRow &&
m_leftCol <= cell.GetCol() && cell.GetCol() <= m_rightCol;
}
// Whether the blocks contain each other.
// returns 1, if this block contains the other,

View File

@@ -1916,12 +1916,12 @@ public:
}
/**
Whether the block contains the cell.
Check whether this block contains the given cell.
@return
@true, if the block contains the cell, @false, otherwise.
@true, if the block contains the cell, @false otherwise.
*/
bool ContainCell(const wxGridCellCoords& cell) const;
bool ContainsCell(const wxGridCellCoords& cell) const;
/**
Whether the blocks contain each other.

View File

@@ -1140,12 +1140,6 @@ const wxGridCornerHeaderRenderer& wxGridCellAttrProvider::GetCornerRenderer()
// wxGridBlockCoords
// ----------------------------------------------------------------------------
bool wxGridBlockCoords::ContainCell(const wxGridCellCoords& cell) const
{
return m_topRow <= cell.GetRow() && cell.GetRow() <= m_bottomRow &&
m_leftCol <= cell.GetCol() && cell.GetCol() <= m_rightCol;
}
int wxGridBlockCoords::ContainBlock(const wxGridBlockCoords& other) const
{
// returns 1, if this block contains the other,

View File

@@ -61,7 +61,7 @@ bool wxGridSelection::IsInSelection( int row, int col )
const size_t count = m_selection.size();
for ( size_t n = 0; n < count; n++ )
{
if ( m_selection[n].ContainCell(wxGridCellCoords(row, col)) )
if ( m_selection[n].ContainsCell(wxGridCellCoords(row, col)) )
return true;
}

View File

@@ -1328,13 +1328,13 @@ TEST_CASE("GridBlockCoords::Intersects", "[grid]")
CHECK(!wxGridBlockCoords(1, 1, 3, 3).Intersects(wxGridBlockCoords(4, 4, 6, 6)));
}
TEST_CASE("GridBlockCoords::ContainCell", "[grid]")
TEST_CASE("GridBlockCoords::ContainsCell", "[grid]")
{
// Inside.
CHECK(wxGridBlockCoords(1, 1, 3, 3).ContainCell(wxGridCellCoords(2, 2)));
CHECK(wxGridBlockCoords(1, 1, 3, 3).ContainsCell(wxGridCellCoords(2, 2)));
// Outside.
CHECK(!wxGridBlockCoords(1, 1, 3, 3).ContainCell(wxGridCellCoords(5, 5)));
CHECK(!wxGridBlockCoords(1, 1, 3, 3).ContainsCell(wxGridCellCoords(5, 5)));
}
TEST_CASE("GridBlockCoords::ContainBlock", "[grid]")