X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a9412f8f03171fdd3606a4ad3db9c9da8fe6bd7c..d223107206e4dfa6768e0bc2455325dd49e4d2bb:/src/mac/carbon/control.cpp diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index b469c40ef4..033c3bde05 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -196,6 +196,8 @@ wxControl::~wxControl() } if ( (ControlHandle) m_macControl ) { + // in case the callback might be called during destruction + ::SetControlColorProc( (ControlHandle) m_macControl , NULL ) ; ::DisposeControl( (ControlHandle) m_macControl ) ; m_macControl = NULL ; } @@ -214,6 +216,9 @@ void wxControl::SetLabel(const wxString& title) wxSize wxControl::DoGetBestSize() const { + if ( (ControlHandle) m_macControl == NULL ) + return wxWindow::DoGetBestSize() ; + Rect bestsize = { 0 , 0 , 0 , 0 } ; short baselineoffset ; int bestWidth, bestHeight ; @@ -235,18 +240,7 @@ wxSize wxControl::DoGetBestSize() const } } - if ( IsKindOf( CLASSINFO( wxButton ) ) ) - { - bestWidth = m_label.Length() * 8 + 12 ; - if ( bestWidth < 70 ) - bestWidth = 70 ; - } - else if ( IsKindOf( CLASSINFO( wxStaticText ) ) ) - { - bestWidth = m_label.Length() * 8 ; - } - else - bestWidth = bestsize.right - bestsize.left ; + bestWidth = bestsize.right - bestsize.left ; bestWidth += 2 * m_macHorizontalBorder ; @@ -462,8 +456,7 @@ void wxControl::MacAdjustControlRect() m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ; } - MacUpdateDimensions() ; -// UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ; + MacUpdateDimensions() ; } }