X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f1e01716310cb6e3bfcf5894b442d277bc32789a..b9d880d6382e24156cdce4ae0390c843cc6208d9:/src/mac/classic/control.cpp?ds=sidebyside diff --git a/src/mac/classic/control.cpp b/src/mac/classic/control.cpp index 1599c395c5..d5c0ca1880 100644 --- a/src/mac/classic/control.cpp +++ b/src/mac/classic/control.cpp @@ -23,17 +23,17 @@ #include "wx/dc.h" #include "wx/dcclient.h" #include "wx/button.h" + #include "wx/dialog.h" + #include "wx/scrolbar.h" + #include "wx/stattext.h" + #include "wx/statbox.h" + #include "wx/radiobox.h" + #include "wx/sizer.h" #endif // WX_PRECOMP #include "wx/notebook.h" #include "wx/tabctrl.h" -#include "wx/radiobox.h" #include "wx/spinbutt.h" -#include "wx/scrolbar.h" -#include "wx/dialog.h" -#include "wx/statbox.h" -#include "wx/sizer.h" -#include "wx/stattext.h" IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) @@ -190,11 +190,11 @@ wxControl::~wxControl() wxRemoveMacControlAssociation( this ) ; // If we delete an item, we should initialize the parent panel, // because it could now be invalid. - wxWindow *parent = GetParent() ; - if ( parent ) + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw ) { - if (parent->GetDefaultItem() == (wxButton*) this) - parent->SetDefaultItem(NULL); + if ( tlw->GetDefaultItem() == (wxButton*) this) + tlw->SetDefaultItem(NULL); } if ( (ControlHandle) m_macControl ) { @@ -207,7 +207,7 @@ wxControl::~wxControl() void wxControl::SetLabel(const wxString& title) { - m_label = wxStripMenuCodes(title) ; + m_label = GetLabelText(title) ; if ( m_macControl ) { @@ -309,7 +309,7 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l ((Rect*)outBounds)->bottom = 0; ((Rect*)outBounds)->right = 0; - wxMacStringToPascal( wxStripMenuCodes(label) , maclabel ) ; + wxMacStringToPascal( GetLabelText(label) , maclabel ) ; } void wxControl::MacPostControlCreate() @@ -398,7 +398,7 @@ void wxControl::MacPostControlCreate() SetSize(pos.x, pos.y, new_size.x, new_size.y); #if wxUSE_UNICODE - UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ; + UMASetControlTitle( (ControlHandle) m_macControl , GetLabelText(m_label) , m_font.GetEncoding() ) ; #endif if ( m_macControlIsShown )