X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..546bfbea8180aeee5a16f4abb34e721445277305:/wxPython/src/clip_dnd.i diff --git a/wxPython/src/clip_dnd.i b/wxPython/src/clip_dnd.i index 8feb9e8786..184f42f0a6 100644 --- a/wxPython/src/clip_dnd.i +++ b/wxPython/src/clip_dnd.i @@ -13,6 +13,8 @@ %module clip_dnd +#ifndef __WXMAC__ + %{ #include "helpers.h" #include @@ -33,6 +35,11 @@ %pragma(python) code = "import wx" +//--------------------------------------------------------------------------- +%{ + // Put some wx default wxChar* values into wxStrings. + static const wxString wxPyEmptyString(wxT("")); +%} //---------------------------------------------------------------------- @@ -70,7 +77,7 @@ public: wxDataFormatId GetType() const; wxString GetId() const; - void SetId(const char *format); + void SetId(const wxString& format); }; %new wxDataFormat* wxCustomDataFormat(const wxString &id); @@ -147,7 +154,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) { // C++ version. bool rval = FALSE; - bool doSave = wxPyRestoreThread(); + wxPyBeginBlockThreads(); if (m_myInst.findCallback("GetDataHere")) { PyObject* ro; ro = m_myInst.callCallbackObj(Py_BuildValue("()")); @@ -158,7 +165,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) { Py_DECREF(ro); } } - wxPySaveThread(doSave); + wxPyEndBlockThreads(); return rval; } @@ -166,13 +173,13 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) { // For this one we simply need to make a string from buf and len // and send it to the Python method. bool rval = FALSE; - bool doSave = wxPyRestoreThread(); + wxPyBeginBlockThreads(); if (m_myInst.findCallback("SetData")) { PyObject* data = PyString_FromStringAndSize((char*)buf, len); rval = m_myInst.callCallback(Py_BuildValue("(O)", data)); Py_DECREF(data); } - wxPySaveThread(doSave); + wxPyEndBlockThreads(); return rval; } %} @@ -183,8 +190,8 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) { class wxPyDataObjectSimple : public wxDataObjectSimple { public: wxPyDataObjectSimple(const wxDataFormat& format = wxPyFormatInvalid); - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDataObjectSimple)" + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyDataObjectSimple)" }; //---------------------------------------------------------------------- @@ -203,7 +210,7 @@ public: class wxTextDataObject : public wxDataObjectSimple { public: - wxTextDataObject(const wxString& text = wxEmptyString); + wxTextDataObject(const wxString& text = wxPyEmptyString); size_t GetTextLength(); wxString GetText(); @@ -215,7 +222,7 @@ public: %{ // Create a new class for wxPython to use class wxPyTextDataObject : public wxTextDataObject { public: - wxPyTextDataObject(const wxString& text = wxEmptyString) + wxPyTextDataObject(const wxString& text = wxPyEmptyString) : wxTextDataObject(text) {} DEC_PYCALLBACK_SIZET_(GetTextLength); @@ -234,9 +241,9 @@ IMP_PYCALLBACK__STRING(wxPyTextDataObject, wxTextDataObject, SetText); // Now define it for SWIG class wxPyTextDataObject : public wxTextDataObject { public: - wxPyTextDataObject(const wxString& text = wxEmptyString); - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyTextDataObject)" + wxPyTextDataObject(const wxString& text = wxPyEmptyString); + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTextDataObject)" }; //---------------------------------------------------------------------- @@ -264,7 +271,7 @@ public: wxBitmap wxPyBitmapDataObject::GetBitmap() { wxBitmap* rval = &wxNullBitmap; - bool doSave = wxPyRestoreThread(); + wxPyBeginBlockThreads(); if (m_myInst.findCallback("GetBitmap")) { PyObject* ro; wxBitmap* ptr; @@ -275,17 +282,17 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() { Py_DECREF(ro); } } - wxPySaveThread(doSave); + wxPyEndBlockThreads(); return *rval; } void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { - bool doSave = wxPyRestoreThread(); + wxPyBeginBlockThreads(); if (m_myInst.findCallback("SetBitmap")) { m_myInst.callCallback(Py_BuildValue("(O)", wxPyConstructObject((void*)&bitmap, "wxBitmap"))); } - wxPySaveThread(doSave); + wxPyEndBlockThreads(); } %} @@ -295,8 +302,8 @@ void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { class wxPyBitmapDataObject : public wxBitmapDataObject { public: wxPyBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap); - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyBitmapDataObject)" + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyBitmapDataObject)" }; @@ -311,10 +318,7 @@ public: %addmethods { PyObject* GetFilenames() { const wxArrayString& strings = self->GetFilenames(); - PyObject* list = PyList_New(0); - for (size_t x=0; x +%} + +class wxMetafileDataObject : public wxDataObjectSimple +{ +public: + wxMetafileDataObject(); + + void SetMetafile(const wxMetafile& metafile); + wxMetafile GetMetafile() const; +}; + +#endif //---------------------------------------------------------------------- //---------------------------------------------------------------------- //---------------------------------------------------------------------- -class wxClipboard { +class wxClipboard : public wxObject { public: wxClipboard(); @@ -399,6 +432,7 @@ enum wxDragResult wxDragNone, // drag target didn't accept the data wxDragCopy, // the data was successfully copied wxDragMove, // the data was successfully moved (MSW only) + wxDragLink, // operation is a drag-link wxDragCancel // the operation was cancelled by user (not an error) }; @@ -442,8 +476,8 @@ public: const wxIcon &go = wxNullIcon); #endif - void _setSelf(PyObject* self, PyObject* _class, int incref); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxDropSource, 0)" + void _setCallbackInfo(PyObject* self, PyObject* _class, int incref); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxDropSource, 0)" ~wxPyDropSource(); void SetData(wxDataObject& data); @@ -497,8 +531,8 @@ class wxPyDropTarget : public wxDropTarget { public: wxPyDropTarget(wxDataObject *dataObject = NULL); %pragma(python) addtomethod = "__init__:if _args:_args[0].thisown = 0" - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxPyDropTarget)" + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyDropTarget)" ~wxPyDropTarget(); @@ -551,8 +585,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop); %name(wxTextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget { public: wxPyTextDropTarget(); - void _setSelf(PyObject* self, PyObject* _class); - %pragma(python) addtomethod = "__init__:self._setSelf(self, wxTextDropTarget)" + void _setCallbackInfo(PyObject* self, PyObject* _class); + %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxTextDropTarget)" //bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def); @@ -582,16 +616,12 @@ public: bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) { bool rval = FALSE; - bool doSave = wxPyRestoreThread(); - PyObject* list = PyList_New(0); - for (size_t i=0; i