Fixed wxMac's wxStaticText::SetFont to behave like the others and

resize the control to fit the text


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15692 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-05-27 21:21:49 +00:00
parent 107ffdc16d
commit bb751cf906
3 changed files with 76 additions and 50 deletions

View File

@@ -41,6 +41,8 @@ class WXDLLEXPORT wxStaticText: public wxStaticTextBase
// accessors
void SetLabel( const wxString &str ) ;
bool SetFont( const wxFont &font );
// operations
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};

View File

@@ -226,11 +226,23 @@ wxSize wxStaticText::DoGetBestSize() const
void wxStaticText::SetLabel(const wxString& st )
{
SetTitle( st ) ;
m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
SetSize( GetBestSize() ) ;
SetTitle( st ) ;
m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
SetSize( GetBestSize() ) ;
Refresh() ;
Update() ;
Refresh() ;
Update() ;
}
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) )
SetSize( GetBestSize() );
return ret;
}

View File

@@ -226,11 +226,23 @@ wxSize wxStaticText::DoGetBestSize() const
void wxStaticText::SetLabel(const wxString& st )
{
SetTitle( st ) ;
m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
SetSize( GetBestSize() ) ;
SetTitle( st ) ;
m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
SetSize( GetBestSize() ) ;
Refresh() ;
Update() ;
Refresh() ;
Update() ;
}
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) )
SetSize( GetBestSize() );
return ret;
}