some (attempts of) appearance fixes for wxGCBoolRenderer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-02-17 19:32:25 +00:00
parent 189d0213da
commit 297da4bad9

View File

@@ -723,19 +723,37 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
{ {
wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
// position it in the centre (ignoring alignment - TODO) // between checkmark and box
static const wxCoord checkSize = 16; static const wxCoord margin = 4;
// get checkbox size
static wxCoord s_checkSize = 0;
if ( s_checkSize == 0 )
{
// compute it only once (no locks for MT safeness in GUI thread...)
wxCheckBox *checkbox = new wxCheckBox(&grid, -1, wxEmptyString);
wxSize size = checkbox->GetBestSize();
s_checkSize = size.y + margin;
// FIXME wxGTK::wxCheckBox::GetBestSize() is really weird...
#ifdef __WXGTK__
s_checkSize -= size.y / 2;
#endif
delete checkbox;
}
// draw a check mark in the centre (ignoring alignment - TODO)
wxRect rectMark; wxRect rectMark;
rectMark.x = rect.x + rect.width/2 - checkSize/2; rectMark.x = rect.x + rect.width/2 - s_checkSize/2;
rectMark.y = rect.y + rect.height/2 - checkSize/2; rectMark.y = rect.y + rect.height/2 - s_checkSize/2;
rectMark.width = rectMark.height = checkSize; rectMark.width = rectMark.height = s_checkSize;
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(wxPen(attr.GetTextColour(), 1, wxSOLID)); dc.SetPen(wxPen(attr.GetTextColour(), 1, wxSOLID));
dc.DrawRectangle(rectMark); dc.DrawRectangle(rectMark);
rectMark.Inflate(-4); rectMark.Inflate(-margin);
if ( !!grid.GetTable()->GetValue(row, col) ) // FIXME-DATA if ( !!grid.GetTable()->GetValue(row, col) ) // FIXME-DATA
{ {