X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aa61d3525370a9b9fa8c797d9b7f89d96994db5f..ec5006bdc630dd6b3d4cad1a3b572ab4c695a029:/src/mac/classic/combobox.cpp diff --git a/src/mac/classic/combobox.cpp b/src/mac/classic/combobox.cpp index d81d07e32b..2879e2a3eb 100644 --- a/src/mac/classic/combobox.cpp +++ b/src/mac/classic/combobox.cpp @@ -9,9 +9,15 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +#include "wx/wxprec.h" + #include "wx/combobox.h" -#include "wx/button.h" -#include "wx/menu.h" + +#ifndef WX_PRECOMP + #include "wx/button.h" + #include "wx/menu.h" +#endif + #include "wx/mac/uma.h" IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) @@ -88,14 +94,10 @@ protected: // This will invoke the dialog default action, such // as the clicking the default button. - wxWindow *parent = GetParent(); - while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) { - parent = parent->GetParent() ; - } - if ( parent && parent->GetDefaultItem() ) + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw && tlw->GetDefaultItem() ) { - wxButton *def = wxDynamicCast(parent->GetDefaultItem(), - wxButton); + wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); if ( def && def->IsEnabled() ) { wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );