X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f481e6a253d4bb2b5237d941311ef3b0f5b214b..79570d64d36dfdf31e20b4242bf664232f20594b:/src/generic/gridg.cpp diff --git a/src/generic/gridg.cpp b/src/generic/gridg.cpp index 3fcd53134c..bfd5c3928b 100644 --- a/src/generic/gridg.cpp +++ b/src/generic/gridg.cpp @@ -80,14 +80,16 @@ wxGenericGrid::wxGenericGrid(void) m_labelTextColour = *wxBLACK; // m_labelBackgroundColour = *wxLIGHT_GREY; m_labelBackgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); - m_labelBackgroundBrush = (wxBrush *) NULL; - m_labelTextFont = (wxFont *) NULL; - m_cellTextFont = (wxFont *) NULL; + m_labelBackgroundBrush = wxNullBrush; + m_labelTextFont = wxNullFont; + m_cellTextFont = wxNullFont; m_textItem = (wxTextCtrl *) NULL; m_currentRectVisible = FALSE; m_editable = TRUE; #if defined(__WIN95__) m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X); +#elif defined(__WXGTK__) + m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X); #else m_scrollWidth = 16; #endif @@ -95,7 +97,7 @@ wxGenericGrid::wxGenericGrid(void) m_dragRowOrCol = 0; m_dragStartPosition = 0; m_dragLastPosition = 0; - m_divisionPen = (wxPen *) NULL; + m_divisionPen = wxNullPen; m_leftOfSheet = wxGRID_DEFAULT_SHEET_LEFT; m_topOfSheet = wxGRID_DEFAULT_SHEET_TOP; m_cellHeight = wxGRID_DEFAULT_CELL_HEIGHT; @@ -122,8 +124,6 @@ wxGenericGrid::wxGenericGrid(void) 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, @@ -133,21 +133,21 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, 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_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_labelBackgroundBrush = wxNullBrush; + m_labelTextFont = * wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxBOLD); + m_cellTextFont = * wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL); m_textItem = (wxTextCtrl *) NULL; m_currentRectVisible = FALSE; m_editable = TRUE; #if defined(__WIN95__) m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X); +#elif defined(__WXGTK__) + m_scrollWidth = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X); #else m_scrollWidth = 16; #endif @@ -155,13 +155,13 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, m_dragRowOrCol = 0; m_dragStartPosition = 0; m_dragLastPosition = 0; - m_divisionPen = wxThePenList->FindOrCreatePen("LIGHT GREY", 1, wxSOLID); + m_divisionPen = * wxThePenList->FindOrCreatePen("LIGHT GREY", 1, wxSOLID); m_doubleBufferingBitmap = (wxBitmap *) NULL; - if (!m_horizontalSashCursor) + if (!m_horizontalSashCursor.Ok()) { - m_horizontalSashCursor = new wxCursor(wxCURSOR_SIZEWE); - m_verticalSashCursor = new wxCursor(wxCURSOR_SIZENS); + m_horizontalSashCursor = wxCursor(wxCURSOR_SIZEWE); + m_verticalSashCursor = wxCursor(wxCURSOR_SIZENS); } SetLabelBackgroundColour(m_labelBackgroundColour); @@ -222,6 +222,8 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, m_hScrollBar = new wxScrollBar(this, wxGRID_HSCROLL, wxPoint(0, 0), wxSize(20, 100), wxHORIZONTAL); m_vScrollBar = new wxScrollBar(this, wxGRID_VSCROLL, wxPoint(0, 0), wxSize(100, 20), wxVERTICAL); +// SetSize(pos.x, pos.y, size.x, size.y); + return TRUE; } @@ -331,7 +333,7 @@ bool wxGenericGrid::CreateGrid(int nRows, int nCols, wxString **cellValues, shor m_hScrollBar->SetObjectLength(objectSizeX); m_hScrollBar->SetPageSize(pageSizeX); */ - m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), pageSizeX, objectSizeX, viewLengthX); + m_hScrollBar->SetScrollbar(m_hScrollBar->GetThumbPosition(), pageSizeX, objectSizeX, viewLengthX); int objectSizeY = m_totalRows; int pageSizeY = 1; @@ -343,7 +345,7 @@ bool wxGenericGrid::CreateGrid(int nRows, int nCols, wxString **cellValues, shor m_vScrollBar->SetPageSize(pageSizeY); */ - m_vScrollBar->SetScrollbar(m_vScrollBar->GetPosition(), pageSizeY, objectSizeY, viewLengthY); + m_vScrollBar->SetScrollbar(m_vScrollBar->GetThumbPosition(), pageSizeY, objectSizeY, viewLengthY); AdjustScrollbars(); @@ -402,7 +404,7 @@ void wxGenericGrid::UpdateDimensions(void) } } -wxGridCell *wxGenericGrid::GetCell(int row, int col) +wxGridCell *wxGenericGrid::GetCell(int row, int col) const { if (!m_gridCells) return (wxGridCell *) NULL; @@ -414,7 +416,7 @@ wxGridCell *wxGenericGrid::GetCell(int row, int col) if (!cell) { // m_gridCells[row][col] = OnCreateCell(); - wxGridEvent g_evt(GetId(), wxEVT_GRID_CREATE_CELL, this, row, col); + wxGridEvent g_evt(GetId(), wxEVT_GRID_CREATE_CELL, (wxGenericGrid*) this, row, col); GetEventHandler()->ProcessEvent(g_evt); m_gridCells[row][col] = g_evt.m_cell; return m_gridCells[row][col]; @@ -556,7 +558,7 @@ void wxGenericGrid::DrawLabelAreas(wxDC *dc) // dc->DrawRectangle(m_rightOfSheet, m_topOfSheet, cw - m_rightOfSheet, ch - m_topOfSheet); // Paint the label areas - dc->SetBrush(*m_labelBackgroundBrush); + dc->SetBrush(m_labelBackgroundBrush); // dc->DrawRectangle(m_leftOfSheet, m_topOfSheet, m_rightOfSheet - m_leftOfSheet + 1, m_horizontalLabelHeight + 1); dc->DrawRectangle(m_leftOfSheet, m_topOfSheet, cw-m_leftOfSheet, m_horizontalLabelHeight + 1); // dc->DrawRectangle(m_leftOfSheet, m_topOfSheet, m_verticalLabelWidth + 1, m_bottomOfSheet - m_topOfSheet + 1); @@ -583,9 +585,9 @@ void wxGenericGrid::DrawGridLines(wxDC *dc) int i; - if (m_divisionPen) + if (m_divisionPen.Ok()) { - dc->SetPen(*m_divisionPen); + dc->SetPen(m_divisionPen); int heightCount = m_topOfSheet + m_horizontalLabelHeight; @@ -653,9 +655,9 @@ void wxGenericGrid::DrawGridLines(wxDC *dc) } - if (m_divisionPen) + if (m_divisionPen.Ok()) { - dc->SetPen(*m_divisionPen); + dc->SetPen(m_divisionPen); // Draw vertical grey lines for cells int widthCount = m_leftOfSheet + m_verticalLabelWidth; @@ -744,7 +746,7 @@ void wxGenericGrid::DrawColumnLabels(wxDC *dc) return; int i; - wxRectangle rect; + wxRect rect; // Draw letters for columns rect.y = m_topOfSheet + 1; @@ -770,19 +772,19 @@ void wxGenericGrid::DrawColumnLabels(wxDC *dc) } } -void wxGenericGrid::DrawColumnLabel(wxDC *dc, wxRectangle *rect, int col) +void wxGenericGrid::DrawColumnLabel(wxDC *dc, wxRect *rect, int col) { wxGridCell *cell = GetLabelCell(wxHORIZONTAL, col); if (cell) { - wxRectangle rect2; + wxRect rect2; rect2 = *rect; rect2.x += 3; rect2.y += 2; rect2.width -= 5; rect2.height -= 4; dc->SetTextForeground(GetLabelTextColour()); - dc->SetFont(*GetLabelTextFont()); + dc->SetFont(GetLabelTextFont()); if ( !cell->GetTextValue().IsNull() ) DrawTextRect(dc, cell->GetTextValue(), &rect2, GetLabelAlignment(wxHORIZONTAL)); } @@ -797,7 +799,7 @@ void wxGenericGrid::DrawRowLabels(wxDC *dc) return; int i; - wxRectangle rect; + wxRect rect; // Draw numbers for rows rect.x = m_leftOfSheet; @@ -823,19 +825,19 @@ void wxGenericGrid::DrawRowLabels(wxDC *dc) } } -void wxGenericGrid::DrawRowLabel(wxDC *dc, wxRectangle *rect, int row) +void wxGenericGrid::DrawRowLabel(wxDC *dc, wxRect *rect, int row) { wxGridCell *cell = GetLabelCell(wxVERTICAL, row); if (cell) { - wxRectangle rect2; + wxRect rect2; rect2 = *rect; rect2.x += 3; rect2.y += 2; rect2.width -= 5; rect2.height -= 4; dc->SetTextForeground(GetLabelTextColour()); - dc->SetFont(*GetLabelTextFont()); + dc->SetFont(GetLabelTextFont()); if ( !cell->GetTextValue().IsNull() ) DrawTextRect(dc, cell->GetTextValue(), &rect2, GetLabelAlignment(wxVERTICAL)); } @@ -869,12 +871,12 @@ void wxGenericGrid::DrawCells(wxDC *dc) dc->SetPen(*wxBLACK_PEN); } -void wxGenericGrid::DrawCellBackground(wxDC *dc, wxRectangle *rect, int row, int col) +void wxGenericGrid::DrawCellBackground(wxDC *dc, wxRect *rect, int row, int col) { wxGridCell *cell = GetCell(row, col); if (cell) { - dc->SetBrush(*cell->GetBackgroundBrush()); + dc->SetBrush(cell->GetBackgroundBrush()); dc->SetPen(*wxTRANSPARENT_PEN); #if 0 // In wxWin 2.0 the dc code is exact. RR. @@ -891,13 +893,13 @@ void wxGenericGrid::DrawCellBackground(wxDC *dc, wxRectangle *rect, int row, int } } -void wxGenericGrid::DrawCellValue(wxDC *dc, wxRectangle *rect, int row, int col) +void wxGenericGrid::DrawCellValue(wxDC *dc, wxRect *rect, int row, int col) { wxGridCell *cell = GetCell(row, col); if (cell) { wxBitmap *bitmap = cell->GetCellBitmap(); - wxRectangle rect2; + wxRect rect2; rect2 = *rect; rect2.x += 3; rect2.y += 2; @@ -912,7 +914,7 @@ void wxGenericGrid::DrawCellValue(wxDC *dc, wxRectangle *rect, int row, int col) { dc->SetBackgroundMode(wxTRANSPARENT); dc->SetTextForeground(cell->GetTextColour()); - dc->SetFont(*cell->GetFont()); + dc->SetFont(cell->GetFont()); if ( !cell->GetTextValue().IsNull() ) DrawTextRect(dc, cell->GetTextValue(), &rect2, cell->GetAlignment()); @@ -1024,20 +1026,25 @@ void wxGenericGrid::AdjustScrollbars(void) if (m_hScrollBar && !m_hScrollBar->IsShown()) horizScrollBarHeight = 0; - if (m_hScrollBar) + if (m_hScrollBar && m_hScrollBar->IsShown()) { int nCols = GetCols(); - m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), wxMax(noHorizSteps, 1), (noHorizSteps == 0) ? 1 : nCols, wxMax(noHorizSteps, 1)); + m_hScrollBar->SetScrollbar(m_hScrollBar->GetThumbPosition(), wxMax(noHorizSteps, 1), (noHorizSteps == 0) ? 1 : nCols, wxMax(noHorizSteps, 1)); - m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2, +/* + m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2, // why -2 ? Robert. + cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth); +*/ + m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth, cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth); + } - if (m_vScrollBar) + if (m_vScrollBar && m_vScrollBar->IsShown()) { int nRows = GetRows(); - m_vScrollBar->SetScrollbar(m_vScrollBar->GetPosition(), wxMax(noVertSteps, 1), (noVertSteps == 0) ? 1 : nRows, wxMax(noVertSteps, 1)); + m_vScrollBar->SetScrollbar(m_vScrollBar->GetThumbPosition(), wxMax(noVertSteps, 1), (noVertSteps == 0) ? 1 : nRows, wxMax(noVertSteps, 1)); m_vScrollBar->SetSize(cw - m_scrollWidth, m_topOfSheet, m_scrollWidth, ch - m_topOfSheet - horizScrollBarHeight); } @@ -1057,7 +1064,7 @@ void wxGenericGrid::OnSize(wxSizeEvent& WXUNUSED(event) ) { m_editingPanel->SetSize(0, 0, cw, m_editControlPosition.height + m_editControlPosition.y + 2); GetTextItem()->SetSize(m_editControlPosition.x, m_editControlPosition.y, - cw - m_editControlPosition.x, m_editControlPosition.height); + cw - 2*m_editControlPosition.x, m_editControlPosition.height); } } @@ -1239,13 +1246,13 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev) if (orientation == wxHORIZONTAL) { m_dragStatus = wxGRID_DRAG_LEFT_RIGHT; - SetCursor(*m_horizontalSashCursor); + SetCursor(m_horizontalSashCursor); m_dragLastPosition = (int)ev.GetX(); } else { m_dragStatus = wxGRID_DRAG_UP_DOWN; - SetCursor(*m_verticalSashCursor); + SetCursor(m_verticalSashCursor); m_dragLastPosition = (int)ev.GetY(); } wxClientDC dc(this); @@ -1272,7 +1279,7 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev) dc.EndDrawing(); m_dragLastPosition = (int)ev.GetX(); - SetCursor(*m_horizontalSashCursor); + SetCursor(m_horizontalSashCursor); break; } case wxGRID_DRAG_UP_DOWN: @@ -1286,7 +1293,7 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev) dc.EndDrawing(); m_dragLastPosition = (int)ev.GetY(); - SetCursor(*m_verticalSashCursor); + SetCursor(m_verticalSashCursor); break; } } @@ -1297,9 +1304,9 @@ void wxGenericGrid::OnMouseEvent(wxMouseEvent& ev) if (LabelSashHitTest((int)ev.GetX(), (int)ev.GetY(), &orientation, &rowOrCol, &startPos)) { if (orientation == wxHORIZONTAL) - SetCursor(*m_horizontalSashCursor); + SetCursor(m_horizontalSashCursor); else - SetCursor(*m_verticalSashCursor); + SetCursor(m_verticalSashCursor); } else SetCursor(*wxSTANDARD_CURSOR); @@ -1406,12 +1413,15 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col) SetGridClippingRegion(dc); - // 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); + // 1) Why isn't this needed for Windows?? + // Probably because of the SetValue?? JS. + // 2) Arrrrrgh. This isn't needed anywhere, + // of course. One hour of debugging... RR. + // Put back for Motif only on advice of Michael Bedward +#ifdef __WXMOTIF__ + HighlightCell(dc); #endif + dc->DestroyClippingRegion(); //OnSelectCell(row, col); @@ -1502,7 +1512,7 @@ void wxGenericGrid::DrawCellText(void) if (!cell) return; - static char szEdit[300]; + static wxChar szEdit[300]; wxClientDC dc(this); dc.BeginDrawing(); @@ -1510,18 +1520,18 @@ void wxGenericGrid::DrawCellText(void) SetGridClippingRegion(& dc); dc.SetBackgroundMode(wxTRANSPARENT); - dc.SetBrush(*cell->GetBackgroundBrush()); + dc.SetBrush(cell->GetBackgroundBrush()); - strcpy(szEdit, m_textItem->GetValue()); + wxStrcpy(szEdit, m_textItem->GetValue()); - wxRectangle rect; + wxRect rect; rect = m_currentRect; rect.x += 3; rect.y += 2; rect.width -= 5; rect.height -= 4; - DrawTextRect(& dc, " ", &rect, wxLEFT); + DrawTextRect(& dc, _T(" "), &rect, wxLEFT); DrawTextRect(& dc, szEdit, &rect, cell->GetAlignment()); dc.DestroyClippingRegion(); @@ -1554,7 +1564,7 @@ void wxGenericGrid::SetCurrentRect(int Row, int Column, int canvasW, int canvasH else m_currentRectVisible = TRUE; } -static bool wxRectIntersection(wxRectangle *rect1, wxRectangle *rect2, wxRectangle *rect3) +static bool wxRectIntersection(wxRect *rect1, wxRect *rect2, wxRect *rect3) { int x2_1 = rect1->x + rect1->width; int y2_1 = rect1->y + rect1->height; @@ -1596,7 +1606,7 @@ static bool wxRectIntersection(wxRectangle *rect1, wxRectangle *rect2, wxRectang return TRUE; } -void wxGenericGrid::DrawTextRect(wxDC *dc, const wxString& text, wxRectangle *rect, int flag) +void wxGenericGrid::DrawTextRect(wxDC *dc, const wxString& text, wxRect *rect, int flag) { dc->BeginDrawing(); @@ -1608,8 +1618,8 @@ void wxGenericGrid::DrawTextRect(wxDC *dc, const wxString& text, wxRectangle *re // If we're already clipping, we need to find the intersection // between current clipping area and text clipping area. - wxRectangle clipRect; - wxRectangle clipRect2; + wxRect clipRect; + wxRect clipRect2; long clipX, clipY, clipW, clipH; dc->GetClippingBox(&clipX, &clipY, &clipW, &clipH); clipRect.x = (int)clipX; clipRect.y = (int)clipY; @@ -1673,7 +1683,7 @@ void wxGenericGrid::DrawTextRect(wxDC *dc, const wxString& text, wxRectangle *re dc->EndDrawing(); } -void wxGenericGrid::DrawBitmapRect(wxDC *dc, wxBitmap *bitmap, wxRectangle *rect, int flag) +void wxGenericGrid::DrawBitmapRect(wxDC *dc, wxBitmap *bitmap, wxRect *rect, int flag) { dc->BeginDrawing(); @@ -1685,8 +1695,8 @@ void wxGenericGrid::DrawBitmapRect(wxDC *dc, wxBitmap *bitmap, wxRectangle *rect // If we're already clipping, we need to find the intersection // between current clipping area and text clipping area. - wxRectangle clipRect; - wxRectangle clipRect2; + wxRect clipRect; + wxRect clipRect2; long clipX, clipY, clipW, clipH; dc->GetClippingBox(&clipX, &clipY, &clipW, &clipH); clipRect.x = (int)clipX; clipRect.y = (int)clipY; @@ -1815,7 +1825,7 @@ void wxGenericGrid::RefreshCell(int row, int col, bool setText) } } -wxString& wxGenericGrid::GetCellValue(int row, int col) +wxString& wxGenericGrid::GetCellValue(int row, int col) const { static wxString emptyString(""); @@ -1832,7 +1842,7 @@ void wxGenericGrid::SetColumnWidth(int col, int width) m_colWidths[col] = width; } -int wxGenericGrid::GetColumnWidth(int col) +int wxGenericGrid::GetColumnWidth(int col) const { if (col <= m_totalCols) return m_colWidths[col]; @@ -1846,7 +1856,7 @@ void wxGenericGrid::SetRowHeight(int row, int height) m_rowHeights[row] = height; } -int wxGenericGrid::GetRowHeight(int row) +int wxGenericGrid::GetRowHeight(int row) const { if (row <= m_totalRows) return m_rowHeights[row]; @@ -1864,7 +1874,7 @@ void wxGenericGrid::SetLabelSize(int orientation, int sz) SetCurrentRect(GetCursorRow(), GetCursorColumn()); } -int wxGenericGrid::GetLabelSize(int orientation) +int wxGenericGrid::GetLabelSize(int orientation) const { if (orientation == wxHORIZONTAL) return m_horizontalLabelHeight; @@ -1872,7 +1882,7 @@ int wxGenericGrid::GetLabelSize(int orientation) return m_verticalLabelWidth; } -wxGridCell *wxGenericGrid::GetLabelCell(int orientation, int pos) +wxGridCell *wxGenericGrid::GetLabelCell(int orientation, int pos) const { if (orientation == wxHORIZONTAL) { @@ -1897,7 +1907,7 @@ void wxGenericGrid::SetLabelValue(int orientation, const wxString& val, int pos) cell->SetTextValue(val); } -wxString& wxGenericGrid::GetLabelValue(int orientation, int pos) +wxString& wxGenericGrid::GetLabelValue(int orientation, int pos) const { static wxString emptyString = ""; wxGridCell *cell = GetLabelCell(orientation, pos); @@ -1917,7 +1927,7 @@ void wxGenericGrid::SetLabelAlignment(int orientation, int align) SetCurrentRect(GetCursorRow(), GetCursorColumn()); } -int wxGenericGrid::GetLabelAlignment(int orientation) +int wxGenericGrid::GetLabelAlignment(int orientation) const { if (orientation == wxHORIZONTAL) return m_horizontalLabelAlignment; @@ -1934,7 +1944,7 @@ void wxGenericGrid::SetLabelTextColour(const wxColour& colour) void wxGenericGrid::SetLabelBackgroundColour(const wxColour& colour) { m_labelBackgroundColour = colour; - m_labelBackgroundBrush = wxTheBrushList->FindOrCreateBrush(m_labelBackgroundColour, wxSOLID); + m_labelBackgroundBrush = * wxTheBrushList->FindOrCreateBrush(m_labelBackgroundColour, wxSOLID); } void wxGenericGrid::SetEditable(bool edit) @@ -1988,7 +1998,7 @@ void wxGenericGrid::SetCellAlignment(int flag, int row, int col) cell->SetAlignment(flag); } -int wxGenericGrid::GetCellAlignment(int row, int col) +int wxGenericGrid::GetCellAlignment(int row, int col) const { wxGridCell *cell = GetCell(row, col); if (cell) @@ -2007,7 +2017,7 @@ void wxGenericGrid::SetCellAlignment(int flag) GetCell(i, j)->SetAlignment(flag); } -int wxGenericGrid::GetCellAlignment(void) +int wxGenericGrid::GetCellAlignment(void) const { return m_cellAlignment; } @@ -2032,13 +2042,13 @@ void wxGenericGrid::SetCellBackgroundColour(const wxColour& val, int row, int co } } -wxColour& wxGenericGrid::GetCellBackgroundColour(int row, int col) +wxColour& wxGenericGrid::GetCellBackgroundColour(int row, int col) const { wxGridCell *cell = GetCell(row, col); if (cell) return cell->GetBackgroundColour(); else - return m_cellBackgroundColour; + return (wxColour&) m_cellBackgroundColour; } void wxGenericGrid::SetCellTextColour(const wxColour& val, int row, int col) @@ -2051,7 +2061,7 @@ void wxGenericGrid::SetCellTextColour(const wxColour& val, int row, int col) } } -void wxGenericGrid::SetCellTextFont(wxFont *fnt, int row, int col) +void wxGenericGrid::SetCellTextFont(const wxFont& fnt, int row, int col) { wxGridCell *cell = GetCell(row, col); if (cell) @@ -2061,22 +2071,22 @@ void wxGenericGrid::SetCellTextFont(wxFont *fnt, int row, int col) } } -wxFont *wxGenericGrid::GetCellTextFont(int row, int col) +wxFont& wxGenericGrid::GetCellTextFont(int row, int col) const { wxGridCell *cell = GetCell(row, col); if (cell) - return cell->GetFont(); + return (wxFont&) cell->GetFont(); else - return m_cellTextFont; + return (wxFont&) m_cellTextFont; } -wxColour& wxGenericGrid::GetCellTextColour(int row, int col) +wxColour& wxGenericGrid::GetCellTextColour(int row, int col) const { wxGridCell *cell = GetCell(row, col); if (cell) - return cell->GetTextColour(); + return (wxColour&) cell->GetTextColour(); else - return m_cellTextColour; + return (wxColour&) m_cellTextColour; } void wxGenericGrid::SetCellTextColour(const wxColour& val) @@ -2089,7 +2099,7 @@ void wxGenericGrid::SetCellTextColour(const wxColour& val) GetCell(i, j)->SetTextColour(val); } -void wxGenericGrid::SetCellTextFont(wxFont *fnt) +void wxGenericGrid::SetCellTextFont(const wxFont& fnt) { m_cellTextFont = fnt; int i,j; @@ -2109,7 +2119,7 @@ void wxGenericGrid::SetCellBitmap(wxBitmap *bitmap, int row, int col) } } -wxBitmap *wxGenericGrid::GetCellBitmap(int row, int col) +wxBitmap *wxGenericGrid::GetCellBitmap(int row, int col) const { wxGridCell *cell = GetCell(row, col); if (cell) @@ -2406,8 +2416,8 @@ void wxGenericGrid::SetGridCursor(int row, int col) wxGridCell::wxGridCell(wxGenericGrid *window) { cellBitmap = (wxBitmap *) NULL; - font = (wxFont *) NULL; - backgroundBrush = (wxBrush *) NULL; + font = wxNullFont; + backgroundBrush = wxNullBrush; if (window) textColour = window->GetCellTextColour(); else @@ -2420,7 +2430,7 @@ wxGridCell::wxGridCell(wxGenericGrid *window) if (window) font = window->GetCellTextFont(); else - font = wxTheFontList->FindOrCreateFont(12, wxSWISS, wxNORMAL, wxNORMAL); + font = * wxTheFontList->FindOrCreateFont(12, wxSWISS, wxNORMAL, wxNORMAL); SetBackgroundColour(backgroundColour); @@ -2437,7 +2447,7 @@ wxGridCell::~wxGridCell(void) void wxGridCell::SetBackgroundColour(const wxColour& colour) { backgroundColour = colour; - backgroundBrush = wxTheBrushList->FindOrCreateBrush(backgroundColour, wxSOLID); + backgroundBrush = * wxTheBrushList->FindOrCreateBrush(backgroundColour, wxSOLID); } void wxGenericGrid::OnText(wxCommandEvent& WXUNUSED(ev) ) @@ -2518,12 +2528,12 @@ void wxGenericGrid::_OnCreateCell(wxGridEvent& ev) ev.m_cell = OnCreateCell(); } -void wxGenericGrid::_OnChangeLabels(wxGridEvent& ev) +void wxGenericGrid::_OnChangeLabels(wxGridEvent& WXUNUSED(ev)) { OnChangeLabels(); } -void wxGenericGrid::_OnChangeSelectionLabel(wxGridEvent& ev) +void wxGenericGrid::_OnChangeSelectionLabel(wxGridEvent& WXUNUSED(ev)) { OnChangeSelectionLabel(); }