]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/combobox.cpp
invert clockwise flag correctly
[wxWidgets.git] / src / mac / carbon / combobox.cpp
index dd73be5b4c15a4276cdae35f087e6fcb0697bbc6..0f0fbdc08a360d22abb0e65c8d334fc0b2c4d17a 100644 (file)
 #ifndef WX_PRECOMP
     #include "wx/button.h"
     #include "wx/menu.h"
+    #include "wx/containr.h"
+    #include "wx/toplevel.h"
 #endif
 
-#include "wx/containr.h"
 #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 ;
@@ -109,13 +110,10 @@ 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() );
@@ -165,7 +163,7 @@ BEGIN_EVENT_TABLE(wxComboBoxText, wxTextCtrl)
     EVT_KEY_DOWN(wxComboBoxText::OnKeyDown)
     EVT_CHAR(wxComboBoxText::OnChar)
     EVT_KEY_UP(wxComboBoxText::OnKeyUp)
-    EVT_TEXT(-1, wxComboBoxText::OnText)
+    EVT_TEXT(wxID_ANY, wxComboBoxText::OnText)
 END_EVENT_TABLE()
 
 class wxComboBoxChoice : public wxChoice
@@ -228,7 +226,7 @@ private:
 };
 
 BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
-    EVT_CHOICE(-1, wxComboBoxChoice::OnChoice)
+    EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice)
 END_EVENT_TABLE()
 
 wxComboBox::~wxComboBox()
@@ -676,4 +674,4 @@ wxInt32 wxComboBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENT
     return noErr ;
 }
 
-#endif
+#endif // wxUSE_COMBOBOX