]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/stattext.cpp
invalidate m_selection in DoRemovePage(), not in DeletePage() (replaces patch 998984)
[wxWidgets.git] / src / mac / carbon / stattext.cpp
index f4757d19d7c223c2b853c4ac0779efdf3f3f55f1..f21e1a9ee8b17fb1656eb533db6764e521aa4501 100644 (file)
@@ -51,7 +51,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
     wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
     m_peer = new wxMacControl() ;
     verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str , 
-        NULL , *m_peer ) ) ;  
+        NULL , m_peer->GetControlRefAddr() ) ) ;  
 
     MacPostControlCreate(pos,size) ;
 
@@ -61,8 +61,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
 wxSize wxStaticText::DoGetBestSize() const
 {
     ControlFontStyleRec controlFont ;
-    Size outSize ;
-    verify_noerr( GetControlData( *m_peer , kControlEntireControl , kControlFontStyleTag , sizeof(controlFont) , &controlFont , &outSize ) ) ;
+    verify_noerr( m_peer->GetData<ControlFontStyleRec>(kControlEntireControl , kControlFontStyleTag , &controlFont ) ) ;
     
     Point bounds ;
     SInt16 baseline ;
@@ -89,15 +88,14 @@ void wxStaticText::SetLabel(const wxString& st )
     
     wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
     CFStringRef ref = str ;
-    SetControlData( *m_peer, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ),
-               &ref );
+    verify_noerr( m_peer->SetData<CFStringRef>(kControlEntireControl , kControlStaticTextCFStringTag, ref ) ) ;
 
     if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
     {
+        InvalidateBestSize();
         SetSize( GetBestSize() ) ;
-        SetSizeHints(GetSize());
     }
-
+    Refresh() ;
     Update() ;
 }
 
@@ -108,10 +106,10 @@ bool wxStaticText::SetFont(const wxFont& font)
        if ( ret )
        {
            if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
-            {
-               SetSize( GetBestSize() );
-                SetSizeHints(GetSize());
-            }
+        {
+            InvalidateBestSize();
+            SetSize( GetBestSize() );
+        }
        }
 
     return ret;