Make some member functions const

This commit is contained in:
Paul Cornett
2021-03-04 11:49:33 -08:00
parent 613dce3d4b
commit 4388b9bd6b
5 changed files with 51 additions and 50 deletions

View File

@@ -1323,11 +1323,11 @@ public:
void SetTableObject( wxGridTableBase *table ) { m_table = table; } void SetTableObject( wxGridTableBase *table ) { m_table = table; }
wxGridTableBase * GetTableObject() const { return m_table; } wxGridTableBase * GetTableObject() const { return m_table; }
void SetId( int id ) { m_id = id; } void SetId( int id ) { m_id = id; }
int GetId() { return m_id; } int GetId() const { return m_id; }
void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; } void SetCommandInt( int comInt1 ) { m_comInt1 = comInt1; }
int GetCommandInt() { return m_comInt1; } int GetCommandInt() const { return m_comInt1; }
void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; } void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; }
int GetCommandInt2() { return m_comInt2; } int GetCommandInt2() const { return m_comInt2; }
private: private:
wxGridTableBase *m_table; wxGridTableBase *m_table;
@@ -1625,7 +1625,7 @@ public:
const wxRect& rect, const wxRect& rect,
const wxGridCellAttr& attr, const wxGridCellAttr& attr,
int defaultHAlign = wxALIGN_INVALID, int defaultHAlign = wxALIGN_INVALID,
int defaultVAlign = wxALIGN_INVALID); int defaultVAlign = wxALIGN_INVALID) const;
// ------ grid render function for printing // ------ grid render function for printing
// //
@@ -2016,7 +2016,7 @@ public:
CellSpan GetCellSize( int row, int col, int *num_rows, int *num_cols ) const; CellSpan GetCellSize( int row, int col, int *num_rows, int *num_cols ) const;
wxSize GetCellSize(const wxGridCellCoords& coords) wxSize GetCellSize(const wxGridCellCoords& coords) const
{ {
wxSize s; wxSize s;
GetCellSize(coords.GetRow(), coords.GetCol(), &s.x, &s.y); GetCellSize(coords.GetRow(), coords.GetCol(), &s.x, &s.y);
@@ -3047,7 +3047,7 @@ private:
const wxGridCellCoords& bottomRight, const wxGridCellCoords& bottomRight,
wxPoint& pointOffSet, wxSize& sizeGrid, wxPoint& pointOffSet, wxSize& sizeGrid,
wxGridCellCoordsArray& renderCells, wxGridCellCoordsArray& renderCells,
wxArrayInt& arrayCols, wxArrayInt& arrayRows ); wxArrayInt& arrayCols, wxArrayInt& arrayRows ) const;
// Helper of Render(): set the scale to draw the cells at the right size. // Helper of Render(): set the scale to draw the cells at the right size.
void SetRenderScale( wxDC& dc, const wxPoint& pos, const wxSize& size, void SetRenderScale( wxDC& dc, const wxPoint& pos, const wxSize& size,
@@ -3211,8 +3211,8 @@ public:
virtual int GetRow() { return m_row; } virtual int GetRow() { return m_row; }
virtual int GetCol() { return m_col; } virtual int GetCol() { return m_col; }
wxPoint GetPosition() { return wxPoint( m_x, m_y ); } wxPoint GetPosition() const { return wxPoint( m_x, m_y ); }
bool Selecting() { return m_selecting; } bool Selecting() const { return m_selecting; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEvent(*this); } virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEvent(*this); }
@@ -3271,8 +3271,8 @@ public:
bool alt = false, bool alt = false,
bool meta = false) ); bool meta = false) );
int GetRowOrCol() { return m_rowOrCol; } int GetRowOrCol() const { return m_rowOrCol; }
wxPoint GetPosition() { return wxPoint( m_x, m_y ); } wxPoint GetPosition() const { return wxPoint( m_x, m_y ); }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridSizeEvent(*this); } virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridSizeEvent(*this); }
@@ -3330,13 +3330,13 @@ public:
bool alt = false, bool alt = false,
bool meta = false) ); bool meta = false) );
wxGridCellCoords GetTopLeftCoords() { return m_topLeft; } wxGridCellCoords GetTopLeftCoords() const { return m_topLeft; }
wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; } wxGridCellCoords GetBottomRightCoords() const { return m_bottomRight; }
int GetTopRow() { return m_topLeft.GetRow(); } int GetTopRow() const { return m_topLeft.GetRow(); }
int GetBottomRow() { return m_bottomRight.GetRow(); } int GetBottomRow() const { return m_bottomRight.GetRow(); }
int GetLeftCol() { return m_topLeft.GetCol(); } int GetLeftCol() const { return m_topLeft.GetCol(); }
int GetRightCol() { return m_bottomRight.GetCol(); } int GetRightCol() const { return m_bottomRight.GetCol(); }
bool Selecting() { return m_selecting; } bool Selecting() const { return m_selecting; }
virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridRangeSelectEvent(*this); } virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridRangeSelectEvent(*this); }
@@ -3372,9 +3372,9 @@ public:
wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
int row, int col, wxWindow* window); int row, int col, wxWindow* window);
int GetRow() { return m_row; } int GetRow() const { return m_row; }
int GetCol() { return m_col; } int GetCol() const { return m_col; }
wxWindow* GetWindow() { return m_window; } wxWindow* GetWindow() const { return m_window; }
void SetRow(int row) { m_row = row; } void SetRow(int row) { m_row = row; }
void SetCol(int col) { m_col = col; } void SetCol(int col) { m_col = col; }
void SetWindow(wxWindow* window) { m_window = window; } void SetWindow(wxWindow* window) { m_window = window; }

View File

@@ -58,7 +58,7 @@ public :
inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const;
// the reflection of this point // the reflection of this point
inline wxPoint2DInt operator-(); wxPoint2DInt operator-() const;
inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator+=(const wxPoint2DInt& pt);
inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt); inline wxPoint2DInt& operator-=(const wxPoint2DInt& pt);
@@ -167,7 +167,7 @@ inline wxPoint2DInt::operator wxPoint() const
return wxPoint( m_x, m_y); return wxPoint( m_x, m_y);
} }
inline wxPoint2DInt wxPoint2DInt::operator-() inline wxPoint2DInt wxPoint2DInt::operator-() const
{ {
return wxPoint2DInt( -m_x, -m_y); return wxPoint2DInt( -m_x, -m_y);
} }
@@ -294,7 +294,7 @@ public :
inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const;
// the reflection of this point // the reflection of this point
inline wxPoint2DDouble operator-(); wxPoint2DDouble operator-() const;
inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt);
inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt); inline wxPoint2DDouble& operator-=(const wxPoint2DDouble& pt);
@@ -384,7 +384,7 @@ inline wxDouble wxPoint2DDouble::GetCrossProduct( const wxPoint2DDouble &vec ) c
return ( m_x * vec.m_y - vec.m_x * m_y ); return ( m_x * vec.m_y - vec.m_x * m_y );
} }
inline wxPoint2DDouble wxPoint2DDouble::operator-() inline wxPoint2DDouble wxPoint2DDouble::operator-() const
{ {
return wxPoint2DDouble( -m_x, -m_y); return wxPoint2DDouble( -m_x, -m_y);
} }
@@ -573,7 +573,7 @@ public:
void ConstrainTo( const wxRect2DDouble &rect ); void ConstrainTo( const wxRect2DDouble &rect );
inline wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) wxPoint2DDouble Interpolate( wxInt32 widthfactor, wxInt32 heightfactor ) const
{ return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } { return wxPoint2DDouble( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); }
static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest );
@@ -680,7 +680,8 @@ public:
{ m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;} { m_x += left; m_y += top; m_width -= left + right; m_height -= top + bottom;}
inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; }
void ConstrainTo( const wxRect2DInt &rect ); void ConstrainTo( const wxRect2DInt &rect );
inline wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ) { return wxPoint2DInt( m_x + m_width * widthfactor , m_y + m_height * heightfactor ); } wxPoint2DInt Interpolate( wxInt32 widthfactor, wxInt32 heightfactor ) const
{ return wxPoint2DInt( m_x + m_width * widthfactor, m_y + m_height * heightfactor ); }
static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest );
inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); }

View File

@@ -41,7 +41,7 @@ public :
wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const;
// the reflection of this point // the reflection of this point
wxPoint2DInt operator-(); wxPoint2DInt operator-() const;
wxPoint2DInt& operator=(const wxPoint2DInt& pt); wxPoint2DInt& operator=(const wxPoint2DInt& pt);
wxPoint2DInt& operator+=(const wxPoint2DInt& pt); wxPoint2DInt& operator+=(const wxPoint2DInt& pt);
@@ -100,7 +100,7 @@ public :
wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const;
// the reflection of this point // the reflection of this point
wxPoint2DDouble operator-(); wxPoint2DDouble operator-() const;
wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); wxPoint2DDouble& operator=(const wxPoint2DDouble& pt);
wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt);
@@ -191,7 +191,7 @@ public:
void ConstrainTo( const wxRect2DDouble &rect ); void ConstrainTo( const wxRect2DDouble &rect );
wxPoint2DDouble Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ); wxPoint2DDouble Interpolate( wxInt32 widthfactor, wxInt32 heightfactor ) const;
static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest ); static void Intersect( const wxRect2DDouble &src1 , const wxRect2DDouble &src2 , wxRect2DDouble *dest );
void Intersect( const wxRect2DDouble &otherRect ); void Intersect( const wxRect2DDouble &otherRect );
@@ -280,7 +280,7 @@ public:
void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ); void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom );
void Offset( const wxPoint2DInt &pt ); void Offset( const wxPoint2DInt &pt );
void ConstrainTo( const wxRect2DInt &rect ); void ConstrainTo( const wxRect2DInt &rect );
wxPoint2DInt Interpolate( wxInt32 widthfactor , wxInt32 heightfactor ); wxPoint2DInt Interpolate( wxInt32 widthfactor, wxInt32 heightfactor ) const;
static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest ); static void Intersect( const wxRect2DInt &src1 , const wxRect2DInt &src2 , wxRect2DInt *dest );
void Intersect( const wxRect2DInt &otherRect ); void Intersect( const wxRect2DInt &otherRect );

View File

@@ -1857,7 +1857,7 @@ public:
/** /**
Gets an id Gets an id
*/ */
int GetId(); int GetId() const;
/** /**
Set the position after which the insertion/deletion occur Set the position after which the insertion/deletion occur
@@ -1867,7 +1867,7 @@ public:
/** /**
Get the position after which the insertion/deletion occur Get the position after which the insertion/deletion occur
*/ */
int GetCommandInt(); int GetCommandInt() const;
/** /**
Set the number of rows to be inserted/deleted Set the number of rows to be inserted/deleted
@@ -1877,7 +1877,7 @@ public:
/** /**
Get the number of rows to be inserted/deleted Get the number of rows to be inserted/deleted
*/ */
int GetCommandInt2(); int GetCommandInt2() const;
}; };
@@ -4447,7 +4447,7 @@ public:
may still be negative, see GetCellSize(int, int, int *, int *) for may still be negative, see GetCellSize(int, int, int *, int *) for
details. details.
*/ */
wxSize GetCellSize(const wxGridCellCoords& coords); wxSize GetCellSize(const wxGridCellCoords& coords) const;
//@} //@}
@@ -6239,7 +6239,7 @@ public:
/** /**
Position in pixels at which the event occurred. Position in pixels at which the event occurred.
*/ */
wxPoint GetPosition(); wxPoint GetPosition() const;
/** /**
Row at which the event occurred. Row at which the event occurred.
@@ -6259,7 +6259,7 @@ public:
Returns @true if the user is selecting grid cells, or @false if Returns @true if the user is selecting grid cells, or @false if
deselecting. deselecting.
*/ */
bool Selecting(); bool Selecting() const;
/** /**
Returns @true if the Shift key was down at the time of the event. Returns @true if the Shift key was down at the time of the event.
@@ -6324,12 +6324,12 @@ public:
/** /**
Position in pixels at which the event occurred. Position in pixels at which the event occurred.
*/ */
wxPoint GetPosition(); wxPoint GetPosition() const;
/** /**
Row or column at that was resized. Row or column at that was resized.
*/ */
int GetRowOrCol(); int GetRowOrCol() const;
/** /**
Returns @true if the Meta key was down at the time of the event. Returns @true if the Meta key was down at the time of the event.
@@ -6416,32 +6416,32 @@ public:
/** /**
Top left corner of the rectangular area that was (de)selected. Top left corner of the rectangular area that was (de)selected.
*/ */
wxGridCellCoords GetBottomRightCoords(); wxGridCellCoords GetBottomRightCoords() const;
/** /**
Bottom row of the rectangular area that was (de)selected. Bottom row of the rectangular area that was (de)selected.
*/ */
int GetBottomRow(); int GetBottomRow() const;
/** /**
Left column of the rectangular area that was (de)selected. Left column of the rectangular area that was (de)selected.
*/ */
int GetLeftCol(); int GetLeftCol() const;
/** /**
Right column of the rectangular area that was (de)selected. Right column of the rectangular area that was (de)selected.
*/ */
int GetRightCol(); int GetRightCol() const;
/** /**
Top left corner of the rectangular area that was (de)selected. Top left corner of the rectangular area that was (de)selected.
*/ */
wxGridCellCoords GetTopLeftCoords(); wxGridCellCoords GetTopLeftCoords() const;
/** /**
Top row of the rectangular area that was (de)selected. Top row of the rectangular area that was (de)selected.
*/ */
int GetTopRow(); int GetTopRow() const;
/** /**
Returns @true if the Meta key was down at the time of the event. Returns @true if the Meta key was down at the time of the event.
@@ -6451,7 +6451,7 @@ public:
/** /**
Returns @true if the area was selected, @false otherwise. Returns @true if the area was selected, @false otherwise.
*/ */
bool Selecting(); bool Selecting() const;
/** /**
Returns @true if the Shift key was down at the time of the event. Returns @true if the Shift key was down at the time of the event.
@@ -6492,7 +6492,7 @@ public:
/** /**
Returns the column at which the event occurred. Returns the column at which the event occurred.
*/ */
int GetCol(); int GetCol() const;
/** /**
Returns the edit control. Returns the edit control.
@@ -6509,14 +6509,14 @@ public:
/** /**
Returns the row at which the event occurred. Returns the row at which the event occurred.
*/ */
int GetRow(); int GetRow() const;
/** /**
Returns the edit window. Returns the edit window.
@since 3.1.3 @since 3.1.3
*/ */
wxWindow* GetWindow(); wxWindow* GetWindow() const;
/** /**
Sets the column at which the event occurred. Sets the column at which the event occurred.

View File

@@ -2477,7 +2477,7 @@ void wxGrid::GetRenderSizes( const wxGridCellCoords& topLeft,
const wxGridCellCoords& bottomRight, const wxGridCellCoords& bottomRight,
wxPoint& pointOffSet, wxSize& sizeGrid, wxPoint& pointOffSet, wxSize& sizeGrid,
wxGridCellCoordsArray& renderCells, wxGridCellCoordsArray& renderCells,
wxArrayInt& arrayCols, wxArrayInt& arrayRows ) wxArrayInt& arrayCols, wxArrayInt& arrayRows ) const
{ {
pointOffSet.x = 0; pointOffSet.x = 0;
pointOffSet.y = 0; pointOffSet.y = 0;
@@ -7215,7 +7215,7 @@ void wxGrid::DrawTextRectangle(wxDC& dc,
const wxRect& rect, const wxRect& rect,
const wxGridCellAttr& attr, const wxGridCellAttr& attr,
int hAlign, int hAlign,
int vAlign) int vAlign) const
{ {
attr.GetNonDefaultAlignment(&hAlign, &vAlign); attr.GetNonDefaultAlignment(&hAlign, &vAlign);