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:
parent
f80ff6f459
commit
6fb85af1f3
@ -705,20 +705,7 @@ void wxGridCellNumberEditor::SetSize(const wxRect& rectCell)
|
|||||||
|
|
||||||
wxRect rectSpin(rectCell.GetPosition(), size);
|
wxRect rectSpin(rectCell.GetPosition(), size);
|
||||||
|
|
||||||
// If possible, i.e. if we're not editing the topmost or leftmost cell,
|
wxGridCellEditor::SetSize(rectSpin.CenterIn(rectCell, wxVERTICAL));
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // wxUSE_SPINCTRL
|
#endif // wxUSE_SPINCTRL
|
||||||
|
Loading…
Reference in New Issue
Block a user