38 void Draw( wxGrid&
grid, wxGridCellAttr& attr, wxDC& dc,
39 const wxRect& rect,
int row,
int col,
bool isSelected )
override
42 T::Draw(
grid, attr, dc, rect, row, col, isSelected );
45 if(
grid.GetCellValue( row, col ).IsEmpty() )
60 dc.SetBrush( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ) );
61 dc.SetPen( *wxTRANSPARENT_PEN );
62 dc.DrawRectangle( rect );
67 wxColour bgColor = attr.GetBackgroundColour();
68 dc.SetBrush( wxBrush( bgColor ) );
69 dc.SetPen( *wxTRANSPARENT_PEN );
70 dc.DrawRectangle( rect );
73 const int stripeSpacing = 20;
77 int bgLuminance = bgColor.GetLuminance();
79 if( bgLuminance < 128 )
80 stripeColor = wxColour( 220, 180, 180 );
82 stripeColor = wxColour( 100, 10, 10 );
84 wxPen stripePen( stripeColor, 1, wxPENSTYLE_SOLID );
85 dc.SetPen( stripePen );
88 int startX = rect.GetLeft() - rect.GetHeight();
89 int endX = rect.GetRight() + rect.GetHeight();
92 for(
int x = startX; x < endX; x += stripeSpacing )
95 int y1 = rect.GetTop();
96 int x2 = x + rect.GetHeight();
97 int y2 = rect.GetBottom();
100 if( x1 < rect.GetLeft() )
102 int deltaY = rect.GetLeft() - x1;
104 y1 = rect.GetTop() + deltaY;
107 if( x2 > rect.GetRight() )
109 int deltaY = x2 - rect.GetRight();
110 x2 = rect.GetRight();
111 y2 = rect.GetBottom() - deltaY;
115 if( x1 <= rect.GetRight() && x2 >= rect.GetLeft() && y1 <= rect.GetBottom() && y2 >= rect.GetTop() )
117 dc.DrawLine( x1, y1, x2, y2 );