X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c24dad6f7aa0797afa0a91861a0124a1099ea91..f49fd6d0cd050ccc55e1bcbb831e078eaac10feb:/src/mac/carbon/combobxc.cpp diff --git a/src/mac/carbon/combobxc.cpp b/src/mac/carbon/combobxc.cpp index f5ba7c6f31..9a63c93e70 100644 --- a/src/mac/carbon/combobxc.cpp +++ b/src/mac/carbon/combobxc.cpp @@ -12,8 +12,12 @@ #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" #if TARGET_API_MAC_OSX #ifndef __HIVIEW__ @@ -143,14 +147,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() ); @@ -399,9 +399,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, (EventHandlerRef *)&comboEventHandler); #else m_choice = new wxComboBoxChoice(this, style ); - - m_choice = new wxComboBoxChoice(this, style ); - m_choice->SetSizeHints( wxSize( POPUPWIDTH , POPUPHEIGHT ) ); + m_choice->SetMinSize( wxSize( POPUPWIDTH , POPUPHEIGHT ) ); wxSize csize = size; if ( style & wxCB_READONLY ) @@ -422,7 +420,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, { m_choice->DoAppend( choices[ i ] ); } - SetBestSize(csize); // Needed because it is a wxControlWithItems + SetInitialSize(csize); // Needed because it is a wxControlWithItems #endif return true;