Sets the minimal width for the specified column. This should normally be called when creating the grid
because it will not resize a column that is already narrower than the minimal width.
+The width argument must be higher than the minimimal acceptable column width, see
+\helpref{wxGrid::GetColMinimalAcceptableWidth}{wxgridgetcolminimalacceptablewidth}.
+
+\membersection{wxGrid::SetColMinimalAcceptableWidth}\label{wxgridsetcolminimalacceptablewidth}
+
+\func{void}{SetColMinimalAcceptableWidth}{\param{int }{width}}
+
+This modifies the minimum column width that can be handled correctly. Specifying a low value here
+allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
+than the actual minimum size will incur a performance penalty in the functions which perform
+grid cell index lookup on the basis of screen coordinates.
+This should normally be called when creating the grid because it will not resize existing columns
+with sizes smaller than the value specified here.
+
+\membersection{wxGrid::GetColMinimalAcceptableWidth}\label{wxgridgetcolminimalacceptablewidth}
+
+\func{int}{GetColMinimalAcceptableWidth}{}
+
+This returns the value of the lowest column width that can be handled correctly. See
+member \helpref{SetColMinimalAcceptableWidth}{wxgridsetcolminimalacceptablewidth} for details.
\membersection{wxGrid::SetColSize}\label{wxgridsetcolsize}
\membersection{wxGrid::SetRowMinimalHeight}\label{wxgridsetrowminimalheight}
-\func{void}{SetRowMinimalHeight}{\param{int }{row}, \param{int }{width}}
+\func{void}{SetRowMinimalHeight}{\param{int }{row}, \param{int }{height}}
Sets the minimal height for the specified row. This should normally be called when creating the grid
because it will not resize a row that is already shorter than the minimal height.
+The height argument must be higher than the minimimal acceptable row height, see
+\helpref{wxGrid::GetRowMinimalAcceptableHeight}{wxgridgetrowminimalacceptableheight}.
+
+\membersection{wxGrid::SetRowMinimalAcceptableHeight}\label{wxgridsetrowminimalacceptableheight}
+
+\func{void}{SetRowMinimalAcceptableHeight}{\param{int }{height}}
+
+This modifies the minimum row width that can be handled correctly. Specifying a low value here
+allows smaller grid cells to be dealt with correctly. Specifying a value here which is much smaller
+than the actual minimum size will incur a performance penalty in the functions which perform
+grid cell index lookup on the basis of screen coordinates.
+This should normally be called when creating the grid because it will not resize existing rows
+with sizes smaller than the value specified here.
+
+\membersection{wxGrid::GetRowMinimalAcceptableHeight}\label{wxgridgetrowminimalacceptableheight}
+
+\func{int}{GetRowMinimalAcceptableHeight}{}
+
+This returns the value of the lowest row width that can be handled correctly. See
+member \helpref{SetRowMinimalAcceptableHeight}{wxgridsetrowminimalacceptableheight} for details.
\membersection{wxGrid::SetRowSize}\label{wxgridsetrowsize}
void SetColMinimalWidth( int col, int width );
void SetRowMinimalHeight( int row, int width );
+ /* These members can be used to query and modify the minimal
+ * acceptable size of grid rows and columns. Call this function in
+ * your code which creates the grid if you want to display cells
+ * with a size smaller than the default acceptable minimum size.
+ * Like the members SetColMinimalWidth and SetRowMinimalWidth,
+ * the existing rows or columns will not be checked/resized.
+ */
+ void SetColMinimalAcceptableWidth( int width );
+ void SetRowMinimalAcceptableHeight( int width );
+ int GetColMinimalAcceptableWidth() const;
+ int GetRowMinimalAcceptableHeight() const;
+
void SetDefaultCellBackgroundColour( const wxColour& );
void SetCellBackgroundColour( int row, int col, const wxColour& );
void SetDefaultCellTextColour( const wxColour& );
void InitRowHeights();
int m_defaultRowHeight;
+ int m_minAcceptableRowHeight;
wxArrayInt m_rowHeights;
wxArrayInt m_rowBottoms;
void InitColWidths();
int m_defaultColWidth;
+ int m_minAcceptableColWidth;
wxArrayInt m_colWidths;
wxArrayInt m_colRights;
DECLARE_NO_COPY_CLASS(wxGrid)
};
+
// ----------------------------------------------------------------------------
// Grid event class and event types
// ----------------------------------------------------------------------------
bool clipToMinMax);
#define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \
- WXGRID_MIN_COL_WIDTH, \
+ m_minAcceptableColWidth, \
m_colRights, m_numCols, TRUE)
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
- WXGRID_MIN_ROW_HEIGHT, \
+ m_minAcceptableRowHeight, \
m_rowBottoms, m_numRows, TRUE)
/////////////////////////////////////////////////////////////////////
m_defaultColWidth = WXGRID_DEFAULT_COL_WIDTH;
m_defaultRowHeight = m_gridWin->GetCharHeight();
+ m_minAcceptableColWidth = WXGRID_MIN_COL_WIDTH;
+ m_minAcceptableRowHeight = WXGRID_MIN_ROW_HEIGHT;
+
#if defined(__WXMOTIF__) || defined(__WXGTK__) // see also text ctrl sizing in ShowCellEditControl()
m_defaultRowHeight += 8;
#else
int rowTop = GetRowTop(m_dragRowOrCol);
SetRowSize( m_dragRowOrCol,
- wxMax( m_dragLastPos - rowTop, WXGRID_MIN_ROW_HEIGHT ) );
+ wxMax( m_dragLastPos - rowTop, m_minAcceptableRowHeight ) );
if ( !GetBatchCount() )
{
int wxGrid::YToRow( int y )
{
return CoordToRowOrCol(y, m_defaultRowHeight,
- WXGRID_MIN_ROW_HEIGHT, m_rowBottoms, m_numRows, FALSE);
+ m_minAcceptableRowHeight, m_rowBottoms, m_numRows, FALSE);
}
int wxGrid::XToCol( int x )
{
return CoordToRowOrCol(x, m_defaultColWidth,
- WXGRID_MIN_COL_WIDTH, m_colRights, m_numCols, FALSE);
+ m_minAcceptableColWidth, m_colRights, m_numCols, FALSE);
}
void wxGrid::SetDefaultRowSize( int height, bool resizeExistingRows )
{
- m_defaultRowHeight = wxMax( height, WXGRID_MIN_ROW_HEIGHT );
+ m_defaultRowHeight = wxMax( height, m_minAcceptableRowHeight );
if ( resizeExistingRows )
{
{
wxCHECK_RET( row >= 0 && row < m_numRows, _T("invalid row index") );
+
if ( m_rowHeights.IsEmpty() )
{
// need to really create the array
void wxGrid::SetDefaultColSize( int width, bool resizeExistingCols )
{
- m_defaultColWidth = wxMax( width, WXGRID_MIN_COL_WIDTH );
+ m_defaultColWidth = wxMax( width, m_minAcceptableColWidth );
if ( resizeExistingCols )
{
void wxGrid::SetColMinimalWidth( int col, int width )
{
- m_colMinWidths.Put(col, width);
+ if (width > GetColMinimalAcceptableWidth()) {
+ m_colMinWidths.Put(col, width);
+ }
}
void wxGrid::SetRowMinimalHeight( int row, int width )
{
- m_rowMinHeights.Put(row, width);
+ if (width > GetRowMinimalAcceptableHeight()) {
+ m_rowMinHeights.Put(row, width);
+ }
}
int wxGrid::GetColMinimalWidth(int col) const
{
long value = m_colMinWidths.Get(col);
- return value != wxNOT_FOUND ? (int)value : WXGRID_MIN_COL_WIDTH;
+ return value != wxNOT_FOUND ? (int)value : m_minAcceptableColWidth;
}
int wxGrid::GetRowMinimalHeight(int row) const
{
long value = m_rowMinHeights.Get(row);
- return value != wxNOT_FOUND ? (int)value : WXGRID_MIN_ROW_HEIGHT;
+ return value != wxNOT_FOUND ? (int)value : m_minAcceptableRowHeight;
+}
+
+void wxGrid::SetColMinimalAcceptableWidth( int width )
+{
+ if ( width<1 )
+ return;
+ m_minAcceptableColWidth = width;
+}
+
+void wxGrid::SetRowMinimalAcceptableHeight( int height )
+{
+ if ( height<1 )
+ return;
+ m_minAcceptableRowHeight = height;
+};
+
+int wxGrid::GetColMinimalAcceptableWidth() const
+{
+ return m_minAcceptableColWidth;
+}
+
+int wxGrid::GetRowMinimalAcceptableHeight() const
+{
+ return m_minAcceptableRowHeight;
}
// ----------------------------------------------------------------------------
return rect;
}
-
-
//
// ------ Grid event classes
//