]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dnd.cpp
define MIIM_BITMAP &c in wx/msw/missing.h instead of msw/menu.cpp as menuitem.cpp...
[wxWidgets.git] / src / osx / carbon / dnd.cpp
index b5d299b476fa3a9c2a0e5f24b56407b72d5dbf39..172b99a437fdab905440699a868a5d02db4a7cd5 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/carbon/dnd.cpp
+// Name:        src/osx/carbon/dnd.cpp
 // Purpose:     wxDropTarget, wxDropSource implementations
 // Author:      Stefan Csomor
 // Modified by:
@@ -107,6 +107,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
         }
     }
 
+#if wxOSX_USE_CARBON
     if ( !supported )
     {
         PasteboardRef   pasteboard;
@@ -116,6 +117,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
             supported = m_dataObject->HasDataInPasteboard( pasteboard );
         }
     }
+#endif
 
     return supported;
 }
@@ -164,6 +166,7 @@ bool wxDropTarget::GetData()
         }
     }
 
+#if wxOSX_USE_CARBON
     if ( !transferred )
     {
         PasteboardRef   pasteboard;
@@ -173,6 +176,7 @@ bool wxDropTarget::GetData()
             transferred = m_dataObject->GetFromPasteboard( pasteboard );
         }
     }
+#endif
 
     return transferred;
 }
@@ -231,6 +235,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
     if ((m_data == NULL) || (m_data->GetFormatCount() == 0))
         return (wxDragResult)wxDragNone;
 
+#if wxOSX_USE_CARBON
     DragReference theDrag;
     RgnHandle dragRegion;
     OSStatus err = noErr;
@@ -305,6 +310,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
     DisposeDrag( theDrag );
     CFRelease( pasteboard );
     gTrackingGlobals.m_currentSource = NULL;
+#endif
 
     return gTrackingGlobals.m_result;
 }
@@ -325,15 +331,18 @@ bool gTrackingGlobalsInstalled = false;
 // passing the globals via refcon is not needed by the CFM and later architectures anymore
 // but I'll leave it in there, just in case...
 
+#if wxOSX_USE_CARBON
 pascal OSErr wxMacWindowDragTrackingHandler(
     DragTrackingMessage theMessage, WindowPtr theWindow,
     void *handlerRefCon, DragReference theDrag );
 pascal OSErr wxMacWindowDragReceiveHandler(
     WindowPtr theWindow, void *handlerRefCon,
     DragReference theDrag );
+#endif
 
 void wxMacEnsureTrackingHandlersInstalled()
 {
+#if wxOSX_USE_CARBON
     if ( !gTrackingGlobalsInstalled )
     {
         OSStatus err;
@@ -346,8 +355,10 @@ void wxMacEnsureTrackingHandlersInstalled()
 
         gTrackingGlobalsInstalled = true;
     }
+#endif
 }
 
+#if wxOSX_USE_CARBON
 pascal OSErr wxMacWindowDragTrackingHandler(
     DragTrackingMessage theMessage, WindowPtr theWindow,
     void *handlerRefCon, DragReference theDrag )
@@ -359,7 +370,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
 
     GetDragAttributes( theDrag, &attributes );
 
-    wxNonOwnedWindow* toplevel = wxFindWinFromMacWindow( theWindow );
+    wxNonOwnedWindow* toplevel = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) theWindow );
 
     bool optionDown = GetCurrentKeyModifiers() & optionKey;
     wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
@@ -385,15 +396,18 @@ pascal OSErr wxMacWindowDragTrackingHandler(
                 break;
 
             GetDragMouse( theDrag, &mouse, 0L );
-            localMouse = mouse;
-            wxMacGlobalToLocal( theWindow, &localMouse );
+            int x = mouse.h ;
+            int y = mouse.v ;
+            toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y );
+            localMouse.h = x;
+            localMouse.v = y;
 
             {
                 wxWindow *win = NULL;
                 ControlPartCode controlPart;
                 ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
                 if ( control )
-                    win = wxFindControlFromMacControl( control );
+                    win = wxFindWindowFromWXWidget( (WXWidget) control );
                 else
                     win = toplevel;
 
@@ -463,7 +477,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
                 {
                   if ( !trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) )
                   {
-                      int cursorID = wxCURSOR_NONE;
+                      wxStockCursor cursorID = wxCURSOR_NONE;
 
                       switch (result)
                       {
@@ -534,9 +548,11 @@ pascal OSErr wxMacWindowDragReceiveHandler(
         trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
         GetDragMouse( theDrag, &mouse, 0L );
         localMouse = mouse;
-        wxMacGlobalToLocal( theWindow, &localMouse );
         localx = localMouse.h;
         localy = localMouse.v;
+        wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) theWindow);
+        if ( tlw )
+            tlw->GetNonOwnedPeer()->ScreenToWindow( &localx, &localy );
 
         // TODO : should we use client coordinates?
         if ( trackingGlobals->m_currentTargetWindow )
@@ -557,6 +573,7 @@ pascal OSErr wxMacWindowDragReceiveHandler(
 
     return noErr;
 }
+#endif
 
 #endif // wxUSE_DRAG_AND_DROP