From 8403515064580b497986dcde81ac1b5b8845422f Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 1 Sep 2002 15:27:26 +0000 Subject: [PATCH] Added some const qualifiers. "Fixed" bug no 500487 by limiting wxGrid::DoGetBestSize's return value by DisplaySize. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/grid.h | 6 +++--- src/generic/grid.cpp | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 85417f5bbc..364339877a 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1131,7 +1131,7 @@ public: // ------ edit control functions // - bool IsEditable() { return m_editable; } + bool IsEditable() const { return m_editable; } void EnableEditing( bool edit ); void EnableCellEditControl( bool enable = TRUE ); @@ -1382,9 +1382,9 @@ public: void ClearSelection(); - bool IsInSelection( int row, int col ); + bool IsInSelection( int row, int col ) const; - bool IsInSelection( const wxGridCellCoords& coords ) + bool IsInSelection( const wxGridCellCoords& coords ) const { return IsInSelection( coords.GetRow(), coords.GetCol() ); } diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 2bb064129b..dc65ee909e 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -9187,8 +9187,17 @@ wxSize wxGrid::DoGetBestSize() const // don't set sizes, only calculate them wxGrid *self = (wxGrid *)this; // const_cast - return wxSize(self->SetOrCalcColumnSizes(TRUE), - self->SetOrCalcRowSizes(TRUE)); + int width, height; + width = self->SetOrCalcColumnSizes(TRUE); + height = self->SetOrCalcRowSizes(TRUE); + + int maxwidth, maxheight; + wxDisplaySize( & maxwidth, & maxheight ); + + if ( width > maxwidth ) width = maxwidth; + if ( height > maxheight ) height = maxheight; + + return wxSize( width, height ); } void wxGrid::Fit() @@ -9339,7 +9348,7 @@ bool wxGrid::IsSelection() m_selectingBottomRight != wxGridNoCellCoords) ) ); } -bool wxGrid::IsInSelection( int row, int col ) +bool wxGrid::IsInSelection( int row, int col ) const { return ( m_selection && (m_selection->IsInSelection( row, col ) || ( row >= m_selectingTopLeft.GetRow() && -- 2.45.2