Tweak width of the date editor

Don't make it larger than 150% than its normal width and also don't make
it larger than its normal width at all if it's not going to be large
enough to cover the entire cell anyhow -- this just looks strange, as
the editor is both too wide and not wide enough.
This commit is contained in:
Vadim Zeitlin
2020-06-22 02:21:14 +02:00
parent 74377ecf38
commit f80ff6f459

View File

@@ -1793,11 +1793,12 @@ void wxGridCellDateEditor::SetSize(const wxRect& r)
wxRect rect(r.GetPosition(), bestSize);
// Allow edit picker to become a bit wider, if necessary, but no more than
// twice as wide as the best width, otherwise they just look ugly.
if ( r.GetWidth() > bestSize.GetWidth() )
// Allow date picker to become a bit wider, if necessary, but not too wide,
// otherwise it just looks ugly.
if ( r.GetWidth() > bestSize.GetWidth()
&& r.GetWidth() < 3*bestSize.GetWidth()/2 )
{
rect.SetWidth(wxMin(r.GetWidth(), 2*bestSize.GetWidth()));
rect.SetWidth(r.GetWidth());
}
wxGridCellEditor::SetSize(rect.CenterIn(r, wxVERTICAL));