Move setting of ioready 'wait' earlier in call chain, to
[python/dscho.git] / Mac / Modules / waste / wastemodule.c
blobf05e467b0b19fc0b72436d160f4c7a2b7dbcc71a
2 /* ========================== Module waste ========================== */
4 #include "Python.h"
8 #ifdef _WIN32
9 #include "pywintoolbox.h"
10 #else
11 #include "macglue.h"
12 #include "pymactoolbox.h"
13 #endif
15 /* Macro to test whether a weak-loaded CFM function exists */
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
23 #include <WASTE.h>
24 #include <WEObjectHandlers.h>
25 #include <WETabs.h>
26 #ifndef PyDoc_STR
27 #define PyDoc_STR(x) (x)
28 #endif
30 /* Exported by Qdmodule.c: */
31 extern PyObject *QdRGB_New(RGBColor *);
32 extern int QdRGB_Convert(PyObject *, RGBColor *);
34 /* Exported by AEModule.c: */
35 extern PyObject *AEDesc_New(AppleEvent *);
36 extern int AEDesc_Convert(PyObject *, AppleEvent *);
38 /* Forward declaration */
39 static PyObject *WEOObj_New(WEObjectReference);
40 static PyObject *ExistingwasteObj_New(WEReference);
43 ** Parse/generate TextStyle records
45 static PyObject *
46 TextStyle_New(TextStylePtr itself)
49 return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
50 &itself->tsColor);
53 static int
54 TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
56 long font, face, size;
58 if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
59 return 0;
60 p_itself->tsFont = (short)font;
61 p_itself->tsFace = (Style)face;
62 p_itself->tsSize = (short)size;
63 return 1;
67 ** Parse/generate RunInfo records
69 static PyObject *
70 RunInfo_New(WERunInfo *itself)
73 return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
74 itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
77 /* Conversion of long points and rects */
78 int
79 LongRect_Convert(PyObject *v, LongRect *r)
81 return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
84 PyObject *
85 LongRect_New(LongRect *r)
87 return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
90 int
91 LongPt_Convert(PyObject *v, LongPt *p)
93 return PyArg_Parse(v, "(ll)", &p->h, &p->v);
96 PyObject *
97 LongPt_New(LongPt *p)
99 return Py_BuildValue("(ll)", p->h, p->v);
102 /* Stuff for the callbacks: */
103 static PyObject *callbackdict;
104 WENewObjectUPP upp_new_handler;
105 WEDisposeObjectUPP upp_dispose_handler;
106 WEDrawObjectUPP upp_draw_handler;
107 WEClickObjectUPP upp_click_handler;
109 static OSErr
110 any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
112 FlavorType tp;
113 PyObject *key, *func;
115 if ( args == NULL ) return errAECorruptData;
117 tp = WEGetObjectType(who);
119 if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
120 return errAECorruptData;
121 if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
122 Py_DECREF(key);
123 return errAEHandlerNotFound;
125 Py_INCREF(func);
126 *rv = PyEval_CallObject(func, args);
127 Py_DECREF(func);
128 Py_DECREF(key);
129 if ( *rv == NULL ) {
130 PySys_WriteStderr("--Exception in callback: ");
131 PyErr_Print();
132 return errAEReplyNotArrived;
134 return 0;
137 static pascal OSErr
138 my_new_handler(Point *objectSize, WEObjectReference objref)
140 PyObject *args=NULL, *rv=NULL;
141 OSErr err;
143 args=Py_BuildValue("(O&)", WEOObj_New, objref);
144 err = any_handler(weNewHandler, objref, args, &rv);
145 if (!err) {
146 if (!PyMac_GetPoint(rv, objectSize) )
147 err = errAECoercionFail;
149 if ( args ) {
150 Py_DECREF(args);
152 if ( rv ) {
153 Py_DECREF(rv);
155 return err;
158 static pascal OSErr
159 my_dispose_handler(WEObjectReference objref)
161 PyObject *args=NULL, *rv=NULL;
162 OSErr err;
164 args=Py_BuildValue("(O&)", WEOObj_New, objref);
165 err = any_handler(weDisposeHandler, objref, args, &rv);
166 if ( args ) {
167 Py_DECREF(args);
169 if ( rv ) {
170 Py_DECREF(rv);
172 return err;
175 static pascal OSErr
176 my_draw_handler(const Rect *destRect, WEObjectReference objref)
178 PyObject *args=NULL, *rv=NULL;
179 OSErr err;
181 args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
182 err = any_handler(weDrawHandler, objref, args, &rv);
183 if ( args ) {
184 Py_DECREF(args);
186 if ( rv ) {
187 Py_DECREF(rv);
189 return err;
192 static pascal Boolean
193 my_click_handler(Point hitPt, EventModifiers modifiers,
194 unsigned long clickTime, WEObjectReference objref)
196 PyObject *args=NULL, *rv=NULL;
197 int retvalue;
198 OSErr err;
200 args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
201 (long)modifiers, (long)clickTime, WEOObj_New, objref);
202 err = any_handler(weClickHandler, objref, args, &rv);
203 if (!err)
204 retvalue = PyInt_AsLong(rv);
205 else
206 retvalue = 0;
207 if ( args ) {
208 Py_DECREF(args);
210 if ( rv ) {
211 Py_DECREF(rv);
213 return retvalue;
218 static PyObject *waste_Error;
220 /* ------------------------ Object type WEO ------------------------- */
222 PyTypeObject WEO_Type;
224 #define WEOObj_Check(x) ((x)->ob_type == &WEO_Type || PyObject_TypeCheck((x), &WEO_Type))
226 typedef struct WEOObject {
227 PyObject_HEAD
228 WEObjectReference ob_itself;
229 } WEOObject;
231 PyObject *WEOObj_New(WEObjectReference itself)
233 WEOObject *it;
234 if (itself == NULL) {
235 Py_INCREF(Py_None);
236 return Py_None;
238 it = PyObject_NEW(WEOObject, &WEO_Type);
239 if (it == NULL) return NULL;
240 it->ob_itself = itself;
241 return (PyObject *)it;
243 int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
245 if (!WEOObj_Check(v))
247 PyErr_SetString(PyExc_TypeError, "WEO required");
248 return 0;
250 *p_itself = ((WEOObject *)v)->ob_itself;
251 return 1;
254 static void WEOObj_dealloc(WEOObject *self)
256 /* Cleanup of self->ob_itself goes here */
257 self->ob_type->tp_free((PyObject *)self);
260 static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
262 PyObject *_res = NULL;
263 FlavorType _rv;
264 if (!PyArg_ParseTuple(_args, ""))
265 return NULL;
266 _rv = WEGetObjectType(_self->ob_itself);
267 _res = Py_BuildValue("O&",
268 PyMac_BuildOSType, _rv);
269 return _res;
272 static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
274 PyObject *_res = NULL;
275 Handle _rv;
276 if (!PyArg_ParseTuple(_args, ""))
277 return NULL;
278 _rv = WEGetObjectDataHandle(_self->ob_itself);
279 _res = Py_BuildValue("O&",
280 ResObj_New, _rv);
281 return _res;
284 static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
286 PyObject *_res = NULL;
287 WEReference _rv;
288 if (!PyArg_ParseTuple(_args, ""))
289 return NULL;
290 _rv = WEGetObjectOwner(_self->ob_itself);
291 _res = Py_BuildValue("O&",
292 ExistingwasteObj_New, _rv);
293 return _res;
296 static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
298 PyObject *_res = NULL;
299 SInt32 _rv;
300 if (!PyArg_ParseTuple(_args, ""))
301 return NULL;
302 _rv = WEGetObjectOffset(_self->ob_itself);
303 _res = Py_BuildValue("l",
304 _rv);
305 return _res;
308 static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
310 PyObject *_res = NULL;
311 Point _rv;
312 if (!PyArg_ParseTuple(_args, ""))
313 return NULL;
314 _rv = WEGetObjectSize(_self->ob_itself);
315 _res = Py_BuildValue("O&",
316 PyMac_BuildPoint, _rv);
317 return _res;
320 static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
322 PyObject *_res = NULL;
323 OSErr _err;
324 Point inObjectSize;
325 if (!PyArg_ParseTuple(_args, "O&",
326 PyMac_GetPoint, &inObjectSize))
327 return NULL;
328 _err = WESetObjectSize(_self->ob_itself,
329 inObjectSize);
330 if (_err != noErr) return PyMac_Error(_err);
331 Py_INCREF(Py_None);
332 _res = Py_None;
333 return _res;
336 static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
338 PyObject *_res = NULL;
339 OSErr _err;
340 LongRect outObjectFrame;
341 if (!PyArg_ParseTuple(_args, ""))
342 return NULL;
343 _err = WEGetObjectFrame(_self->ob_itself,
344 &outObjectFrame);
345 if (_err != noErr) return PyMac_Error(_err);
346 _res = Py_BuildValue("O&",
347 LongRect_New, &outObjectFrame);
348 return _res;
351 static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
353 PyObject *_res = NULL;
354 SInt32 _rv;
355 if (!PyArg_ParseTuple(_args, ""))
356 return NULL;
357 _rv = WEGetObjectRefCon(_self->ob_itself);
358 _res = Py_BuildValue("l",
359 _rv);
360 return _res;
363 static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
365 PyObject *_res = NULL;
366 SInt32 inRefCon;
367 if (!PyArg_ParseTuple(_args, "l",
368 &inRefCon))
369 return NULL;
370 WESetObjectRefCon(_self->ob_itself,
371 inRefCon);
372 Py_INCREF(Py_None);
373 _res = Py_None;
374 return _res;
377 static PyMethodDef WEOObj_methods[] = {
378 {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
379 PyDoc_STR("() -> (FlavorType _rv)")},
380 {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
381 PyDoc_STR("() -> (Handle _rv)")},
382 {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
383 PyDoc_STR("() -> (WEReference _rv)")},
384 {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
385 PyDoc_STR("() -> (SInt32 _rv)")},
386 {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
387 PyDoc_STR("() -> (Point _rv)")},
388 {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
389 PyDoc_STR("(Point inObjectSize) -> None")},
390 {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
391 PyDoc_STR("() -> (LongRect outObjectFrame)")},
392 {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
393 PyDoc_STR("() -> (SInt32 _rv)")},
394 {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
395 PyDoc_STR("(SInt32 inRefCon) -> None")},
396 {NULL, NULL, 0}
399 #define WEOObj_getsetlist NULL
402 #define WEOObj_compare NULL
404 #define WEOObj_repr NULL
406 #define WEOObj_hash NULL
407 #define WEOObj_tp_init 0
409 #define WEOObj_tp_alloc PyType_GenericAlloc
411 static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
413 PyObject *self;
414 WEObjectReference itself;
415 char *kw[] = {"itself", 0};
417 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
418 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
419 ((WEOObject *)self)->ob_itself = itself;
420 return self;
423 #define WEOObj_tp_free PyObject_Del
426 PyTypeObject WEO_Type = {
427 PyObject_HEAD_INIT(NULL)
428 0, /*ob_size*/
429 "waste.WEO", /*tp_name*/
430 sizeof(WEOObject), /*tp_basicsize*/
431 0, /*tp_itemsize*/
432 /* methods */
433 (destructor) WEOObj_dealloc, /*tp_dealloc*/
434 0, /*tp_print*/
435 (getattrfunc)0, /*tp_getattr*/
436 (setattrfunc)0, /*tp_setattr*/
437 (cmpfunc) WEOObj_compare, /*tp_compare*/
438 (reprfunc) WEOObj_repr, /*tp_repr*/
439 (PyNumberMethods *)0, /* tp_as_number */
440 (PySequenceMethods *)0, /* tp_as_sequence */
441 (PyMappingMethods *)0, /* tp_as_mapping */
442 (hashfunc) WEOObj_hash, /*tp_hash*/
443 0, /*tp_call*/
444 0, /*tp_str*/
445 PyObject_GenericGetAttr, /*tp_getattro*/
446 PyObject_GenericSetAttr, /*tp_setattro */
447 0, /*tp_as_buffer*/
448 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
449 0, /*tp_doc*/
450 0, /*tp_traverse*/
451 0, /*tp_clear*/
452 0, /*tp_richcompare*/
453 0, /*tp_weaklistoffset*/
454 0, /*tp_iter*/
455 0, /*tp_iternext*/
456 WEOObj_methods, /* tp_methods */
457 0, /*tp_members*/
458 WEOObj_getsetlist, /*tp_getset*/
459 0, /*tp_base*/
460 0, /*tp_dict*/
461 0, /*tp_descr_get*/
462 0, /*tp_descr_set*/
463 0, /*tp_dictoffset*/
464 WEOObj_tp_init, /* tp_init */
465 WEOObj_tp_alloc, /* tp_alloc */
466 WEOObj_tp_new, /* tp_new */
467 WEOObj_tp_free, /* tp_free */
470 /* ---------------------- End object type WEO ----------------------- */
473 /* ----------------------- Object type waste ------------------------ */
475 PyTypeObject waste_Type;
477 #define wasteObj_Check(x) ((x)->ob_type == &waste_Type || PyObject_TypeCheck((x), &waste_Type))
479 typedef struct wasteObject {
480 PyObject_HEAD
481 WEReference ob_itself;
482 } wasteObject;
484 PyObject *wasteObj_New(WEReference itself)
486 wasteObject *it;
487 if (itself == NULL) {
488 PyErr_SetString(waste_Error,"Cannot create null WE");
489 return NULL;
491 it = PyObject_NEW(wasteObject, &waste_Type);
492 if (it == NULL) return NULL;
493 it->ob_itself = itself;
494 WESetInfo(weRefCon, (void *)&it, itself);
495 return (PyObject *)it;
497 int wasteObj_Convert(PyObject *v, WEReference *p_itself)
499 if (!wasteObj_Check(v))
501 PyErr_SetString(PyExc_TypeError, "waste required");
502 return 0;
504 *p_itself = ((wasteObject *)v)->ob_itself;
505 return 1;
508 static void wasteObj_dealloc(wasteObject *self)
510 WEDispose(self->ob_itself);
511 self->ob_type->tp_free((PyObject *)self);
514 static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
516 PyObject *_res = NULL;
517 Handle _rv;
518 if (!PyArg_ParseTuple(_args, ""))
519 return NULL;
520 _rv = WEGetText(_self->ob_itself);
521 _res = Py_BuildValue("O&",
522 ResObj_New, _rv);
523 return _res;
526 static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
528 PyObject *_res = NULL;
529 SInt16 _rv;
530 SInt32 inOffset;
531 if (!PyArg_ParseTuple(_args, "l",
532 &inOffset))
533 return NULL;
534 _rv = WEGetChar(inOffset,
535 _self->ob_itself);
536 _res = Py_BuildValue("h",
537 _rv);
538 return _res;
541 static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
543 PyObject *_res = NULL;
544 SInt32 _rv;
545 if (!PyArg_ParseTuple(_args, ""))
546 return NULL;
547 _rv = WEGetTextLength(_self->ob_itself);
548 _res = Py_BuildValue("l",
549 _rv);
550 return _res;
553 static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
555 PyObject *_res = NULL;
556 SInt32 outSelStart;
557 SInt32 outSelEnd;
558 if (!PyArg_ParseTuple(_args, ""))
559 return NULL;
560 WEGetSelection(&outSelStart,
561 &outSelEnd,
562 _self->ob_itself);
563 _res = Py_BuildValue("ll",
564 outSelStart,
565 outSelEnd);
566 return _res;
569 static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
571 PyObject *_res = NULL;
572 LongRect outDestRect;
573 if (!PyArg_ParseTuple(_args, ""))
574 return NULL;
575 WEGetDestRect(&outDestRect,
576 _self->ob_itself);
577 _res = Py_BuildValue("O&",
578 LongRect_New, &outDestRect);
579 return _res;
582 static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
584 PyObject *_res = NULL;
585 LongRect outViewRect;
586 if (!PyArg_ParseTuple(_args, ""))
587 return NULL;
588 WEGetViewRect(&outViewRect,
589 _self->ob_itself);
590 _res = Py_BuildValue("O&",
591 LongRect_New, &outViewRect);
592 return _res;
595 static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
597 PyObject *_res = NULL;
598 Boolean _rv;
599 if (!PyArg_ParseTuple(_args, ""))
600 return NULL;
601 _rv = WEIsActive(_self->ob_itself);
602 _res = Py_BuildValue("b",
603 _rv);
604 return _res;
607 static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
609 PyObject *_res = NULL;
610 UInt16 _rv;
611 if (!PyArg_ParseTuple(_args, ""))
612 return NULL;
613 _rv = WEGetClickCount(_self->ob_itself);
614 _res = Py_BuildValue("H",
615 _rv);
616 return _res;
619 static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
621 PyObject *_res = NULL;
622 SInt32 inSelStart;
623 SInt32 inSelEnd;
624 if (!PyArg_ParseTuple(_args, "ll",
625 &inSelStart,
626 &inSelEnd))
627 return NULL;
628 WESetSelection(inSelStart,
629 inSelEnd,
630 _self->ob_itself);
631 Py_INCREF(Py_None);
632 _res = Py_None;
633 return _res;
636 static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
638 PyObject *_res = NULL;
639 LongRect inDestRect;
640 if (!PyArg_ParseTuple(_args, "O&",
641 LongRect_Convert, &inDestRect))
642 return NULL;
643 WESetDestRect(&inDestRect,
644 _self->ob_itself);
645 Py_INCREF(Py_None);
646 _res = Py_None;
647 return _res;
650 static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
652 PyObject *_res = NULL;
653 LongRect inViewRect;
654 if (!PyArg_ParseTuple(_args, "O&",
655 LongRect_Convert, &inViewRect))
656 return NULL;
657 WESetViewRect(&inViewRect,
658 _self->ob_itself);
659 Py_INCREF(Py_None);
660 _res = Py_None;
661 return _res;
664 static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
666 PyObject *_res = NULL;
667 Boolean _rv;
668 WEStyleMode ioMode;
669 TextStyle outTextStyle;
670 if (!PyArg_ParseTuple(_args, "H",
671 &ioMode))
672 return NULL;
673 _rv = WEContinuousStyle(&ioMode,
674 &outTextStyle,
675 _self->ob_itself);
676 _res = Py_BuildValue("bHO&",
677 _rv,
678 ioMode,
679 TextStyle_New, &outTextStyle);
680 return _res;
683 static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
685 PyObject *_res = NULL;
686 SInt32 _rv;
687 if (!PyArg_ParseTuple(_args, ""))
688 return NULL;
689 _rv = WECountRuns(_self->ob_itself);
690 _res = Py_BuildValue("l",
691 _rv);
692 return _res;
695 static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
697 PyObject *_res = NULL;
698 SInt32 _rv;
699 SInt32 inOffset;
700 if (!PyArg_ParseTuple(_args, "l",
701 &inOffset))
702 return NULL;
703 _rv = WEOffsetToRun(inOffset,
704 _self->ob_itself);
705 _res = Py_BuildValue("l",
706 _rv);
707 return _res;
710 static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
712 PyObject *_res = NULL;
713 SInt32 inStyleRunIndex;
714 SInt32 outStyleRunStart;
715 SInt32 outStyleRunEnd;
716 if (!PyArg_ParseTuple(_args, "l",
717 &inStyleRunIndex))
718 return NULL;
719 WEGetRunRange(inStyleRunIndex,
720 &outStyleRunStart,
721 &outStyleRunEnd,
722 _self->ob_itself);
723 _res = Py_BuildValue("ll",
724 outStyleRunStart,
725 outStyleRunEnd);
726 return _res;
729 static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
731 PyObject *_res = NULL;
732 SInt32 inOffset;
733 WERunInfo outStyleRunInfo;
734 if (!PyArg_ParseTuple(_args, "l",
735 &inOffset))
736 return NULL;
737 WEGetRunInfo(inOffset,
738 &outStyleRunInfo,
739 _self->ob_itself);
740 _res = Py_BuildValue("O&",
741 RunInfo_New, &outStyleRunInfo);
742 return _res;
745 static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
747 PyObject *_res = NULL;
748 SInt32 inStyleRunIndex;
749 WERunInfo outStyleRunInfo;
750 if (!PyArg_ParseTuple(_args, "l",
751 &inStyleRunIndex))
752 return NULL;
753 WEGetIndRunInfo(inStyleRunIndex,
754 &outStyleRunInfo,
755 _self->ob_itself);
756 _res = Py_BuildValue("O&",
757 RunInfo_New, &outStyleRunInfo);
758 return _res;
761 static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
763 PyObject *_res = NULL;
764 Boolean _rv;
765 SInt32 inOffset;
766 if (!PyArg_ParseTuple(_args, "l",
767 &inOffset))
768 return NULL;
769 _rv = WEGetRunDirection(inOffset,
770 _self->ob_itself);
771 _res = Py_BuildValue("b",
772 _rv);
773 return _res;
776 static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
778 PyObject *_res = NULL;
779 SInt32 _rv;
780 if (!PyArg_ParseTuple(_args, ""))
781 return NULL;
782 _rv = WECountParaRuns(_self->ob_itself);
783 _res = Py_BuildValue("l",
784 _rv);
785 return _res;
788 static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
790 PyObject *_res = NULL;
791 SInt32 _rv;
792 SInt32 inOffset;
793 if (!PyArg_ParseTuple(_args, "l",
794 &inOffset))
795 return NULL;
796 _rv = WEOffsetToParaRun(inOffset,
797 _self->ob_itself);
798 _res = Py_BuildValue("l",
799 _rv);
800 return _res;
803 static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
805 PyObject *_res = NULL;
806 SInt32 inParagraphRunIndex;
807 SInt32 outParagraphRunStart;
808 SInt32 outParagraphRunEnd;
809 if (!PyArg_ParseTuple(_args, "l",
810 &inParagraphRunIndex))
811 return NULL;
812 WEGetParaRunRange(inParagraphRunIndex,
813 &outParagraphRunStart,
814 &outParagraphRunEnd,
815 _self->ob_itself);
816 _res = Py_BuildValue("ll",
817 outParagraphRunStart,
818 outParagraphRunEnd);
819 return _res;
822 static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
824 PyObject *_res = NULL;
825 SInt32 _rv;
826 if (!PyArg_ParseTuple(_args, ""))
827 return NULL;
828 _rv = WECountLines(_self->ob_itself);
829 _res = Py_BuildValue("l",
830 _rv);
831 return _res;
834 static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
836 PyObject *_res = NULL;
837 SInt32 _rv;
838 SInt32 inOffset;
839 if (!PyArg_ParseTuple(_args, "l",
840 &inOffset))
841 return NULL;
842 _rv = WEOffsetToLine(inOffset,
843 _self->ob_itself);
844 _res = Py_BuildValue("l",
845 _rv);
846 return _res;
849 static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
851 PyObject *_res = NULL;
852 SInt32 inLineIndex;
853 SInt32 outLineStart;
854 SInt32 outLineEnd;
855 if (!PyArg_ParseTuple(_args, "l",
856 &inLineIndex))
857 return NULL;
858 WEGetLineRange(inLineIndex,
859 &outLineStart,
860 &outLineEnd,
861 _self->ob_itself);
862 _res = Py_BuildValue("ll",
863 outLineStart,
864 outLineEnd);
865 return _res;
868 static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
870 PyObject *_res = NULL;
871 SInt32 _rv;
872 SInt32 inStartLineIndex;
873 SInt32 inEndLineIndex;
874 if (!PyArg_ParseTuple(_args, "ll",
875 &inStartLineIndex,
876 &inEndLineIndex))
877 return NULL;
878 _rv = WEGetHeight(inStartLineIndex,
879 inEndLineIndex,
880 _self->ob_itself);
881 _res = Py_BuildValue("l",
882 _rv);
883 return _res;
886 static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
888 PyObject *_res = NULL;
889 SInt32 _rv;
890 LongPt inPoint;
891 WEEdge outEdge;
892 if (!PyArg_ParseTuple(_args, "O&",
893 LongPt_Convert, &inPoint))
894 return NULL;
895 _rv = WEGetOffset(&inPoint,
896 &outEdge,
897 _self->ob_itself);
898 _res = Py_BuildValue("lB",
899 _rv,
900 outEdge);
901 return _res;
904 static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
906 PyObject *_res = NULL;
907 SInt32 inOffset;
908 SInt16 inDirection;
909 LongPt outPoint;
910 SInt16 outLineHeight;
911 if (!PyArg_ParseTuple(_args, "lh",
912 &inOffset,
913 &inDirection))
914 return NULL;
915 WEGetPoint(inOffset,
916 inDirection,
917 &outPoint,
918 &outLineHeight,
919 _self->ob_itself);
920 _res = Py_BuildValue("O&h",
921 LongPt_New, &outPoint,
922 outLineHeight);
923 return _res;
926 static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
928 PyObject *_res = NULL;
929 SInt32 inOffset;
930 WEEdge inEdge;
931 SInt32 outWordStart;
932 SInt32 outWordEnd;
933 if (!PyArg_ParseTuple(_args, "lB",
934 &inOffset,
935 &inEdge))
936 return NULL;
937 WEFindWord(inOffset,
938 inEdge,
939 &outWordStart,
940 &outWordEnd,
941 _self->ob_itself);
942 _res = Py_BuildValue("ll",
943 outWordStart,
944 outWordEnd);
945 return _res;
948 static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
950 PyObject *_res = NULL;
951 SInt32 inOffset;
952 WEEdge inEdge;
953 SInt32 outLineStart;
954 SInt32 outLineEnd;
955 if (!PyArg_ParseTuple(_args, "lB",
956 &inOffset,
957 &inEdge))
958 return NULL;
959 WEFindLine(inOffset,
960 inEdge,
961 &outLineStart,
962 &outLineEnd,
963 _self->ob_itself);
964 _res = Py_BuildValue("ll",
965 outLineStart,
966 outLineEnd);
967 return _res;
970 static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
972 PyObject *_res = NULL;
973 SInt32 inOffset;
974 WEEdge inEdge;
975 SInt32 outParagraphStart;
976 SInt32 outParagraphEnd;
977 if (!PyArg_ParseTuple(_args, "lB",
978 &inOffset,
979 &inEdge))
980 return NULL;
981 WEFindParagraph(inOffset,
982 inEdge,
983 &outParagraphStart,
984 &outParagraphEnd,
985 _self->ob_itself);
986 _res = Py_BuildValue("ll",
987 outParagraphStart,
988 outParagraphEnd);
989 return _res;
992 static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
994 PyObject *_res = NULL;
995 OSErr _err;
996 char* inKey;
997 SInt32 inKeyLength;
998 TextEncoding inKeyEncoding;
999 OptionBits inMatchOptions;
1000 SInt32 inRangeStart;
1001 SInt32 inRangeEnd;
1002 SInt32 outMatchStart;
1003 SInt32 outMatchEnd;
1004 if (!PyArg_ParseTuple(_args, "slllll",
1005 &inKey,
1006 &inKeyLength,
1007 &inKeyEncoding,
1008 &inMatchOptions,
1009 &inRangeStart,
1010 &inRangeEnd))
1011 return NULL;
1012 _err = WEFind(inKey,
1013 inKeyLength,
1014 inKeyEncoding,
1015 inMatchOptions,
1016 inRangeStart,
1017 inRangeEnd,
1018 &outMatchStart,
1019 &outMatchEnd,
1020 _self->ob_itself);
1021 if (_err != noErr) return PyMac_Error(_err);
1022 _res = Py_BuildValue("ll",
1023 outMatchStart,
1024 outMatchEnd);
1025 return _res;
1028 static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
1030 PyObject *_res = NULL;
1031 OSErr _err;
1032 SInt32 inRangeStart;
1033 SInt32 inRangeEnd;
1034 FlavorType inRequestedType;
1035 OptionBits inStreamOptions;
1036 Handle outData;
1037 if (!PyArg_ParseTuple(_args, "llO&lO&",
1038 &inRangeStart,
1039 &inRangeEnd,
1040 PyMac_GetOSType, &inRequestedType,
1041 &inStreamOptions,
1042 ResObj_Convert, &outData))
1043 return NULL;
1044 _err = WEStreamRange(inRangeStart,
1045 inRangeEnd,
1046 inRequestedType,
1047 inStreamOptions,
1048 outData,
1049 _self->ob_itself);
1050 if (_err != noErr) return PyMac_Error(_err);
1051 Py_INCREF(Py_None);
1052 _res = Py_None;
1053 return _res;
1056 static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
1058 PyObject *_res = NULL;
1059 OSErr _err;
1060 SInt32 inRangeStart;
1061 SInt32 inRangeEnd;
1062 Handle outText;
1063 StScrpHandle outStyles;
1064 WESoupHandle outSoup;
1065 if (!PyArg_ParseTuple(_args, "llO&O&O&",
1066 &inRangeStart,
1067 &inRangeEnd,
1068 OptResObj_Convert, &outText,
1069 OptResObj_Convert, &outStyles,
1070 OptResObj_Convert, &outSoup))
1071 return NULL;
1072 _err = WECopyRange(inRangeStart,
1073 inRangeEnd,
1074 outText,
1075 outStyles,
1076 outSoup,
1077 _self->ob_itself);
1078 if (_err != noErr) return PyMac_Error(_err);
1079 Py_INCREF(Py_None);
1080 _res = Py_None;
1081 return _res;
1084 static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
1086 PyObject *_res = NULL;
1087 OSErr _err;
1088 SInt32 inRangeStart;
1089 SInt32 inRangeEnd;
1090 Handle outUnicodeText;
1091 Handle ioCharFormat;
1092 Handle ioParaFormat;
1093 TextEncodingVariant inUnicodeVariant;
1094 TextEncodingFormat inTransformationFormat;
1095 OptionBits inGetOptions;
1096 if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
1097 &inRangeStart,
1098 &inRangeEnd,
1099 ResObj_Convert, &outUnicodeText,
1100 ResObj_Convert, &ioCharFormat,
1101 ResObj_Convert, &ioParaFormat,
1102 &inUnicodeVariant,
1103 &inTransformationFormat,
1104 &inGetOptions))
1105 return NULL;
1106 _err = WEGetTextRangeAsUnicode(inRangeStart,
1107 inRangeEnd,
1108 outUnicodeText,
1109 ioCharFormat,
1110 ioParaFormat,
1111 inUnicodeVariant,
1112 inTransformationFormat,
1113 inGetOptions,
1114 _self->ob_itself);
1115 if (_err != noErr) return PyMac_Error(_err);
1116 Py_INCREF(Py_None);
1117 _res = Py_None;
1118 return _res;
1121 static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
1123 PyObject *_res = NULL;
1124 WEAlignment _rv;
1125 if (!PyArg_ParseTuple(_args, ""))
1126 return NULL;
1127 _rv = WEGetAlignment(_self->ob_itself);
1128 _res = Py_BuildValue("B",
1129 _rv);
1130 return _res;
1133 static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
1135 PyObject *_res = NULL;
1136 WEAlignment inAlignment;
1137 if (!PyArg_ParseTuple(_args, "B",
1138 &inAlignment))
1139 return NULL;
1140 WESetAlignment(inAlignment,
1141 _self->ob_itself);
1142 Py_INCREF(Py_None);
1143 _res = Py_None;
1144 return _res;
1147 static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
1149 PyObject *_res = NULL;
1150 WEDirection _rv;
1151 if (!PyArg_ParseTuple(_args, ""))
1152 return NULL;
1153 _rv = WEGetDirection(_self->ob_itself);
1154 _res = Py_BuildValue("h",
1155 _rv);
1156 return _res;
1159 static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
1161 PyObject *_res = NULL;
1162 WEDirection inDirection;
1163 if (!PyArg_ParseTuple(_args, "h",
1164 &inDirection))
1165 return NULL;
1166 WESetDirection(inDirection,
1167 _self->ob_itself);
1168 Py_INCREF(Py_None);
1169 _res = Py_None;
1170 return _res;
1173 static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
1175 PyObject *_res = NULL;
1176 OSErr _err;
1177 if (!PyArg_ParseTuple(_args, ""))
1178 return NULL;
1179 _err = WECalText(_self->ob_itself);
1180 if (_err != noErr) return PyMac_Error(_err);
1181 Py_INCREF(Py_None);
1182 _res = Py_None;
1183 return _res;
1186 static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
1188 PyObject *_res = NULL;
1189 RgnHandle inUpdateRgn;
1190 if (!PyArg_ParseTuple(_args, "O&",
1191 ResObj_Convert, &inUpdateRgn))
1192 return NULL;
1193 WEUpdate(inUpdateRgn,
1194 _self->ob_itself);
1195 Py_INCREF(Py_None);
1196 _res = Py_None;
1197 return _res;
1200 static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
1202 PyObject *_res = NULL;
1203 SInt32 inHorizontalOffset;
1204 SInt32 inVerticalOffset;
1205 if (!PyArg_ParseTuple(_args, "ll",
1206 &inHorizontalOffset,
1207 &inVerticalOffset))
1208 return NULL;
1209 WEScroll(inHorizontalOffset,
1210 inVerticalOffset,
1211 _self->ob_itself);
1212 Py_INCREF(Py_None);
1213 _res = Py_None;
1214 return _res;
1217 static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
1219 PyObject *_res = NULL;
1220 SInt32 inHorizontalOffset;
1221 SInt32 inVerticalOffset;
1222 if (!PyArg_ParseTuple(_args, "ll",
1223 &inHorizontalOffset,
1224 &inVerticalOffset))
1225 return NULL;
1226 WEPinScroll(inHorizontalOffset,
1227 inVerticalOffset,
1228 _self->ob_itself);
1229 Py_INCREF(Py_None);
1230 _res = Py_None;
1231 return _res;
1234 static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
1236 PyObject *_res = NULL;
1237 if (!PyArg_ParseTuple(_args, ""))
1238 return NULL;
1239 WESelView(_self->ob_itself);
1240 Py_INCREF(Py_None);
1241 _res = Py_None;
1242 return _res;
1245 static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
1247 PyObject *_res = NULL;
1248 if (!PyArg_ParseTuple(_args, ""))
1249 return NULL;
1250 WEActivate(_self->ob_itself);
1251 Py_INCREF(Py_None);
1252 _res = Py_None;
1253 return _res;
1256 static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
1258 PyObject *_res = NULL;
1259 if (!PyArg_ParseTuple(_args, ""))
1260 return NULL;
1261 WEDeactivate(_self->ob_itself);
1262 Py_INCREF(Py_None);
1263 _res = Py_None;
1264 return _res;
1267 static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
1269 PyObject *_res = NULL;
1270 CharParameter inKey;
1271 EventModifiers inModifiers;
1272 if (!PyArg_ParseTuple(_args, "hH",
1273 &inKey,
1274 &inModifiers))
1275 return NULL;
1276 WEKey(inKey,
1277 inModifiers,
1278 _self->ob_itself);
1279 Py_INCREF(Py_None);
1280 _res = Py_None;
1281 return _res;
1284 static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
1286 PyObject *_res = NULL;
1287 Point inHitPoint;
1288 EventModifiers inModifiers;
1289 UInt32 inClickTime;
1290 if (!PyArg_ParseTuple(_args, "O&Hl",
1291 PyMac_GetPoint, &inHitPoint,
1292 &inModifiers,
1293 &inClickTime))
1294 return NULL;
1295 WEClick(inHitPoint,
1296 inModifiers,
1297 inClickTime,
1298 _self->ob_itself);
1299 Py_INCREF(Py_None);
1300 _res = Py_None;
1301 return _res;
1304 static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
1306 PyObject *_res = NULL;
1307 Boolean _rv;
1308 Point inMouseLoc;
1309 RgnHandle ioMouseRgn;
1310 if (!PyArg_ParseTuple(_args, "O&O&",
1311 PyMac_GetPoint, &inMouseLoc,
1312 ResObj_Convert, &ioMouseRgn))
1313 return NULL;
1314 _rv = WEAdjustCursor(inMouseLoc,
1315 ioMouseRgn,
1316 _self->ob_itself);
1317 _res = Py_BuildValue("b",
1318 _rv);
1319 return _res;
1322 static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
1324 PyObject *_res = NULL;
1325 UInt32 outMaxSleep;
1326 if (!PyArg_ParseTuple(_args, ""))
1327 return NULL;
1328 WEIdle(&outMaxSleep,
1329 _self->ob_itself);
1330 _res = Py_BuildValue("l",
1331 outMaxSleep);
1332 return _res;
1335 static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
1337 PyObject *_res = NULL;
1338 OSErr _err;
1339 char *inTextPtr__in__;
1340 long inTextPtr__len__;
1341 int inTextPtr__in_len__;
1342 StScrpHandle inStyles;
1343 WESoupHandle inSoup;
1344 if (!PyArg_ParseTuple(_args, "s#O&O&",
1345 &inTextPtr__in__, &inTextPtr__in_len__,
1346 OptResObj_Convert, &inStyles,
1347 OptResObj_Convert, &inSoup))
1348 return NULL;
1349 inTextPtr__len__ = inTextPtr__in_len__;
1350 _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
1351 inStyles,
1352 inSoup,
1353 _self->ob_itself);
1354 if (_err != noErr) return PyMac_Error(_err);
1355 Py_INCREF(Py_None);
1356 _res = Py_None;
1357 return _res;
1360 static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
1362 PyObject *_res = NULL;
1363 OSErr _err;
1364 char *inTextPtr__in__;
1365 long inTextPtr__len__;
1366 int inTextPtr__in_len__;
1367 StScrpHandle inStyles;
1368 WESoupHandle inSoup;
1369 Handle inParaFormat;
1370 Handle inRulerScrap;
1371 if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
1372 &inTextPtr__in__, &inTextPtr__in_len__,
1373 OptResObj_Convert, &inStyles,
1374 OptResObj_Convert, &inSoup,
1375 ResObj_Convert, &inParaFormat,
1376 ResObj_Convert, &inRulerScrap))
1377 return NULL;
1378 inTextPtr__len__ = inTextPtr__in_len__;
1379 _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
1380 inStyles,
1381 inSoup,
1382 inParaFormat,
1383 inRulerScrap,
1384 _self->ob_itself);
1385 if (_err != noErr) return PyMac_Error(_err);
1386 Py_INCREF(Py_None);
1387 _res = Py_None;
1388 return _res;
1391 static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
1393 PyObject *_res = NULL;
1394 OSErr _err;
1395 if (!PyArg_ParseTuple(_args, ""))
1396 return NULL;
1397 _err = WEDelete(_self->ob_itself);
1398 if (_err != noErr) return PyMac_Error(_err);
1399 Py_INCREF(Py_None);
1400 _res = Py_None;
1401 return _res;
1404 static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
1406 PyObject *_res = NULL;
1407 OSErr _err;
1408 Handle inText;
1409 if (!PyArg_ParseTuple(_args, "O&",
1410 ResObj_Convert, &inText))
1411 return NULL;
1412 _err = WEUseText(inText,
1413 _self->ob_itself);
1414 if (_err != noErr) return PyMac_Error(_err);
1415 Py_INCREF(Py_None);
1416 _res = Py_None;
1417 return _res;
1420 static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
1422 PyObject *_res = NULL;
1423 OSErr _err;
1424 SInt16 inCase;
1425 if (!PyArg_ParseTuple(_args, "h",
1426 &inCase))
1427 return NULL;
1428 _err = WEChangeCase(inCase,
1429 _self->ob_itself);
1430 if (_err != noErr) return PyMac_Error(_err);
1431 Py_INCREF(Py_None);
1432 _res = Py_None;
1433 return _res;
1436 static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
1438 PyObject *_res = NULL;
1439 OSErr _err;
1440 SInt32 inRangeStart;
1441 SInt32 inRangeEnd;
1442 WESelector inAttributeSelector;
1443 char *inAttributeValue__in__;
1444 long inAttributeValue__len__;
1445 int inAttributeValue__in_len__;
1446 if (!PyArg_ParseTuple(_args, "llO&s#",
1447 &inRangeStart,
1448 &inRangeEnd,
1449 PyMac_GetOSType, &inAttributeSelector,
1450 &inAttributeValue__in__, &inAttributeValue__in_len__))
1451 return NULL;
1452 inAttributeValue__len__ = inAttributeValue__in_len__;
1453 _err = WESetOneAttribute(inRangeStart,
1454 inRangeEnd,
1455 inAttributeSelector,
1456 inAttributeValue__in__, inAttributeValue__len__,
1457 _self->ob_itself);
1458 if (_err != noErr) return PyMac_Error(_err);
1459 Py_INCREF(Py_None);
1460 _res = Py_None;
1461 return _res;
1464 static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
1466 PyObject *_res = NULL;
1467 OSErr _err;
1468 WEStyleMode inMode;
1469 TextStyle inTextStyle;
1470 if (!PyArg_ParseTuple(_args, "HO&",
1471 &inMode,
1472 TextStyle_Convert, &inTextStyle))
1473 return NULL;
1474 _err = WESetStyle(inMode,
1475 &inTextStyle,
1476 _self->ob_itself);
1477 if (_err != noErr) return PyMac_Error(_err);
1478 Py_INCREF(Py_None);
1479 _res = Py_None;
1480 return _res;
1483 static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
1485 PyObject *_res = NULL;
1486 OSErr _err;
1487 StScrpHandle inStyles;
1488 if (!PyArg_ParseTuple(_args, "O&",
1489 ResObj_Convert, &inStyles))
1490 return NULL;
1491 _err = WEUseStyleScrap(inStyles,
1492 _self->ob_itself);
1493 if (_err != noErr) return PyMac_Error(_err);
1494 Py_INCREF(Py_None);
1495 _res = Py_None;
1496 return _res;
1499 static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
1501 PyObject *_res = NULL;
1502 OSErr _err;
1503 if (!PyArg_ParseTuple(_args, ""))
1504 return NULL;
1505 _err = WEUndo(_self->ob_itself);
1506 if (_err != noErr) return PyMac_Error(_err);
1507 Py_INCREF(Py_None);
1508 _res = Py_None;
1509 return _res;
1512 static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
1514 PyObject *_res = NULL;
1515 OSErr _err;
1516 if (!PyArg_ParseTuple(_args, ""))
1517 return NULL;
1518 _err = WERedo(_self->ob_itself);
1519 if (_err != noErr) return PyMac_Error(_err);
1520 Py_INCREF(Py_None);
1521 _res = Py_None;
1522 return _res;
1525 static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
1527 PyObject *_res = NULL;
1528 if (!PyArg_ParseTuple(_args, ""))
1529 return NULL;
1530 WEClearUndo(_self->ob_itself);
1531 Py_INCREF(Py_None);
1532 _res = Py_None;
1533 return _res;
1536 static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
1538 PyObject *_res = NULL;
1539 WEActionKind _rv;
1540 Boolean outRedoFlag;
1541 if (!PyArg_ParseTuple(_args, ""))
1542 return NULL;
1543 _rv = WEGetUndoInfo(&outRedoFlag,
1544 _self->ob_itself);
1545 _res = Py_BuildValue("hb",
1546 _rv,
1547 outRedoFlag);
1548 return _res;
1551 static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
1553 PyObject *_res = NULL;
1554 WEActionKind _rv;
1555 SInt32 inUndoLevel;
1556 if (!PyArg_ParseTuple(_args, "l",
1557 &inUndoLevel))
1558 return NULL;
1559 _rv = WEGetIndUndoInfo(inUndoLevel,
1560 _self->ob_itself);
1561 _res = Py_BuildValue("h",
1562 _rv);
1563 return _res;
1566 static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
1568 PyObject *_res = NULL;
1569 Boolean _rv;
1570 if (!PyArg_ParseTuple(_args, ""))
1571 return NULL;
1572 _rv = WEIsTyping(_self->ob_itself);
1573 _res = Py_BuildValue("b",
1574 _rv);
1575 return _res;
1578 static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
1580 PyObject *_res = NULL;
1581 OSErr _err;
1582 if (!PyArg_ParseTuple(_args, ""))
1583 return NULL;
1584 _err = WEBeginAction(_self->ob_itself);
1585 if (_err != noErr) return PyMac_Error(_err);
1586 Py_INCREF(Py_None);
1587 _res = Py_None;
1588 return _res;
1591 static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
1593 PyObject *_res = NULL;
1594 OSErr _err;
1595 WEActionKind inActionKind;
1596 if (!PyArg_ParseTuple(_args, "h",
1597 &inActionKind))
1598 return NULL;
1599 _err = WEEndAction(inActionKind,
1600 _self->ob_itself);
1601 if (_err != noErr) return PyMac_Error(_err);
1602 Py_INCREF(Py_None);
1603 _res = Py_None;
1604 return _res;
1607 static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
1609 PyObject *_res = NULL;
1610 UInt32 _rv;
1611 if (!PyArg_ParseTuple(_args, ""))
1612 return NULL;
1613 _rv = WEGetModCount(_self->ob_itself);
1614 _res = Py_BuildValue("l",
1615 _rv);
1616 return _res;
1619 static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
1621 PyObject *_res = NULL;
1622 if (!PyArg_ParseTuple(_args, ""))
1623 return NULL;
1624 WEResetModCount(_self->ob_itself);
1625 Py_INCREF(Py_None);
1626 _res = Py_None;
1627 return _res;
1630 static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
1632 PyObject *_res = NULL;
1633 OSErr _err;
1634 FlavorType inObjectType;
1635 Handle inObjectDataHandle;
1636 Point inObjectSize;
1637 if (!PyArg_ParseTuple(_args, "O&O&O&",
1638 PyMac_GetOSType, &inObjectType,
1639 ResObj_Convert, &inObjectDataHandle,
1640 PyMac_GetPoint, &inObjectSize))
1641 return NULL;
1642 _err = WEInsertObject(inObjectType,
1643 inObjectDataHandle,
1644 inObjectSize,
1645 _self->ob_itself);
1646 if (_err != noErr) return PyMac_Error(_err);
1647 Py_INCREF(Py_None);
1648 _res = Py_None;
1649 return _res;
1652 static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
1654 PyObject *_res = NULL;
1655 OSErr _err;
1656 WEObjectReference outObject;
1657 if (!PyArg_ParseTuple(_args, ""))
1658 return NULL;
1659 _err = WEGetSelectedObject(&outObject,
1660 _self->ob_itself);
1661 if (_err != noErr) return PyMac_Error(_err);
1662 _res = Py_BuildValue("O&",
1663 WEOObj_New, outObject);
1664 return _res;
1667 static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
1669 PyObject *_res = NULL;
1670 OSErr _err;
1671 SInt32 inOffset;
1672 WEObjectReference outObject;
1673 if (!PyArg_ParseTuple(_args, "l",
1674 &inOffset))
1675 return NULL;
1676 _err = WEGetObjectAtOffset(inOffset,
1677 &outObject,
1678 _self->ob_itself);
1679 if (_err != noErr) return PyMac_Error(_err);
1680 _res = Py_BuildValue("O&",
1681 WEOObj_New, outObject);
1682 return _res;
1685 static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
1687 PyObject *_res = NULL;
1688 SInt32 _rv;
1689 SInt32 inOffset;
1690 WEObjectReference outObject;
1691 if (!PyArg_ParseTuple(_args, "l",
1692 &inOffset))
1693 return NULL;
1694 _rv = WEFindNextObject(inOffset,
1695 &outObject,
1696 _self->ob_itself);
1697 _res = Py_BuildValue("lO&",
1698 _rv,
1699 WEOObj_New, outObject);
1700 return _res;
1703 static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
1705 PyObject *_res = NULL;
1706 OSErr _err;
1707 WESoupHandle inSoup;
1708 if (!PyArg_ParseTuple(_args, "O&",
1709 ResObj_Convert, &inSoup))
1710 return NULL;
1711 _err = WEUseSoup(inSoup,
1712 _self->ob_itself);
1713 if (_err != noErr) return PyMac_Error(_err);
1714 Py_INCREF(Py_None);
1715 _res = Py_None;
1716 return _res;
1719 static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
1721 PyObject *_res = NULL;
1722 OSErr _err;
1723 if (!PyArg_ParseTuple(_args, ""))
1724 return NULL;
1725 _err = WECut(_self->ob_itself);
1726 if (_err != noErr) return PyMac_Error(_err);
1727 Py_INCREF(Py_None);
1728 _res = Py_None;
1729 return _res;
1732 static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
1734 PyObject *_res = NULL;
1735 OSErr _err;
1736 if (!PyArg_ParseTuple(_args, ""))
1737 return NULL;
1738 _err = WECopy(_self->ob_itself);
1739 if (_err != noErr) return PyMac_Error(_err);
1740 Py_INCREF(Py_None);
1741 _res = Py_None;
1742 return _res;
1745 static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
1747 PyObject *_res = NULL;
1748 OSErr _err;
1749 if (!PyArg_ParseTuple(_args, ""))
1750 return NULL;
1751 _err = WEPaste(_self->ob_itself);
1752 if (_err != noErr) return PyMac_Error(_err);
1753 Py_INCREF(Py_None);
1754 _res = Py_None;
1755 return _res;
1758 static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
1760 PyObject *_res = NULL;
1761 Boolean _rv;
1762 if (!PyArg_ParseTuple(_args, ""))
1763 return NULL;
1764 _rv = WECanPaste(_self->ob_itself);
1765 _res = Py_BuildValue("b",
1766 _rv);
1767 return _res;
1770 static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
1772 PyObject *_res = NULL;
1773 RgnHandle _rv;
1774 SInt32 inRangeStart;
1775 SInt32 inRangeEnd;
1776 if (!PyArg_ParseTuple(_args, "ll",
1777 &inRangeStart,
1778 &inRangeEnd))
1779 return NULL;
1780 _rv = WEGetHiliteRgn(inRangeStart,
1781 inRangeEnd,
1782 _self->ob_itself);
1783 _res = Py_BuildValue("O&",
1784 ResObj_New, _rv);
1785 return _res;
1788 static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
1790 PyObject *_res = NULL;
1791 SInt16 _rv;
1792 SInt32 inOffset;
1793 if (!PyArg_ParseTuple(_args, "l",
1794 &inOffset))
1795 return NULL;
1796 _rv = WECharByte(inOffset,
1797 _self->ob_itself);
1798 _res = Py_BuildValue("h",
1799 _rv);
1800 return _res;
1803 static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
1805 PyObject *_res = NULL;
1806 SInt16 _rv;
1807 SInt32 inOffset;
1808 if (!PyArg_ParseTuple(_args, "l",
1809 &inOffset))
1810 return NULL;
1811 _rv = WECharType(inOffset,
1812 _self->ob_itself);
1813 _res = Py_BuildValue("h",
1814 _rv);
1815 return _res;
1818 static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
1820 PyObject *_res = NULL;
1821 if (!PyArg_ParseTuple(_args, ""))
1822 return NULL;
1823 WEStopInlineSession(_self->ob_itself);
1824 Py_INCREF(Py_None);
1825 _res = Py_None;
1826 return _res;
1829 static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
1831 PyObject *_res = NULL;
1832 SInt16 _rv;
1833 SInt16 inFeature;
1834 SInt16 inAction;
1835 if (!PyArg_ParseTuple(_args, "hh",
1836 &inFeature,
1837 &inAction))
1838 return NULL;
1839 _rv = WEFeatureFlag(inFeature,
1840 inAction,
1841 _self->ob_itself);
1842 _res = Py_BuildValue("h",
1843 _rv);
1844 return _res;
1847 static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
1849 PyObject *_res = NULL;
1850 OSErr _err;
1851 WESelector inUserTag;
1852 SInt32 outUserInfo;
1853 if (!PyArg_ParseTuple(_args, "O&",
1854 PyMac_GetOSType, &inUserTag))
1855 return NULL;
1856 _err = WEGetUserInfo(inUserTag,
1857 &outUserInfo,
1858 _self->ob_itself);
1859 if (_err != noErr) return PyMac_Error(_err);
1860 _res = Py_BuildValue("l",
1861 outUserInfo);
1862 return _res;
1865 static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
1867 PyObject *_res = NULL;
1868 OSErr _err;
1869 WESelector inUserTag;
1870 SInt32 inUserInfo;
1871 if (!PyArg_ParseTuple(_args, "O&l",
1872 PyMac_GetOSType, &inUserTag,
1873 &inUserInfo))
1874 return NULL;
1875 _err = WESetUserInfo(inUserTag,
1876 inUserInfo,
1877 _self->ob_itself);
1878 if (_err != noErr) return PyMac_Error(_err);
1879 Py_INCREF(Py_None);
1880 _res = Py_None;
1881 return _res;
1884 static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
1886 PyObject *_res = NULL;
1887 OSErr _err;
1888 WESelector inUserTag;
1889 if (!PyArg_ParseTuple(_args, "O&",
1890 PyMac_GetOSType, &inUserTag))
1891 return NULL;
1892 _err = WERemoveUserInfo(inUserTag,
1893 _self->ob_itself);
1894 if (_err != noErr) return PyMac_Error(_err);
1895 Py_INCREF(Py_None);
1896 _res = Py_None;
1897 return _res;
1900 static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
1902 PyObject *_res = NULL;
1903 OSErr _err;
1904 if (!PyArg_ParseTuple(_args, ""))
1905 return NULL;
1906 _err = WEInstallTabHooks(_self->ob_itself);
1907 if (_err != noErr) return PyMac_Error(_err);
1908 Py_INCREF(Py_None);
1909 _res = Py_None;
1910 return _res;
1913 static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
1915 PyObject *_res = NULL;
1916 OSErr _err;
1917 if (!PyArg_ParseTuple(_args, ""))
1918 return NULL;
1919 _err = WERemoveTabHooks(_self->ob_itself);
1920 if (_err != noErr) return PyMac_Error(_err);
1921 Py_INCREF(Py_None);
1922 _res = Py_None;
1923 return _res;
1926 static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
1928 PyObject *_res = NULL;
1929 Boolean _rv;
1930 if (!PyArg_ParseTuple(_args, ""))
1931 return NULL;
1932 _rv = WEIsTabHooks(_self->ob_itself);
1933 _res = Py_BuildValue("b",
1934 _rv);
1935 return _res;
1938 static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
1940 PyObject *_res = NULL;
1941 SInt16 _rv;
1942 if (!PyArg_ParseTuple(_args, ""))
1943 return NULL;
1944 _rv = WEGetTabSize(_self->ob_itself);
1945 _res = Py_BuildValue("h",
1946 _rv);
1947 return _res;
1950 static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
1952 PyObject *_res = NULL;
1953 OSErr _err;
1954 SInt16 tabWidth;
1955 if (!PyArg_ParseTuple(_args, "h",
1956 &tabWidth))
1957 return NULL;
1958 _err = WESetTabSize(tabWidth,
1959 _self->ob_itself);
1960 if (_err != noErr) return PyMac_Error(_err);
1961 Py_INCREF(Py_None);
1962 _res = Py_None;
1963 return _res;
1966 static PyMethodDef wasteObj_methods[] = {
1967 {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
1968 PyDoc_STR("() -> (Handle _rv)")},
1969 {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
1970 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
1971 {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
1972 PyDoc_STR("() -> (SInt32 _rv)")},
1973 {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
1974 PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
1975 {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
1976 PyDoc_STR("() -> (LongRect outDestRect)")},
1977 {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
1978 PyDoc_STR("() -> (LongRect outViewRect)")},
1979 {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
1980 PyDoc_STR("() -> (Boolean _rv)")},
1981 {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
1982 PyDoc_STR("() -> (UInt16 _rv)")},
1983 {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
1984 PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
1985 {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
1986 PyDoc_STR("(LongRect inDestRect) -> None")},
1987 {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
1988 PyDoc_STR("(LongRect inViewRect) -> None")},
1989 {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
1990 PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
1991 {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
1992 PyDoc_STR("() -> (SInt32 _rv)")},
1993 {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
1994 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
1995 {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
1996 PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
1997 {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
1998 PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
1999 {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
2000 PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
2001 {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
2002 PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
2003 {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
2004 PyDoc_STR("() -> (SInt32 _rv)")},
2005 {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
2006 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
2007 {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
2008 PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
2009 {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
2010 PyDoc_STR("() -> (SInt32 _rv)")},
2011 {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
2012 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
2013 {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
2014 PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
2015 {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
2016 PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
2017 {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
2018 PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
2019 {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
2020 PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
2021 {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
2022 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
2023 {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
2024 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
2025 {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
2026 PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
2027 {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
2028 PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")},
2029 {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
2030 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
2031 {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
2032 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
2033 {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
2034 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")},
2035 {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
2036 PyDoc_STR("() -> (WEAlignment _rv)")},
2037 {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
2038 PyDoc_STR("(WEAlignment inAlignment) -> None")},
2039 {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
2040 PyDoc_STR("() -> (WEDirection _rv)")},
2041 {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
2042 PyDoc_STR("(WEDirection inDirection) -> None")},
2043 {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
2044 PyDoc_STR("() -> None")},
2045 {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
2046 PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
2047 {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
2048 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
2049 {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
2050 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
2051 {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
2052 PyDoc_STR("() -> None")},
2053 {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
2054 PyDoc_STR("() -> None")},
2055 {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
2056 PyDoc_STR("() -> None")},
2057 {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
2058 PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
2059 {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
2060 PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
2061 {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
2062 PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
2063 {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
2064 PyDoc_STR("() -> (UInt32 outMaxSleep)")},
2065 {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
2066 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
2067 {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
2068 PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
2069 {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
2070 PyDoc_STR("() -> None")},
2071 {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
2072 PyDoc_STR("(Handle inText) -> None")},
2073 {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
2074 PyDoc_STR("(SInt16 inCase) -> None")},
2075 {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
2076 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
2077 {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
2078 PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
2079 {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
2080 PyDoc_STR("(StScrpHandle inStyles) -> None")},
2081 {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
2082 PyDoc_STR("() -> None")},
2083 {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
2084 PyDoc_STR("() -> None")},
2085 {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
2086 PyDoc_STR("() -> None")},
2087 {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
2088 PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
2089 {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
2090 PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
2091 {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
2092 PyDoc_STR("() -> (Boolean _rv)")},
2093 {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
2094 PyDoc_STR("() -> None")},
2095 {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
2096 PyDoc_STR("(WEActionKind inActionKind) -> None")},
2097 {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
2098 PyDoc_STR("() -> (UInt32 _rv)")},
2099 {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
2100 PyDoc_STR("() -> None")},
2101 {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
2102 PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
2103 {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
2104 PyDoc_STR("() -> (WEObjectReference outObject)")},
2105 {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
2106 PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
2107 {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
2108 PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
2109 {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
2110 PyDoc_STR("(WESoupHandle inSoup) -> None")},
2111 {"WECut", (PyCFunction)wasteObj_WECut, 1,
2112 PyDoc_STR("() -> None")},
2113 {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
2114 PyDoc_STR("() -> None")},
2115 {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
2116 PyDoc_STR("() -> None")},
2117 {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
2118 PyDoc_STR("() -> (Boolean _rv)")},
2119 {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
2120 PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
2121 {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
2122 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2123 {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
2124 PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
2125 {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
2126 PyDoc_STR("() -> None")},
2127 {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
2128 PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
2129 {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
2130 PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
2131 {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
2132 PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
2133 {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
2134 PyDoc_STR("(WESelector inUserTag) -> None")},
2135 {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
2136 PyDoc_STR("() -> None")},
2137 {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
2138 PyDoc_STR("() -> None")},
2139 {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
2140 PyDoc_STR("() -> (Boolean _rv)")},
2141 {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
2142 PyDoc_STR("() -> (SInt16 _rv)")},
2143 {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
2144 PyDoc_STR("(SInt16 tabWidth) -> None")},
2145 {NULL, NULL, 0}
2148 #define wasteObj_getsetlist NULL
2151 #define wasteObj_compare NULL
2153 #define wasteObj_repr NULL
2155 #define wasteObj_hash NULL
2156 #define wasteObj_tp_init 0
2158 #define wasteObj_tp_alloc PyType_GenericAlloc
2160 static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2162 PyObject *self;
2163 WEReference itself;
2164 char *kw[] = {"itself", 0};
2166 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
2167 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
2168 ((wasteObject *)self)->ob_itself = itself;
2169 return self;
2172 #define wasteObj_tp_free PyObject_Del
2175 PyTypeObject waste_Type = {
2176 PyObject_HEAD_INIT(NULL)
2177 0, /*ob_size*/
2178 "waste.waste", /*tp_name*/
2179 sizeof(wasteObject), /*tp_basicsize*/
2180 0, /*tp_itemsize*/
2181 /* methods */
2182 (destructor) wasteObj_dealloc, /*tp_dealloc*/
2183 0, /*tp_print*/
2184 (getattrfunc)0, /*tp_getattr*/
2185 (setattrfunc)0, /*tp_setattr*/
2186 (cmpfunc) wasteObj_compare, /*tp_compare*/
2187 (reprfunc) wasteObj_repr, /*tp_repr*/
2188 (PyNumberMethods *)0, /* tp_as_number */
2189 (PySequenceMethods *)0, /* tp_as_sequence */
2190 (PyMappingMethods *)0, /* tp_as_mapping */
2191 (hashfunc) wasteObj_hash, /*tp_hash*/
2192 0, /*tp_call*/
2193 0, /*tp_str*/
2194 PyObject_GenericGetAttr, /*tp_getattro*/
2195 PyObject_GenericSetAttr, /*tp_setattro */
2196 0, /*tp_as_buffer*/
2197 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
2198 0, /*tp_doc*/
2199 0, /*tp_traverse*/
2200 0, /*tp_clear*/
2201 0, /*tp_richcompare*/
2202 0, /*tp_weaklistoffset*/
2203 0, /*tp_iter*/
2204 0, /*tp_iternext*/
2205 wasteObj_methods, /* tp_methods */
2206 0, /*tp_members*/
2207 wasteObj_getsetlist, /*tp_getset*/
2208 0, /*tp_base*/
2209 0, /*tp_dict*/
2210 0, /*tp_descr_get*/
2211 0, /*tp_descr_set*/
2212 0, /*tp_dictoffset*/
2213 wasteObj_tp_init, /* tp_init */
2214 wasteObj_tp_alloc, /* tp_alloc */
2215 wasteObj_tp_new, /* tp_new */
2216 wasteObj_tp_free, /* tp_free */
2219 /* --------------------- End object type waste ---------------------- */
2222 static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
2224 PyObject *_res = NULL;
2225 OSErr _err;
2226 LongRect inDestRect;
2227 LongRect inViewRect;
2228 OptionBits inOptions;
2229 WEReference outWE;
2230 if (!PyArg_ParseTuple(_args, "O&O&l",
2231 LongRect_Convert, &inDestRect,
2232 LongRect_Convert, &inViewRect,
2233 &inOptions))
2234 return NULL;
2235 _err = WENew(&inDestRect,
2236 &inViewRect,
2237 inOptions,
2238 &outWE);
2239 if (_err != noErr) return PyMac_Error(_err);
2240 _res = Py_BuildValue("O&",
2241 wasteObj_New, outWE);
2242 return _res;
2245 static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
2247 PyObject *_res = NULL;
2248 OSErr _err;
2249 StScrpHandle ioStyles;
2250 WEFontTableHandle inFontTable;
2251 if (!PyArg_ParseTuple(_args, "O&O&",
2252 ResObj_Convert, &ioStyles,
2253 ResObj_Convert, &inFontTable))
2254 return NULL;
2255 _err = WEUpdateStyleScrap(ioStyles,
2256 inFontTable);
2257 if (_err != noErr) return PyMac_Error(_err);
2258 Py_INCREF(Py_None);
2259 _res = Py_None;
2260 return _res;
2263 static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
2265 PyObject *_res = NULL;
2266 OSErr _err;
2267 if (!PyArg_ParseTuple(_args, ""))
2268 return NULL;
2269 _err = WEInstallTSMHandlers();
2270 if (_err != noErr) return PyMac_Error(_err);
2271 Py_INCREF(Py_None);
2272 _res = Py_None;
2273 return _res;
2276 static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
2278 PyObject *_res = NULL;
2279 OSErr _err;
2280 if (!PyArg_ParseTuple(_args, ""))
2281 return NULL;
2282 _err = WERemoveTSMHandlers();
2283 if (_err != noErr) return PyMac_Error(_err);
2284 Py_INCREF(Py_None);
2285 _res = Py_None;
2286 return _res;
2289 static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
2291 PyObject *_res = NULL;
2292 OSErr _err;
2293 AppleEvent inAppleEvent;
2294 AppleEvent ioReply;
2295 if (!PyArg_ParseTuple(_args, "O&",
2296 AEDesc_Convert, &inAppleEvent))
2297 return NULL;
2298 _err = WEHandleTSMEvent(&inAppleEvent,
2299 &ioReply);
2300 if (_err != noErr) return PyMac_Error(_err);
2301 _res = Py_BuildValue("O&",
2302 AEDesc_New, &ioReply);
2303 return _res;
2306 static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
2308 PyObject *_res = NULL;
2309 LongPt inLongPoint;
2310 Point outPoint;
2311 if (!PyArg_ParseTuple(_args, "O&",
2312 LongPt_Convert, &inLongPoint))
2313 return NULL;
2314 WELongPointToPoint(&inLongPoint,
2315 &outPoint);
2316 _res = Py_BuildValue("O&",
2317 PyMac_BuildPoint, outPoint);
2318 return _res;
2321 static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
2323 PyObject *_res = NULL;
2324 Point inPoint;
2325 LongPt outLongPoint;
2326 if (!PyArg_ParseTuple(_args, "O&",
2327 PyMac_GetPoint, &inPoint))
2328 return NULL;
2329 WEPointToLongPoint(inPoint,
2330 &outLongPoint);
2331 _res = Py_BuildValue("O&",
2332 LongPt_New, &outLongPoint);
2333 return _res;
2336 static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
2338 PyObject *_res = NULL;
2339 LongRect outLongRect;
2340 SInt32 inLeft;
2341 SInt32 inTop;
2342 SInt32 inRight;
2343 SInt32 inBottom;
2344 if (!PyArg_ParseTuple(_args, "llll",
2345 &inLeft,
2346 &inTop,
2347 &inRight,
2348 &inBottom))
2349 return NULL;
2350 WESetLongRect(&outLongRect,
2351 inLeft,
2352 inTop,
2353 inRight,
2354 inBottom);
2355 _res = Py_BuildValue("O&",
2356 LongRect_New, &outLongRect);
2357 return _res;
2360 static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
2362 PyObject *_res = NULL;
2363 LongRect inLongRect;
2364 Rect outRect;
2365 if (!PyArg_ParseTuple(_args, "O&",
2366 LongRect_Convert, &inLongRect))
2367 return NULL;
2368 WELongRectToRect(&inLongRect,
2369 &outRect);
2370 _res = Py_BuildValue("O&",
2371 PyMac_BuildRect, &outRect);
2372 return _res;
2375 static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
2377 PyObject *_res = NULL;
2378 Rect inRect;
2379 LongRect outLongRect;
2380 if (!PyArg_ParseTuple(_args, "O&",
2381 PyMac_GetRect, &inRect))
2382 return NULL;
2383 WERectToLongRect(&inRect,
2384 &outLongRect);
2385 _res = Py_BuildValue("O&",
2386 LongRect_New, &outLongRect);
2387 return _res;
2390 static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
2392 PyObject *_res = NULL;
2393 LongRect ioLongRect;
2394 SInt32 inHorizontalOffset;
2395 SInt32 inVerticalOffset;
2396 if (!PyArg_ParseTuple(_args, "ll",
2397 &inHorizontalOffset,
2398 &inVerticalOffset))
2399 return NULL;
2400 WEOffsetLongRect(&ioLongRect,
2401 inHorizontalOffset,
2402 inVerticalOffset);
2403 _res = Py_BuildValue("O&",
2404 LongRect_New, &ioLongRect);
2405 return _res;
2408 static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
2410 PyObject *_res = NULL;
2411 Boolean _rv;
2412 LongPt inLongPoint;
2413 LongRect inLongRect;
2414 if (!PyArg_ParseTuple(_args, "O&O&",
2415 LongPt_Convert, &inLongPoint,
2416 LongRect_Convert, &inLongRect))
2417 return NULL;
2418 _rv = WELongPointInLongRect(&inLongPoint,
2419 &inLongRect);
2420 _res = Py_BuildValue("b",
2421 _rv);
2422 return _res;
2425 static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
2427 PyObject *_res = NULL;
2429 OSErr err;
2430 // install the sample object handlers for pictures and sounds
2431 #define kTypePicture 'PICT'
2432 #define kTypeSound 'snd '
2434 if ( !PyArg_ParseTuple(_args, "") ) return NULL;
2436 if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
2437 (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
2438 goto cleanup;
2440 if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
2441 (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
2442 goto cleanup;
2444 if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
2445 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
2446 goto cleanup;
2448 if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
2449 (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
2450 goto cleanup;
2452 if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
2453 (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
2454 goto cleanup;
2456 if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
2457 (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
2458 goto cleanup;
2459 Py_INCREF(Py_None);
2460 _res = Py_None;
2461 return _res;
2463 cleanup:
2464 return PyMac_Error(err);
2468 static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
2470 PyObject *_res = NULL;
2472 OSErr err;
2473 FlavorType objectType;
2474 WESelector selector;
2475 PyObject *py_handler;
2476 UniversalProcPtr handler;
2477 WEReference we = NULL;
2478 PyObject *key;
2481 if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
2482 PyMac_GetOSType, &objectType,
2483 PyMac_GetOSType, &selector,
2484 &py_handler,
2485 WEOObj_Convert, &we) ) return NULL;
2487 if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
2488 else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
2489 else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
2490 else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
2491 else return PyMac_Error(weUndefinedSelectorErr);
2493 if ((key = Py_BuildValue("O&O&",
2494 PyMac_BuildOSType, objectType,
2495 PyMac_BuildOSType, selector)) == NULL )
2496 return NULL;
2498 PyDict_SetItem(callbackdict, key, py_handler);
2500 err = WEInstallObjectHandler(objectType, selector, handler, we);
2501 if ( err ) return PyMac_Error(err);
2502 Py_INCREF(Py_None);
2503 _res = Py_None;
2504 return _res;
2508 static PyMethodDef waste_methods[] = {
2509 {"WENew", (PyCFunction)waste_WENew, 1,
2510 PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
2511 {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
2512 PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
2513 {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
2514 PyDoc_STR("() -> None")},
2515 {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
2516 PyDoc_STR("() -> None")},
2517 {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
2518 PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
2519 {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
2520 PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
2521 {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
2522 PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
2523 {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
2524 PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
2525 {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
2526 PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
2527 {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
2528 PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
2529 {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
2530 PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
2531 {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
2532 PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
2533 {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
2534 PyDoc_STR(NULL)},
2535 {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
2536 PyDoc_STR(NULL)},
2537 {NULL, NULL, 0}
2542 /* Return the object corresponding to the window, or NULL */
2544 PyObject *
2545 ExistingwasteObj_New(w)
2546 WEReference w;
2548 PyObject *it = NULL;
2550 if (w == NULL)
2551 it = NULL;
2552 else
2553 WEGetInfo(weRefCon, (void *)&it, w);
2554 if (it == NULL || ((wasteObject *)it)->ob_itself != w)
2555 it = Py_None;
2556 Py_INCREF(it);
2557 return it;
2561 void initwaste(void)
2563 PyObject *m;
2564 PyObject *d;
2569 m = Py_InitModule("waste", waste_methods);
2570 d = PyModule_GetDict(m);
2571 waste_Error = PyMac_GetOSErrException();
2572 if (waste_Error == NULL ||
2573 PyDict_SetItemString(d, "Error", waste_Error) != 0)
2574 return;
2575 WEO_Type.ob_type = &PyType_Type;
2576 if (PyType_Ready(&WEO_Type) < 0) return;
2577 Py_INCREF(&WEO_Type);
2578 PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
2579 /* Backward-compatible name */
2580 Py_INCREF(&WEO_Type);
2581 PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
2582 waste_Type.ob_type = &PyType_Type;
2583 if (PyType_Ready(&waste_Type) < 0) return;
2584 Py_INCREF(&waste_Type);
2585 PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
2586 /* Backward-compatible name */
2587 Py_INCREF(&waste_Type);
2588 PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
2590 callbackdict = PyDict_New();
2591 if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
2592 return;
2593 upp_new_handler = NewWENewObjectProc(my_new_handler);
2594 upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
2595 upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
2596 upp_click_handler = NewWEClickObjectProc(my_click_handler);
2601 /* ======================== End module waste ======================== */