Refactor code deciding the kind of span of a grid cell
Move wxGrid's GetCellSize() cell span logic into GetCellSpan() for future usage.
This commit is contained in:
@@ -158,6 +158,24 @@ wxDEFINE_EVENT( wxEVT_GRID_TABBING, wxGridEvent );
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
// Helper function for consistent cell span determination based on cell size.
|
||||||
|
wxGrid::CellSpan GetCellSpan(int numRows, int numCols)
|
||||||
|
{
|
||||||
|
if ( numRows == 1 && numCols == 1 )
|
||||||
|
return wxGrid::CellSpan_None; // just a normal cell
|
||||||
|
|
||||||
|
if ( numRows < 0 || numCols < 0 )
|
||||||
|
return wxGrid::CellSpan_Inside; // covered by a multi-span cell
|
||||||
|
|
||||||
|
// this cell spans multiple cells to its right/bottom
|
||||||
|
return wxGrid::CellSpan_Main;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
wxIMPLEMENT_ABSTRACT_CLASS(wxGridCellEditorEvtHandler, wxEvtHandler);
|
wxIMPLEMENT_ABSTRACT_CLASS(wxGridCellEditorEvtHandler, wxEvtHandler);
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE( wxGridCellEditorEvtHandler, wxEvtHandler )
|
wxBEGIN_EVENT_TABLE( wxGridCellEditorEvtHandler, wxEvtHandler )
|
||||||
@@ -9126,14 +9144,7 @@ wxGrid::GetCellSize( int row, int col, int *num_rows, int *num_cols ) const
|
|||||||
{
|
{
|
||||||
GetCellAttrPtr(row, col)->GetSize( num_rows, num_cols );
|
GetCellAttrPtr(row, col)->GetSize( num_rows, num_cols );
|
||||||
|
|
||||||
if ( *num_rows == 1 && *num_cols == 1 )
|
return GetCellSpan(*num_rows, *num_cols);
|
||||||
return CellSpan_None; // just a normal cell
|
|
||||||
|
|
||||||
if ( *num_rows < 0 || *num_cols < 0 )
|
|
||||||
return CellSpan_Inside; // covered by a multi-span cell
|
|
||||||
|
|
||||||
// this cell spans multiple cells to its right/bottom
|
|
||||||
return CellSpan_Main;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCellRenderer* wxGrid::GetCellRenderer(int row, int col) const
|
wxGridCellRenderer* wxGrid::GetCellRenderer(int row, int col) const
|
||||||
|
Reference in New Issue
Block a user