Don't account for the border size twice in wxMSW wxListCtrl

When computing the best control width from height, or vice versa, don't
account for the border size twice, once inside ListView_ApproximateViewRect()
and another time in our own code in the base class.

As we can't change the former, just compensate what the latter does by
returning the best width or height of the client part of the control, as
indicated by the DoGetBestClient{Height,Width}() methods names.
This commit is contained in:
Vadim Zeitlin
2016-01-25 02:51:06 +01:00
parent b67ca545cc
commit a358c898c5

View File

@@ -1350,7 +1350,10 @@ wxSize wxListCtrl::MSWGetBestViewRect(int x, int y) const
if ( mswStyle & WS_VSCROLL ) if ( mswStyle & WS_VSCROLL )
size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
return size; // OTOH we have to subtract the size of our borders because the base class
// public method already adds them, but ListView_ApproximateViewRect()
// already takes the borders into account, so this would be superfluous.
return size - DoGetBorderSize();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------