28 #include <wx/checkbox.h> 39 m_background( aBackground )
78 if(
m_size != wxDefaultSize )
83 dc.SetFont( attr.GetFont() );
84 dc.GetTextExtent(
"WWW", &bestSize.x, &bestSize.y );
91 const wxRect& aRect,
int aRow,
int aCol,
bool isSelected )
96 wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
99 COLOR4D color( aGrid.GetTable()->GetValue( aRow, aCol ) );
100 wxSize size = (
m_size == wxDefaultSize ) ? aRect.GetSize() :
m_size;
104 wxPoint origin = rect.GetTopLeft();
106 if(
m_size != wxDefaultSize )
108 int x = std::max( 0, ( aRect.GetWidth() -
m_size.x ) / 2 );
109 int y = std::max( 0, ( aRect.GetHeight() -
m_size.y ) / 2 );
110 origin += wxPoint( x, y );
113 aDC.DrawBitmap( bitmap, origin,
true );
138 wxEvtHandler* aEventHandler )
141 m_control =
new wxCheckBox( aParent, wxID_ANY, wxEmptyString );
143 wxGridCellEditor::Create( aParent, aId, aEventHandler );
149 return m_value.ToWxString( wxC2S_CSS_SYNTAX );
155 m_value.SetFromWxString(
grid->GetTable()->GetValue( row, col ) );
159 if( dialog.ShowModal() == wxID_OK )
165 m_grid->HideCellEditControl();
171 const wxString& oldval, wxString *newval )
182 aGrid->GetTable()->SetValue( aRow, aCol,
GetValue() );
wxSize GetBestSize(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col) override
wxGridCellEditor * Clone() const override
static wxBitmap MakeBitmap(const KIGFX::COLOR4D &aColor, const KIGFX::COLOR4D &aBackground, const wxSize &aSize, const wxSize &aCheckerboardSize, const KIGFX::COLOR4D &aCheckerboardBackground)
static const wxSize SWATCH_SIZE_LARGE_DU(24, 16)
wxString GetValue() const override
wxSize m_checkerboardSize
void Draw(wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, const wxRect &aRect, int aRow, int aCol, bool isSelected) override
KIGFX::COLOR4D m_checkerboardBg
KIGFX::COLOR4D m_background
static const wxSize SWATCH_SIZE_MEDIUM_DU(24, 10)
GRID_CELL_COLOR_SELECTOR(wxWindow *aParent, wxGrid *aGrid)
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
GRID_CELL_COLOR_RENDERER(wxWindow *aParent=nullptr, SWATCH_SIZE aSize=SWATCH_EXPAND, const KIGFX::COLOR4D &aBackground=KIGFX::COLOR4D::UNSPECIFIED)
static const wxSize CHECKERBOARD_SIZE_DU(3, 3)
wxGridCellRenderer * Clone() const override
KIGFX::COLOR4D GetColor()
~GRID_CELL_COLOR_RENDERER() override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
static const wxSize SWATCH_SIZE_SMALL_DU(8, 6)
bool EndEdit(int, int, const wxGrid *, const wxString &, wxString *newval) override
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
A color representation with 4 components: red, green, blue, alpha.