X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..c97e7fa8dbda704c9c9cdb61c22ebdf9b692e114:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index b7e0f01365..c4a61fd113 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -57,7 +57,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, m_windowStyle = style; - long msStyle = WS_CHILD|WS_VISIBLE; + long msStyle = WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */ ; if (m_windowStyle & wxALIGN_CENTRE) msStyle |= SS_CENTER; else if (m_windowStyle & wxALIGN_RIGHT) @@ -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