X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d394edcac8c94d0ac1c1025f5b43bb372f8eb905..b9ac87bc5cbe46227195e32c44e25831f8206e3c:/wxPython/src/clip_dnd.i?ds=inline diff --git a/wxPython/src/clip_dnd.i b/wxPython/src/clip_dnd.i index bf4acd7712..e5547215f4 100644 --- a/wxPython/src/clip_dnd.i +++ b/wxPython/src/clip_dnd.i @@ -13,8 +13,6 @@ %module clip_dnd -#ifndef __WXMAC__ - %{ #include "helpers.h" #include @@ -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(); } @@ -427,6 +429,15 @@ public: //---------------------------------------------------------------------- //---------------------------------------------------------------------- +// flags for wxDropSource::DoDragDrop() +// +enum +{ + wxDrag_CopyOnly = 0, // allow only copying + wxDrag_AllowMove = 1, // allow moving (copying is always allowed) + wxDrag_DefaultMove = 3 // the default operation is move, not copy +}; + enum wxDragResult { wxDragError, // error prevented the d&d operation from completing @@ -444,15 +455,17 @@ 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) {} + wxPyDropSource(wxWindow *win = NULL, + const wxCursor © = 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() { } @@ -468,13 +481,15 @@ 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); + wxPyDropSource(wxWindow *win = NULL, + const wxCursor © = 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); @@ -484,7 +499,7 @@ public: void SetData(wxDataObject& data); wxDataObject *GetDataObject(); void SetCursor(wxDragResult res, const wxCursor& cursor); - wxDragResult DoDragDrop(int bAllowMove = FALSE); + wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); bool base_GiveFeedback(wxDragResult effect); }; @@ -618,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; } @@ -665,5 +681,5 @@ public: %} //---------------------------------------------------------------------- -#endif +