#if wxUSE_STATTEXT
#ifndef WX_PRECOMP
-#include "wx/event.h"
-#include "wx/app.h"
-#include "wx/brush.h"
+ #include "wx/event.h"
+ #include "wx/app.h"
+ #include "wx/brush.h"
+ #include "wx/dcclient.h"
+ #include "wx/settings.h"
#endif
#include "wx/stattext.h"
#include "wx/msw/private.h"
-#include <stdio.h>
#if wxUSE_EXTENDED_RTTI
WX_DEFINE_FLAGS( wxStaticTextStyle )
wxSize wxStaticText::DoGetBestSize() const
{
wxClientDC dc(wx_const_cast(wxStaticText *, this));
- dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+ wxFont font(GetFont());
+ if (!font.Ok())
+ font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+
+ dc.SetFont(font);
wxCoord widthTextMax, heightTextTotal;
dc.GetMultiLineTextExtent(GetLabel(), &widthTextMax, &heightTextTotal);
widthTextMax += 2;
#endif // __WXWINCE__
- return wxSize(widthTextMax, heightTextTotal);
+ wxSize best(widthTextMax, heightTextTotal);
+ CacheBestSize(best);
+ return best;
}
void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)