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:
@@ -162,8 +162,6 @@ void wxDateTimePickerCtrl::SetNullText(const wxString& text)
|
|||||||
|
|
||||||
wxSize wxDateTimePickerCtrl::DoGetBestSize() const
|
wxSize wxDateTimePickerCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxClientDC dc(const_cast<wxDateTimePickerCtrl *>(this));
|
|
||||||
|
|
||||||
// Use the same native format as the underlying native control.
|
// Use the same native format as the underlying native control.
|
||||||
#if wxUSE_INTL
|
#if wxUSE_INTL
|
||||||
wxString s = wxDateTime::Now().Format(wxLocale::GetOSInfo(MSWGetFormat()));
|
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
|
// the width of the month string varies a lot, so try to account for it
|
||||||
s += wxS("W");
|
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
|
// 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
|
// it for the horizontal component: the vertical size is not computed
|
||||||
|
Reference in New Issue
Block a user