From c9a1416a3aa25c297d8d6126c08658dba968767d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 26 Oct 2001 07:19:20 +0000 Subject: [PATCH] Added wxURLDataObject git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/clip_dnd.i | 10 +++ wxPython/src/msw/clip_dnd.cpp | 133 ++++++++++++++++++++++++++++++++++ wxPython/src/msw/clip_dnd.py | 21 ++++++ 3 files changed, 164 insertions(+) diff --git a/wxPython/src/clip_dnd.i b/wxPython/src/clip_dnd.i index f0bc85fd90..20bc010a59 100644 --- a/wxPython/src/clip_dnd.i +++ b/wxPython/src/clip_dnd.i @@ -358,6 +358,15 @@ public: }; +//---------------------------------------------------------------------- + +class wxURLDataObject : public wxDataObjectComposite { +public: + wxURLDataObject(); + + wxString GetURL(); + void SetURL(const wxString& url); +}; //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -400,6 +409,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) }; diff --git a/wxPython/src/msw/clip_dnd.cpp b/wxPython/src/msw/clip_dnd.cpp index e0d6b38223..0d81093266 100644 --- a/wxPython/src/msw/clip_dnd.cpp +++ b/wxPython/src/msw/clip_dnd.cpp @@ -1983,6 +1983,133 @@ static PyObject *_wrap_wxCustomDataObject_GetData(PyObject *self, PyObject *args return _resultobj; } +static void *SwigwxURLDataObjectTowxDataObjectComposite(void *ptr) { + wxURLDataObject *src; + wxDataObjectComposite *dest; + src = (wxURLDataObject *) ptr; + dest = (wxDataObjectComposite *) src; + return (void *) dest; +} + +static void *SwigwxURLDataObjectTowxDataObject(void *ptr) { + wxURLDataObject *src; + wxDataObject *dest; + src = (wxURLDataObject *) ptr; + dest = (wxDataObject *) src; + return (void *) dest; +} + +#define new_wxURLDataObject() (new wxURLDataObject()) +static PyObject *_wrap_new_wxURLDataObject(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxURLDataObject * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxURLDataObject",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxURLDataObject *)new_wxURLDataObject(); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxURLDataObject_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxURLDataObject_GetURL(_swigobj) (_swigobj->GetURL()) +static PyObject *_wrap_wxURLDataObject_GetURL(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxURLDataObject * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxURLDataObject_GetURL",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxURLDataObject_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxURLDataObject_GetURL. Expected _wxURLDataObject_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxURLDataObject_GetURL(_arg0)); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +} +{ + delete _result; +} + return _resultobj; +} + +#define wxURLDataObject_SetURL(_swigobj,_swigarg0) (_swigobj->SetURL(_swigarg0)) +static PyObject *_wrap_wxURLDataObject_SetURL(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxURLDataObject * _arg0; + wxString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","url", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxURLDataObject_SetURL",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxURLDataObject_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxURLDataObject_SetURL. Expected _wxURLDataObject_p."); + return NULL; + } + } +{ +#if PYTHON_API_VERSION >= 1009 + char* tmpPtr; int tmpSize; + if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1) + return NULL; + _arg1 = new wxString(tmpPtr, tmpSize); +#else + if (!PyString_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1)); +#endif +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxURLDataObject_SetURL(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + static void *SwigwxClipboardTowxObject(void *ptr) { wxClipboard *src; wxObject *dest; @@ -3466,6 +3593,9 @@ static PyMethodDef clip_dndcMethods[] = { { "wxClipboard_Close", (PyCFunction) _wrap_wxClipboard_Close, METH_VARARGS | METH_KEYWORDS }, { "wxClipboard_Open", (PyCFunction) _wrap_wxClipboard_Open, METH_VARARGS | METH_KEYWORDS }, { "new_wxClipboard", (PyCFunction) _wrap_new_wxClipboard, METH_VARARGS | METH_KEYWORDS }, + { "wxURLDataObject_SetURL", (PyCFunction) _wrap_wxURLDataObject_SetURL, METH_VARARGS | METH_KEYWORDS }, + { "wxURLDataObject_GetURL", (PyCFunction) _wrap_wxURLDataObject_GetURL, METH_VARARGS | METH_KEYWORDS }, + { "new_wxURLDataObject", (PyCFunction) _wrap_new_wxURLDataObject, METH_VARARGS | METH_KEYWORDS }, { "wxCustomDataObject_GetData", (PyCFunction) _wrap_wxCustomDataObject_GetData, METH_VARARGS | METH_KEYWORDS }, { "wxCustomDataObject_GetSize", (PyCFunction) _wrap_wxCustomDataObject_GetSize, METH_VARARGS | METH_KEYWORDS }, { "wxCustomDataObject_SetData", (PyCFunction) _wrap_wxCustomDataObject_SetData, METH_VARARGS | METH_KEYWORDS }, @@ -3529,6 +3659,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrintQuality","_size_t",0}, { "_wxPrintQuality","_time_t",0}, { "_byte","_unsigned_char",0}, + { "_wxDataObject","_wxURLDataObject",SwigwxURLDataObjectTowxDataObject}, { "_wxDataObject","_wxCustomDataObject",SwigwxCustomDataObjectTowxDataObject}, { "_wxDataObject","_wxFileDataObject",SwigwxFileDataObjectTowxDataObject}, { "_wxDataObject","_wxPyBitmapDataObject",SwigwxPyBitmapDataObjectTowxDataObject}, @@ -3633,6 +3764,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxCoord","_size_t",0}, { "_wxCoord","_time_t",0}, { "_wxCoord","_wxPrintQuality",0}, + { "_wxDataObjectComposite","_wxURLDataObject",SwigwxURLDataObjectTowxDataObjectComposite}, { "_wxPyDropTarget","_wxPyFileDropTarget",SwigwxPyFileDropTargetTowxPyDropTarget}, { "_wxPyDropTarget","_wxPyTextDropTarget",SwigwxPyTextDropTargetTowxPyDropTarget}, {0,0,0}}; @@ -3672,6 +3804,7 @@ SWIGEXPORT(void) initclip_dndc() { PyDict_SetItemString(d,"wxDragNone", PyInt_FromLong((long) wxDragNone)); PyDict_SetItemString(d,"wxDragCopy", PyInt_FromLong((long) wxDragCopy)); PyDict_SetItemString(d,"wxDragMove", PyInt_FromLong((long) wxDragMove)); + PyDict_SetItemString(d,"wxDragLink", PyInt_FromLong((long) wxDragLink)); PyDict_SetItemString(d,"wxDragCancel", PyInt_FromLong((long) wxDragCancel)); diff --git a/wxPython/src/msw/clip_dnd.py b/wxPython/src/msw/clip_dnd.py index 8b47a1ac62..7638de0a1d 100644 --- a/wxPython/src/msw/clip_dnd.py +++ b/wxPython/src/msw/clip_dnd.py @@ -258,6 +258,26 @@ class wxCustomDataObject(wxCustomDataObjectPtr): +class wxURLDataObjectPtr(wxDataObjectCompositePtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetURL(self, *_args, **_kwargs): + val = apply(clip_dndc.wxURLDataObject_GetURL,(self,) + _args, _kwargs) + return val + def SetURL(self, *_args, **_kwargs): + val = apply(clip_dndc.wxURLDataObject_SetURL,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "" % (self.this,) +class wxURLDataObject(wxURLDataObjectPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(clip_dndc.new_wxURLDataObject,_args,_kwargs) + self.thisown = 1 + + + + class wxClipboardPtr(wxObjectPtr): def __init__(self,this): self.this = this @@ -506,4 +526,5 @@ wxDragError = clip_dndc.wxDragError wxDragNone = clip_dndc.wxDragNone wxDragCopy = clip_dndc.wxDragCopy wxDragMove = clip_dndc.wxDragMove +wxDragLink = clip_dndc.wxDragLink wxDragCancel = clip_dndc.wxDragCancel -- 2.47.2