X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/864a91c827740da5e8a3e1f36feaf396d34dedc0..d0ee33f5c6908b4ac5e1364381f0ef00942e3936:/wxPython/src/_dnd.i diff --git a/wxPython/src/_dnd.i b/wxPython/src/_dnd.i index 9c2ade6aa3..29a4d2cc19 100644 --- a/wxPython/src/_dnd.i +++ b/wxPython/src/_dnd.i @@ -55,7 +55,8 @@ IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback); %} -%name(DropSource) class wxPyDropSource { +%rename(DropSource) wxPyDropSource; +class wxPyDropSource { public: %pythonAppend wxPyDropSource "self._setCallbackInfo(self, DropSource, 0)" #ifndef __WXGTK__ @@ -87,6 +88,21 @@ public: }; +%pythoncode { +def DROP_ICON(filename): + """ + Returns either a `wx.Cursor` or `wx.Icon` created from the image file + ``filename``. This function is useful with the `wx.DropSource` class + which, depending on platform accepts either a icon or a cursor. + """ + img = wx.Image(filename) + if wx.Platform == '__WXGTK__': + return wx.IconFromBitmap(wx.BitmapFromImage(img)) + else: + return wx.CursorFromImage(img) +} + + //--------------------------------------------------------------------------- // wxDropTarget should be associated with a window if it wants to be able to @@ -115,7 +131,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop); %} -%name(DropTarget) class wxPyDropTarget // : public wxDropTarget +%rename(DropTarget) wxPyDropTarget; +class wxPyDropTarget // : public wxDropTarget { public: %pythonAppend wxPyDropTarget @@ -142,6 +159,15 @@ public: // with the data from the drop source if it returns True bool GetData(); + // sets the default action for drag and drop: + // use wxDragMove or wxDragCopy to set deafult action to move or copy + // and use wxDragNone (default) to set default action specified by + // initialization of draging (see wxDropSourceBase::DoDragDrop()) + void SetDefaultAction(wxDragResult action); + + // returns default action for drag and drop or + // wxDragNone if this not specified + wxDragResult GetDefaultAction(); }; @@ -178,7 +204,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop); %} -%name(TextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget { +%rename(TextDropTarget) wxPyTextDropTarget; +class wxPyTextDropTarget : public wxPyDropTarget { public: %pythonAppend wxPyTextDropTarget "self._setCallbackInfo(self, TextDropTarget)" @@ -216,8 +243,8 @@ public: bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) { - bool rval = False; - bool blocked = wxPyBeginBlockThreads(); + bool rval = false; + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) { PyObject* list = wxArrayString2PyList_helper(filenames); rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list)); @@ -238,7 +265,8 @@ IMP_PYCALLBACK_BOOL_INTINT(wxPyFileDropTarget, wxFileDropTarget, OnDrop); %} -%name(FileDropTarget) class wxPyFileDropTarget : public wxPyDropTarget +%rename(FileDropTarget) wxPyFileDropTarget; +class wxPyFileDropTarget : public wxPyDropTarget { public: %pythonAppend wxPyFileDropTarget "self._setCallbackInfo(self, FileDropTarget)"