Jack Jansen | c4f6331 | 1999-06-21 15:14:26 +0000 | [diff] [blame^] | 1 | |
| 2 | /* ========================== Module Drag =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #define SystemSevenOrLater 1 |
| 9 | |
| 10 | #include "macglue.h" |
| 11 | #include <Memory.h> |
| 12 | #include <Dialogs.h> |
| 13 | #include <Menus.h> |
| 14 | #include <Controls.h> |
| 15 | |
| 16 | extern PyObject *ResObj_New(Handle); |
| 17 | extern int ResObj_Convert(PyObject *, Handle *); |
| 18 | extern PyObject *OptResObj_New(Handle); |
| 19 | extern int OptResObj_Convert(PyObject *, Handle *); |
| 20 | |
| 21 | extern PyObject *WinObj_New(WindowPtr); |
| 22 | extern int WinObj_Convert(PyObject *, WindowPtr *); |
| 23 | extern PyTypeObject Window_Type; |
| 24 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
| 25 | |
| 26 | extern PyObject *DlgObj_New(DialogPtr); |
| 27 | extern int DlgObj_Convert(PyObject *, DialogPtr *); |
| 28 | extern PyTypeObject Dialog_Type; |
| 29 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 30 | |
| 31 | extern PyObject *MenuObj_New(MenuHandle); |
| 32 | extern int MenuObj_Convert(PyObject *, MenuHandle *); |
| 33 | |
| 34 | extern PyObject *CtlObj_New(ControlHandle); |
| 35 | extern int CtlObj_Convert(PyObject *, ControlHandle *); |
| 36 | |
| 37 | extern PyObject *GrafObj_New(GrafPtr); |
| 38 | extern int GrafObj_Convert(PyObject *, GrafPtr *); |
| 39 | |
| 40 | extern PyObject *BMObj_New(BitMapPtr); |
| 41 | extern int BMObj_Convert(PyObject *, BitMapPtr *); |
| 42 | |
| 43 | extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
| 45 | #include <Drag.h> |
| 46 | |
| 47 | #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ |
| 48 | /* Exported by Qdmodule.c: */ |
| 49 | extern PyObject *QdRGB_New(RGBColor *); |
| 50 | extern int QdRGB_Convert(PyObject *, RGBColor *); |
| 51 | |
| 52 | |
| 53 | /* Exported by AEModule.c: */ |
| 54 | extern PyObject *AEDesc_New(AppleEvent *); |
| 55 | extern int AEDesc_Convert(PyObject *, AppleEvent *); |
| 56 | |
| 57 | /* Callback glue routines */ |
| 58 | DragTrackingHandlerUPP dragglue_TrackingHandlerUPP; |
| 59 | DragReceiveHandlerUPP dragglue_ReceiveHandlerUPP; |
| 60 | DragSendDataUPP dragglue_SendDataUPP; |
| 61 | #if 0 |
| 62 | DragInputUPP dragglue_InputUPP; |
| 63 | DragDrawingUPP dragglue_DrawingUPP; |
| 64 | #endif |
| 65 | |
| 66 | static PyObject *Drag_Error; |
| 67 | |
| 68 | /* ---------------------- Object type DragObj ----------------------- */ |
| 69 | |
| 70 | PyTypeObject DragObj_Type; |
| 71 | |
| 72 | #define DragObj_Check(x) ((x)->ob_type == &DragObj_Type) |
| 73 | |
| 74 | typedef struct DragObjObject { |
| 75 | PyObject_HEAD |
| 76 | DragReference ob_itself; |
| 77 | PyObject *sendproc; |
| 78 | } DragObjObject; |
| 79 | |
| 80 | PyObject *DragObj_New(itself) |
| 81 | DragReference itself; |
| 82 | { |
| 83 | DragObjObject *it; |
| 84 | if (itself == NULL) { |
| 85 | PyErr_SetString(Drag_Error,"Cannot create null Drag"); |
| 86 | return NULL; |
| 87 | } |
| 88 | it = PyObject_NEW(DragObjObject, &DragObj_Type); |
| 89 | if (it == NULL) return NULL; |
| 90 | it->ob_itself = itself; |
| 91 | it->sendproc = NULL; |
| 92 | return (PyObject *)it; |
| 93 | } |
| 94 | DragObj_Convert(v, p_itself) |
| 95 | PyObject *v; |
| 96 | DragReference *p_itself; |
| 97 | { |
| 98 | if (!DragObj_Check(v)) |
| 99 | { |
| 100 | PyErr_SetString(PyExc_TypeError, "DragObj required"); |
| 101 | return 0; |
| 102 | } |
| 103 | *p_itself = ((DragObjObject *)v)->ob_itself; |
| 104 | return 1; |
| 105 | } |
| 106 | |
| 107 | static void DragObj_dealloc(self) |
| 108 | DragObjObject *self; |
| 109 | { |
| 110 | Py_XDECREF(self->sendproc); |
| 111 | PyMem_DEL(self); |
| 112 | } |
| 113 | |
| 114 | static PyObject *DragObj_DisposeDrag(_self, _args) |
| 115 | DragObjObject *_self; |
| 116 | PyObject *_args; |
| 117 | { |
| 118 | PyObject *_res = NULL; |
| 119 | OSErr _err; |
| 120 | if (!PyArg_ParseTuple(_args, "")) |
| 121 | return NULL; |
| 122 | _err = DisposeDrag(_self->ob_itself); |
| 123 | if (_err != noErr) return PyMac_Error(_err); |
| 124 | Py_INCREF(Py_None); |
| 125 | _res = Py_None; |
| 126 | return _res; |
| 127 | } |
| 128 | |
| 129 | static PyObject *DragObj_AddDragItemFlavor(_self, _args) |
| 130 | DragObjObject *_self; |
| 131 | PyObject *_args; |
| 132 | { |
| 133 | PyObject *_res = NULL; |
| 134 | OSErr _err; |
| 135 | ItemReference theItemRef; |
| 136 | FlavorType theType; |
| 137 | char *dataPtr__in__; |
| 138 | long dataPtr__len__; |
| 139 | int dataPtr__in_len__; |
| 140 | FlavorFlags theFlags; |
| 141 | if (!PyArg_ParseTuple(_args, "lO&z#l", |
| 142 | &theItemRef, |
| 143 | PyMac_GetOSType, &theType, |
| 144 | &dataPtr__in__, &dataPtr__in_len__, |
| 145 | &theFlags)) |
| 146 | return NULL; |
| 147 | dataPtr__len__ = dataPtr__in_len__; |
| 148 | _err = AddDragItemFlavor(_self->ob_itself, |
| 149 | theItemRef, |
| 150 | theType, |
| 151 | dataPtr__in__, dataPtr__len__, |
| 152 | theFlags); |
| 153 | if (_err != noErr) return PyMac_Error(_err); |
| 154 | Py_INCREF(Py_None); |
| 155 | _res = Py_None; |
| 156 | dataPtr__error__: ; |
| 157 | return _res; |
| 158 | } |
| 159 | |
| 160 | static PyObject *DragObj_SetDragItemFlavorData(_self, _args) |
| 161 | DragObjObject *_self; |
| 162 | PyObject *_args; |
| 163 | { |
| 164 | PyObject *_res = NULL; |
| 165 | OSErr _err; |
| 166 | ItemReference theItemRef; |
| 167 | FlavorType theType; |
| 168 | char *dataPtr__in__; |
| 169 | long dataPtr__len__; |
| 170 | int dataPtr__in_len__; |
| 171 | UInt32 dataOffset; |
| 172 | if (!PyArg_ParseTuple(_args, "lO&z#l", |
| 173 | &theItemRef, |
| 174 | PyMac_GetOSType, &theType, |
| 175 | &dataPtr__in__, &dataPtr__in_len__, |
| 176 | &dataOffset)) |
| 177 | return NULL; |
| 178 | dataPtr__len__ = dataPtr__in_len__; |
| 179 | _err = SetDragItemFlavorData(_self->ob_itself, |
| 180 | theItemRef, |
| 181 | theType, |
| 182 | dataPtr__in__, dataPtr__len__, |
| 183 | dataOffset); |
| 184 | if (_err != noErr) return PyMac_Error(_err); |
| 185 | Py_INCREF(Py_None); |
| 186 | _res = Py_None; |
| 187 | dataPtr__error__: ; |
| 188 | return _res; |
| 189 | } |
| 190 | |
| 191 | static PyObject *DragObj_SetDragImage(_self, _args) |
| 192 | DragObjObject *_self; |
| 193 | PyObject *_args; |
| 194 | { |
| 195 | PyObject *_res = NULL; |
| 196 | OSErr _err; |
| 197 | PixMapHandle imagePixMap; |
| 198 | RgnHandle imageRgn; |
| 199 | Point imageOffsetPt; |
| 200 | DragImageFlags theImageFlags; |
| 201 | if (!PyArg_ParseTuple(_args, "O&O&O&l", |
| 202 | ResObj_Convert, &imagePixMap, |
| 203 | ResObj_Convert, &imageRgn, |
| 204 | PyMac_GetPoint, &imageOffsetPt, |
| 205 | &theImageFlags)) |
| 206 | return NULL; |
| 207 | _err = SetDragImage(_self->ob_itself, |
| 208 | imagePixMap, |
| 209 | imageRgn, |
| 210 | imageOffsetPt, |
| 211 | theImageFlags); |
| 212 | if (_err != noErr) return PyMac_Error(_err); |
| 213 | Py_INCREF(Py_None); |
| 214 | _res = Py_None; |
| 215 | return _res; |
| 216 | } |
| 217 | |
| 218 | static PyObject *DragObj_TrackDrag(_self, _args) |
| 219 | DragObjObject *_self; |
| 220 | PyObject *_args; |
| 221 | { |
| 222 | PyObject *_res = NULL; |
| 223 | OSErr _err; |
| 224 | EventRecord theEvent; |
| 225 | RgnHandle theRegion; |
| 226 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 227 | PyMac_GetEventRecord, &theEvent, |
| 228 | ResObj_Convert, &theRegion)) |
| 229 | return NULL; |
| 230 | _err = TrackDrag(_self->ob_itself, |
| 231 | &theEvent, |
| 232 | theRegion); |
| 233 | if (_err != noErr) return PyMac_Error(_err); |
| 234 | Py_INCREF(Py_None); |
| 235 | _res = Py_None; |
| 236 | return _res; |
| 237 | } |
| 238 | |
| 239 | static PyObject *DragObj_CountDragItems(_self, _args) |
| 240 | DragObjObject *_self; |
| 241 | PyObject *_args; |
| 242 | { |
| 243 | PyObject *_res = NULL; |
| 244 | OSErr _err; |
| 245 | UInt16 numItems; |
| 246 | if (!PyArg_ParseTuple(_args, "")) |
| 247 | return NULL; |
| 248 | _err = CountDragItems(_self->ob_itself, |
| 249 | &numItems); |
| 250 | if (_err != noErr) return PyMac_Error(_err); |
| 251 | _res = Py_BuildValue("h", |
| 252 | numItems); |
| 253 | return _res; |
| 254 | } |
| 255 | |
| 256 | static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args) |
| 257 | DragObjObject *_self; |
| 258 | PyObject *_args; |
| 259 | { |
| 260 | PyObject *_res = NULL; |
| 261 | OSErr _err; |
| 262 | UInt16 index; |
| 263 | ItemReference theItemRef; |
| 264 | if (!PyArg_ParseTuple(_args, "h", |
| 265 | &index)) |
| 266 | return NULL; |
| 267 | _err = GetDragItemReferenceNumber(_self->ob_itself, |
| 268 | index, |
| 269 | &theItemRef); |
| 270 | if (_err != noErr) return PyMac_Error(_err); |
| 271 | _res = Py_BuildValue("l", |
| 272 | theItemRef); |
| 273 | return _res; |
| 274 | } |
| 275 | |
| 276 | static PyObject *DragObj_CountDragItemFlavors(_self, _args) |
| 277 | DragObjObject *_self; |
| 278 | PyObject *_args; |
| 279 | { |
| 280 | PyObject *_res = NULL; |
| 281 | OSErr _err; |
| 282 | ItemReference theItemRef; |
| 283 | UInt16 numFlavors; |
| 284 | if (!PyArg_ParseTuple(_args, "l", |
| 285 | &theItemRef)) |
| 286 | return NULL; |
| 287 | _err = CountDragItemFlavors(_self->ob_itself, |
| 288 | theItemRef, |
| 289 | &numFlavors); |
| 290 | if (_err != noErr) return PyMac_Error(_err); |
| 291 | _res = Py_BuildValue("h", |
| 292 | numFlavors); |
| 293 | return _res; |
| 294 | } |
| 295 | |
| 296 | static PyObject *DragObj_GetFlavorType(_self, _args) |
| 297 | DragObjObject *_self; |
| 298 | PyObject *_args; |
| 299 | { |
| 300 | PyObject *_res = NULL; |
| 301 | OSErr _err; |
| 302 | ItemReference theItemRef; |
| 303 | UInt16 index; |
| 304 | FlavorType theType; |
| 305 | if (!PyArg_ParseTuple(_args, "lh", |
| 306 | &theItemRef, |
| 307 | &index)) |
| 308 | return NULL; |
| 309 | _err = GetFlavorType(_self->ob_itself, |
| 310 | theItemRef, |
| 311 | index, |
| 312 | &theType); |
| 313 | if (_err != noErr) return PyMac_Error(_err); |
| 314 | _res = Py_BuildValue("O&", |
| 315 | PyMac_BuildOSType, theType); |
| 316 | return _res; |
| 317 | } |
| 318 | |
| 319 | static PyObject *DragObj_GetFlavorFlags(_self, _args) |
| 320 | DragObjObject *_self; |
| 321 | PyObject *_args; |
| 322 | { |
| 323 | PyObject *_res = NULL; |
| 324 | OSErr _err; |
| 325 | ItemReference theItemRef; |
| 326 | FlavorType theType; |
| 327 | FlavorFlags theFlags; |
| 328 | if (!PyArg_ParseTuple(_args, "lO&", |
| 329 | &theItemRef, |
| 330 | PyMac_GetOSType, &theType)) |
| 331 | return NULL; |
| 332 | _err = GetFlavorFlags(_self->ob_itself, |
| 333 | theItemRef, |
| 334 | theType, |
| 335 | &theFlags); |
| 336 | if (_err != noErr) return PyMac_Error(_err); |
| 337 | _res = Py_BuildValue("l", |
| 338 | theFlags); |
| 339 | return _res; |
| 340 | } |
| 341 | |
| 342 | static PyObject *DragObj_GetFlavorDataSize(_self, _args) |
| 343 | DragObjObject *_self; |
| 344 | PyObject *_args; |
| 345 | { |
| 346 | PyObject *_res = NULL; |
| 347 | OSErr _err; |
| 348 | ItemReference theItemRef; |
| 349 | FlavorType theType; |
| 350 | Size dataSize; |
| 351 | if (!PyArg_ParseTuple(_args, "lO&", |
| 352 | &theItemRef, |
| 353 | PyMac_GetOSType, &theType)) |
| 354 | return NULL; |
| 355 | _err = GetFlavorDataSize(_self->ob_itself, |
| 356 | theItemRef, |
| 357 | theType, |
| 358 | &dataSize); |
| 359 | if (_err != noErr) return PyMac_Error(_err); |
| 360 | _res = Py_BuildValue("l", |
| 361 | dataSize); |
| 362 | return _res; |
| 363 | } |
| 364 | |
| 365 | static PyObject *DragObj_GetFlavorData(_self, _args) |
| 366 | DragObjObject *_self; |
| 367 | PyObject *_args; |
| 368 | { |
| 369 | PyObject *_res = NULL; |
| 370 | OSErr _err; |
| 371 | ItemReference theItemRef; |
| 372 | FlavorType theType; |
| 373 | char *dataPtr__out__; |
| 374 | long dataPtr__len__; |
| 375 | int dataPtr__in_len__; |
| 376 | UInt32 dataOffset; |
| 377 | if (!PyArg_ParseTuple(_args, "lO&il", |
| 378 | &theItemRef, |
| 379 | PyMac_GetOSType, &theType, |
| 380 | &dataPtr__in_len__, |
| 381 | &dataOffset)) |
| 382 | return NULL; |
| 383 | if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) |
| 384 | { |
| 385 | PyErr_NoMemory(); |
| 386 | goto dataPtr__error__; |
| 387 | } |
| 388 | dataPtr__len__ = dataPtr__in_len__; |
| 389 | _err = GetFlavorData(_self->ob_itself, |
| 390 | theItemRef, |
| 391 | theType, |
| 392 | dataPtr__out__, &dataPtr__len__, |
| 393 | dataOffset); |
| 394 | if (_err != noErr) return PyMac_Error(_err); |
| 395 | _res = Py_BuildValue("s#", |
| 396 | dataPtr__out__, (int)dataPtr__len__); |
| 397 | free(dataPtr__out__); |
| 398 | dataPtr__error__: ; |
| 399 | return _res; |
| 400 | } |
| 401 | |
| 402 | static PyObject *DragObj_GetDragItemBounds(_self, _args) |
| 403 | DragObjObject *_self; |
| 404 | PyObject *_args; |
| 405 | { |
| 406 | PyObject *_res = NULL; |
| 407 | OSErr _err; |
| 408 | ItemReference theItemRef; |
| 409 | Rect itemBounds; |
| 410 | if (!PyArg_ParseTuple(_args, "l", |
| 411 | &theItemRef)) |
| 412 | return NULL; |
| 413 | _err = GetDragItemBounds(_self->ob_itself, |
| 414 | theItemRef, |
| 415 | &itemBounds); |
| 416 | if (_err != noErr) return PyMac_Error(_err); |
| 417 | _res = Py_BuildValue("O&", |
| 418 | PyMac_BuildRect, &itemBounds); |
| 419 | return _res; |
| 420 | } |
| 421 | |
| 422 | static PyObject *DragObj_SetDragItemBounds(_self, _args) |
| 423 | DragObjObject *_self; |
| 424 | PyObject *_args; |
| 425 | { |
| 426 | PyObject *_res = NULL; |
| 427 | OSErr _err; |
| 428 | ItemReference theItemRef; |
| 429 | Rect itemBounds; |
| 430 | if (!PyArg_ParseTuple(_args, "lO&", |
| 431 | &theItemRef, |
| 432 | PyMac_GetRect, &itemBounds)) |
| 433 | return NULL; |
| 434 | _err = SetDragItemBounds(_self->ob_itself, |
| 435 | theItemRef, |
| 436 | &itemBounds); |
| 437 | if (_err != noErr) return PyMac_Error(_err); |
| 438 | Py_INCREF(Py_None); |
| 439 | _res = Py_None; |
| 440 | return _res; |
| 441 | } |
| 442 | |
| 443 | static PyObject *DragObj_GetDropLocation(_self, _args) |
| 444 | DragObjObject *_self; |
| 445 | PyObject *_args; |
| 446 | { |
| 447 | PyObject *_res = NULL; |
| 448 | OSErr _err; |
| 449 | AEDesc dropLocation; |
| 450 | if (!PyArg_ParseTuple(_args, "")) |
| 451 | return NULL; |
| 452 | _err = GetDropLocation(_self->ob_itself, |
| 453 | &dropLocation); |
| 454 | if (_err != noErr) return PyMac_Error(_err); |
| 455 | _res = Py_BuildValue("O&", |
| 456 | AEDesc_New, &dropLocation); |
| 457 | return _res; |
| 458 | } |
| 459 | |
| 460 | static PyObject *DragObj_SetDropLocation(_self, _args) |
| 461 | DragObjObject *_self; |
| 462 | PyObject *_args; |
| 463 | { |
| 464 | PyObject *_res = NULL; |
| 465 | OSErr _err; |
| 466 | AEDesc dropLocation; |
| 467 | if (!PyArg_ParseTuple(_args, "O&", |
| 468 | AEDesc_Convert, &dropLocation)) |
| 469 | return NULL; |
| 470 | _err = SetDropLocation(_self->ob_itself, |
| 471 | &dropLocation); |
| 472 | if (_err != noErr) return PyMac_Error(_err); |
| 473 | Py_INCREF(Py_None); |
| 474 | _res = Py_None; |
| 475 | return _res; |
| 476 | } |
| 477 | |
| 478 | static PyObject *DragObj_GetDragAttributes(_self, _args) |
| 479 | DragObjObject *_self; |
| 480 | PyObject *_args; |
| 481 | { |
| 482 | PyObject *_res = NULL; |
| 483 | OSErr _err; |
| 484 | DragAttributes flags; |
| 485 | if (!PyArg_ParseTuple(_args, "")) |
| 486 | return NULL; |
| 487 | _err = GetDragAttributes(_self->ob_itself, |
| 488 | &flags); |
| 489 | if (_err != noErr) return PyMac_Error(_err); |
| 490 | _res = Py_BuildValue("l", |
| 491 | flags); |
| 492 | return _res; |
| 493 | } |
| 494 | |
| 495 | static PyObject *DragObj_GetDragMouse(_self, _args) |
| 496 | DragObjObject *_self; |
| 497 | PyObject *_args; |
| 498 | { |
| 499 | PyObject *_res = NULL; |
| 500 | OSErr _err; |
| 501 | Point mouse; |
| 502 | Point globalPinnedMouse; |
| 503 | if (!PyArg_ParseTuple(_args, "")) |
| 504 | return NULL; |
| 505 | _err = GetDragMouse(_self->ob_itself, |
| 506 | &mouse, |
| 507 | &globalPinnedMouse); |
| 508 | if (_err != noErr) return PyMac_Error(_err); |
| 509 | _res = Py_BuildValue("O&O&", |
| 510 | PyMac_BuildPoint, mouse, |
| 511 | PyMac_BuildPoint, globalPinnedMouse); |
| 512 | return _res; |
| 513 | } |
| 514 | |
| 515 | static PyObject *DragObj_SetDragMouse(_self, _args) |
| 516 | DragObjObject *_self; |
| 517 | PyObject *_args; |
| 518 | { |
| 519 | PyObject *_res = NULL; |
| 520 | OSErr _err; |
| 521 | Point globalPinnedMouse; |
| 522 | if (!PyArg_ParseTuple(_args, "O&", |
| 523 | PyMac_GetPoint, &globalPinnedMouse)) |
| 524 | return NULL; |
| 525 | _err = SetDragMouse(_self->ob_itself, |
| 526 | globalPinnedMouse); |
| 527 | if (_err != noErr) return PyMac_Error(_err); |
| 528 | Py_INCREF(Py_None); |
| 529 | _res = Py_None; |
| 530 | return _res; |
| 531 | } |
| 532 | |
| 533 | static PyObject *DragObj_GetDragOrigin(_self, _args) |
| 534 | DragObjObject *_self; |
| 535 | PyObject *_args; |
| 536 | { |
| 537 | PyObject *_res = NULL; |
| 538 | OSErr _err; |
| 539 | Point globalInitialMouse; |
| 540 | if (!PyArg_ParseTuple(_args, "")) |
| 541 | return NULL; |
| 542 | _err = GetDragOrigin(_self->ob_itself, |
| 543 | &globalInitialMouse); |
| 544 | if (_err != noErr) return PyMac_Error(_err); |
| 545 | _res = Py_BuildValue("O&", |
| 546 | PyMac_BuildPoint, globalInitialMouse); |
| 547 | return _res; |
| 548 | } |
| 549 | |
| 550 | static PyObject *DragObj_GetDragModifiers(_self, _args) |
| 551 | DragObjObject *_self; |
| 552 | PyObject *_args; |
| 553 | { |
| 554 | PyObject *_res = NULL; |
| 555 | OSErr _err; |
| 556 | SInt16 modifiers; |
| 557 | SInt16 mouseDownModifiers; |
| 558 | SInt16 mouseUpModifiers; |
| 559 | if (!PyArg_ParseTuple(_args, "")) |
| 560 | return NULL; |
| 561 | _err = GetDragModifiers(_self->ob_itself, |
| 562 | &modifiers, |
| 563 | &mouseDownModifiers, |
| 564 | &mouseUpModifiers); |
| 565 | if (_err != noErr) return PyMac_Error(_err); |
| 566 | _res = Py_BuildValue("hhh", |
| 567 | modifiers, |
| 568 | mouseDownModifiers, |
| 569 | mouseUpModifiers); |
| 570 | return _res; |
| 571 | } |
| 572 | |
| 573 | static PyObject *DragObj_ShowDragHilite(_self, _args) |
| 574 | DragObjObject *_self; |
| 575 | PyObject *_args; |
| 576 | { |
| 577 | PyObject *_res = NULL; |
| 578 | OSErr _err; |
| 579 | RgnHandle hiliteFrame; |
| 580 | Boolean inside; |
| 581 | if (!PyArg_ParseTuple(_args, "O&b", |
| 582 | ResObj_Convert, &hiliteFrame, |
| 583 | &inside)) |
| 584 | return NULL; |
| 585 | _err = ShowDragHilite(_self->ob_itself, |
| 586 | hiliteFrame, |
| 587 | inside); |
| 588 | if (_err != noErr) return PyMac_Error(_err); |
| 589 | Py_INCREF(Py_None); |
| 590 | _res = Py_None; |
| 591 | return _res; |
| 592 | } |
| 593 | |
| 594 | static PyObject *DragObj_HideDragHilite(_self, _args) |
| 595 | DragObjObject *_self; |
| 596 | PyObject *_args; |
| 597 | { |
| 598 | PyObject *_res = NULL; |
| 599 | OSErr _err; |
| 600 | if (!PyArg_ParseTuple(_args, "")) |
| 601 | return NULL; |
| 602 | _err = HideDragHilite(_self->ob_itself); |
| 603 | if (_err != noErr) return PyMac_Error(_err); |
| 604 | Py_INCREF(Py_None); |
| 605 | _res = Py_None; |
| 606 | return _res; |
| 607 | } |
| 608 | |
| 609 | static PyObject *DragObj_DragPreScroll(_self, _args) |
| 610 | DragObjObject *_self; |
| 611 | PyObject *_args; |
| 612 | { |
| 613 | PyObject *_res = NULL; |
| 614 | OSErr _err; |
| 615 | SInt16 dH; |
| 616 | SInt16 dV; |
| 617 | if (!PyArg_ParseTuple(_args, "hh", |
| 618 | &dH, |
| 619 | &dV)) |
| 620 | return NULL; |
| 621 | _err = DragPreScroll(_self->ob_itself, |
| 622 | dH, |
| 623 | dV); |
| 624 | if (_err != noErr) return PyMac_Error(_err); |
| 625 | Py_INCREF(Py_None); |
| 626 | _res = Py_None; |
| 627 | return _res; |
| 628 | } |
| 629 | |
| 630 | static PyObject *DragObj_DragPostScroll(_self, _args) |
| 631 | DragObjObject *_self; |
| 632 | PyObject *_args; |
| 633 | { |
| 634 | PyObject *_res = NULL; |
| 635 | OSErr _err; |
| 636 | if (!PyArg_ParseTuple(_args, "")) |
| 637 | return NULL; |
| 638 | _err = DragPostScroll(_self->ob_itself); |
| 639 | if (_err != noErr) return PyMac_Error(_err); |
| 640 | Py_INCREF(Py_None); |
| 641 | _res = Py_None; |
| 642 | return _res; |
| 643 | } |
| 644 | |
| 645 | static PyObject *DragObj_UpdateDragHilite(_self, _args) |
| 646 | DragObjObject *_self; |
| 647 | PyObject *_args; |
| 648 | { |
| 649 | PyObject *_res = NULL; |
| 650 | OSErr _err; |
| 651 | RgnHandle updateRgn; |
| 652 | if (!PyArg_ParseTuple(_args, "O&", |
| 653 | ResObj_Convert, &updateRgn)) |
| 654 | return NULL; |
| 655 | _err = UpdateDragHilite(_self->ob_itself, |
| 656 | updateRgn); |
| 657 | if (_err != noErr) return PyMac_Error(_err); |
| 658 | Py_INCREF(Py_None); |
| 659 | _res = Py_None; |
| 660 | return _res; |
| 661 | } |
| 662 | |
| 663 | static PyMethodDef DragObj_methods[] = { |
| 664 | {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1, |
| 665 | "() -> None"}, |
| 666 | {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1, |
| 667 | "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None"}, |
| 668 | {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1, |
| 669 | "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None"}, |
| 670 | {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1, |
| 671 | "(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None"}, |
| 672 | {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1, |
| 673 | "(EventRecord theEvent, RgnHandle theRegion) -> None"}, |
| 674 | {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1, |
| 675 | "() -> (UInt16 numItems)"}, |
| 676 | {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1, |
| 677 | "(UInt16 index) -> (ItemReference theItemRef)"}, |
| 678 | {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1, |
| 679 | "(ItemReference theItemRef) -> (UInt16 numFlavors)"}, |
| 680 | {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1, |
| 681 | "(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)"}, |
| 682 | {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1, |
| 683 | "(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)"}, |
| 684 | {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1, |
| 685 | "(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)"}, |
| 686 | {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1, |
| 687 | "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)"}, |
| 688 | {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1, |
| 689 | "(ItemReference theItemRef) -> (Rect itemBounds)"}, |
| 690 | {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1, |
| 691 | "(ItemReference theItemRef, Rect itemBounds) -> None"}, |
| 692 | {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1, |
| 693 | "() -> (AEDesc dropLocation)"}, |
| 694 | {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1, |
| 695 | "(AEDesc dropLocation) -> None"}, |
| 696 | {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1, |
| 697 | "() -> (DragAttributes flags)"}, |
| 698 | {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1, |
| 699 | "() -> (Point mouse, Point globalPinnedMouse)"}, |
| 700 | {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1, |
| 701 | "(Point globalPinnedMouse) -> None"}, |
| 702 | {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1, |
| 703 | "() -> (Point globalInitialMouse)"}, |
| 704 | {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1, |
| 705 | "() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)"}, |
| 706 | {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1, |
| 707 | "(RgnHandle hiliteFrame, Boolean inside) -> None"}, |
| 708 | {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1, |
| 709 | "() -> None"}, |
| 710 | {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1, |
| 711 | "(SInt16 dH, SInt16 dV) -> None"}, |
| 712 | {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1, |
| 713 | "() -> None"}, |
| 714 | {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1, |
| 715 | "(RgnHandle updateRgn) -> None"}, |
| 716 | {NULL, NULL, 0} |
| 717 | }; |
| 718 | |
| 719 | PyMethodChain DragObj_chain = { DragObj_methods, NULL }; |
| 720 | |
| 721 | static PyObject *DragObj_getattr(self, name) |
| 722 | DragObjObject *self; |
| 723 | char *name; |
| 724 | { |
| 725 | return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name); |
| 726 | } |
| 727 | |
| 728 | #define DragObj_setattr NULL |
| 729 | |
| 730 | #define DragObj_compare NULL |
| 731 | |
| 732 | #define DragObj_repr NULL |
| 733 | |
| 734 | #define DragObj_hash NULL |
| 735 | |
| 736 | PyTypeObject DragObj_Type = { |
| 737 | PyObject_HEAD_INIT(&PyType_Type) |
| 738 | 0, /*ob_size*/ |
| 739 | "DragObj", /*tp_name*/ |
| 740 | sizeof(DragObjObject), /*tp_basicsize*/ |
| 741 | 0, /*tp_itemsize*/ |
| 742 | /* methods */ |
| 743 | (destructor) DragObj_dealloc, /*tp_dealloc*/ |
| 744 | 0, /*tp_print*/ |
| 745 | (getattrfunc) DragObj_getattr, /*tp_getattr*/ |
| 746 | (setattrfunc) DragObj_setattr, /*tp_setattr*/ |
| 747 | (cmpfunc) DragObj_compare, /*tp_compare*/ |
| 748 | (reprfunc) DragObj_repr, /*tp_repr*/ |
| 749 | (PyNumberMethods *)0, /* tp_as_number */ |
| 750 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 751 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 752 | (hashfunc) DragObj_hash, /*tp_hash*/ |
| 753 | }; |
| 754 | |
| 755 | /* -------------------- End object type DragObj --------------------- */ |
| 756 | |
| 757 | |
| 758 | static PyObject *Drag_NewDrag(_self, _args) |
| 759 | PyObject *_self; |
| 760 | PyObject *_args; |
| 761 | { |
| 762 | PyObject *_res = NULL; |
| 763 | OSErr _err; |
| 764 | DragReference theDrag; |
| 765 | if (!PyArg_ParseTuple(_args, "")) |
| 766 | return NULL; |
| 767 | _err = NewDrag(&theDrag); |
| 768 | if (_err != noErr) return PyMac_Error(_err); |
| 769 | _res = Py_BuildValue("O&", |
| 770 | DragObj_New, theDrag); |
| 771 | return _res; |
| 772 | } |
| 773 | |
| 774 | static PyObject *Drag_GetDragHiliteColor(_self, _args) |
| 775 | PyObject *_self; |
| 776 | PyObject *_args; |
| 777 | { |
| 778 | PyObject *_res = NULL; |
| 779 | OSErr _err; |
| 780 | WindowPtr window; |
| 781 | RGBColor color; |
| 782 | if (!PyArg_ParseTuple(_args, "O&", |
| 783 | WinObj_Convert, &window)) |
| 784 | return NULL; |
| 785 | _err = GetDragHiliteColor(window, |
| 786 | &color); |
| 787 | if (_err != noErr) return PyMac_Error(_err); |
| 788 | _res = Py_BuildValue("O&", |
| 789 | QdRGB_New, &color); |
| 790 | return _res; |
| 791 | } |
| 792 | |
| 793 | static PyObject *Drag_WaitMouseMoved(_self, _args) |
| 794 | PyObject *_self; |
| 795 | PyObject *_args; |
| 796 | { |
| 797 | PyObject *_res = NULL; |
| 798 | Boolean _rv; |
| 799 | Point initialMouse; |
| 800 | if (!PyArg_ParseTuple(_args, "O&", |
| 801 | PyMac_GetPoint, &initialMouse)) |
| 802 | return NULL; |
| 803 | _rv = WaitMouseMoved(initialMouse); |
| 804 | _res = Py_BuildValue("b", |
| 805 | _rv); |
| 806 | return _res; |
| 807 | } |
| 808 | |
| 809 | static PyObject *Drag_ZoomRects(_self, _args) |
| 810 | PyObject *_self; |
| 811 | PyObject *_args; |
| 812 | { |
| 813 | PyObject *_res = NULL; |
| 814 | OSErr _err; |
| 815 | Rect fromRect; |
| 816 | Rect toRect; |
| 817 | SInt16 zoomSteps; |
| 818 | ZoomAcceleration acceleration; |
| 819 | if (!PyArg_ParseTuple(_args, "O&O&hh", |
| 820 | PyMac_GetRect, &fromRect, |
| 821 | PyMac_GetRect, &toRect, |
| 822 | &zoomSteps, |
| 823 | &acceleration)) |
| 824 | return NULL; |
| 825 | _err = ZoomRects(&fromRect, |
| 826 | &toRect, |
| 827 | zoomSteps, |
| 828 | acceleration); |
| 829 | if (_err != noErr) return PyMac_Error(_err); |
| 830 | Py_INCREF(Py_None); |
| 831 | _res = Py_None; |
| 832 | return _res; |
| 833 | } |
| 834 | |
| 835 | static PyObject *Drag_ZoomRegion(_self, _args) |
| 836 | PyObject *_self; |
| 837 | PyObject *_args; |
| 838 | { |
| 839 | PyObject *_res = NULL; |
| 840 | OSErr _err; |
| 841 | RgnHandle region; |
| 842 | Point zoomDistance; |
| 843 | SInt16 zoomSteps; |
| 844 | ZoomAcceleration acceleration; |
| 845 | if (!PyArg_ParseTuple(_args, "O&O&hh", |
| 846 | ResObj_Convert, ®ion, |
| 847 | PyMac_GetPoint, &zoomDistance, |
| 848 | &zoomSteps, |
| 849 | &acceleration)) |
| 850 | return NULL; |
| 851 | _err = ZoomRegion(region, |
| 852 | zoomDistance, |
| 853 | zoomSteps, |
| 854 | acceleration); |
| 855 | if (_err != noErr) return PyMac_Error(_err); |
| 856 | Py_INCREF(Py_None); |
| 857 | _res = Py_None; |
| 858 | return _res; |
| 859 | } |
| 860 | |
| 861 | static PyObject *Drag_InstallTrackingHandler(_self, _args) |
| 862 | PyObject *_self; |
| 863 | PyObject *_args; |
| 864 | { |
| 865 | PyObject *_res = NULL; |
| 866 | |
| 867 | PyObject *callback; |
| 868 | WindowPtr theWindow = NULL; |
| 869 | OSErr _err; |
| 870 | |
| 871 | if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) ) |
| 872 | return NULL; |
| 873 | Py_INCREF(callback); /* Cannot decref later, too bad */ |
| 874 | _err = InstallTrackingHandler(dragglue_TrackingHandlerUPP, theWindow, (void *)callback); |
| 875 | if (_err != noErr) return PyMac_Error(_err); |
| 876 | Py_INCREF(Py_None); |
| 877 | return Py_None; |
| 878 | |
| 879 | } |
| 880 | |
| 881 | static PyObject *Drag_InstallReceiveHandler(_self, _args) |
| 882 | PyObject *_self; |
| 883 | PyObject *_args; |
| 884 | { |
| 885 | PyObject *_res = NULL; |
| 886 | |
| 887 | PyObject *callback; |
| 888 | WindowPtr theWindow = NULL; |
| 889 | OSErr _err; |
| 890 | |
| 891 | if ( !PyArg_ParseTuple(_args, "O|O&", &callback, WinObj_Convert, &theWindow) ) |
| 892 | return NULL; |
| 893 | Py_INCREF(callback); /* Cannot decref later, too bad */ |
| 894 | _err = InstallReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow, (void *)callback); |
| 895 | if (_err != noErr) return PyMac_Error(_err); |
| 896 | Py_INCREF(Py_None); |
| 897 | return Py_None; |
| 898 | |
| 899 | } |
| 900 | |
| 901 | static PyObject *Drag_RemoveTrackingHandler(_self, _args) |
| 902 | PyObject *_self; |
| 903 | PyObject *_args; |
| 904 | { |
| 905 | PyObject *_res = NULL; |
| 906 | |
| 907 | WindowPtr theWindow = NULL; |
| 908 | OSErr _err; |
| 909 | |
| 910 | if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) ) |
| 911 | return NULL; |
| 912 | _err = RemoveTrackingHandler(dragglue_TrackingHandlerUPP, theWindow); |
| 913 | if (_err != noErr) return PyMac_Error(_err); |
| 914 | Py_INCREF(Py_None); |
| 915 | return Py_None; |
| 916 | |
| 917 | } |
| 918 | |
| 919 | static PyObject *Drag_RemoveReceiveHandler(_self, _args) |
| 920 | PyObject *_self; |
| 921 | PyObject *_args; |
| 922 | { |
| 923 | PyObject *_res = NULL; |
| 924 | |
| 925 | WindowPtr theWindow = NULL; |
| 926 | OSErr _err; |
| 927 | |
| 928 | if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) ) |
| 929 | return NULL; |
| 930 | _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow); |
| 931 | if (_err != noErr) return PyMac_Error(_err); |
| 932 | Py_INCREF(Py_None); |
| 933 | return Py_None; |
| 934 | |
| 935 | } |
| 936 | |
| 937 | static PyMethodDef Drag_methods[] = { |
| 938 | {"NewDrag", (PyCFunction)Drag_NewDrag, 1, |
| 939 | "() -> (DragReference theDrag)"}, |
| 940 | {"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1, |
| 941 | "(WindowPtr window) -> (RGBColor color)"}, |
| 942 | {"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1, |
| 943 | "(Point initialMouse) -> (Boolean _rv)"}, |
| 944 | {"ZoomRects", (PyCFunction)Drag_ZoomRects, 1, |
| 945 | "(Rect fromRect, Rect toRect, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None"}, |
| 946 | {"ZoomRegion", (PyCFunction)Drag_ZoomRegion, 1, |
| 947 | "(RgnHandle region, Point zoomDistance, SInt16 zoomSteps, ZoomAcceleration acceleration) -> None"}, |
| 948 | {"InstallTrackingHandler", (PyCFunction)Drag_InstallTrackingHandler, 1, |
| 949 | NULL}, |
| 950 | {"InstallReceiveHandler", (PyCFunction)Drag_InstallReceiveHandler, 1, |
| 951 | NULL}, |
| 952 | {"RemoveTrackingHandler", (PyCFunction)Drag_RemoveTrackingHandler, 1, |
| 953 | NULL}, |
| 954 | {"RemoveReceiveHandler", (PyCFunction)Drag_RemoveReceiveHandler, 1, |
| 955 | NULL}, |
| 956 | {NULL, NULL, 0} |
| 957 | }; |
| 958 | |
| 959 | |
| 960 | |
| 961 | static pascal OSErr |
| 962 | dragglue_TrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow, |
| 963 | void *handlerRefCon, DragReference theDrag) |
| 964 | { |
| 965 | PyObject *args, *rv; |
| 966 | int i; |
| 967 | |
| 968 | args = Py_BuildValue("hO&O&", theMessage, DragObj_New, theDrag, WinObj_WhichWindow, theWindow); |
| 969 | if ( args == NULL ) |
| 970 | return -1; |
| 971 | rv = PyEval_CallObject((PyObject *)handlerRefCon, args); |
| 972 | Py_DECREF(args); |
| 973 | if ( rv == NULL ) |
| 974 | return -1; |
| 975 | i = -1; |
| 976 | if ( rv == Py_None ) |
| 977 | i = 0; |
| 978 | else |
| 979 | PyArg_Parse(rv, "l", &i); |
| 980 | Py_DECREF(rv); |
| 981 | return i; |
| 982 | } |
| 983 | |
| 984 | static pascal OSErr |
| 985 | dragglue_ReceiveHandler(WindowPtr theWindow, void *handlerRefCon, |
| 986 | DragReference theDrag) |
| 987 | { |
| 988 | PyObject *args, *rv; |
| 989 | int i; |
| 990 | |
| 991 | args = Py_BuildValue("O&O&", DragObj_New, theDrag, WinObj_WhichWindow, theWindow); |
| 992 | if ( args == NULL ) |
| 993 | return -1; |
| 994 | rv = PyEval_CallObject((PyObject *)handlerRefCon, args); |
| 995 | Py_DECREF(args); |
| 996 | if ( rv == NULL ) |
| 997 | return -1; |
| 998 | i = -1; |
| 999 | if ( rv == Py_None ) |
| 1000 | i = 0; |
| 1001 | else |
| 1002 | PyArg_Parse(rv, "l", &i); |
| 1003 | Py_DECREF(rv); |
| 1004 | return i; |
| 1005 | } |
| 1006 | |
| 1007 | static pascal OSErr |
| 1008 | dragglue_SendData(FlavorType theType, void *dragSendRefCon, |
| 1009 | ItemReference theItem, DragReference theDrag) |
| 1010 | { |
| 1011 | DragObjObject *self = (DragObjObject *)dragSendRefCon; |
| 1012 | PyObject *args, *rv; |
| 1013 | int i; |
| 1014 | |
| 1015 | if ( self->sendproc == NULL ) |
| 1016 | return -1; |
| 1017 | args = Py_BuildValue("O&l", PyMac_BuildOSType, theType, theItem); |
| 1018 | if ( args == NULL ) |
| 1019 | return -1; |
| 1020 | rv = PyEval_CallObject(self->sendproc, args); |
| 1021 | Py_DECREF(args); |
| 1022 | if ( rv == NULL ) |
| 1023 | return -1; |
| 1024 | i = -1; |
| 1025 | if ( rv == Py_None ) |
| 1026 | i = 0; |
| 1027 | else |
| 1028 | PyArg_Parse(rv, "l", &i); |
| 1029 | Py_DECREF(rv); |
| 1030 | return i; |
| 1031 | } |
| 1032 | |
| 1033 | #if 0 |
| 1034 | static pascal OSErr |
| 1035 | dragglue_Input(Point *mouse, short *modifiers, |
| 1036 | void *dragSendRefCon, DragReference theDrag) |
| 1037 | { |
| 1038 | return 0; |
| 1039 | } |
| 1040 | |
| 1041 | static pascal OSErr |
| 1042 | dragglue_Drawing(xxxx |
| 1043 | void *dragSendRefCon, DragReference theDrag) |
| 1044 | { |
| 1045 | return 0; |
| 1046 | } |
| 1047 | #endif |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | void initDrag() |
| 1052 | { |
| 1053 | PyObject *m; |
| 1054 | PyObject *d; |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | m = Py_InitModule("Drag", Drag_methods); |
| 1060 | d = PyModule_GetDict(m); |
| 1061 | Drag_Error = PyMac_GetOSErrException(); |
| 1062 | if (Drag_Error == NULL || |
| 1063 | PyDict_SetItemString(d, "Error", Drag_Error) != 0) |
| 1064 | Py_FatalError("can't initialize Drag.Error"); |
| 1065 | DragObj_Type.ob_type = &PyType_Type; |
| 1066 | Py_INCREF(&DragObj_Type); |
| 1067 | if (PyDict_SetItemString(d, "DragObjType", (PyObject *)&DragObj_Type) != 0) |
| 1068 | Py_FatalError("can't initialize DragObjType"); |
| 1069 | |
| 1070 | dragglue_TrackingHandlerUPP = NewDragTrackingHandlerProc(dragglue_TrackingHandler); |
| 1071 | dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerProc(dragglue_ReceiveHandler); |
| 1072 | dragglue_SendDataUPP = NewDragSendDataProc(dragglue_SendData); |
| 1073 | #if 0 |
| 1074 | dragglue_InputUPP = NewDragInputProc(dragglue_Input); |
| 1075 | dragglue_DrawingUPP = NewDragDrawingProc(dragglue_Drawing); |
| 1076 | #endif |
| 1077 | |
| 1078 | |
| 1079 | } |
| 1080 | |
| 1081 | /* ======================== End module Drag ========================= */ |
| 1082 | |