]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/clip_dnd.i
added functions to read/write several elements at once (patch 754986)
[wxWidgets.git] / wxPython / src / clip_dnd.i
index a1d9058763bb7e808a6921cc14d3fb2c15e780ed..2efd633649ff0b3aae99921ed0609afa430970ca 100644 (file)
@@ -13,8 +13,6 @@
 
 %module clip_dnd
 
-#ifndef __WXMAC__
-
 %{
 #include "helpers.h"
 #include <wx/dataobj.h>
@@ -113,10 +111,13 @@ public:
 
     wxDataFormat GetPreferredFormat(Direction dir = wxDataObject::Get);
     size_t GetFormatCount(Direction dir = wxDataObject::Get);
+
+    // TODO:  Fix these two to be usable from wxPython.
     void GetAllFormats(wxDataFormat *formats,
                        Direction dir = wxDataObject::Get);
-    size_t GetDataSize(const wxDataFormat& format);
     bool GetDataHere(const wxDataFormat& format, void *buf);
+
+    size_t GetDataSize(const wxDataFormat& format);
     bool SetData(const wxDataFormat& format,
                  size_t len, const void * buf);
     bool IsSupportedFormat(const wxDataFormat& format);
@@ -290,8 +291,9 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() {
 void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
     wxPyBeginBlockThreads();
     if (m_myInst.findCallback("SetBitmap")) {
-        m_myInst.callCallback(Py_BuildValue("(O)",
-                              wxPyConstructObject((void*)&bitmap, "wxBitmap")));
+        PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"));
+        m_myInst.callCallback(Py_BuildValue("(O)", bo));
+        Py_DECREF(bo);
     }
     wxPyEndBlockThreads();
 }
@@ -452,16 +454,18 @@ bool wxIsDragResultOk(wxDragResult res);
 %{
 class wxPyDropSource : public wxDropSource {
 public:
-#ifdef __WXMSW__
-    wxPyDropSource(wxWindow *win = NULL,
-                   const wxCursor &cursorCopy = wxNullCursor,
-                   const wxCursor &cursorMove = wxNullCursor,
-                   const wxCursor &cursorStop = wxNullCursor)
-        : wxDropSource(win, cursorCopy, cursorMove, cursorStop) {}
+#ifndef __WXGTK__
+     wxPyDropSource(wxWindow *win = NULL,
+                    const wxCursor &copy = wxNullCursor,
+                    const wxCursor &move = wxNullCursor,
+                    const wxCursor &none = wxNullCursor)
+         : wxDropSource(win, copy, move, none) {}
 #else
     wxPyDropSource(wxWindow *win = NULL,
-                   const wxIcon &go = wxNullIcon)
-        : wxDropSource(win, go) {}
+                   const wxIcon& copy = wxNullIcon,
+                   const wxIcon& move = wxNullIcon,
+                   const wxIcon& none = wxNullIcon)
+        : wxDropSource(win, copy, move, none) {}
 #endif
     ~wxPyDropSource() { }
 
@@ -476,14 +480,16 @@ IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback);
 
 %name(wxDropSource) class wxPyDropSource {
 public:
-#ifdef __WXMSW__
-    wxPyDropSource(wxWindow *win = NULL,
-                 const wxCursor &cursorCopy = wxNullCursor,
-                 const wxCursor &cursorMove = wxNullCursor,
-                 const wxCursor &cursorStop = wxNullCursor);
+#ifndef __WXGTK__
+     wxPyDropSource(wxWindow *win = NULL,
+                    const wxCursor &copy = wxNullCursor,
+                    const wxCursor &move = wxNullCursor,
+                    const wxCursor &none = wxNullCursor);
 #else
     wxPyDropSource(wxWindow *win = NULL,
-                   const wxIcon &go = wxNullIcon);
+                   const wxIcon& copy = wxNullIcon,
+                   const wxIcon& move = wxNullIcon,
+                   const wxIcon& none = wxNullIcon);
 #endif
 
     void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
@@ -627,10 +633,11 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
                                      const wxArrayString& filenames) {
     bool rval = FALSE;
     wxPyBeginBlockThreads();
-    PyObject* list = wxArrayString2PyList_helper(filenames);
-    if (m_myInst.findCallback("OnDropFiles"))
+    if (m_myInst.findCallback("OnDropFiles")) {
+        PyObject* list = wxArrayString2PyList_helper(filenames);
         rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
-    Py_DECREF(list);
+        Py_DECREF(list);
+    }
     wxPyEndBlockThreads();
     return rval;
 }
@@ -674,5 +681,5 @@ public:
 %}
 
 //----------------------------------------------------------------------
-#endif
+