]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/dnd_osx.cpp
Refactor DND code into Carbon and Cocoa parts, and provide a basic OS X Cocoa impleme...
[wxWidgets.git] / src / osx / dnd_osx.cpp
diff --git a/src/osx/dnd_osx.cpp b/src/osx/dnd_osx.cpp
new file mode 100644 (file)
index 0000000..c19bf6e
--- /dev/null
@@ -0,0 +1,87 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/dnd_osx.cpp
+// Purpose:     Mac common wxDropTarget, wxDropSource implementations
+// Author:      Stefan Csomor
+// Modified by:
+// Created:     1998-01-01
+// RCS-ID:      $Id: dnd.cpp 61724 2009-08-21 10:41:26Z VZ $
+// Copyright:   (c) 1998 Stefan Csomor
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#if wxUSE_DRAG_AND_DROP
+
+#include "wx/dnd.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/toplevel.h"
+    #include "wx/gdicmn.h"
+#endif // WX_PRECOMP
+
+#include "wx/osx/private.h"
+
+//----------------------------------------------------------------------------
+// wxDropTarget
+//----------------------------------------------------------------------------
+
+wxDragResult wxDropTarget::OnDragOver(
+    wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+    wxDragResult def )
+{
+    return CurrentDragHasSupportedFormat() ? def : wxDragNone;
+}
+
+wxDataFormat wxDropTarget::GetMatchingPair()
+{
+    wxFAIL_MSG("wxDropTarget::GetMatchingPair() not implemented in src/osx/carbon/dnd.cpp");
+    return wxDF_INVALID;
+}
+
+bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
+{
+    if (m_dataObject == NULL)
+        return false;
+
+    return CurrentDragHasSupportedFormat();
+}
+
+wxDragResult wxDropTarget::OnData(
+    wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+    wxDragResult def )
+{
+    if (m_dataObject == NULL)
+        return wxDragNone;
+
+    if (!CurrentDragHasSupportedFormat())
+        return wxDragNone;
+
+    return GetData() ? def : wxDragNone;
+}
+
+//-------------------------------------------------------------------------
+// wxDropSource
+//-------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// drag request
+
+wxDropSource::~wxDropSource()
+{
+}
+
+bool wxDropSource::MacInstallDefaultCursor(wxDragResult effect)
+{
+    const wxCursor& cursor = GetCursor(effect);
+    bool result = cursor.Ok();
+
+    if ( result )
+        cursor.MacInstall();
+
+    return result;
+}
+
+#endif // wxUSE_DRAG_AND_DROP
+