28 const wxBitmapBundle& aUncheckedBitmap ) :
30 m_bitmapChecked( aCheckedBitmap ),
31 m_bitmapUnchecked( aUncheckedBitmap )
45 const wxRect& aRect,
int aRow,
int aCol,
bool aIsSelected )
48 wxGridCellRenderer::Draw( aGrid, aAttr, aDc, aRect, aRow, aCol, aIsSelected );
50 bool checked = aGrid.GetCellValue( aRow, aCol ) ==
"1";
52 wxBitmap bitmap = bundle.GetBitmapFor( &aGrid );
54 int x = std::max( 0, ( aRect.GetWidth() - bitmap.GetWidth() ) / 2 );
55 int y = std::max( 0, ( aRect.GetHeight() - bitmap.GetHeight() ) / 2 );
57 aDc.DrawBitmap( bitmap, aRect.GetTopLeft() + wxPoint( x, y ) );
A toggle button renderer for a wxGrid, similar to BITMAP_TOGGLE.
wxBitmapBundle m_bitmapUnchecked
void Draw(wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDc, const wxRect &aRect, int aRow, int aCol, bool aIsSelected) override
wxBitmapBundle m_bitmapChecked
wxSize GetBestSize(wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDc, int aRow, int aCol) override
GRID_BITMAP_TOGGLE_RENDERER * Clone() const override
GRID_BITMAP_TOGGLE_RENDERER(const wxBitmapBundle &aCheckedBitmap, const wxBitmapBundle &aUncheckedBitmap)