]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/window_osx.cpp
return index of first added image in Add(), like MSW does, #10013
[wxWidgets.git] / src / osx / window_osx.cpp
index b5baf1f0098567c366d503261044d9f7a02c6404..e482f1d0a03d13375a81c33d8ab49071aee172f2 100644 (file)
@@ -274,19 +274,11 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), const wxSiz
 {
     wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid mac control") ) ;
 
-#if wxOSX_USE_CARBON
-    m_peer->SetReference( (URefCon) this ) ;
-#endif
-
     GetParent()->AddChild( this );
 
-#if wxOSX_USE_CARBON
     m_peer->InstallEventHandler();
+    m_peer->Embed(GetParent()->GetPeer());
 
-    ControlRef container = (ControlRef) GetParent()->GetHandle() ;
-    wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
-    ::EmbedControl( m_peer->GetControlRef() , container ) ;
-#endif
     GetParent()->MacChildAdded() ;
 
     // adjust font, controlsize etc
@@ -456,8 +448,7 @@ void wxWindowMac::DoReleaseMouse()
 
 void wxWindowMac::SetDropTarget(wxDropTarget *pDropTarget)
 {
-    if ( m_dropTarget != NULL )
-        delete m_dropTarget;
+    delete m_dropTarget;
 
     m_dropTarget = pDropTarget;
     if ( m_dropTarget != NULL )
@@ -757,30 +748,8 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
     {
         ClientToScreen( &x , &y ) ;
     }
-#ifdef __WXOSX_CARBON__
-    long menuResult = ::PopUpMenuSelect((MenuHandle) menu->GetHMenu() , y, x, 0) ;
-    if ( HiWord(menuResult) != 0 )
-    {
-        MenuCommand macid;
-        GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &macid );
-        int id = wxMacCommandToId( macid );
-        wxMenuItem* item = NULL ;
-        wxMenu* realmenu ;
-        item = menu->FindItem( id, &realmenu ) ;
-        if ( item )
-        {
-            if (item->IsCheckable())
-                item->Check( !item->IsChecked() ) ;
-
-            menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
-        }
-    }
-
-#else
+    menu->GetPeer()->PopUp(this, x, y);
     menu->SetInvokingWindow( NULL );
-    return false;
-#endif
-
     return true;
 #else
     // actually this shouldn't be called, because universal is having its own implementation