X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a72f4631fe5ab7ebeefdacf8ec9c826ea962133f..99fbb25ba438c675f21e9db67c894ef01d166107:/wxPython/src/_dataobj.i diff --git a/wxPython/src/_dataobj.i b/wxPython/src/_dataobj.i index d755d6d1ec..fd6cd5c5b0 100644 --- a/wxPython/src/_dataobj.i +++ b/wxPython/src/_dataobj.i @@ -71,7 +71,7 @@ The standard format IDs are: Windows and non-unicode builds ================ ===================================== -Aside the standard formats, the application may also use custom +Besies the standard formats, the application may also use custom formats which are identified by their names (strings) and not numeric identifiers. Although internally custom format must be created (or registered) first, you shouldn\'t care about it because it is done @@ -230,26 +230,22 @@ data.", ""); - // return all formats in the provided array (of size GetFormatCount()) - //virtual void GetAllFormats(wxDataFormat *formats, - // Direction dir = Get) const; - DocAStr(GetAllFormats, - "GetAllFormats(self, int dir=Get) -> [formats]", - "Returns a list of all the wx.DataFormats that this dataobject supports -in the given direction.", ""); %extend { + DocAStr(GetAllFormats, + "GetAllFormats(self, int dir=Get) -> [formats]", + "Returns a list of all the wx.DataFormats that this dataobject supports +in the given direction.", ""); PyObject* GetAllFormats(Direction dir = Get) { size_t count = self->GetFormatCount(dir); wxDataFormat* formats = new wxDataFormat[count]; self->GetAllFormats(formats, dir); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* list = PyList_New(count); for (size_t i=0; i String", - "Get the data bytes in the specified format, returns None on failure. -", " -:todo: This should use the python buffer interface isntead..."); %extend { + DocAStr(GetDataHere, + "GetDataHere(self, DataFormat format) -> String", + "Get the data bytes in the specified format, returns None on failure.", " +:todo: This should use the python buffer interface isntead..."); PyObject* GetDataHere(const wxDataFormat& format) { PyObject* rval = NULL; size_t size = self->GetDataSize(format); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (size) { char* buf = new char[size]; if (self->GetDataHere(format, buf)) @@ -301,7 +296,7 @@ in the given direction.", ""); %extend { bool SetData(const wxDataFormat& format, PyObject* data) { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (PyString_Check(data)) { rval = self->SetData(format, PyString_Size(data), PyString_AsString(data)); } @@ -354,16 +349,16 @@ assumed that the format is supported in both directions.", ""); - DocAStr(GetDataHere, - "GetDataHere(self) -> String", - "Returns the data bytes from the data object as a string, returns None + %extend { + DocAStr(GetDataHere, + "GetDataHere(self) -> String", + "Returns the data bytes from the data object as a string, returns None on failure. Must be implemented in the derived class if the object supports rendering its data.", ""); - %extend { PyObject* GetDataHere() { PyObject* rval = NULL; size_t size = self->GetDataSize(); - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (size) { char* buf = new char[size]; if (self->GetDataHere(buf)) @@ -380,15 +375,15 @@ supports rendering its data.", ""); } - DocAStr(SetData, - "SetData(self, String data) -> bool", - "Copy the data value to the data object. Must be implemented in the + %extend { + DocAStr(SetData, + "SetData(self, String data) -> bool", + "Copy the data value to the data object. Must be implemented in the derived class if the object supports setting its data. ", ""); - %extend { bool SetData(PyObject* data) { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (PyString_Check(data)) { rval = self->SetData(PyString_Size(data), PyString_AsString(data)); } @@ -428,7 +423,7 @@ bool wxPyDataObjectSimple::GetDataHere(void *buf) const { // C++ version. bool rval = false; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetDataHere")) { PyObject* ro; ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); @@ -447,7 +442,7 @@ 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 blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetData")) { PyObject* data = PyString_FromStringAndSize((char*)buf, len); rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", data)); @@ -521,14 +516,14 @@ class wxDataObjectComposite : public wxDataObject { public: wxDataObjectComposite(); - %apply SWIGTYPE *DISOWN { wxDataObjectSimple *dataObject }; + %disownarg( wxDataObjectSimple *dataObject ); DocDeclStr( void , Add(wxDataObjectSimple *dataObject, bool preferred = false), "Adds the dataObject to the list of supported objects and it becomes the preferred object if preferred is True.", ""); - %clear wxDataObjectSimple *dataObject; + %cleardisown( wxDataObjectSimple *dataObject ); }; //--------------------------------------------------------------------------- @@ -665,7 +660,7 @@ public: wxBitmap wxPyBitmapDataObject::GetBitmap() const { wxBitmap* rval = &wxNullBitmap; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "GetBitmap")) { PyObject* ro; wxBitmap* ptr; @@ -681,7 +676,7 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() const { } void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) { PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), false); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", bo)); @@ -717,13 +712,7 @@ file names. The program works with it just as if it were a list of absolute file names, but internally it uses the same format as Explorer and other compatible programs under Windows or GNOME/KDE filemanager under Unix which makes it possible to receive files from -them using this class. - -:Warning: Under all non-Windows platforms this class is currently - \"input-only\", i.e. you can receive the files from another - application, but copying (or dragging) file(s) from a wxWidgets - application is not currently supported. -", ""); +them using this class.", ""); class wxFileDataObject : public wxDataObjectSimple { @@ -754,16 +743,23 @@ data object.", ""); class wxCustomDataObject : public wxDataObjectSimple { public: - wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid); - + %nokwargs wxCustomDataObject; + wxCustomDataObject(const wxDataFormat& format); + %extend { + wxCustomDataObject(const wxString& formatName) { + return new wxCustomDataObject(wxDataFormat(formatName)); + } + } + wxCustomDataObject(); + - DocAStr(SetData, - "SetData(self, String data) -> bool", - "Copy the data value to the data object.", ""); %extend { + DocAStr(SetData, + "SetData(self, String data) -> bool", + "Copy the data value to the data object.", ""); bool SetData(PyObject* data) { bool rval; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (PyString_Check(data)) { rval = self->SetData(PyString_Size(data), PyString_AsString(data)); } @@ -783,13 +779,13 @@ public: "Get the size of the data.", ""); - DocAStr(GetData, - "GetData(self) -> String", - "Returns the data bytes from the data object as a string.", ""); %extend { + DocAStr(GetData, + "GetData(self) -> String", + "Returns the data bytes from the data object as a string.", ""); PyObject* GetData() { PyObject* obj; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); obj = PyString_FromStringAndSize((char*)self->GetData(), self->GetSize()); wxPyEndBlockThreads(blocked); return obj; @@ -803,7 +799,7 @@ public: DocStr(wxURLDataObject, "This data object holds a URL in a format that is compatible with some browsers such that it is able to be dragged to or from them.", ""); -class wxURLDataObject : public wxDataObjectComposite { +class wxURLDataObject : public wxDataObject/*Composite*/ { public: wxURLDataObject();