Rename wxGridBlockCoords::ContainsCell/Block() to just Contains()
These methods do the same thing, so it seems better to use the same name for them. This is not really a backwards-incompatible change, as these methods were just added in the parent commit, so nobody is using them yet.
This commit is contained in:
@@ -817,14 +817,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return whether this block contains the given cell.
|
// Return whether this block contains the given cell.
|
||||||
bool ContainsCell(const wxGridCellCoords& cell) const
|
bool Contains(const wxGridCellCoords& cell) const
|
||||||
{
|
{
|
||||||
return m_topRow <= cell.GetRow() && cell.GetRow() <= m_bottomRow &&
|
return m_topRow <= cell.GetRow() && cell.GetRow() <= m_bottomRow &&
|
||||||
m_leftCol <= cell.GetCol() && cell.GetCol() <= m_rightCol;
|
m_leftCol <= cell.GetCol() && cell.GetCol() <= m_rightCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return whether this blocks fully contains another one.
|
// Return whether this blocks fully contains another one.
|
||||||
bool ContainsBlock(const wxGridBlockCoords& other) const
|
bool Contains(const wxGridBlockCoords& other) const
|
||||||
{
|
{
|
||||||
return m_topRow <= other.m_topRow && other.m_bottomRow <= m_bottomRow &&
|
return m_topRow <= other.m_topRow && other.m_bottomRow <= m_bottomRow &&
|
||||||
m_leftCol <= other.m_leftCol && other.m_rightCol <= m_rightCol;
|
m_leftCol <= other.m_leftCol && other.m_rightCol <= m_rightCol;
|
||||||
|
@@ -1921,7 +1921,7 @@ public:
|
|||||||
@return
|
@return
|
||||||
@true, if the block contains the cell, @false otherwise.
|
@true, if the block contains the cell, @false otherwise.
|
||||||
*/
|
*/
|
||||||
bool ContainsCell(const wxGridCellCoords& cell) const;
|
bool Contains(const wxGridCellCoords& cell) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether this block contains another one.
|
Check whether this block contains another one.
|
||||||
@@ -1929,7 +1929,7 @@ public:
|
|||||||
@return
|
@return
|
||||||
@true if @a other is entirely contained within this block.
|
@true if @a other is entirely contained within this block.
|
||||||
*/
|
*/
|
||||||
bool ContainsBlock(const wxGridBlockCoords& other) const;
|
bool Contains(const wxGridBlockCoords& other) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculates the result blocks by subtracting the other block from this
|
Calculates the result blocks by subtracting the other block from this
|
||||||
|
@@ -67,7 +67,7 @@ bool wxGridSelection::IsInSelection( int row, int col ) const
|
|||||||
const size_t count = m_selection.size();
|
const size_t count = m_selection.size();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( size_t n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
if ( m_selection[n].ContainsCell(wxGridCellCoords(row, col)) )
|
if ( m_selection[n].Contains(wxGridCellCoords(row, col)) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,10 +830,10 @@ void wxGridSelection::MergeOrAddBlock(wxVectorGridBlockCoords& blocks,
|
|||||||
{
|
{
|
||||||
const wxGridBlockCoords& block = blocks[n];
|
const wxGridBlockCoords& block = blocks[n];
|
||||||
|
|
||||||
if ( block.ContainsBlock(newBlock) )
|
if ( block.Contains(newBlock) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( newBlock.ContainsBlock(block) )
|
if ( newBlock.Contains(block) )
|
||||||
{
|
{
|
||||||
blocks.erase(blocks.begin() + n);
|
blocks.erase(blocks.begin() + n);
|
||||||
n--;
|
n--;
|
||||||
|
@@ -1379,28 +1379,25 @@ TEST_CASE("GridBlockCoords::Intersects", "[grid]")
|
|||||||
CHECK(!wxGridBlockCoords(1, 1, 3, 3).Intersects(wxGridBlockCoords(4, 4, 6, 6)));
|
CHECK(!wxGridBlockCoords(1, 1, 3, 3).Intersects(wxGridBlockCoords(4, 4, 6, 6)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("GridBlockCoords::ContainsCell", "[grid]")
|
TEST_CASE("GridBlockCoords::Contains", "[grid]")
|
||||||
{
|
{
|
||||||
// Inside.
|
// Inside.
|
||||||
CHECK(wxGridBlockCoords(1, 1, 3, 3).ContainsCell(wxGridCellCoords(2, 2)));
|
CHECK(wxGridBlockCoords(1, 1, 3, 3).Contains(wxGridCellCoords(2, 2)));
|
||||||
|
|
||||||
// Outside.
|
// Outside.
|
||||||
CHECK(!wxGridBlockCoords(1, 1, 3, 3).ContainsCell(wxGridCellCoords(5, 5)));
|
CHECK(!wxGridBlockCoords(1, 1, 3, 3).Contains(wxGridCellCoords(5, 5)));
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("GridBlockCoords::ContainsBlock", "[grid]")
|
|
||||||
{
|
|
||||||
wxGridBlockCoords block1(1, 1, 5, 5);
|
wxGridBlockCoords block1(1, 1, 5, 5);
|
||||||
wxGridBlockCoords block2(1, 1, 3, 3);
|
wxGridBlockCoords block2(1, 1, 3, 3);
|
||||||
wxGridBlockCoords block3(2, 2, 7, 7);
|
wxGridBlockCoords block3(2, 2, 7, 7);
|
||||||
wxGridBlockCoords block4(10, 10, 12, 12);
|
wxGridBlockCoords block4(10, 10, 12, 12);
|
||||||
|
|
||||||
CHECK( block1.ContainsBlock(block2));
|
CHECK( block1.Contains(block2));
|
||||||
CHECK(!block2.ContainsBlock(block1));
|
CHECK(!block2.Contains(block1));
|
||||||
CHECK(!block1.ContainsBlock(block3));
|
CHECK(!block1.Contains(block3));
|
||||||
CHECK(!block1.ContainsBlock(block4));
|
CHECK(!block1.Contains(block4));
|
||||||
CHECK(!block3.ContainsBlock(block1));
|
CHECK(!block3.Contains(block1));
|
||||||
CHECK(!block4.ContainsBlock(block1));
|
CHECK(!block4.Contains(block1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("GridBlockCoords::Difference", "[grid]")
|
TEST_CASE("GridBlockCoords::Difference", "[grid]")
|
||||||
|
Reference in New Issue
Block a user