28#include <wx/generic/gridctrl.h>
30#include <wx/settings.h>
34template<
typename T = wxGr
idCellStringRenderer>
38 template <
typename... Args>
41 T(
std::forward<Args>( aArgs )... ),
48 const wxRect&
rect,
int row,
int col,
bool isSelected )
override
51 T::Draw(
grid, attr,
dc,
rect, row, col, isSelected );
54 if(
grid.GetCellValue( row, col ).IsEmpty() )
58 wxGridCellRenderer*
Clone()
const override
69 dc.SetBrush( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ) );
70 dc.SetPen( *wxTRANSPARENT_PEN );
76 wxColour bgColor = attr.GetBackgroundColour();
77 dc.SetBrush( wxBrush( bgColor ) );
78 dc.SetPen( *wxTRANSPARENT_PEN );
82 const int stripeSpacing = 20;
84 int bgLuminance = bgColor.GetLuminance();
87 wxPen stripePen( stripeColor, 1, wxPENSTYLE_SOLID );
88 dc.SetPen( stripePen );
91 int startX =
rect.GetLeft() -
rect.GetHeight();
92 int endX =
rect.GetRight() +
rect.GetHeight();
95 for(
int x = startX; x < endX; x += stripeSpacing )
98 int y1 =
rect.GetTop();
99 int x2 = x +
rect.GetHeight();
100 int y2 =
rect.GetBottom();
103 if( x1 <
rect.GetLeft() )
105 int deltaY =
rect.GetLeft() - x1;
107 y1 =
rect.GetTop() + deltaY;
110 if( x2 >
rect.GetRight() )
112 int deltaY = x2 -
rect.GetRight();
113 x2 =
rect.GetRight();
114 y2 =
rect.GetBottom() - deltaY;
118 if( x1 <=
rect.GetRight() && x2 >=
rect.GetLeft() && y1 <=
rect.GetBottom() && y2 >=
rect.GetTop() )
120 dc.DrawLine( x1, y1, x2, y2 );
wxGridCellRenderer * Clone() const override
STRIPED_CELL_RENDERER(const wxColour &aStripeOnDarkBackground, const wxColour &aStripeOnLightBackground, Args &&... aArgs)
void drawStripedBackground(wxDC &dc, wxGridCellAttr &attr, const wxRect &rect, bool isSelected) const
wxColour m_stripeOnLightBackground
wxColour m_stripeOnDarkBackground
void Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected) override
STRIPED_CELL_RENDERER< wxGridCellStringRenderer > STRIPED_STRING_RENDERER
STRIPED_CELL_RENDERER< wxGridCellNumberRenderer > STRIPED_NUMBER_RENDERER
STRIPED_CELL_RENDERER< wxGridCellBoolRenderer > STRIPED_BOOL_RENDERER
DATABASE_CONNECTION dc(odbcBackend(cs))
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)