// Set to zero to use no double-buffering
#ifdef __WXMSW__
-#define USE_DOUBLE_BUFFERING 1
+#define wxUSE_DOUBLE_BUFFERING 1
#else
-#define USE_DOUBLE_BUFFERING 0
+#define wxUSE_DOUBLE_BUFFERING 0
#endif
#define wxGRID_DRAG_NONE 0
wxGenericGrid::wxGenericGrid(void)
{
m_batchCount = 0;
- m_hScrollBar = NULL;
- m_vScrollBar = NULL;
+ m_hScrollBar = (wxScrollBar *) NULL;
+ m_vScrollBar = (wxScrollBar *) NULL;
m_cellTextColour = *wxBLACK;
m_cellBackgroundColour = *wxWHITE;
m_labelTextColour = *wxBLACK;
- m_labelBackgroundColour = *wxLIGHT_GREY;
- m_labelBackgroundBrush = NULL;
- m_labelTextFont = NULL;
- m_cellTextFont = NULL;
- m_textItem = NULL;
+// m_labelBackgroundColour = *wxLIGHT_GREY;
+ m_labelBackgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
+ m_labelBackgroundBrush = (wxBrush *) NULL;
+ m_labelTextFont = (wxFont *) NULL;
+ m_cellTextFont = (wxFont *) NULL;
+ m_textItem = (wxTextCtrl *) NULL;
m_currentRectVisible = FALSE;
m_editable = TRUE;
#if defined(__WIN95__)
m_dragRowOrCol = 0;
m_dragStartPosition = 0;
m_dragLastPosition = 0;
- m_divisionPen = NULL;
+ m_divisionPen = (wxPen *) NULL;
m_leftOfSheet = wxGRID_DEFAULT_SHEET_LEFT;
m_topOfSheet = wxGRID_DEFAULT_SHEET_TOP;
m_cellHeight = wxGRID_DEFAULT_CELL_HEIGHT;
m_totalGridWidth = 0;
m_totalGridHeight = 0;
- m_colWidths = NULL;
- m_rowHeights = NULL;
+ m_colWidths = (short *) NULL;
+ m_rowHeights = (short *) NULL;
m_verticalLabelWidth = wxGRID_DEFAULT_VERTICAL_LABEL_WIDTH;
m_horizontalLabelHeight = wxGRID_DEFAULT_HORIZONAL_LABEL_HEIGHT;
m_verticalLabelAlignment = wxCENTRE;
m_editCreated = FALSE;
m_totalRows = 0;
m_totalCols = 0;
- m_gridCells = NULL;
- m_rowLabelCells = NULL;
- m_colLabelCells = NULL;
- m_textItem = NULL;
- m_horizontalSashCursor = NULL;
- m_verticalSashCursor = NULL;
+ m_gridCells = (wxGridCell ***) NULL;
+ m_rowLabelCells = (wxGridCell **) NULL;
+ m_colLabelCells = (wxGridCell **) NULL;
+ m_textItem = (wxTextCtrl *) NULL;
+ m_horizontalSashCursor = (wxCursor *) NULL;
+ m_verticalSashCursor = (wxCursor *) NULL;
}
bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
m_batchCount = 0;
- m_editingPanel = NULL;
- m_hScrollBar = NULL;
- m_vScrollBar = NULL;
- m_horizontalSashCursor = NULL;
- m_verticalSashCursor = NULL;
+ m_editingPanel = (wxPanel *) NULL;
+ m_hScrollBar = (wxScrollBar *) NULL;
+ m_vScrollBar = (wxScrollBar *) NULL;
+ m_horizontalSashCursor = (wxCursor *) NULL;
+ m_verticalSashCursor = (wxCursor *) NULL;
m_cellTextColour = *wxBLACK;
m_cellBackgroundColour = *wxWHITE;
m_labelTextColour = *wxBLACK;
- m_labelBackgroundColour = *wxLIGHT_GREY;
- m_labelBackgroundBrush = NULL;
+// m_labelBackgroundColour = *wxLIGHT_GREY;
+ m_labelBackgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
+ m_labelBackgroundBrush = (wxBrush *) NULL;
m_labelTextFont = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxBOLD);
m_cellTextFont = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
- m_textItem = NULL;
+ m_textItem = (wxTextCtrl *) NULL;
m_currentRectVisible = FALSE;
m_editable = TRUE;
#if defined(__WIN95__)
m_dragStartPosition = 0;
m_dragLastPosition = 0;
m_divisionPen = wxThePenList->FindOrCreatePen("LIGHT GREY", 1, wxSOLID);
- m_doubleBufferingBitmap = NULL;
+ m_doubleBufferingBitmap = (wxBitmap *) NULL;
if (!m_horizontalSashCursor)
{
m_cellHeight = wxGRID_DEFAULT_CELL_HEIGHT;
m_totalGridWidth = 0;
m_totalGridHeight = 0;
- m_colWidths = NULL;
- m_rowHeights = NULL;
+ m_colWidths = (short *) NULL;
+ m_rowHeights = (short *) NULL;
m_verticalLabelWidth = wxGRID_DEFAULT_VERTICAL_LABEL_WIDTH;
m_horizontalLabelHeight = wxGRID_DEFAULT_HORIZONAL_LABEL_HEIGHT;
m_totalRows = 0;
m_totalCols = 0;
- m_gridCells = NULL;
- m_rowLabelCells = NULL;
- m_colLabelCells = NULL;
- m_textItem = NULL;
+ m_gridCells = (wxGridCell ***) NULL;
+ m_rowLabelCells = (wxGridCell **) NULL;
+ m_colLabelCells = (wxGridCell **) NULL;
+ m_textItem = (wxTextCtrl *) NULL;
wxPanel::Create(parent, id, pos, size, style, name);
delete[] m_gridCells[i];
}
delete[] m_gridCells;
- m_gridCells = NULL;
+ m_gridCells = (wxGridCell ***) NULL;
}
if (m_colWidths)
delete[] m_colWidths;
- m_colWidths = NULL;
+ m_colWidths = (short *) NULL;
if (m_rowHeights)
delete[] m_rowHeights;
- m_rowHeights = NULL;
+ m_rowHeights = (short *) NULL;
if (m_rowLabelCells)
{
for (i = 0; i < m_totalRows; i++)
delete m_rowLabelCells[i];
delete[] m_rowLabelCells;
- m_rowLabelCells = NULL;
+ m_rowLabelCells = (wxGridCell **) NULL;
}
if (m_colLabelCells)
{
for (i = 0; i < m_totalCols; i++)
delete m_colLabelCells[i];
delete[] m_colLabelCells;
- m_colLabelCells = NULL;
+ m_colLabelCells = (wxGridCell **) NULL;
}
if (m_doubleBufferingBitmap)
{
delete m_doubleBufferingBitmap;
- m_doubleBufferingBitmap = NULL;
+ m_doubleBufferingBitmap = (wxBitmap *) NULL;
}
}
m_gridCells[i][j]->SetTextValue(cellValues[i][j]);
}
else
- m_gridCells[i][j] = NULL;
+ m_gridCells[i][j] = (wxGridCell *) NULL;
m_rowLabelCells = new wxGridCell *[nRows];
for (i = 0; i < nRows; i++)
int objectSizeX = m_totalCols;
int pageSizeX = 1;
int viewLengthX = m_totalCols;
+
+/*
m_hScrollBar->SetViewLength(viewLengthX);
m_hScrollBar->SetObjectLength(objectSizeX);
m_hScrollBar->SetPageSize(pageSizeX);
+*/
+ m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), pageSizeX, objectSizeX, viewLengthX);
int objectSizeY = m_totalRows;
int pageSizeY = 1;
int viewLengthY = m_totalRows;
+/*
m_vScrollBar->SetViewLength(viewLengthY);
m_vScrollBar->SetObjectLength(objectSizeY);
m_vScrollBar->SetPageSize(pageSizeY);
+*/
+
+ m_vScrollBar->SetScrollbar(m_vScrollBar->GetPosition(), pageSizeY, objectSizeY, viewLengthY);
AdjustScrollbars();
wxGridCell *wxGenericGrid::GetCell(int row, int col)
{
if (!m_gridCells)
- return NULL;
+ return (wxGridCell *) NULL;
if ((row >= m_totalRows) || (col >= m_totalCols))
- return NULL;
+ return (wxGridCell *) NULL;
wxGridCell *cell = m_gridCells[row][col];
if (!cell)
int w, h;
GetClientSize(&w, &h);
- bool useDoubleBuffering = (bool) USE_DOUBLE_BUFFERING;
+ bool useDoubleBuffering = (bool) wxUSE_DOUBLE_BUFFERING;
if (useDoubleBuffering)
{
// Reuse the old bitmap if possible
// then don't complain, just don't double-buffer
if (m_doubleBufferingBitmap)
delete m_doubleBufferingBitmap;
- m_doubleBufferingBitmap = NULL;
+ m_doubleBufferingBitmap = (wxBitmap *) NULL;
useDoubleBuffering = FALSE;
}
}
{
dc->SetBrush(*cell->GetBackgroundBrush());
dc->SetPen(*wxTRANSPARENT_PEN);
+
+#if 0 // In wxWin 2.0 the dc code is exact. RR.
#ifdef __WXMOTIF__
dc->DrawRectangle(rect->x+1, rect->y+1, rect->width-1, rect->height-1);
#else
dc->DrawRectangle(rect->x+1, rect->y+1, rect->width, rect->height);
#endif
+#endif
+
+ dc->DrawRectangle(rect->x+1, rect->y+1, rect->width-1, rect->height-1);
+
dc->SetPen(*wxBLACK_PEN);
}
}
*/
m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), wxMax(noHorizSteps, 1), nCols, wxMax(noHorizSteps, 1));
- m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth,
+ m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2,
cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth);
}
// Why isn't this needed for Windows??
// Probably because of the SetValue??
+ // Arrrrrgh. This isn't needed anywhere, of course. RR.
#ifndef __WXMSW__
- HighlightCell(dc);
+// HighlightCell(dc);
#endif
dc->DestroyClippingRegion();
void wxGenericGrid::HighlightCell(wxDC *dc)
{
dc->SetLogicalFunction(wxINVERT);
+
// Top
- dc->DrawLine(m_currentRect.x + 1, m_currentRect.y + 1, m_currentRect.x + m_currentRect.width - 1, m_currentRect.y + 1);
+ dc->DrawLine( m_currentRect.x + 1,
+ m_currentRect.y + 1,
+ m_currentRect.x + m_currentRect.width - 1,
+ m_currentRect.y + 1);
// Right
- dc->DrawLine(m_currentRect.x + m_currentRect.width - 1, m_currentRect.y + 1,
- m_currentRect.x + m_currentRect.width - 1, m_currentRect.y +m_currentRect.height - 1);
+ dc->DrawLine( m_currentRect.x + m_currentRect.width - 1,
+ m_currentRect.y + 1,
+ m_currentRect.x + m_currentRect.width - 1,
+ m_currentRect.y +m_currentRect.height - 1 );
// Bottom
- dc->DrawLine(m_currentRect.x + m_currentRect.width - 1, m_currentRect.y + m_currentRect.height - 1,
- m_currentRect.x + 1, m_currentRect.y + m_currentRect.height - 1);
+ dc->DrawLine( m_currentRect.x + m_currentRect.width - 1,
+ m_currentRect.y + m_currentRect.height - 1,
+ m_currentRect.x + 1,
+ m_currentRect.y + m_currentRect.height - 1);
// Left
- dc->DrawLine(m_currentRect.x + 1, m_currentRect.y + m_currentRect.height - 1, m_currentRect.x + 1, m_currentRect.y + 1);
+ dc->DrawLine( m_currentRect.x + 1,
+ m_currentRect.y + m_currentRect.height - 1,
+ m_currentRect.x + 1,
+ m_currentRect.y + 1);
dc->SetLogicalFunction(wxCOPY);
}
if (m_colLabelCells && pos < m_totalCols)
return m_colLabelCells[pos];
else
- return NULL;
+ return (wxGridCell *) NULL;
}
else
{
if (m_rowLabelCells && pos < m_totalRows)
return m_rowLabelCells[pos];
else
- return NULL;
+ return (wxGridCell *) NULL;
}
}
return cell->GetCellBitmap();
}
else
- return NULL;
+ return (wxBitmap *) NULL;
}
bool wxGenericGrid::InsertCols(int pos, int n, bool updateLabels)
wxGridCell::wxGridCell(wxGenericGrid *window)
{
- cellBitmap = NULL;
- font = NULL;
- backgroundBrush = NULL;
+ cellBitmap = (wxBitmap *) NULL;
+ font = (wxFont *) NULL;
+ backgroundBrush = (wxBrush *) NULL;
if (window)
textColour = window->GetCellTextColour();
else