]> git.saurik.com Git - wxWidgets.git/commitdiff
reverted m_adjustMinSize change prepatory for a new approach to fix
authorRobin Dunn <robin@alldunn.com>
Mon, 21 Jun 2004 22:58:13 +0000 (22:58 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 21 Jun 2004 22:58:13 +0000 (22:58 +0000)
the problem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

33 files changed:
docs/latex/wx/control.tex
include/wx/control.h
include/wx/gtk/control.h
include/wx/gtk/stattext.h
include/wx/gtk1/control.h
include/wx/gtk1/stattext.h
include/wx/mac/carbon/stattext.h
include/wx/mac/classic/stattext.h
include/wx/msw/stattext.h
include/wx/stattext.h
src/common/bookctrl.cpp
src/common/ctrlcmn.cpp
src/gtk/bmpbuttn.cpp
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/control.cpp
src/gtk/radiobox.cpp
src/gtk/radiobut.cpp
src/gtk/statbox.cpp
src/gtk/stattext.cpp
src/gtk/tglbtn.cpp
src/gtk1/bmpbuttn.cpp
src/gtk1/button.cpp
src/gtk1/checkbox.cpp
src/gtk1/control.cpp
src/gtk1/radiobox.cpp
src/gtk1/radiobut.cpp
src/gtk1/statbox.cpp
src/gtk1/stattext.cpp
src/gtk1/tglbtn.cpp
src/mac/carbon/stattext.cpp
src/mac/classic/stattext.cpp
src/msw/stattext.cpp

index 52ecc060f25fd4a54c151a8375fc7ee30096c79b..75c4e5f975a89c46d702a879641381f429b89a4b 100644 (file)
@@ -29,14 +29,6 @@ displays one or more item of data.
 Simulates the effect of the user issuing a command to the item. See \helpref{wxCommandEvent}{wxcommandevent}.
 
 
-\membersection{wxControl::GetAdjustMinSizeFlag}\label{wxcontrolgetadjustminsizeflag}
-
-\func{bool}{GetAdjustMinSizeFlag}{}
-
-Returns whether the minsize should be adjusted for this control when
-SetLabel or SetFont are called.
-
-
 \membersection{wxControl::GetLabel}\label{wxcontrolgetlabel}
 
 \func{wxString\&}{GetLabel}{\void}
@@ -44,14 +36,6 @@ SetLabel or SetFont are called.
 Returns the control's text.
 
 
-\membersection{wxControl::SetAdjustMinSizeFlag}\label{wxcontrolsetadjustminsizeflag}
-
-\func{void}{SetAdjustMinSizeFlag}{\param{bool }{adjust}}
-
-By default controls will readjust their size and minsize when
-SetLabel or SetFont are called.  This flag will allow you to
-control this behavior.
-
 \membersection{wxControl::SetLabel}\label{wxcontrolsetlabel}
 
 \func{void}{SetLabel}{\param{const wxString\& }{label}}
index 5fd882ce0c3210a246fd2da3fd23769f0c602726..6552443ecdedfa08aa515d78e6686feb16555483 100644 (file)
@@ -32,11 +32,10 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
 // wxControl is the base class for all controls
 // ----------------------------------------------------------------------------
 
-
 class WXDLLEXPORT wxControlBase : public wxWindow
 {
 public:
-    wxControlBase() { Init(); }
+    wxControlBase() { }
 
     virtual ~wxControlBase();
 
@@ -64,16 +63,7 @@ public:
     // if the button was clicked)
     virtual void Command(wxCommandEvent &event);
 
-        
-    virtual void SetLabel(const wxString& label);
-    virtual bool SetFont(const wxFont& font);
-    virtual bool GetAdjustMinSizeFlag() const { return m_adjustMinSize; }
-    void SetAdjustMinSizeFlag(bool adjust) { m_adjustMinSize = adjust; }
-    
-    
 protected:
-    void Init();
-    
     // creates the control (calls wxWindowBase::CreateBase inside) and adds it
     // to the list of parents children
     bool CreateControl(wxWindowBase *parent,
@@ -98,9 +88,6 @@ protected:
         SetBestSize(size);
     }
 
-    // should minsize and size be adjusted when font or label change?
-    bool        m_adjustMinSize;  
-    
     DECLARE_NO_COPY_CLASS(wxControlBase)
 };
 
index 5d444e9b453d002d4907dbb68d64437963dd78f0..0dd1153df7393b1631845e2441a019d4badfe94e 100644 (file)
@@ -58,7 +58,6 @@ public:
 protected:
     virtual wxSize DoGetBestSize() const;
     void PostCreation(const wxSize& size);
-    void PostSetLabel();
 
 #ifdef __WXGTK20__
     wxString PrepareLabelMnemonics( const wxString &label ) const;
@@ -89,7 +88,6 @@ protected:
 
     wxString   m_label;
     char       m_chAccel;  // enabled to avoid breaking binary compatibility later on
-    bool       m_createComplete;
 
 private:
     DECLARE_DYNAMIC_CLASS(wxControl)
index dd4d499883b259bd680fd4d353cd84b0093f862b..6686c96982fd80da969685882386aaf5925a2a6f 100644 (file)
@@ -57,8 +57,7 @@ public:
     wxString GetLabel() const;
     void SetLabel( const wxString &label );
 
-    bool GetAdjustMinSizeFlag() const { return !HasFlag(wxST_NO_AUTORESIZE); }
-    
+    bool SetFont( const wxFont &font );
     bool SetForegroundColour( const wxColour& colour );
 
     static wxVisualAttributes
index 5d444e9b453d002d4907dbb68d64437963dd78f0..0dd1153df7393b1631845e2441a019d4badfe94e 100644 (file)
@@ -58,7 +58,6 @@ public:
 protected:
     virtual wxSize DoGetBestSize() const;
     void PostCreation(const wxSize& size);
-    void PostSetLabel();
 
 #ifdef __WXGTK20__
     wxString PrepareLabelMnemonics( const wxString &label ) const;
@@ -89,7 +88,6 @@ protected:
 
     wxString   m_label;
     char       m_chAccel;  // enabled to avoid breaking binary compatibility later on
-    bool       m_createComplete;
 
 private:
     DECLARE_DYNAMIC_CLASS(wxControl)
index dd4d499883b259bd680fd4d353cd84b0093f862b..6686c96982fd80da969685882386aaf5925a2a6f 100644 (file)
@@ -57,8 +57,7 @@ public:
     wxString GetLabel() const;
     void SetLabel( const wxString &label );
 
-    bool GetAdjustMinSizeFlag() const { return !HasFlag(wxST_NO_AUTORESIZE); }
-    
+    bool SetFont( const wxFont &font );
     bool SetForegroundColour( const wxColour& colour );
 
     static wxVisualAttributes
index 95c32a82b9c905f252f475d3923278e1a3140024..c5f41c02c41b6e220eabcc3cb61f0ec47538b266 100644 (file)
@@ -40,6 +40,7 @@ public:
 
   // accessors
   void SetLabel( const wxString &str ) ;
+  bool SetFont( const wxFont &font );
 
 protected :
 
index 15eae66671ee96c789c7ac66216c56d8e5d59325..17ecf98ad00e8b032ce4ee43e8dedbee174dcde7 100644 (file)
@@ -41,6 +41,7 @@ class WXDLLEXPORT wxStaticText: public wxStaticTextBase
 
   // accessors
   void SetLabel( const wxString &str ) ;
+  bool SetFont( const wxFont &font );
 
   // operations
   virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
index c42f65552c131fc9d6205516cb596bdd9d50952a..0ceef4c977a417ba06fc1e6a90e8e7ddb1b1b7b6 100644 (file)
@@ -40,6 +40,10 @@ public:
                 long style = 0,
                 const wxString& name = wxStaticTextNameStr);
 
+    // override some methods to resize the window properly
+    virtual void SetLabel(const wxString& label);
+    virtual bool SetFont( const wxFont &font );
+
 protected:
     // implement/override some base class virtuals
     virtual wxBorder GetDefaultBorder() const;
index c210383e5c63001abfa0c5f90b57442c78138ed3..8590052f74938221b45eccb6218c4ffaed5ff1ef 100644 (file)
@@ -17,8 +17,6 @@ public:
     virtual void ApplyParentThemeBackground(const wxColour& bg)
         { SetBackgroundColour(bg); }
 
-    bool GetAdjustMinSizeFlag() const { return !HasFlag(wxST_NO_AUTORESIZE); }
-    
 private:
     DECLARE_NO_COPY_CLASS(wxStaticTextBase)
 };
index 553ee11ffd189a26b243df0ee50121313b363ecd..b04136183e26f69943df4b3cc2a638dd66e55c05 100644 (file)
@@ -46,10 +46,6 @@ void wxBookCtrl::Init()
 {
     m_imageList = NULL;
     m_ownsImageList = false;
-    // Unlike most controls, we don't want to adjust the min size
-    // when we set the font, since the page size is not related to
-    // the font size.
-    m_adjustMinSize = false;
 }
 
 bool
index eab0f889f12ae35443944932851c14336ae00c77..242efdca1f1c05ec55bcd4904cf0cc9bfe1bb29e 100644 (file)
@@ -68,13 +68,6 @@ bool wxControlBase::Create(wxWindow *parent,
     return ret;
 }
 
-
-void wxControlBase::Init()
-{
-    m_adjustMinSize = true;
-}
-
-
 bool wxControlBase::CreateControl(wxWindowBase *parent,
                                   wxWindowID id,
                                   const wxPoint& pos,
@@ -123,24 +116,6 @@ void wxControlBase::InitCommandEvent(wxCommandEvent& event) const
     }
 }
 
-void wxControlBase::SetLabel(const wxString& label)
-{
-    wxWindow::SetLabel(label);
-    if (GetAdjustMinSizeFlag())
-        SetBestSize(wxDefaultSize);
-}
-
-
-bool wxControlBase::SetFont(const wxFont& font)
-{
-    bool ret = wxWindow::SetFont(font);
-
-    if (GetAdjustMinSizeFlag())
-        SetBestSize(wxDefaultSize);
-
-    return ret;
-}
-
 // ----------------------------------------------------------------------------
 // wxStaticBitmap
 // ----------------------------------------------------------------------------
index 8be33e83f7de06ef90ce59e4eab8892a1759f024..db117650134db117c4d6c76b80e2058b8df09813 100644 (file)
@@ -184,7 +184,6 @@ void wxBitmapButton::SetLabel( const wxString &label )
     wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
 
     wxControl::SetLabel( label );
-    PostSetLabel();
 }
 
 wxString wxBitmapButton::GetLabel() const
index 330b5d0e1278fc024172679f2760fde5f311325b..d64273b78006e960f02070aa9024b0b13a1ada40 100644 (file)
@@ -175,8 +175,6 @@ void wxButton::SetLabel( const wxString &label )
 #else
     gtk_label_set( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( GetLabel() ) );
 #endif
-
-    PostSetLabel();
 }
 
 bool wxButton::Enable( bool enable )
index 33f8a565b79d5cebb1fbaf3aa15dde039be7f09f..1c64e26ba1c5156da9fd5d2b8fc51b0a8459f0e3 100644 (file)
@@ -158,8 +158,6 @@ void wxCheckBox::SetLabel( const wxString& label )
 #else
     gtk_label_set( GTK_LABEL(m_widgetLabel), wxGTK_CONV( GetLabel() ) );
 #endif
-
-    PostSetLabel();
 }
 
 bool wxCheckBox::Enable( bool enable )
index c12735e39bd39badd3edd69f32eb8222f937078a..41f5cc4ea1737f5e7794e4ab4a323be70585be2f 100644 (file)
@@ -33,7 +33,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
 wxControl::wxControl()
 {
     m_needParent = TRUE;
-    m_createComplete = false;
 }
 
 bool wxControl::Create( wxWindow *parent,
@@ -44,7 +43,6 @@ bool wxControl::Create( wxWindow *parent,
                       const wxValidator& validator,
                       const wxString &name )
 {
-    m_createComplete = false;
     bool ret = wxWindow::Create(parent, id, pos, size, style, name);
     
 #if wxUSE_VALIDATORS
@@ -70,14 +68,6 @@ void wxControl::SetLabel( const wxString &label )
     }
 }
 
-void wxControl::PostSetLabel()
-{
-    // make sure the widget has been created, and that PostCreate has already
-    // been called
-    if (m_widget && m_createComplete && GetAdjustMinSizeFlag())
-        SetBestSize(wxDefaultSize);
-}
-
 wxString wxControl::GetLabel() const
 {
     return m_label;
@@ -113,7 +103,6 @@ void wxControl::PostCreation(const wxSize& size)
     InheritAttributes();
     ApplyWidgetStyle();
     SetInitialBestSize(size);
-    m_createComplete = true;
 }
 
 
index f0af2b64a5dddcd6add84faa4dcad4e297bfaf1e..ea1eee523009f2267e4b1d760e14cecc3b71a6bd 100644 (file)
@@ -540,8 +540,6 @@ void wxRadioBox::SetLabel( const wxString& label )
     wxControl::SetLabel( label );
 
     gtk_frame_set_label( GTK_FRAME(m_widget), wxGTK_CONV( wxControl::GetLabel() ) );
-
-    PostSetLabel();
 }
 
 void wxRadioBox::SetString( int item, const wxString& label )
index 837cd33058432b82c0a58d73e4c65e4ff2907e76..2c3e1c0d107c9d0f53c74df9c2e45fa47f2b63ca 100644 (file)
@@ -145,8 +145,6 @@ void wxRadioButton::SetLabel( const wxString& label )
 #else
     gtk_label_set( g_label, wxGTK_CONV( GetLabel() ) );
 #endif
-
-    PostSetLabel();
 }
 
 void wxRadioButton::SetValue( bool val )
index 9d489265d8f5fb291d620add559eb12d6473af5d..7c3eb9678ee91cdea241dfb38a7121f90fe2cd64 100644 (file)
@@ -89,7 +89,6 @@ void wxStaticBox::SetLabel( const wxString &label )
 
     gtk_frame_set_label( GTK_FRAME( m_widget ),
                          m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
-    PostSetLabel();
 }
 
 // static
index f3c40c1226586bec271e23f85e1f4b3af3d1269c..d659e8cc167cbb7ab1acc629beabdbe2226d5a48 100644 (file)
@@ -146,10 +146,27 @@ void wxStaticText::SetLabel( const wxString &label )
 #else
     gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
 #endif
-    
-    PostSetLabel();
+
+    // adjust the label size to the new label unless disabled
+    if (!HasFlag(wxST_NO_AUTORESIZE))
+    {
+        SetSize( GetBestSize() );
+        SetSizeHints(GetSize());
+    }
 }
 
+bool wxStaticText::SetFont( const wxFont &font )
+{
+    bool ret = wxControl::SetFont(font);
+
+    // adjust the label size to the new label unless disabled
+    if (!HasFlag(wxST_NO_AUTORESIZE))
+    {
+        SetSize( GetBestSize() );
+        SetSizeHints(GetSize());
+    }
+    return ret;
+}
 
 wxSize wxStaticText::DoGetBestSize() const
 {
index 7bccf53080fb67ad46a0bf5b2313c654c80ee2f8..8ac7ec5a3c6364728ce0f8ed57194b0976e3f193 100644 (file)
@@ -287,8 +287,6 @@ void wxToggleButton::SetLabel(const wxString& label)
     wxControl::SetLabel(label);
 
     gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
-
-    PostSetLabel();
 }
 
 bool wxToggleButton::Enable(bool enable /*=TRUE*/)
index 8be33e83f7de06ef90ce59e4eab8892a1759f024..db117650134db117c4d6c76b80e2058b8df09813 100644 (file)
@@ -184,7 +184,6 @@ void wxBitmapButton::SetLabel( const wxString &label )
     wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
 
     wxControl::SetLabel( label );
-    PostSetLabel();
 }
 
 wxString wxBitmapButton::GetLabel() const
index 330b5d0e1278fc024172679f2760fde5f311325b..d64273b78006e960f02070aa9024b0b13a1ada40 100644 (file)
@@ -175,8 +175,6 @@ void wxButton::SetLabel( const wxString &label )
 #else
     gtk_label_set( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( GetLabel() ) );
 #endif
-
-    PostSetLabel();
 }
 
 bool wxButton::Enable( bool enable )
index 33f8a565b79d5cebb1fbaf3aa15dde039be7f09f..1c64e26ba1c5156da9fd5d2b8fc51b0a8459f0e3 100644 (file)
@@ -158,8 +158,6 @@ void wxCheckBox::SetLabel( const wxString& label )
 #else
     gtk_label_set( GTK_LABEL(m_widgetLabel), wxGTK_CONV( GetLabel() ) );
 #endif
-
-    PostSetLabel();
 }
 
 bool wxCheckBox::Enable( bool enable )
index c12735e39bd39badd3edd69f32eb8222f937078a..41f5cc4ea1737f5e7794e4ab4a323be70585be2f 100644 (file)
@@ -33,7 +33,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
 wxControl::wxControl()
 {
     m_needParent = TRUE;
-    m_createComplete = false;
 }
 
 bool wxControl::Create( wxWindow *parent,
@@ -44,7 +43,6 @@ bool wxControl::Create( wxWindow *parent,
                       const wxValidator& validator,
                       const wxString &name )
 {
-    m_createComplete = false;
     bool ret = wxWindow::Create(parent, id, pos, size, style, name);
     
 #if wxUSE_VALIDATORS
@@ -70,14 +68,6 @@ void wxControl::SetLabel( const wxString &label )
     }
 }
 
-void wxControl::PostSetLabel()
-{
-    // make sure the widget has been created, and that PostCreate has already
-    // been called
-    if (m_widget && m_createComplete && GetAdjustMinSizeFlag())
-        SetBestSize(wxDefaultSize);
-}
-
 wxString wxControl::GetLabel() const
 {
     return m_label;
@@ -113,7 +103,6 @@ void wxControl::PostCreation(const wxSize& size)
     InheritAttributes();
     ApplyWidgetStyle();
     SetInitialBestSize(size);
-    m_createComplete = true;
 }
 
 
index f0af2b64a5dddcd6add84faa4dcad4e297bfaf1e..ea1eee523009f2267e4b1d760e14cecc3b71a6bd 100644 (file)
@@ -540,8 +540,6 @@ void wxRadioBox::SetLabel( const wxString& label )
     wxControl::SetLabel( label );
 
     gtk_frame_set_label( GTK_FRAME(m_widget), wxGTK_CONV( wxControl::GetLabel() ) );
-
-    PostSetLabel();
 }
 
 void wxRadioBox::SetString( int item, const wxString& label )
index 837cd33058432b82c0a58d73e4c65e4ff2907e76..2c3e1c0d107c9d0f53c74df9c2e45fa47f2b63ca 100644 (file)
@@ -145,8 +145,6 @@ void wxRadioButton::SetLabel( const wxString& label )
 #else
     gtk_label_set( g_label, wxGTK_CONV( GetLabel() ) );
 #endif
-
-    PostSetLabel();
 }
 
 void wxRadioButton::SetValue( bool val )
index 9d489265d8f5fb291d620add559eb12d6473af5d..7c3eb9678ee91cdea241dfb38a7121f90fe2cd64 100644 (file)
@@ -89,7 +89,6 @@ void wxStaticBox::SetLabel( const wxString &label )
 
     gtk_frame_set_label( GTK_FRAME( m_widget ),
                          m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
-    PostSetLabel();
 }
 
 // static
index f3c40c1226586bec271e23f85e1f4b3af3d1269c..d659e8cc167cbb7ab1acc629beabdbe2226d5a48 100644 (file)
@@ -146,10 +146,27 @@ void wxStaticText::SetLabel( const wxString &label )
 #else
     gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
 #endif
-    
-    PostSetLabel();
+
+    // adjust the label size to the new label unless disabled
+    if (!HasFlag(wxST_NO_AUTORESIZE))
+    {
+        SetSize( GetBestSize() );
+        SetSizeHints(GetSize());
+    }
 }
 
+bool wxStaticText::SetFont( const wxFont &font )
+{
+    bool ret = wxControl::SetFont(font);
+
+    // adjust the label size to the new label unless disabled
+    if (!HasFlag(wxST_NO_AUTORESIZE))
+    {
+        SetSize( GetBestSize() );
+        SetSizeHints(GetSize());
+    }
+    return ret;
+}
 
 wxSize wxStaticText::DoGetBestSize() const
 {
index 7bccf53080fb67ad46a0bf5b2313c654c80ee2f8..8ac7ec5a3c6364728ce0f8ed57194b0976e3f193 100644 (file)
@@ -287,8 +287,6 @@ void wxToggleButton::SetLabel(const wxString& label)
     wxControl::SetLabel(label);
 
     gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV( GetLabel() ) );
-
-    PostSetLabel();
 }
 
 bool wxToggleButton::Enable(bool enable /*=TRUE*/)
index 761b0598b5194dba245ec6a8de86eb5403b3fa22..f4757d19d7c223c2b853c4ac0779efdf3f3f55f1 100644 (file)
@@ -92,9 +92,27 @@ void wxStaticText::SetLabel(const wxString& st )
     SetControlData( *m_peer, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ),
                &ref );
 
-    if (GetAdjustMinSizeFlag())
-        SetBestSize(wxDefaultSize);
+    if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+    {
+        SetSize( GetBestSize() ) ;
+        SetSizeHints(GetSize());
+    }
 
     Update() ;
 }
 
+bool wxStaticText::SetFont(const wxFont& font)
+{
+    bool ret = wxControl::SetFont(font);
+
+       if ( ret )
+       {
+           if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+            {
+               SetSize( GetBestSize() );
+                SetSizeHints(GetSize());
+            }
+       }
+
+    return ret;
+}
index 8bc3ee927248f7bc9342fa53584e0008552b97ba..1c0facdbf70d86610846d12989813d7cef848fd9 100644 (file)
@@ -232,11 +232,31 @@ void wxStaticText::SetLabel(const wxString& st )
 {
     SetTitle( st ) ;
     m_label = st ;
-
-    if (GetAdjustMinSizeFlag())
-        SetBestSize(wxDefaultSize);
-
+    if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+    {
+        // temporary fix until layout measurement and drawing are in synch again
+        Refresh() ;
+        SetSize( GetBestSize() ) ;
+    }
     Refresh() ;
     Update() ;
 }
 
+bool wxStaticText::SetFont(const wxFont& font)
+{
+    bool ret = wxControl::SetFont(font);
+
+       if ( ret )
+       {
+           // adjust the size of the window to fit to the label unless autoresizing is
+           // disabled
+           if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
+           {
+               // temporary fix until layout measurement and drawing are in synch again
+            Refresh() ;
+               SetSize( GetBestSize() );
+           }
+       }
+
+    return ret;
+}
index 02d4e44b50d9504304ac40b654273d0835ef8b02..12b740301880e7a625246ba2184a47363b9bfa0a 100644 (file)
@@ -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) )
+    {
+        DoSetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT);
+        SetSizeHints(GetSize());
+    }
+}
+
+
+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);
+        SetSizeHints(GetSize());
+    }
+
+    return ret;
+}
 
 #endif // wxUSE_STATTEXT