Refactor: extra wxStaticText auto-resizing code from wxMSW to common.

This will allow its reuse in wxGenericStaticText and maybe other ports that
need it in the future.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-10-24 21:54:31 +00:00
parent 4936366716
commit f0aea4098c
3 changed files with 22 additions and 17 deletions

View File

@@ -194,6 +194,18 @@ void wxStaticTextBase::Wrap(int width)
wrapper.WrapLabel(this, width);
}
void wxStaticTextBase::AutoResizeIfNecessary()
{
// adjust the size of the window to fit to the label unless autoresizing is
// disabled
if ( !HasFlag(wxST_NO_AUTORESIZE) )
{
InvalidateBestSize();
DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord,
wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
}
}
// ----------------------------------------------------------------------------
// wxStaticTextBase - generic implementation for wxST_ELLIPSIZE_* support
// ----------------------------------------------------------------------------