Remove unneeded wxClientDC wxDateTimePickerCtrl::DoGetBestSize()

Just call GetTextExtent() on the window itself, it does the same thing
anyhow.

No real changes, just a tiny simplification.
This commit is contained in:
Vadim Zeitlin
2021-03-25 14:46:37 +01:00
parent 776c3e5b73
commit 67e9829b55

View File

@@ -162,8 +162,6 @@ void wxDateTimePickerCtrl::SetNullText(const wxString& text)
wxSize wxDateTimePickerCtrl::DoGetBestSize() const
{
wxClientDC dc(const_cast<wxDateTimePickerCtrl *>(this));
// Use the same native format as the underlying native control.
#if wxUSE_INTL
wxString s = wxDateTime::Now().Format(wxLocale::GetOSInfo(MSWGetFormat()));
@@ -177,7 +175,7 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
// the width of the month string varies a lot, so try to account for it
s += wxS("W");
wxSize size = dc.GetTextExtent(s);
wxSize size = GetTextExtent(s);
// We can ask the control itself to compute its ideal size, but we only use
// it for the horizontal component: the vertical size is not computed