X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe161a2685012cf90bb5bfe95f2260aee71d8ad7..118322a3dfcc1803bd13df8193ea1be9ae39e653:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 02d4e44b50..0f6faf5e03 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -207,5 +207,33 @@ void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags) Refresh(); } +void wxStaticText::SetLabel(const wxString& label) +{ + wxStaticTextBase::SetLabel(label); + + // adjust the size of the window to fit to the label unless autoresizing is + // disabled + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { + InvalidateBestSize(); + DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + } +} + + +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) ) + { + InvalidateBestSize(); + DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + } + + return ret; +} #endif // wxUSE_STATTEXT