X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/841f23e18a9d9e3d987b60422c3a220571868337..2e57368359ab190b5bbad1849d88f298e30723c9:/src/mac/carbon/combobox.cpp diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 331103395a..f2c79697b6 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -19,13 +19,14 @@ #include "wx/button.h" #include "wx/menu.h" #include "wx/containr.h" + #include "wx/toplevel.h" #endif #include "wx/mac/uma.h" IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) -WX_DELEGATE_TO_CONTROL_CONTAINER(wxComboBox) +WX_DELEGATE_TO_CONTROL_CONTAINER(wxComboBox, wxControl) BEGIN_EVENT_TABLE(wxComboBox, wxControl) WX_EVENT_TABLE_CONTROL_CONTAINER(wxComboBox) @@ -36,7 +37,7 @@ static int nextPopUpMenuId = 1000 ; MenuHandle NewUniqueMenu() { - MenuHandle handle = NewMenu( nextPopUpMenuId , "\pMenu" ) ; + MenuHandle handle = UMANewMenu(nextPopUpMenuId, wxString(wxT("Menu")), wxFont::GetDefaultEncoding() ); nextPopUpMenuId++ ; return handle ; @@ -58,7 +59,6 @@ static const int TEXTFOCUSBORDER = 3 ; static const wxCoord MARGIN = 2; static const int TEXTFOCUSBORDER = 0 ; #endif -static const int POPUPHEIGHT = 23; // ---------------------------------------------------------------------------- @@ -109,19 +109,16 @@ protected: // such as the clicking the default button. if (!m_cb->GetEventHandler()->ProcessEvent( event )) { - 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() ); event.SetEventObject(def); def->Command(event); - } + } } return;