From f8d0234d39c66f3d1d7fc2346562cb96c8c7be20 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sun, 1 Mar 2009 16:09:44 +0000 Subject: [PATCH] move wxGridCellRenderer::Draw before other derived classes implementations (no real change) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/gridctrl.cpp | 78 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index 3098fd5ad5..955c652ce8 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -32,6 +32,46 @@ #include "wx/tokenzr.h" #include "wx/renderer.h" + +// ---------------------------------------------------------------------------- +// wxGridCellRenderer +// ---------------------------------------------------------------------------- + +void wxGridCellRenderer::Draw(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + const wxRect& rect, + int WXUNUSED(row), int WXUNUSED(col), + bool isSelected) +{ + dc.SetBackgroundMode( wxBRUSHSTYLE_SOLID ); + + wxColour clr; + if ( grid.IsEnabled() ) + { + if ( isSelected ) + { + if ( grid.HasFocus() ) + clr = grid.GetSelectionBackground(); + else + clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW); + } + else + { + clr = attr.GetBackgroundColour(); + } + } + else // grey out fields if the grid is disabled + { + clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); + } + + dc.SetBrush(clr); + dc.SetPen( *wxTRANSPARENT_PEN ); + dc.DrawRectangle(rect); +} + + // ---------------------------------------------------------------------------- // wxGridCellDateTimeRenderer // ---------------------------------------------------------------------------- @@ -338,44 +378,6 @@ wxGridCellAutoWrapStringRenderer::GetBestSize(wxGrid& grid, } -// ---------------------------------------------------------------------------- -// wxGridCellRenderer -// ---------------------------------------------------------------------------- - -void wxGridCellRenderer::Draw(wxGrid& grid, - wxGridCellAttr& attr, - wxDC& dc, - const wxRect& rect, - int WXUNUSED(row), int WXUNUSED(col), - bool isSelected) -{ - dc.SetBackgroundMode( wxBRUSHSTYLE_SOLID ); - - wxColour clr; - if ( grid.IsEnabled() ) - { - if ( isSelected ) - { - if ( grid.HasFocus() ) - clr = grid.GetSelectionBackground(); - else - clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW); - } - else - { - clr = attr.GetBackgroundColour(); - } - } - else // grey out fields if the grid is disabled - { - clr = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); - } - - dc.SetBrush(clr); - dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle(rect); -} - // ---------------------------------------------------------------------------- // wxGridCellStringRenderer // ---------------------------------------------------------------------------- -- 2.45.2