Merge branch 'grid-col-row-sel'
Fix returning duplicates from Get{Row,Col}Selection(); add more tests. See https://github.com/wxWidgets/wxWidgets/pull/1874
This commit is contained in:
@@ -864,6 +864,8 @@ private:
|
||||
int m_rightCol;
|
||||
};
|
||||
|
||||
typedef wxVector<wxGridBlockCoords> wxGridBlockCoordsVector;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGridBlockDiffResult: The helper struct uses as a result type for difference
|
||||
// functions of wxGridBlockCoords class.
|
||||
@@ -882,7 +884,7 @@ struct wxGridBlockDiffResult
|
||||
|
||||
class wxGridBlocks
|
||||
{
|
||||
typedef wxVector<wxGridBlockCoords>::const_iterator iterator_impl;
|
||||
typedef wxGridBlockCoordsVector::const_iterator iterator_impl;
|
||||
|
||||
public:
|
||||
class iterator
|
||||
@@ -1997,7 +1999,13 @@ public:
|
||||
bool IsInSelection( const wxGridCellCoords& coords ) const
|
||||
{ return IsInSelection( coords.GetRow(), coords.GetCol() ); }
|
||||
|
||||
// Efficient methods returning the selected blocks (there are few of those).
|
||||
wxGridBlocks GetSelectedBlocks() const;
|
||||
wxGridBlockCoordsVector GetSelectedRowBlocks() const;
|
||||
wxGridBlockCoordsVector GetSelectedColBlocks() const;
|
||||
|
||||
// Less efficient (but maybe more convenient methods) returning all
|
||||
// selected cells, rows or columns -- there can be many and many of those.
|
||||
wxGridCellCoordsArray GetSelectedCells() const;
|
||||
wxGridCellCoordsArray GetSelectionBlockTopLeft() const;
|
||||
wxGridCellCoordsArray GetSelectionBlockBottomRight() const;
|
||||
|
@@ -530,6 +530,12 @@ public:
|
||||
virtual int Select(const wxRect& r) const = 0;
|
||||
virtual int& Select(wxRect& r) const = 0;
|
||||
|
||||
// Return or set left/top or right/bottom component of a block.
|
||||
virtual int SelectFirst(const wxGridBlockCoords& block) const = 0;
|
||||
virtual int SelectLast(const wxGridBlockCoords& block) const = 0;
|
||||
virtual void SetFirst(wxGridBlockCoords& block, int line) const = 0;
|
||||
virtual void SetLast(wxGridBlockCoords& block, int line) const = 0;
|
||||
|
||||
// Returns width or height of the rectangle
|
||||
virtual int& SelectSize(wxRect& r) const = 0;
|
||||
|
||||
@@ -642,6 +648,14 @@ public:
|
||||
virtual int Select(const wxSize& sz) const wxOVERRIDE { return sz.x; }
|
||||
virtual int Select(const wxRect& r) const wxOVERRIDE { return r.x; }
|
||||
virtual int& Select(wxRect& r) const wxOVERRIDE { return r.x; }
|
||||
virtual int SelectFirst(const wxGridBlockCoords& block) const wxOVERRIDE
|
||||
{ return block.GetTopRow(); }
|
||||
virtual int SelectLast(const wxGridBlockCoords& block) const wxOVERRIDE
|
||||
{ return block.GetBottomRow(); }
|
||||
virtual void SetFirst(wxGridBlockCoords& block, int line) const wxOVERRIDE
|
||||
{ block.SetTopRow(line); }
|
||||
virtual void SetLast(wxGridBlockCoords& block, int line) const wxOVERRIDE
|
||||
{ block.SetBottomRow(line); }
|
||||
virtual int& SelectSize(wxRect& r) const wxOVERRIDE { return r.width; }
|
||||
virtual wxSize MakeSize(int first, int second) const wxOVERRIDE
|
||||
{ return wxSize(first, second); }
|
||||
@@ -715,6 +729,14 @@ public:
|
||||
virtual int Select(const wxSize& sz) const wxOVERRIDE { return sz.y; }
|
||||
virtual int Select(const wxRect& r) const wxOVERRIDE { return r.y; }
|
||||
virtual int& Select(wxRect& r) const wxOVERRIDE { return r.y; }
|
||||
virtual int SelectFirst(const wxGridBlockCoords& block) const wxOVERRIDE
|
||||
{ return block.GetLeftCol(); }
|
||||
virtual int SelectLast(const wxGridBlockCoords& block) const wxOVERRIDE
|
||||
{ return block.GetRightCol(); }
|
||||
virtual void SetFirst(wxGridBlockCoords& block, int line) const wxOVERRIDE
|
||||
{ block.SetLeftCol(line); }
|
||||
virtual void SetLast(wxGridBlockCoords& block, int line) const wxOVERRIDE
|
||||
{ block.SetRightCol(line); }
|
||||
virtual int& SelectSize(wxRect& r) const wxOVERRIDE { return r.height; }
|
||||
virtual wxSize MakeSize(int first, int second) const wxOVERRIDE
|
||||
{ return wxSize(second, first); }
|
||||
|
Reference in New Issue
Block a user