1//--------------------------------------------------------------------------- 2// This file is generated by wxPython's SIP generator. Do not edit by hand. 3// 4// Copyright: (c) 2018 by Total Control Software 5// License: wxWindows License 6// 7// This file will be included by _core.sip 8// 9//--------------------------------------------------------------------------- 10 11%ModuleHeaderCode 12#include <wx/dnd.h> 13%End 14 15 16//--------------------------------------------------------------------------- 17 18enum 19{ 20 wxDrag_CopyOnly, 21 wxDrag_AllowMove, 22 wxDrag_DefaultMove 23}; 24 25enum wxDragResult 26{ 27 wxDragError, 28 wxDragNone, 29 wxDragCopy, 30 wxDragMove, 31 wxDragLink, 32 wxDragCancel 33}; 34 35bool wxIsDragResultOk( 36 wxDragResult res 37); 38%Docstring 39 IsDragResultOk(res) -> bool 40 41 Returns true if res indicates that something was done during a DnD 42 operation, i.e. 43%End 44 45class wxDropSource 46{ 47 %Docstring 48 DropSource(win=None) 49 DropSource(data, win=None) 50 51 This class represents a source for a drag and drop operation. 52 %End 53 %TypeHeaderCode 54 #include <wx/dnd.h> 55 %End 56 57public: 58 wxDropSource( 59 wxWindow * win = NULL 60 ); 61 62 wxDropSource( 63 wxDataObject & data, 64 wxWindow * win = NULL 65 ); 66 67 virtual 68 wxDragResult DoDragDrop( 69 int flags = wxDrag_CopyOnly 70 ); 71 %Docstring 72 DoDragDrop(flags=Drag_CopyOnly) -> DragResult 73 74 Starts the drag-and-drop operation which will terminate when the user 75 releases the mouse. 76 %End 77 78 wxDataObject * GetDataObject(); 79 %Docstring 80 GetDataObject() -> DataObject 81 82 Returns the wxDataObject object that has been assigned previously. 83 %End 84 85 virtual 86 bool GiveFeedback( 87 wxDragResult effect 88 ); 89 %Docstring 90 GiveFeedback(effect) -> bool 91 92 You may give some custom UI feedback during the drag and drop 93 operation by overriding this function. 94 %End 95 96 void SetCursor( 97 wxDragResult res, 98 const wxCursor & cursor 99 ); 100 %Docstring 101 SetCursor(res, cursor) 102 103 Set the icon to use for a certain drag result. 104 %End 105 %MethodCode 106 PyErr_Clear(); 107 Py_BEGIN_ALLOW_THREADS 108 _wxDropSource_SetCursor(sipCpp, res, cursor); 109 Py_END_ALLOW_THREADS 110 if (PyErr_Occurred()) sipIsErr = 1; 111 %End 112 %TypeCode 113 void _wxDropSource_SetCursor(wxDropSource* self, wxDragResult res, const wxCursor *cursor) 114 { 115 #ifdef __WXGTK__ 116 wxPyRaiseNotImplementedMsg("Cursors not supported, use SetIcon on wxGTK instead."); 117 #else 118 self->SetCursor(res, *cursor); 119 #endif 120 } 121 %End 122 123 void SetIcon( 124 wxDragResult res, 125 const wxIcon & icon 126 ); 127 %Docstring 128 SetIcon(res, icon) 129 130 Set the icon to use for a certain drag result. 131 %End 132 %MethodCode 133 PyErr_Clear(); 134 Py_BEGIN_ALLOW_THREADS 135 _wxDropSource_SetIcon(sipCpp, res, icon); 136 Py_END_ALLOW_THREADS 137 if (PyErr_Occurred()) sipIsErr = 1; 138 %End 139 %TypeCode 140 void _wxDropSource_SetIcon(wxDropSource* self, wxDragResult res, const wxIcon *icon) 141 { 142 #ifdef __WXGTK__ 143 self->SetIcon(res, *icon); 144 #else 145 wxPyRaiseNotImplementedMsg("Icons not supported, use SetCursor on non-wxGTK ports."); 146 #endif 147 } 148 %End 149 150 void SetData( 151 wxDataObject & data 152 ); 153 %Docstring 154 SetData(data) 155 156 Sets the data wxDataObject associated with the drop source. 157 %End 158 159 private: 160 wxDropSource(const wxDropSource&); 161 162 163 public: 164 165 166 %Property(name=DataObject, get=GetDataObject) 167}; // end of class wxDropSource 168 169 170class wxDropTarget 171{ 172 %Docstring 173 DropTarget(data=None) 174 175 This class represents a target for a drag and drop operation. 176 %End 177 %TypeHeaderCode 178 #include <wx/dnd.h> 179 %End 180 181public: 182 wxDropTarget( 183 wxDataObject * data /Transfer/ = NULL 184 ); 185 186 virtual 187 ~wxDropTarget(); 188 189 virtual 190 bool GetData(); 191 %Docstring 192 GetData() -> bool 193 194 This method may only be called from within OnData(). 195 %End 196 197 virtual 198 wxDragResult OnData( 199 wxCoord x, 200 wxCoord y, 201 wxDragResult defResult 202 ) = 0; 203 %Docstring 204 OnData(x, y, defResult) -> DragResult 205 206 Called after OnDrop() returns true. 207 %End 208 209 virtual 210 wxDragResult OnDragOver( 211 wxCoord x, 212 wxCoord y, 213 wxDragResult defResult 214 ); 215 %Docstring 216 OnDragOver(x, y, defResult) -> DragResult 217 218 Called when the mouse is being dragged over the drop target. 219 %End 220 221 virtual 222 bool OnDrop( 223 wxCoord x, 224 wxCoord y 225 ); 226 %Docstring 227 OnDrop(x, y) -> bool 228 229 Called when the user drops a data object on the target. 230 %End 231 232 virtual 233 wxDragResult OnEnter( 234 wxCoord x, 235 wxCoord y, 236 wxDragResult defResult 237 ); 238 %Docstring 239 OnEnter(x, y, defResult) -> DragResult 240 241 Called when the mouse enters the drop target. 242 %End 243 244 virtual 245 void OnLeave(); 246 %Docstring 247 OnLeave() 248 249 Called when the mouse leaves the drop target. 250 %End 251 252 wxDataObject * GetDataObject() const; 253 %Docstring 254 GetDataObject() -> DataObject 255 256 Returns the data wxDataObject associated with the drop target. 257 %End 258 259 void SetDataObject( 260 wxDataObject * data /Transfer/ 261 ); 262 %Docstring 263 SetDataObject(data) 264 265 Sets the data wxDataObject associated with the drop target and deletes 266 any previously associated data object. 267 %End 268 269 void SetDefaultAction( 270 wxDragResult action 271 ); 272 %Docstring 273 SetDefaultAction(action) 274 275 Sets the default action for drag and drop. 276 %End 277 278 wxDragResult GetDefaultAction(); 279 %Docstring 280 GetDefaultAction() -> DragResult 281 282 Returns default action for drag and drop or wxDragNone if this not 283 specified. 284 %End 285 286 private: 287 wxDropTarget(const wxDropTarget&); 288 289 290 public: 291 292 293 %Property(name=Data, get=GetData) 294 %Property(name=DataObject, get=GetDataObject, set=SetDataObject) 295 %Property(name=DefaultAction, get=GetDefaultAction, set=SetDefaultAction) 296}; // end of class wxDropTarget 297 298 299class wxTextDropTarget : wxDropTarget 300{ 301 %Docstring 302 TextDropTarget() 303 304 A predefined drop target for dealing with text data. 305 %End 306 %TypeHeaderCode 307 #include <wx/dnd.h> 308 %End 309 310public: 311 wxTextDropTarget(); 312 313 virtual 314 bool OnDrop( 315 wxCoord x, 316 wxCoord y 317 ); 318 %Docstring 319 OnDrop(x, y) -> bool 320 321 See wxDropTarget::OnDrop(). 322 %End 323 324 virtual 325 bool OnDropText( 326 wxCoord x, 327 wxCoord y, 328 const wxString & data 329 ) = 0; 330 %Docstring 331 OnDropText(x, y, data) -> bool 332 333 Override this function to receive dropped text. 334 %End 335 336 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); 337 338 339}; // end of class wxTextDropTarget 340 341 342class wxFileDropTarget : wxDropTarget 343{ 344 %Docstring 345 FileDropTarget() 346 347 This is a drop target which accepts files (dragged from File Manager 348 or Explorer). 349 %End 350 %TypeHeaderCode 351 #include <wx/dnd.h> 352 %End 353 354public: 355 wxFileDropTarget(); 356 357 virtual 358 bool OnDrop( 359 wxCoord x, 360 wxCoord y 361 ); 362 %Docstring 363 OnDrop(x, y) -> bool 364 365 See wxDropTarget::OnDrop(). 366 %End 367 368 virtual 369 bool OnDropFiles( 370 wxCoord x, 371 wxCoord y, 372 const wxArrayString & filenames 373 ) = 0; 374 %Docstring 375 OnDropFiles(x, y, filenames) -> bool 376 377 Override this function to receive dropped files. 378 %End 379 380 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); 381 382 383}; // end of class wxFileDropTarget 384 385 386%Extract(id=pycode_core) 387PyDropTarget = wx.deprecated(DropTarget, 'Use DropTarget instead.') 388 389%End 390 391 392//--------------------------------------------------------------------------- 393 394