diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 98f494f376..02ae6d2554 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -817,14 +817,14 @@ public: } // 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 && m_leftCol <= cell.GetCol() && cell.GetCol() <= m_rightCol; } // 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 && m_leftCol <= other.m_leftCol && other.m_rightCol <= m_rightCol; diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 5a48bab795..d478052677 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -1921,7 +1921,7 @@ public: @return @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. @@ -1929,7 +1929,7 @@ public: @return @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 diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index 97aeee4f50..83b39e1fb3 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -67,7 +67,7 @@ bool wxGridSelection::IsInSelection( int row, int col ) const const size_t count = m_selection.size(); 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; } @@ -830,10 +830,10 @@ void wxGridSelection::MergeOrAddBlock(wxVectorGridBlockCoords& blocks, { const wxGridBlockCoords& block = blocks[n]; - if ( block.ContainsBlock(newBlock) ) + if ( block.Contains(newBlock) ) return; - if ( newBlock.ContainsBlock(block) ) + if ( newBlock.Contains(block) ) { blocks.erase(blocks.begin() + n); n--; diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index d61ba77d21..9c280c6d9b 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -1379,28 +1379,25 @@ TEST_CASE("GridBlockCoords::Intersects", "[grid]") CHECK(!wxGridBlockCoords(1, 1, 3, 3).Intersects(wxGridBlockCoords(4, 4, 6, 6))); } -TEST_CASE("GridBlockCoords::ContainsCell", "[grid]") +TEST_CASE("GridBlockCoords::Contains", "[grid]") { // Inside. - CHECK(wxGridBlockCoords(1, 1, 3, 3).ContainsCell(wxGridCellCoords(2, 2))); + CHECK(wxGridBlockCoords(1, 1, 3, 3).Contains(wxGridCellCoords(2, 2))); // 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 block2(1, 1, 3, 3); wxGridBlockCoords block3(2, 2, 7, 7); wxGridBlockCoords block4(10, 10, 12, 12); - CHECK( block1.ContainsBlock(block2)); - CHECK(!block2.ContainsBlock(block1)); - CHECK(!block1.ContainsBlock(block3)); - CHECK(!block1.ContainsBlock(block4)); - CHECK(!block3.ContainsBlock(block1)); - CHECK(!block4.ContainsBlock(block1)); + CHECK( block1.Contains(block2)); + CHECK(!block2.Contains(block1)); + CHECK(!block1.Contains(block3)); + CHECK(!block1.Contains(block4)); + CHECK(!block3.Contains(block1)); + CHECK(!block4.Contains(block1)); } TEST_CASE("GridBlockCoords::Difference", "[grid]")