X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..52f52ebc4e0be6a9899d328b08db9eb14629d219:/wxPython/src/_dataobj.i?ds=sidebyside diff --git a/wxPython/src/_dataobj.i b/wxPython/src/_dataobj.i index 0336e55dde..a0b8fbbdd6 100644 --- a/wxPython/src/_dataobj.i +++ b/wxPython/src/_dataobj.i @@ -112,7 +112,7 @@ public: // get the number of formats we support virtual size_t GetFormatCount(Direction dir = Get) const; - // returns TRUE if this format is supported + // returns True if this format is supported bool IsSupported(const wxDataFormat& format, Direction dir = Get) const; // get the (total) size of data for the given format @@ -128,11 +128,11 @@ public: Direction dir = Get) const; // copy raw data (in the specified format) to the provided buffer, return - // TRUE if data copied successfully, FALSE otherwise + // True if data copied successfully, False otherwise virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; // get data from the buffer of specified length (in the given format), - // return TRUE if the data was read successfully, FALSE otherwise + // return True if the data was read successfully, False otherwise virtual bool SetData(const wxDataFormat& format, size_t len, const void * buf); }; @@ -143,7 +143,7 @@ public: // wxDataObjectSimple is a wxDataObject which only supports one format (in -// both Get and Set directions, but you may return FALSE from GetDataHere() or +// both Get and Set directions, but you may return False from GetDataHere() or // SetData() if one of them is not supported). This is the simplest possible // wxDataObject implementation. // @@ -186,7 +186,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) const { // return either a string or None and then act appropriately with the // C++ version. - bool rval = FALSE; + bool rval = False; wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetDataHere")) { PyObject* ro; @@ -205,7 +205,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) const { bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) const{ // 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 rval = False; wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetData")) { PyObject* data = PyString_FromStringAndSize((char*)buf, len); @@ -222,7 +222,7 @@ bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) const{ // Now define it for SWIG class wxPyDataObjectSimple : public wxDataObjectSimple { public: - %addtofunc wxPyDataObjectSimple "self._setCallbackInfo(self, PyDataObjectSimple)" + %pythonAppend wxPyDataObjectSimple "self._setCallbackInfo(self, PyDataObjectSimple)" wxPyDataObjectSimple(const wxDataFormat& format = wxFormatInvalid); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -240,8 +240,9 @@ class wxDataObjectComposite : public wxDataObject { public: wxDataObjectComposite(); - %addtofunc Add "args[1].thisown = 0" - void Add(wxDataObjectSimple *dataObject, int preferred = FALSE); + %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject }; + void Add(wxDataObjectSimple *dataObject, int preferred = False); + %clear wxDataObjectSimple *dataObject; }; //--------------------------------------------------------------------------- @@ -280,7 +281,7 @@ IMP_PYCALLBACK__STRING(wxPyTextDataObject, wxTextDataObject, SetText); // Now define it for SWIG class wxPyTextDataObject : public wxTextDataObject { public: - %addtofunc wxPyTextDataObject "self._setCallbackInfo(self, PyTextDataObject)" + %pythonAppend wxPyTextDataObject "self._setCallbackInfo(self, PyTextDataObject)" wxPyTextDataObject(const wxString& text = wxPyEmptyString); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -330,7 +331,7 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() const { void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) { - PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), false); + PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), False); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", bo)); Py_DECREF(bo); } @@ -343,7 +344,7 @@ void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { // Now define it for SWIG class wxPyBitmapDataObject : public wxBitmapDataObject { public: - %addtofunc wxPyBitmapDataObject "self._setCallbackInfo(self, PyBitmapDataObject)" + %pythonAppend wxPyBitmapDataObject "self._setCallbackInfo(self, PyBitmapDataObject)" wxPyBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -359,9 +360,7 @@ public: wxFileDataObject(); const wxArrayString& GetFilenames(); -#ifdef __WXMSW__ void AddFile(const wxString &filename); -#endif }; @@ -393,7 +392,7 @@ public: else { // raise a TypeError if not a string PyErr_SetString(PyExc_TypeError, "String expected."); - return FALSE; + return False; } } } @@ -424,7 +423,7 @@ public: //--------------------------------------------------------------------------- -#ifndef __WXGTK__ +#if defined(__WXMSW__) || defined(__WXMAC__) %{ #include @@ -445,7 +444,7 @@ public: class wxMetafileDataObject : public wxDataObjectSimple { public: - wxMetafileDataObject() { PyErr_SetNone(PyExc_NotImplementedError); } + wxMetafileDataObject() { wxPyRaiseNotImplemented(); } }; %}