Account for vertical alignment in wxGetGridCheckBoxRect() too

Do it if only for consistency with the horizontal alignment.
This commit is contained in:
Vadim Zeitlin
2019-11-22 01:35:11 +01:00
parent 6b63016fb2
commit ab02d36e10

View File

@@ -10335,7 +10335,7 @@ wxGridCellEditor* wxGridTypeRegistry::GetEditor(int index)
wxRect wxGetGridCheckBoxRect(wxWindow* win, wxRect wxGetGridCheckBoxRect(wxWindow* win,
const wxRect& cellRect, const wxRect& cellRect,
int hAlign, int hAlign,
int WXUNUSED(vAlign)) int vAlign)
{ {
wxSize checkBoxSize = wxSize checkBoxSize =
wxRendererNative::Get().GetCheckBoxSize(win, wxCONTROL_CELL); wxRendererNative::Get().GetCheckBoxSize(win, wxCONTROL_CELL);
@@ -10368,8 +10368,19 @@ wxRect wxGetGridCheckBoxRect(wxWindow* win,
checkBoxRect.SetX(cellRect.x + GRID_CELL_CHECKBOX_MARGIN); checkBoxRect.SetX(cellRect.x + GRID_CELL_CHECKBOX_MARGIN);
} }
// TODO: support vAlign if ( vAlign & wxALIGN_CENTER_VERTICAL )
checkBoxRect = checkBoxRect.CentreIn(cellRect, wxVERTICAL); {
checkBoxRect = checkBoxRect.CentreIn(cellRect, wxVERTICAL);
}
else if ( vAlign & wxALIGN_BOTTOM )
{
checkBoxRect.SetY(cellRect.y + cellRect.height
- checkBoxRect.y - GRID_CELL_CHECKBOX_MARGIN);
}
else // wxALIGN_TOP
{
checkBoxRect.SetY(cellRect.y + GRID_CELL_CHECKBOX_MARGIN);
}
return checkBoxRect; return checkBoxRect;
} }