Simplify centering wxGridCellNumberEditor vertically

There is no need to check that the rectangle fits as it's done by wxGrid
itself, so just use a single wxRect::CenterIn() call instead of several
lines doing it manually.

No real changes.
This commit is contained in:
Vadim Zeitlin 2020-06-22 02:33:07 +02:00
parent f80ff6f459
commit 6fb85af1f3

View File

@ -705,20 +705,7 @@ void wxGridCellNumberEditor::SetSize(const wxRect& rectCell)
wxRect rectSpin(rectCell.GetPosition(), size);
// If possible, i.e. if we're not editing the topmost or leftmost cell,
// center the control rectangle in the cell.
if ( rectCell.GetTop() > 0 )
{
rectSpin.SetTop(rectCell.GetTop() -
(rectSpin.GetHeight() - rectCell.GetHeight()) / 2);
}
if ( rectCell.GetLeft() > 0 )
{
rectSpin.SetLeft(rectCell.GetLeft() -
(rectSpin.GetWidth() - rectCell.GetWidth()) / 2);
}
wxGridCellEditor::SetSize(rectSpin);
wxGridCellEditor::SetSize(rectSpin.CenterIn(rectCell, wxVERTICAL));
}
else
#endif // wxUSE_SPINCTRL