X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..4e0e692f033442a2f700771a209ca08e538411b0:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 82b2a21745..c4a61fd113 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -86,7 +86,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, SubclassWin(m_hWnd); - SetFont(parent->GetFont()); + wxControl::SetFont(parent->GetFont()); SetSize(x, y, width, height); return TRUE; @@ -148,6 +148,22 @@ void wxStaticText::SetLabel(const wxString& label) } } + +bool wxStaticText::SetFont(const wxFont& font) +{ + bool ret = wxControl::SetFont(font); + + // adjust the size of the window to fit to the label unless autoresizing is + // disabled + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { + DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + } + + return ret; +} + + long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { // Ensure that static items get messages. Some controls don't like this