Centre checkboxes in wxGrid vertically by default
Make the alignment used by default in wxGridCellBoolRenderer and wxGridCellBoolEditor consistent and centre the checkbox vertically in both of them: previously only the editor tried to do it, but failed, because the code wrongly overwrote the default alignment as it used GetAlignment() instead of GetNonDefaultAlignment(), while the renderer didn't even try.
This commit is contained in:
@@ -953,8 +953,9 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
|
||||
{
|
||||
wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
|
||||
|
||||
int vAlign, hAlign;
|
||||
attr.GetAlignment(&hAlign, &vAlign);
|
||||
int hAlign = wxALIGN_LEFT;
|
||||
int vAlign = wxALIGN_CENTRE_VERTICAL;
|
||||
attr.GetNonDefaultAlignment(&hAlign, &vAlign);
|
||||
|
||||
const wxRect
|
||||
checkBoxRect = wxGetGridCheckBoxRect
|
||||
|
@@ -1218,10 +1218,10 @@ void wxGridCellBoolEditor::Create(wxWindow* parent,
|
||||
|
||||
void wxGridCellBoolEditor::SetSize(const wxRect& r)
|
||||
{
|
||||
int hAlign = wxALIGN_CENTRE;
|
||||
int vAlign = wxALIGN_CENTRE;
|
||||
int hAlign = wxALIGN_LEFT;
|
||||
int vAlign = wxALIGN_CENTRE_VERTICAL;
|
||||
if (GetCellAttr())
|
||||
GetCellAttr()->GetAlignment(& hAlign, & vAlign);
|
||||
GetCellAttr()->GetNonDefaultAlignment(&hAlign, &vAlign);
|
||||
|
||||
const wxRect
|
||||
checkBoxRect = wxGetGridCheckBoxRect
|
||||
|
Reference in New Issue
Block a user