* 2.4 version of sf.net pacth 735595
Backport of docs from patch 2.5 patch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1071,6 +1071,26 @@ for this to have any effect.
|
||||
|
||||
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}
|
||||
|
||||
@@ -1214,10 +1234,30 @@ for this to have any effect.
|
||||
|
||||
\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}
|
||||
|
||||
|
@@ -1309,6 +1309,39 @@ public:
|
||||
void SetColMinimalWidth( int col, int width );
|
||||
void SetRowMinimalHeight( int row, int width );
|
||||
|
||||
/* These two members can be used to query and modify the minimal
|
||||
* acceptable size of grid rows and columns. In the implementation of
|
||||
* wxGrid and related functions and classes these replace the macros
|
||||
* WXGRID_MIN_ROW_HEIGHT and WXGRID_MIN_COL_WIDTH. This allows users
|
||||
* to override these defaults to allow for grids with smaller cells.
|
||||
*
|
||||
* These numbers are the lower boundaries for the arguments which are
|
||||
* passed to the two versions above for setting per row/column minimum
|
||||
* sizes. Like the members SetColMinimalWidth and SetRowMinimalWidth,
|
||||
* the two Set members below must be called during grid creation, because
|
||||
* the existing rows or columns will not be resized if necessary.
|
||||
*
|
||||
* Notes:
|
||||
* * In order to keep backwards compatibility, these bits of state
|
||||
* information cannot be stored in member variables in the 2.4 series.
|
||||
* Hence the implementations of these functions use auxiliary static
|
||||
* functions which hold the numbers as static data (see grid.cpp).
|
||||
* * Those data are initialised to according to the values of the macros
|
||||
* WXGRID_MIN_ROW_HEIGHT and WXGRID_MIN_COL_WIDTH. This ensures
|
||||
* complete backward compatibility. There is guaranteed to be no
|
||||
* effect of this change, unless you actually call this function.
|
||||
* * In the 2.6 series, the behaviour of these functions will change. The
|
||||
* minimal acceptable height and width will be stored in member
|
||||
* variables, so calling these members only affects the class on which
|
||||
* they are called.
|
||||
*/
|
||||
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& );
|
||||
@@ -1836,6 +1869,7 @@ protected:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Grid event class and event types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -3698,10 +3698,10 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
|
||||
bool clipToMinMax);
|
||||
|
||||
#define internalXToCol(x) CoordToRowOrCol(x, m_defaultColWidth, \
|
||||
WXGRID_MIN_COL_WIDTH, \
|
||||
GetColMinimalAcceptableWidth(), \
|
||||
m_colRights, m_numCols, TRUE)
|
||||
#define internalYToRow(y) CoordToRowOrCol(y, m_defaultRowHeight, \
|
||||
WXGRID_MIN_ROW_HEIGHT, \
|
||||
GetRowMinimalAcceptableHeight(), \
|
||||
m_rowBottoms, m_numRows, TRUE)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -5542,7 +5542,7 @@ void wxGrid::DoEndDragResizeRow()
|
||||
|
||||
int rowTop = GetRowTop(m_dragRowOrCol);
|
||||
SetRowSize( m_dragRowOrCol,
|
||||
wxMax( m_dragLastPos - rowTop, WXGRID_MIN_ROW_HEIGHT ) );
|
||||
wxMax( m_dragLastPos - rowTop, GetRowMinimalAcceptableHeight() ) );
|
||||
|
||||
if ( !GetBatchCount() )
|
||||
{
|
||||
@@ -7556,14 +7556,14 @@ static int CoordToRowOrCol(int coord, int defaultDist, int minDist,
|
||||
int wxGrid::YToRow( int y )
|
||||
{
|
||||
return CoordToRowOrCol(y, m_defaultRowHeight,
|
||||
WXGRID_MIN_ROW_HEIGHT, m_rowBottoms, m_numRows, FALSE);
|
||||
GetRowMinimalAcceptableHeight(), m_rowBottoms, m_numRows, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int wxGrid::XToCol( int x )
|
||||
{
|
||||
return CoordToRowOrCol(x, m_defaultColWidth,
|
||||
WXGRID_MIN_COL_WIDTH, m_colRights, m_numCols, FALSE);
|
||||
GetColMinimalAcceptableWidth(), m_colRights, m_numCols, FALSE);
|
||||
}
|
||||
|
||||
|
||||
@@ -9124,7 +9124,7 @@ void wxGrid::EnableDragGridSize( bool enable )
|
||||
|
||||
void wxGrid::SetDefaultRowSize( int height, bool resizeExistingRows )
|
||||
{
|
||||
m_defaultRowHeight = wxMax( height, WXGRID_MIN_ROW_HEIGHT );
|
||||
m_defaultRowHeight = wxMax( height, GetRowMinimalAcceptableHeight() );
|
||||
|
||||
if ( resizeExistingRows )
|
||||
{
|
||||
@@ -9164,7 +9164,7 @@ void wxGrid::SetRowSize( int row, int height )
|
||||
|
||||
void wxGrid::SetDefaultColSize( int width, bool resizeExistingCols )
|
||||
{
|
||||
m_defaultColWidth = wxMax( width, WXGRID_MIN_COL_WIDTH );
|
||||
m_defaultColWidth = wxMax( width, GetColMinimalAcceptableWidth() );
|
||||
|
||||
if ( resizeExistingCols )
|
||||
{
|
||||
@@ -9218,13 +9218,13 @@ void wxGrid::SetRowMinimalHeight( int row, int 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 : GetColMinimalAcceptableWidth();
|
||||
}
|
||||
|
||||
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 : GetRowMinimalAcceptableHeight();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -9771,6 +9771,48 @@ wxRect wxGrid::BlockToDeviceRect( const wxGridCellCoords &topLeft,
|
||||
return rect;
|
||||
}
|
||||
|
||||
/* We may be overly precise here, but: a static global variable is not good
|
||||
* enough here. In theory, a wxGrid may be created from within the constructor
|
||||
* of a global class variable. In that case there is no guarantee that global
|
||||
* width/heght variables have been initialised already. Therefore we use this
|
||||
* typical Singleton pattern. The static rowsize variable in the function below
|
||||
* will be initialised when the function is first called.
|
||||
*
|
||||
* The same holds for the wxGridGlobalMinColWidth() function below.
|
||||
*/
|
||||
static inline int& wxGridGlobalMinRowHeight()
|
||||
{
|
||||
static int rowsize=WXGRID_MIN_ROW_HEIGHT;
|
||||
return rowsize;
|
||||
}
|
||||
|
||||
void wxGrid::SetRowMinimalAcceptableHeight( int height )
|
||||
{
|
||||
::wxGridGlobalMinRowHeight()=height;
|
||||
}
|
||||
|
||||
int wxGrid::GetRowMinimalAcceptableHeight() const
|
||||
{
|
||||
return ::wxGridGlobalMinRowHeight();
|
||||
}
|
||||
|
||||
static inline int& wxGridGlobalMinColWidth()
|
||||
{
|
||||
static int colwidth=WXGRID_MIN_COL_WIDTH;
|
||||
return colwidth;
|
||||
}
|
||||
|
||||
void wxGrid::SetColMinimalAcceptableWidth( int width )
|
||||
{
|
||||
::wxGridGlobalMinColWidth()=width;
|
||||
}
|
||||
|
||||
|
||||
int wxGrid::GetColMinimalAcceptableWidth() const
|
||||
{
|
||||
return ::wxGridGlobalMinColWidth();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user