diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index d78a836773..c12d3f3e2a 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1323,11 +1323,11 @@ public: void SetTableObject( wxGridTableBase *table ) { m_table = table; } wxGridTableBase * GetTableObject() const { return m_table; } 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; } - int GetCommandInt() { return m_comInt1; } + int GetCommandInt() const { return m_comInt1; } void SetCommandInt2( int comInt2 ) { m_comInt2 = comInt2; } - int GetCommandInt2() { return m_comInt2; } + int GetCommandInt2() const { return m_comInt2; } private: wxGridTableBase *m_table; @@ -1625,7 +1625,7 @@ public: const wxRect& rect, const wxGridCellAttr& attr, int defaultHAlign = wxALIGN_INVALID, - int defaultVAlign = wxALIGN_INVALID); + int defaultVAlign = wxALIGN_INVALID) const; // ------ grid render function for printing // @@ -2016,7 +2016,7 @@ public: 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; GetCellSize(coords.GetRow(), coords.GetCol(), &s.x, &s.y); @@ -3047,7 +3047,7 @@ private: const wxGridCellCoords& bottomRight, wxPoint& pointOffSet, wxSize& sizeGrid, 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. void SetRenderScale( wxDC& dc, const wxPoint& pos, const wxSize& size, @@ -3211,8 +3211,8 @@ public: virtual int GetRow() { return m_row; } virtual int GetCol() { return m_col; } - wxPoint GetPosition() { return wxPoint( m_x, m_y ); } - bool Selecting() { return m_selecting; } + wxPoint GetPosition() const { return wxPoint( m_x, m_y ); } + bool Selecting() const { return m_selecting; } virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEvent(*this); } @@ -3271,8 +3271,8 @@ public: bool alt = false, bool meta = false) ); - int GetRowOrCol() { return m_rowOrCol; } - wxPoint GetPosition() { return wxPoint( m_x, m_y ); } + int GetRowOrCol() const { return m_rowOrCol; } + wxPoint GetPosition() const { return wxPoint( m_x, m_y ); } virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridSizeEvent(*this); } @@ -3330,13 +3330,13 @@ public: bool alt = false, bool meta = false) ); - wxGridCellCoords GetTopLeftCoords() { return m_topLeft; } - wxGridCellCoords GetBottomRightCoords() { return m_bottomRight; } - int GetTopRow() { return m_topLeft.GetRow(); } - int GetBottomRow() { return m_bottomRight.GetRow(); } - int GetLeftCol() { return m_topLeft.GetCol(); } - int GetRightCol() { return m_bottomRight.GetCol(); } - bool Selecting() { return m_selecting; } + wxGridCellCoords GetTopLeftCoords() const { return m_topLeft; } + wxGridCellCoords GetBottomRightCoords() const { return m_bottomRight; } + int GetTopRow() const { return m_topLeft.GetRow(); } + int GetBottomRow() const { return m_bottomRight.GetRow(); } + int GetLeftCol() const { return m_topLeft.GetCol(); } + int GetRightCol() const { return m_bottomRight.GetCol(); } + bool Selecting() const { return m_selecting; } virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridRangeSelectEvent(*this); } @@ -3372,9 +3372,9 @@ public: wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, int row, int col, wxWindow* window); - int GetRow() { return m_row; } - int GetCol() { return m_col; } - wxWindow* GetWindow() { return m_window; } + int GetRow() const { return m_row; } + int GetCol() const { return m_col; } + wxWindow* GetWindow() const { return m_window; } void SetRow(int row) { m_row = row; } void SetCol(int col) { m_col = col; } void SetWindow(wxWindow* window) { m_window = window; } diff --git a/include/wx/geometry.h b/include/wx/geometry.h index 7865fb0cd0..48214eae05 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -58,7 +58,7 @@ public : inline wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; // the reflection of this point - inline wxPoint2DInt operator-(); + wxPoint2DInt operator-() const; 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); } -inline wxPoint2DInt wxPoint2DInt::operator-() +inline wxPoint2DInt wxPoint2DInt::operator-() const { return wxPoint2DInt( -m_x, -m_y); } @@ -294,7 +294,7 @@ public : inline wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; // the reflection of this point - inline wxPoint2DDouble operator-(); + wxPoint2DDouble operator-() const; 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 ); } -inline wxPoint2DDouble wxPoint2DDouble::operator-() +inline wxPoint2DDouble wxPoint2DDouble::operator-() const { return wxPoint2DDouble( -m_x, -m_y); } @@ -573,7 +573,7 @@ public: 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 ); } 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;} inline void Offset( const wxPoint2DInt &pt ) { m_x += pt.m_x; m_y += pt.m_y; } 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 ); inline void Intersect( const wxRect2DInt &otherRect ) { Intersect( *this , otherRect , this ); } diff --git a/interface/wx/geometry.h b/interface/wx/geometry.h index 1db6856378..cff1c62234 100644 --- a/interface/wx/geometry.h +++ b/interface/wx/geometry.h @@ -41,7 +41,7 @@ public : wxInt32 GetCrossProduct( const wxPoint2DInt &vec ) const; // the reflection of this point - wxPoint2DInt operator-(); + wxPoint2DInt operator-() const; wxPoint2DInt& operator=(const wxPoint2DInt& pt); wxPoint2DInt& operator+=(const wxPoint2DInt& pt); @@ -100,7 +100,7 @@ public : wxDouble GetCrossProduct( const wxPoint2DDouble &vec ) const; // the reflection of this point - wxPoint2DDouble operator-(); + wxPoint2DDouble operator-() const; wxPoint2DDouble& operator=(const wxPoint2DDouble& pt); wxPoint2DDouble& operator+=(const wxPoint2DDouble& pt); @@ -191,7 +191,7 @@ public: 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 ); void Intersect( const wxRect2DDouble &otherRect ); @@ -280,7 +280,7 @@ public: void Inset( wxInt32 left , wxInt32 top ,wxInt32 right , wxInt32 bottom ); void Offset( const wxPoint2DInt &pt ); 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 ); void Intersect( const wxRect2DInt &otherRect ); diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 02d8767444..9584fe43a8 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -1857,7 +1857,7 @@ public: /** Gets an id */ - int GetId(); + int GetId() const; /** Set the position after which the insertion/deletion occur @@ -1867,7 +1867,7 @@ public: /** Get the position after which the insertion/deletion occur */ - int GetCommandInt(); + int GetCommandInt() const; /** Set the number of rows to be inserted/deleted @@ -1877,7 +1877,7 @@ public: /** 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 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. */ - wxPoint GetPosition(); + wxPoint GetPosition() const; /** Row at which the event occurred. @@ -6259,7 +6259,7 @@ public: Returns @true if the user is selecting grid cells, or @false if deselecting. */ - bool Selecting(); + bool Selecting() const; /** 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. */ - wxPoint GetPosition(); + wxPoint GetPosition() const; /** 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. @@ -6416,32 +6416,32 @@ public: /** 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. */ - int GetBottomRow(); + int GetBottomRow() const; /** 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. */ - int GetRightCol(); + int GetRightCol() const; /** 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. */ - int GetTopRow(); + int GetTopRow() const; /** 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. */ - bool Selecting(); + bool Selecting() const; /** 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. */ - int GetCol(); + int GetCol() const; /** Returns the edit control. @@ -6509,14 +6509,14 @@ public: /** Returns the row at which the event occurred. */ - int GetRow(); + int GetRow() const; /** Returns the edit window. @since 3.1.3 */ - wxWindow* GetWindow(); + wxWindow* GetWindow() const; /** Sets the column at which the event occurred. diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 261c7d2520..41fd4524cf 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2477,7 +2477,7 @@ void wxGrid::GetRenderSizes( const wxGridCellCoords& topLeft, const wxGridCellCoords& bottomRight, wxPoint& pointOffSet, wxSize& sizeGrid, wxGridCellCoordsArray& renderCells, - wxArrayInt& arrayCols, wxArrayInt& arrayRows ) + wxArrayInt& arrayCols, wxArrayInt& arrayRows ) const { pointOffSet.x = 0; pointOffSet.y = 0; @@ -7215,7 +7215,7 @@ void wxGrid::DrawTextRectangle(wxDC& dc, const wxRect& rect, const wxGridCellAttr& attr, int hAlign, - int vAlign) + int vAlign) const { attr.GetNonDefaultAlignment(&hAlign, &vAlign);