]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/combobox.cpp
Compilo.
[wxWidgets.git] / src / mac / carbon / combobox.cpp
index 331103395af5ca0de612572cfbbb7f7243873ff4..f2c79697b6218e8d40c8026f63c4d1f4c0eee571 100644 (file)
     #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;