39 void Draw( wxGrid&
grid, wxGridCellAttr& attr, wxDC& dc,
40 const wxRect& rect,
int row,
int col,
bool isSelected )
override
43 T::Draw(
grid, attr, dc, rect, row, col, isSelected );
46 if(
grid.GetCellValue( row, col ).IsEmpty() )
61 dc.SetBrush( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ) );
62 dc.SetPen( *wxTRANSPARENT_PEN );
63 dc.DrawRectangle( rect );
68 wxColour bgColor = attr.GetBackgroundColour();
69 dc.SetBrush( wxBrush( bgColor ) );
70 dc.SetPen( *wxTRANSPARENT_PEN );
71 dc.DrawRectangle( rect );
74 const int stripeSpacing = 20;
78 int bgLuminance = bgColor.GetLuminance();
80 if( bgLuminance < 128 )
81 stripeColor = wxColour( 220, 180, 180 );
83 stripeColor = wxColour( 100, 10, 10 );
85 wxPen stripePen( stripeColor, 1, wxPENSTYLE_SOLID );
86 dc.SetPen( stripePen );
89 int startX = rect.GetLeft() - rect.GetHeight();
90 int endX = rect.GetRight() + rect.GetHeight();
93 for(
int x = startX; x < endX; x += stripeSpacing )
96 int y1 = rect.GetTop();
97 int x2 = x + rect.GetHeight();
98 int y2 = rect.GetBottom();
101 if( x1 < rect.GetLeft() )
103 int deltaY = rect.GetLeft() - x1;
105 y1 = rect.GetTop() + deltaY;
108 if( x2 > rect.GetRight() )
110 int deltaY = x2 - rect.GetRight();
111 x2 = rect.GetRight();
112 y2 = rect.GetBottom() - deltaY;
116 if( x1 <= rect.GetRight() && x2 >= rect.GetLeft() && y1 <= rect.GetBottom() && y2 >= rect.GetTop() )
118 dc.DrawLine( x1, y1, x2, y2 );