PageRenderTime 110ms CodeModel.GetById 14ms app.highlight 81ms RepoModel.GetById 1ms app.codeStats 1ms

/Mac/Modules/qd/_Qdmodule.c

http://unladen-swallow.googlecode.com/
C | 7154 lines | 6694 code | 436 blank | 24 comment | 412 complexity | d16b8692f04b1691e2e467c3b13a32f3 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1
   2/* =========================== Module _Qd =========================== */
   3
   4#include "Python.h"
   5
   6
   7#ifndef __LP64__
   8
   9#include "pymactoolbox.h"
  10
  11/* Macro to test whether a weak-loaded CFM function exists */
  12#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
  13        PyErr_SetString(PyExc_NotImplementedError, \
  14        "Not available in this shared library/OS version"); \
  15        return NULL; \
  16    }} while(0)
  17
  18
  19#include <Carbon/Carbon.h>
  20
  21#ifdef USE_TOOLBOX_OBJECT_GLUE
  22extern PyObject *_GrafObj_New(GrafPtr);
  23extern int _GrafObj_Convert(PyObject *, GrafPtr *);
  24extern PyObject *_BMObj_New(BitMapPtr);
  25extern int _BMObj_Convert(PyObject *, BitMapPtr *);
  26extern PyObject *_QdRGB_New(RGBColorPtr);
  27extern int _QdRGB_Convert(PyObject *, RGBColorPtr);
  28
  29#define GrafObj_New _GrafObj_New
  30#define GrafObj_Convert _GrafObj_Convert
  31#define BMObj_New _BMObj_New
  32#define BMObj_Convert _BMObj_Convert
  33#define QdRGB_New _QdRGB_New
  34#define QdRGB_Convert _QdRGB_Convert
  35#endif
  36
  37static PyObject *BMObj_NewCopied(BitMapPtr);
  38
  39/*
  40** Parse/generate RGB records
  41*/
  42PyObject *QdRGB_New(RGBColorPtr itself)
  43{
  44
  45        return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
  46}
  47
  48int QdRGB_Convert(PyObject *v, RGBColorPtr p_itself)
  49{
  50        long red, green, blue;
  51
  52        if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
  53                return 0;
  54        p_itself->red = (unsigned short)red;
  55        p_itself->green = (unsigned short)green;
  56        p_itself->blue = (unsigned short)blue;
  57        return 1;
  58}
  59
  60/*
  61** Generate FontInfo records
  62*/
  63static
  64PyObject *QdFI_New(FontInfo *itself)
  65{
  66
  67        return Py_BuildValue("hhhh", itself->ascent, itself->descent,
  68                        itself->widMax, itself->leading);
  69}
  70
  71static PyObject *Qd_Error;
  72
  73/* ---------------------- Object type GrafPort ---------------------- */
  74
  75PyTypeObject GrafPort_Type;
  76
  77#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type))
  78
  79typedef struct GrafPortObject {
  80	PyObject_HEAD
  81	GrafPtr ob_itself;
  82} GrafPortObject;
  83
  84PyObject *GrafObj_New(GrafPtr itself)
  85{
  86	GrafPortObject *it;
  87	if (itself == NULL) return PyMac_Error(resNotFound);
  88	it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
  89	if (it == NULL) return NULL;
  90	it->ob_itself = itself;
  91	return (PyObject *)it;
  92}
  93
  94int GrafObj_Convert(PyObject *v, GrafPtr *p_itself)
  95{
  96#if 1
  97	{
  98		WindowRef win;
  99		if (WinObj_Convert(v, &win) && v) {
 100			*p_itself = (GrafPtr)GetWindowPort(win);
 101			return 1;
 102		}
 103		PyErr_Clear();
 104	}
 105#else
 106	if (DlgObj_Check(v)) {
 107		DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
 108		*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
 109		return 1;
 110	}
 111	if (WinObj_Check(v)) {
 112		WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
 113		*p_itself = (GrafPtr)GetWindowPort(win);
 114		return 1;
 115	}
 116#endif
 117	if (!GrafObj_Check(v))
 118	{
 119		PyErr_SetString(PyExc_TypeError, "GrafPort required");
 120		return 0;
 121	}
 122	*p_itself = ((GrafPortObject *)v)->ob_itself;
 123	return 1;
 124}
 125
 126static void GrafObj_dealloc(GrafPortObject *self)
 127{
 128	/* Cleanup of self->ob_itself goes here */
 129	self->ob_type->tp_free((PyObject *)self);
 130}
 131
 132static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args)
 133{
 134	PyObject *_res = NULL;
 135#ifndef MacSetPort
 136	PyMac_PRECHECK(MacSetPort);
 137#endif
 138	if (!PyArg_ParseTuple(_args, ""))
 139		return NULL;
 140	MacSetPort(_self->ob_itself);
 141	Py_INCREF(Py_None);
 142	_res = Py_None;
 143	return _res;
 144}
 145
 146static PyObject *GrafObj_QDSwapPort(GrafPortObject *_self, PyObject *_args)
 147{
 148	PyObject *_res = NULL;
 149	Boolean _rv;
 150	CGrafPtr outOldPort;
 151#ifndef QDSwapPort
 152	PyMac_PRECHECK(QDSwapPort);
 153#endif
 154	if (!PyArg_ParseTuple(_args, ""))
 155		return NULL;
 156	_rv = QDSwapPort(_self->ob_itself,
 157	                 &outOldPort);
 158	_res = Py_BuildValue("bO&",
 159	                     _rv,
 160	                     GrafObj_New, outOldPort);
 161	return _res;
 162}
 163
 164static PyObject *GrafObj_IsValidPort(GrafPortObject *_self, PyObject *_args)
 165{
 166	PyObject *_res = NULL;
 167	Boolean _rv;
 168#ifndef IsValidPort
 169	PyMac_PRECHECK(IsValidPort);
 170#endif
 171	if (!PyArg_ParseTuple(_args, ""))
 172		return NULL;
 173	_rv = IsValidPort(_self->ob_itself);
 174	_res = Py_BuildValue("b",
 175	                     _rv);
 176	return _res;
 177}
 178
 179static PyObject *GrafObj_GetPortPixMap(GrafPortObject *_self, PyObject *_args)
 180{
 181	PyObject *_res = NULL;
 182	PixMapHandle _rv;
 183#ifndef GetPortPixMap
 184	PyMac_PRECHECK(GetPortPixMap);
 185#endif
 186	if (!PyArg_ParseTuple(_args, ""))
 187		return NULL;
 188	_rv = GetPortPixMap(_self->ob_itself);
 189	_res = Py_BuildValue("O&",
 190	                     ResObj_New, _rv);
 191	return _res;
 192}
 193
 194static PyObject *GrafObj_GetPortBitMapForCopyBits(GrafPortObject *_self, PyObject *_args)
 195{
 196	PyObject *_res = NULL;
 197	const BitMap * _rv;
 198#ifndef GetPortBitMapForCopyBits
 199	PyMac_PRECHECK(GetPortBitMapForCopyBits);
 200#endif
 201	if (!PyArg_ParseTuple(_args, ""))
 202		return NULL;
 203	_rv = GetPortBitMapForCopyBits(_self->ob_itself);
 204	_res = Py_BuildValue("O&",
 205	                     BMObj_New, _rv);
 206	return _res;
 207}
 208
 209static PyObject *GrafObj_GetPortBounds(GrafPortObject *_self, PyObject *_args)
 210{
 211	PyObject *_res = NULL;
 212	Rect rect;
 213#ifndef GetPortBounds
 214	PyMac_PRECHECK(GetPortBounds);
 215#endif
 216	if (!PyArg_ParseTuple(_args, ""))
 217		return NULL;
 218	GetPortBounds(_self->ob_itself,
 219	              &rect);
 220	_res = Py_BuildValue("O&",
 221	                     PyMac_BuildRect, &rect);
 222	return _res;
 223}
 224
 225static PyObject *GrafObj_GetPortForeColor(GrafPortObject *_self, PyObject *_args)
 226{
 227	PyObject *_res = NULL;
 228	RGBColor foreColor;
 229#ifndef GetPortForeColor
 230	PyMac_PRECHECK(GetPortForeColor);
 231#endif
 232	if (!PyArg_ParseTuple(_args, ""))
 233		return NULL;
 234	GetPortForeColor(_self->ob_itself,
 235	                 &foreColor);
 236	_res = Py_BuildValue("O&",
 237	                     QdRGB_New, &foreColor);
 238	return _res;
 239}
 240
 241static PyObject *GrafObj_GetPortBackColor(GrafPortObject *_self, PyObject *_args)
 242{
 243	PyObject *_res = NULL;
 244	RGBColor backColor;
 245#ifndef GetPortBackColor
 246	PyMac_PRECHECK(GetPortBackColor);
 247#endif
 248	if (!PyArg_ParseTuple(_args, ""))
 249		return NULL;
 250	GetPortBackColor(_self->ob_itself,
 251	                 &backColor);
 252	_res = Py_BuildValue("O&",
 253	                     QdRGB_New, &backColor);
 254	return _res;
 255}
 256
 257static PyObject *GrafObj_GetPortOpColor(GrafPortObject *_self, PyObject *_args)
 258{
 259	PyObject *_res = NULL;
 260	RGBColor opColor;
 261#ifndef GetPortOpColor
 262	PyMac_PRECHECK(GetPortOpColor);
 263#endif
 264	if (!PyArg_ParseTuple(_args, ""))
 265		return NULL;
 266	GetPortOpColor(_self->ob_itself,
 267	               &opColor);
 268	_res = Py_BuildValue("O&",
 269	                     QdRGB_New, &opColor);
 270	return _res;
 271}
 272
 273static PyObject *GrafObj_GetPortHiliteColor(GrafPortObject *_self, PyObject *_args)
 274{
 275	PyObject *_res = NULL;
 276	RGBColor hiliteColor;
 277#ifndef GetPortHiliteColor
 278	PyMac_PRECHECK(GetPortHiliteColor);
 279#endif
 280	if (!PyArg_ParseTuple(_args, ""))
 281		return NULL;
 282	GetPortHiliteColor(_self->ob_itself,
 283	                   &hiliteColor);
 284	_res = Py_BuildValue("O&",
 285	                     QdRGB_New, &hiliteColor);
 286	return _res;
 287}
 288
 289static PyObject *GrafObj_GetPortTextFont(GrafPortObject *_self, PyObject *_args)
 290{
 291	PyObject *_res = NULL;
 292	short _rv;
 293#ifndef GetPortTextFont
 294	PyMac_PRECHECK(GetPortTextFont);
 295#endif
 296	if (!PyArg_ParseTuple(_args, ""))
 297		return NULL;
 298	_rv = GetPortTextFont(_self->ob_itself);
 299	_res = Py_BuildValue("h",
 300	                     _rv);
 301	return _res;
 302}
 303
 304static PyObject *GrafObj_GetPortTextFace(GrafPortObject *_self, PyObject *_args)
 305{
 306	PyObject *_res = NULL;
 307	Style _rv;
 308#ifndef GetPortTextFace
 309	PyMac_PRECHECK(GetPortTextFace);
 310#endif
 311	if (!PyArg_ParseTuple(_args, ""))
 312		return NULL;
 313	_rv = GetPortTextFace(_self->ob_itself);
 314	_res = Py_BuildValue("b",
 315	                     _rv);
 316	return _res;
 317}
 318
 319static PyObject *GrafObj_GetPortTextMode(GrafPortObject *_self, PyObject *_args)
 320{
 321	PyObject *_res = NULL;
 322	short _rv;
 323#ifndef GetPortTextMode
 324	PyMac_PRECHECK(GetPortTextMode);
 325#endif
 326	if (!PyArg_ParseTuple(_args, ""))
 327		return NULL;
 328	_rv = GetPortTextMode(_self->ob_itself);
 329	_res = Py_BuildValue("h",
 330	                     _rv);
 331	return _res;
 332}
 333
 334static PyObject *GrafObj_GetPortTextSize(GrafPortObject *_self, PyObject *_args)
 335{
 336	PyObject *_res = NULL;
 337	short _rv;
 338#ifndef GetPortTextSize
 339	PyMac_PRECHECK(GetPortTextSize);
 340#endif
 341	if (!PyArg_ParseTuple(_args, ""))
 342		return NULL;
 343	_rv = GetPortTextSize(_self->ob_itself);
 344	_res = Py_BuildValue("h",
 345	                     _rv);
 346	return _res;
 347}
 348
 349static PyObject *GrafObj_GetPortChExtra(GrafPortObject *_self, PyObject *_args)
 350{
 351	PyObject *_res = NULL;
 352	short _rv;
 353#ifndef GetPortChExtra
 354	PyMac_PRECHECK(GetPortChExtra);
 355#endif
 356	if (!PyArg_ParseTuple(_args, ""))
 357		return NULL;
 358	_rv = GetPortChExtra(_self->ob_itself);
 359	_res = Py_BuildValue("h",
 360	                     _rv);
 361	return _res;
 362}
 363
 364static PyObject *GrafObj_GetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
 365{
 366	PyObject *_res = NULL;
 367	short _rv;
 368#ifndef GetPortFracHPenLocation
 369	PyMac_PRECHECK(GetPortFracHPenLocation);
 370#endif
 371	if (!PyArg_ParseTuple(_args, ""))
 372		return NULL;
 373	_rv = GetPortFracHPenLocation(_self->ob_itself);
 374	_res = Py_BuildValue("h",
 375	                     _rv);
 376	return _res;
 377}
 378
 379static PyObject *GrafObj_GetPortSpExtra(GrafPortObject *_self, PyObject *_args)
 380{
 381	PyObject *_res = NULL;
 382	Fixed _rv;
 383#ifndef GetPortSpExtra
 384	PyMac_PRECHECK(GetPortSpExtra);
 385#endif
 386	if (!PyArg_ParseTuple(_args, ""))
 387		return NULL;
 388	_rv = GetPortSpExtra(_self->ob_itself);
 389	_res = Py_BuildValue("O&",
 390	                     PyMac_BuildFixed, _rv);
 391	return _res;
 392}
 393
 394static PyObject *GrafObj_GetPortPenVisibility(GrafPortObject *_self, PyObject *_args)
 395{
 396	PyObject *_res = NULL;
 397	short _rv;
 398#ifndef GetPortPenVisibility
 399	PyMac_PRECHECK(GetPortPenVisibility);
 400#endif
 401	if (!PyArg_ParseTuple(_args, ""))
 402		return NULL;
 403	_rv = GetPortPenVisibility(_self->ob_itself);
 404	_res = Py_BuildValue("h",
 405	                     _rv);
 406	return _res;
 407}
 408
 409static PyObject *GrafObj_GetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
 410{
 411	PyObject *_res = NULL;
 412	RgnHandle _rv;
 413	RgnHandle visRgn;
 414#ifndef GetPortVisibleRegion
 415	PyMac_PRECHECK(GetPortVisibleRegion);
 416#endif
 417	if (!PyArg_ParseTuple(_args, "O&",
 418	                      ResObj_Convert, &visRgn))
 419		return NULL;
 420	_rv = GetPortVisibleRegion(_self->ob_itself,
 421	                           visRgn);
 422	_res = Py_BuildValue("O&",
 423	                     ResObj_New, _rv);
 424	return _res;
 425}
 426
 427static PyObject *GrafObj_GetPortClipRegion(GrafPortObject *_self, PyObject *_args)
 428{
 429	PyObject *_res = NULL;
 430	RgnHandle _rv;
 431	RgnHandle clipRgn;
 432#ifndef GetPortClipRegion
 433	PyMac_PRECHECK(GetPortClipRegion);
 434#endif
 435	if (!PyArg_ParseTuple(_args, "O&",
 436	                      ResObj_Convert, &clipRgn))
 437		return NULL;
 438	_rv = GetPortClipRegion(_self->ob_itself,
 439	                        clipRgn);
 440	_res = Py_BuildValue("O&",
 441	                     ResObj_New, _rv);
 442	return _res;
 443}
 444
 445static PyObject *GrafObj_GetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
 446{
 447	PyObject *_res = NULL;
 448	PixPatHandle _rv;
 449	PixPatHandle backPattern;
 450#ifndef GetPortBackPixPat
 451	PyMac_PRECHECK(GetPortBackPixPat);
 452#endif
 453	if (!PyArg_ParseTuple(_args, "O&",
 454	                      ResObj_Convert, &backPattern))
 455		return NULL;
 456	_rv = GetPortBackPixPat(_self->ob_itself,
 457	                        backPattern);
 458	_res = Py_BuildValue("O&",
 459	                     ResObj_New, _rv);
 460	return _res;
 461}
 462
 463static PyObject *GrafObj_GetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
 464{
 465	PyObject *_res = NULL;
 466	PixPatHandle _rv;
 467	PixPatHandle penPattern;
 468#ifndef GetPortPenPixPat
 469	PyMac_PRECHECK(GetPortPenPixPat);
 470#endif
 471	if (!PyArg_ParseTuple(_args, "O&",
 472	                      ResObj_Convert, &penPattern))
 473		return NULL;
 474	_rv = GetPortPenPixPat(_self->ob_itself,
 475	                       penPattern);
 476	_res = Py_BuildValue("O&",
 477	                     ResObj_New, _rv);
 478	return _res;
 479}
 480
 481static PyObject *GrafObj_GetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
 482{
 483	PyObject *_res = NULL;
 484	PixPatHandle _rv;
 485	PixPatHandle fillPattern;
 486#ifndef GetPortFillPixPat
 487	PyMac_PRECHECK(GetPortFillPixPat);
 488#endif
 489	if (!PyArg_ParseTuple(_args, "O&",
 490	                      ResObj_Convert, &fillPattern))
 491		return NULL;
 492	_rv = GetPortFillPixPat(_self->ob_itself,
 493	                        fillPattern);
 494	_res = Py_BuildValue("O&",
 495	                     ResObj_New, _rv);
 496	return _res;
 497}
 498
 499static PyObject *GrafObj_GetPortPenSize(GrafPortObject *_self, PyObject *_args)
 500{
 501	PyObject *_res = NULL;
 502	Point penSize;
 503#ifndef GetPortPenSize
 504	PyMac_PRECHECK(GetPortPenSize);
 505#endif
 506	if (!PyArg_ParseTuple(_args, "O&",
 507	                      PyMac_GetPoint, &penSize))
 508		return NULL;
 509	GetPortPenSize(_self->ob_itself,
 510	               &penSize);
 511	_res = Py_BuildValue("O&",
 512	                     PyMac_BuildPoint, penSize);
 513	return _res;
 514}
 515
 516static PyObject *GrafObj_GetPortPenMode(GrafPortObject *_self, PyObject *_args)
 517{
 518	PyObject *_res = NULL;
 519	SInt32 _rv;
 520#ifndef GetPortPenMode
 521	PyMac_PRECHECK(GetPortPenMode);
 522#endif
 523	if (!PyArg_ParseTuple(_args, ""))
 524		return NULL;
 525	_rv = GetPortPenMode(_self->ob_itself);
 526	_res = Py_BuildValue("l",
 527	                     _rv);
 528	return _res;
 529}
 530
 531static PyObject *GrafObj_GetPortPenLocation(GrafPortObject *_self, PyObject *_args)
 532{
 533	PyObject *_res = NULL;
 534	Point penLocation;
 535#ifndef GetPortPenLocation
 536	PyMac_PRECHECK(GetPortPenLocation);
 537#endif
 538	if (!PyArg_ParseTuple(_args, "O&",
 539	                      PyMac_GetPoint, &penLocation))
 540		return NULL;
 541	GetPortPenLocation(_self->ob_itself,
 542	                   &penLocation);
 543	_res = Py_BuildValue("O&",
 544	                     PyMac_BuildPoint, penLocation);
 545	return _res;
 546}
 547
 548static PyObject *GrafObj_IsPortRegionBeingDefined(GrafPortObject *_self, PyObject *_args)
 549{
 550	PyObject *_res = NULL;
 551	Boolean _rv;
 552#ifndef IsPortRegionBeingDefined
 553	PyMac_PRECHECK(IsPortRegionBeingDefined);
 554#endif
 555	if (!PyArg_ParseTuple(_args, ""))
 556		return NULL;
 557	_rv = IsPortRegionBeingDefined(_self->ob_itself);
 558	_res = Py_BuildValue("b",
 559	                     _rv);
 560	return _res;
 561}
 562
 563static PyObject *GrafObj_IsPortPictureBeingDefined(GrafPortObject *_self, PyObject *_args)
 564{
 565	PyObject *_res = NULL;
 566	Boolean _rv;
 567#ifndef IsPortPictureBeingDefined
 568	PyMac_PRECHECK(IsPortPictureBeingDefined);
 569#endif
 570	if (!PyArg_ParseTuple(_args, ""))
 571		return NULL;
 572	_rv = IsPortPictureBeingDefined(_self->ob_itself);
 573	_res = Py_BuildValue("b",
 574	                     _rv);
 575	return _res;
 576}
 577
 578static PyObject *GrafObj_IsPortPolyBeingDefined(GrafPortObject *_self, PyObject *_args)
 579{
 580	PyObject *_res = NULL;
 581	Boolean _rv;
 582#ifndef IsPortPolyBeingDefined
 583	PyMac_PRECHECK(IsPortPolyBeingDefined);
 584#endif
 585	if (!PyArg_ParseTuple(_args, ""))
 586		return NULL;
 587	_rv = IsPortPolyBeingDefined(_self->ob_itself);
 588	_res = Py_BuildValue("b",
 589	                     _rv);
 590	return _res;
 591}
 592
 593static PyObject *GrafObj_IsPortOffscreen(GrafPortObject *_self, PyObject *_args)
 594{
 595	PyObject *_res = NULL;
 596	Boolean _rv;
 597#ifndef IsPortOffscreen
 598	PyMac_PRECHECK(IsPortOffscreen);
 599#endif
 600	if (!PyArg_ParseTuple(_args, ""))
 601		return NULL;
 602	_rv = IsPortOffscreen(_self->ob_itself);
 603	_res = Py_BuildValue("b",
 604	                     _rv);
 605	return _res;
 606}
 607
 608static PyObject *GrafObj_IsPortColor(GrafPortObject *_self, PyObject *_args)
 609{
 610	PyObject *_res = NULL;
 611	Boolean _rv;
 612#ifndef IsPortColor
 613	PyMac_PRECHECK(IsPortColor);
 614#endif
 615	if (!PyArg_ParseTuple(_args, ""))
 616		return NULL;
 617	_rv = IsPortColor(_self->ob_itself);
 618	_res = Py_BuildValue("b",
 619	                     _rv);
 620	return _res;
 621}
 622
 623static PyObject *GrafObj_IsPortVisibleRegionEmpty(GrafPortObject *_self, PyObject *_args)
 624{
 625	PyObject *_res = NULL;
 626	Boolean _rv;
 627#ifndef IsPortVisibleRegionEmpty
 628	PyMac_PRECHECK(IsPortVisibleRegionEmpty);
 629#endif
 630	if (!PyArg_ParseTuple(_args, ""))
 631		return NULL;
 632	_rv = IsPortVisibleRegionEmpty(_self->ob_itself);
 633	_res = Py_BuildValue("b",
 634	                     _rv);
 635	return _res;
 636}
 637
 638static PyObject *GrafObj_IsPortClipRegionEmpty(GrafPortObject *_self, PyObject *_args)
 639{
 640	PyObject *_res = NULL;
 641	Boolean _rv;
 642#ifndef IsPortClipRegionEmpty
 643	PyMac_PRECHECK(IsPortClipRegionEmpty);
 644#endif
 645	if (!PyArg_ParseTuple(_args, ""))
 646		return NULL;
 647	_rv = IsPortClipRegionEmpty(_self->ob_itself);
 648	_res = Py_BuildValue("b",
 649	                     _rv);
 650	return _res;
 651}
 652
 653static PyObject *GrafObj_SectRegionWithPortClipRegion(GrafPortObject *_self, PyObject *_args)
 654{
 655	PyObject *_res = NULL;
 656	RgnHandle ioRegion;
 657#ifndef SectRegionWithPortClipRegion
 658	PyMac_PRECHECK(SectRegionWithPortClipRegion);
 659#endif
 660	if (!PyArg_ParseTuple(_args, "O&",
 661	                      ResObj_Convert, &ioRegion))
 662		return NULL;
 663	SectRegionWithPortClipRegion(_self->ob_itself,
 664	                             ioRegion);
 665	Py_INCREF(Py_None);
 666	_res = Py_None;
 667	return _res;
 668}
 669
 670static PyObject *GrafObj_SectRegionWithPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
 671{
 672	PyObject *_res = NULL;
 673	RgnHandle ioRegion;
 674#ifndef SectRegionWithPortVisibleRegion
 675	PyMac_PRECHECK(SectRegionWithPortVisibleRegion);
 676#endif
 677	if (!PyArg_ParseTuple(_args, "O&",
 678	                      ResObj_Convert, &ioRegion))
 679		return NULL;
 680	SectRegionWithPortVisibleRegion(_self->ob_itself,
 681	                                ioRegion);
 682	Py_INCREF(Py_None);
 683	_res = Py_None;
 684	return _res;
 685}
 686
 687static PyObject *GrafObj_SwapPortPicSaveHandle(GrafPortObject *_self, PyObject *_args)
 688{
 689	PyObject *_res = NULL;
 690	Handle _rv;
 691	Handle inPicSaveHdl;
 692#ifndef SwapPortPicSaveHandle
 693	PyMac_PRECHECK(SwapPortPicSaveHandle);
 694#endif
 695	if (!PyArg_ParseTuple(_args, "O&",
 696	                      ResObj_Convert, &inPicSaveHdl))
 697		return NULL;
 698	_rv = SwapPortPicSaveHandle(_self->ob_itself,
 699	                            inPicSaveHdl);
 700	_res = Py_BuildValue("O&",
 701	                     ResObj_New, _rv);
 702	return _res;
 703}
 704
 705static PyObject *GrafObj_SwapPortPolySaveHandle(GrafPortObject *_self, PyObject *_args)
 706{
 707	PyObject *_res = NULL;
 708	Handle _rv;
 709	Handle inPolySaveHdl;
 710#ifndef SwapPortPolySaveHandle
 711	PyMac_PRECHECK(SwapPortPolySaveHandle);
 712#endif
 713	if (!PyArg_ParseTuple(_args, "O&",
 714	                      ResObj_Convert, &inPolySaveHdl))
 715		return NULL;
 716	_rv = SwapPortPolySaveHandle(_self->ob_itself,
 717	                             inPolySaveHdl);
 718	_res = Py_BuildValue("O&",
 719	                     ResObj_New, _rv);
 720	return _res;
 721}
 722
 723static PyObject *GrafObj_SwapPortRegionSaveHandle(GrafPortObject *_self, PyObject *_args)
 724{
 725	PyObject *_res = NULL;
 726	Handle _rv;
 727	Handle inRegionSaveHdl;
 728#ifndef SwapPortRegionSaveHandle
 729	PyMac_PRECHECK(SwapPortRegionSaveHandle);
 730#endif
 731	if (!PyArg_ParseTuple(_args, "O&",
 732	                      ResObj_Convert, &inRegionSaveHdl))
 733		return NULL;
 734	_rv = SwapPortRegionSaveHandle(_self->ob_itself,
 735	                               inRegionSaveHdl);
 736	_res = Py_BuildValue("O&",
 737	                     ResObj_New, _rv);
 738	return _res;
 739}
 740
 741static PyObject *GrafObj_SetPortBounds(GrafPortObject *_self, PyObject *_args)
 742{
 743	PyObject *_res = NULL;
 744	Rect rect;
 745#ifndef SetPortBounds
 746	PyMac_PRECHECK(SetPortBounds);
 747#endif
 748	if (!PyArg_ParseTuple(_args, "O&",
 749	                      PyMac_GetRect, &rect))
 750		return NULL;
 751	SetPortBounds(_self->ob_itself,
 752	              &rect);
 753	Py_INCREF(Py_None);
 754	_res = Py_None;
 755	return _res;
 756}
 757
 758static PyObject *GrafObj_SetPortOpColor(GrafPortObject *_self, PyObject *_args)
 759{
 760	PyObject *_res = NULL;
 761	RGBColor opColor;
 762#ifndef SetPortOpColor
 763	PyMac_PRECHECK(SetPortOpColor);
 764#endif
 765	if (!PyArg_ParseTuple(_args, "O&",
 766	                      QdRGB_Convert, &opColor))
 767		return NULL;
 768	SetPortOpColor(_self->ob_itself,
 769	               &opColor);
 770	Py_INCREF(Py_None);
 771	_res = Py_None;
 772	return _res;
 773}
 774
 775static PyObject *GrafObj_SetPortTextFont(GrafPortObject *_self, PyObject *_args)
 776{
 777	PyObject *_res = NULL;
 778	short txFont;
 779#ifndef SetPortTextFont
 780	PyMac_PRECHECK(SetPortTextFont);
 781#endif
 782	if (!PyArg_ParseTuple(_args, "h",
 783	                      &txFont))
 784		return NULL;
 785	SetPortTextFont(_self->ob_itself,
 786	                txFont);
 787	Py_INCREF(Py_None);
 788	_res = Py_None;
 789	return _res;
 790}
 791
 792static PyObject *GrafObj_SetPortTextSize(GrafPortObject *_self, PyObject *_args)
 793{
 794	PyObject *_res = NULL;
 795	short txSize;
 796#ifndef SetPortTextSize
 797	PyMac_PRECHECK(SetPortTextSize);
 798#endif
 799	if (!PyArg_ParseTuple(_args, "h",
 800	                      &txSize))
 801		return NULL;
 802	SetPortTextSize(_self->ob_itself,
 803	                txSize);
 804	Py_INCREF(Py_None);
 805	_res = Py_None;
 806	return _res;
 807}
 808
 809static PyObject *GrafObj_SetPortTextFace(GrafPortObject *_self, PyObject *_args)
 810{
 811	PyObject *_res = NULL;
 812	StyleParameter face;
 813#ifndef SetPortTextFace
 814	PyMac_PRECHECK(SetPortTextFace);
 815#endif
 816	if (!PyArg_ParseTuple(_args, "h",
 817	                      &face))
 818		return NULL;
 819	SetPortTextFace(_self->ob_itself,
 820	                face);
 821	Py_INCREF(Py_None);
 822	_res = Py_None;
 823	return _res;
 824}
 825
 826static PyObject *GrafObj_SetPortTextMode(GrafPortObject *_self, PyObject *_args)
 827{
 828	PyObject *_res = NULL;
 829	short mode;
 830#ifndef SetPortTextMode
 831	PyMac_PRECHECK(SetPortTextMode);
 832#endif
 833	if (!PyArg_ParseTuple(_args, "h",
 834	                      &mode))
 835		return NULL;
 836	SetPortTextMode(_self->ob_itself,
 837	                mode);
 838	Py_INCREF(Py_None);
 839	_res = Py_None;
 840	return _res;
 841}
 842
 843static PyObject *GrafObj_SetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
 844{
 845	PyObject *_res = NULL;
 846	RgnHandle visRgn;
 847#ifndef SetPortVisibleRegion
 848	PyMac_PRECHECK(SetPortVisibleRegion);
 849#endif
 850	if (!PyArg_ParseTuple(_args, "O&",
 851	                      ResObj_Convert, &visRgn))
 852		return NULL;
 853	SetPortVisibleRegion(_self->ob_itself,
 854	                     visRgn);
 855	Py_INCREF(Py_None);
 856	_res = Py_None;
 857	return _res;
 858}
 859
 860static PyObject *GrafObj_SetPortClipRegion(GrafPortObject *_self, PyObject *_args)
 861{
 862	PyObject *_res = NULL;
 863	RgnHandle clipRgn;
 864#ifndef SetPortClipRegion
 865	PyMac_PRECHECK(SetPortClipRegion);
 866#endif
 867	if (!PyArg_ParseTuple(_args, "O&",
 868	                      ResObj_Convert, &clipRgn))
 869		return NULL;
 870	SetPortClipRegion(_self->ob_itself,
 871	                  clipRgn);
 872	Py_INCREF(Py_None);
 873	_res = Py_None;
 874	return _res;
 875}
 876
 877static PyObject *GrafObj_SetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
 878{
 879	PyObject *_res = NULL;
 880	PixPatHandle penPattern;
 881#ifndef SetPortPenPixPat
 882	PyMac_PRECHECK(SetPortPenPixPat);
 883#endif
 884	if (!PyArg_ParseTuple(_args, "O&",
 885	                      ResObj_Convert, &penPattern))
 886		return NULL;
 887	SetPortPenPixPat(_self->ob_itself,
 888	                 penPattern);
 889	Py_INCREF(Py_None);
 890	_res = Py_None;
 891	return _res;
 892}
 893
 894static PyObject *GrafObj_SetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
 895{
 896	PyObject *_res = NULL;
 897	PixPatHandle penPattern;
 898#ifndef SetPortFillPixPat
 899	PyMac_PRECHECK(SetPortFillPixPat);
 900#endif
 901	if (!PyArg_ParseTuple(_args, "O&",
 902	                      ResObj_Convert, &penPattern))
 903		return NULL;
 904	SetPortFillPixPat(_self->ob_itself,
 905	                  penPattern);
 906	Py_INCREF(Py_None);
 907	_res = Py_None;
 908	return _res;
 909}
 910
 911static PyObject *GrafObj_SetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
 912{
 913	PyObject *_res = NULL;
 914	PixPatHandle backPattern;
 915#ifndef SetPortBackPixPat
 916	PyMac_PRECHECK(SetPortBackPixPat);
 917#endif
 918	if (!PyArg_ParseTuple(_args, "O&",
 919	                      ResObj_Convert, &backPattern))
 920		return NULL;
 921	SetPortBackPixPat(_self->ob_itself,
 922	                  backPattern);
 923	Py_INCREF(Py_None);
 924	_res = Py_None;
 925	return _res;
 926}
 927
 928static PyObject *GrafObj_SetPortPenSize(GrafPortObject *_self, PyObject *_args)
 929{
 930	PyObject *_res = NULL;
 931	Point penSize;
 932#ifndef SetPortPenSize
 933	PyMac_PRECHECK(SetPortPenSize);
 934#endif
 935	if (!PyArg_ParseTuple(_args, "O&",
 936	                      PyMac_GetPoint, &penSize))
 937		return NULL;
 938	SetPortPenSize(_self->ob_itself,
 939	               penSize);
 940	Py_INCREF(Py_None);
 941	_res = Py_None;
 942	return _res;
 943}
 944
 945static PyObject *GrafObj_SetPortPenMode(GrafPortObject *_self, PyObject *_args)
 946{
 947	PyObject *_res = NULL;
 948	SInt32 penMode;
 949#ifndef SetPortPenMode
 950	PyMac_PRECHECK(SetPortPenMode);
 951#endif
 952	if (!PyArg_ParseTuple(_args, "l",
 953	                      &penMode))
 954		return NULL;
 955	SetPortPenMode(_self->ob_itself,
 956	               penMode);
 957	Py_INCREF(Py_None);
 958	_res = Py_None;
 959	return _res;
 960}
 961
 962static PyObject *GrafObj_SetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
 963{
 964	PyObject *_res = NULL;
 965	short pnLocHFrac;
 966#ifndef SetPortFracHPenLocation
 967	PyMac_PRECHECK(SetPortFracHPenLocation);
 968#endif
 969	if (!PyArg_ParseTuple(_args, "h",
 970	                      &pnLocHFrac))
 971		return NULL;
 972	SetPortFracHPenLocation(_self->ob_itself,
 973	                        pnLocHFrac);
 974	Py_INCREF(Py_None);
 975	_res = Py_None;
 976	return _res;
 977}
 978
 979static PyObject *GrafObj_DisposePort(GrafPortObject *_self, PyObject *_args)
 980{
 981	PyObject *_res = NULL;
 982#ifndef DisposePort
 983	PyMac_PRECHECK(DisposePort);
 984#endif
 985	if (!PyArg_ParseTuple(_args, ""))
 986		return NULL;
 987	DisposePort(_self->ob_itself);
 988	Py_INCREF(Py_None);
 989	_res = Py_None;
 990	return _res;
 991}
 992
 993static PyObject *GrafObj_QDLocalToGlobalPoint(GrafPortObject *_self, PyObject *_args)
 994{
 995	PyObject *_res = NULL;
 996	Point point;
 997#ifndef QDLocalToGlobalPoint
 998	PyMac_PRECHECK(QDLocalToGlobalPoint);
 999#endif
1000	if (!PyArg_ParseTuple(_args, "O&",
1001	                      PyMac_GetPoint, &point))
1002		return NULL;
1003	QDLocalToGlobalPoint(_self->ob_itself,
1004	                     &point);
1005	_res = Py_BuildValue("O&",
1006	                     PyMac_BuildPoint, point);
1007	return _res;
1008}
1009
1010static PyObject *GrafObj_QDGlobalToLocalPoint(GrafPortObject *_self, PyObject *_args)
1011{
1012	PyObject *_res = NULL;
1013	Point point;
1014#ifndef QDGlobalToLocalPoint
1015	PyMac_PRECHECK(QDGlobalToLocalPoint);
1016#endif
1017	if (!PyArg_ParseTuple(_args, "O&",
1018	                      PyMac_GetPoint, &point))
1019		return NULL;
1020	QDGlobalToLocalPoint(_self->ob_itself,
1021	                     &point);
1022	_res = Py_BuildValue("O&",
1023	                     PyMac_BuildPoint, point);
1024	return _res;
1025}
1026
1027static PyObject *GrafObj_QDLocalToGlobalRect(GrafPortObject *_self, PyObject *_args)
1028{
1029	PyObject *_res = NULL;
1030	Rect bounds;
1031#ifndef QDLocalToGlobalRect
1032	PyMac_PRECHECK(QDLocalToGlobalRect);
1033#endif
1034	if (!PyArg_ParseTuple(_args, ""))
1035		return NULL;
1036	QDLocalToGlobalRect(_self->ob_itself,
1037	                    &bounds);
1038	_res = Py_BuildValue("O&",
1039	                     PyMac_BuildRect, &bounds);
1040	return _res;
1041}
1042
1043static PyObject *GrafObj_QDGlobalToLocalRect(GrafPortObject *_self, PyObject *_args)
1044{
1045	PyObject *_res = NULL;
1046	Rect bounds;
1047#ifndef QDGlobalToLocalRect
1048	PyMac_PRECHECK(QDGlobalToLocalRect);
1049#endif
1050	if (!PyArg_ParseTuple(_args, ""))
1051		return NULL;
1052	QDGlobalToLocalRect(_self->ob_itself,
1053	                    &bounds);
1054	_res = Py_BuildValue("O&",
1055	                     PyMac_BuildRect, &bounds);
1056	return _res;
1057}
1058
1059static PyObject *GrafObj_QDLocalToGlobalRegion(GrafPortObject *_self, PyObject *_args)
1060{
1061	PyObject *_res = NULL;
1062	RgnHandle _rv;
1063	RgnHandle region;
1064#ifndef QDLocalToGlobalRegion
1065	PyMac_PRECHECK(QDLocalToGlobalRegion);
1066#endif
1067	if (!PyArg_ParseTuple(_args, "O&",
1068	                      ResObj_Convert, &region))
1069		return NULL;
1070	_rv = QDLocalToGlobalRegion(_self->ob_itself,
1071	                            region);
1072	_res = Py_BuildValue("O&",
1073	                     ResObj_New, _rv);
1074	return _res;
1075}
1076
1077static PyObject *GrafObj_QDGlobalToLocalRegion(GrafPortObject *_self, PyObject *_args)
1078{
1079	PyObject *_res = NULL;
1080	RgnHandle _rv;
1081	RgnHandle region;
1082#ifndef QDGlobalToLocalRegion
1083	PyMac_PRECHECK(QDGlobalToLocalRegion);
1084#endif
1085	if (!PyArg_ParseTuple(_args, "O&",
1086	                      ResObj_Convert, &region))
1087		return NULL;
1088	_rv = QDGlobalToLocalRegion(_self->ob_itself,
1089	                            region);
1090	_res = Py_BuildValue("O&",
1091	                     ResObj_New, _rv);
1092	return _res;
1093}
1094
1095static PyObject *GrafObj_QDIsPortBuffered(GrafPortObject *_self, PyObject *_args)
1096{
1097	PyObject *_res = NULL;
1098	Boolean _rv;
1099#ifndef QDIsPortBuffered
1100	PyMac_PRECHECK(QDIsPortBuffered);
1101#endif
1102	if (!PyArg_ParseTuple(_args, ""))
1103		return NULL;
1104	_rv = QDIsPortBuffered(_self->ob_itself);
1105	_res = Py_BuildValue("b",
1106	                     _rv);
1107	return _res;
1108}
1109
1110static PyObject *GrafObj_QDIsPortBufferDirty(GrafPortObject *_self, PyObject *_args)
1111{
1112	PyObject *_res = NULL;
1113	Boolean _rv;
1114#ifndef QDIsPortBufferDirty
1115	PyMac_PRECHECK(QDIsPortBufferDirty);
1116#endif
1117	if (!PyArg_ParseTuple(_args, ""))
1118		return NULL;
1119	_rv = QDIsPortBufferDirty(_self->ob_itself);
1120	_res = Py_BuildValue("b",
1121	                     _rv);
1122	return _res;
1123}
1124
1125static PyObject *GrafObj_QDFlushPortBuffer(GrafPortObject *_self, PyObject *_args)
1126{
1127	PyObject *_res = NULL;
1128	RgnHandle region;
1129#ifndef QDFlushPortBuffer
1130	PyMac_PRECHECK(QDFlushPortBuffer);
1131#endif
1132	if (!PyArg_ParseTuple(_args, "O&",
1133	                      OptResObj_Convert, &region))
1134		return NULL;
1135	QDFlushPortBuffer(_self->ob_itself,
1136	                  region);
1137	Py_INCREF(Py_None);
1138	_res = Py_None;
1139	return _res;
1140}
1141
1142static PyObject *GrafObj_QDGetDirtyRegion(GrafPortObject *_self, PyObject *_args)
1143{
1144	PyObject *_res = NULL;
1145	OSStatus _err;
1146	RgnHandle rgn;
1147#ifndef QDGetDirtyRegion
1148	PyMac_PRECHECK(QDGetDirtyRegion);
1149#endif
1150	if (!PyArg_ParseTuple(_args, "O&",
1151	                      ResObj_Convert, &rgn))
1152		return NULL;
1153	_err = QDGetDirtyRegion(_self->ob_itself,
1154	                        rgn);
1155	if (_err != noErr) return PyMac_Error(_err);
1156	Py_INCREF(Py_None);
1157	_res = Py_None;
1158	return _res;
1159}
1160
1161static PyObject *GrafObj_QDSetDirtyRegion(GrafPortObject *_self, PyObject *_args)
1162{
1163	PyObject *_res = NULL;
1164	OSStatus _err;
1165	RgnHandle rgn;
1166#ifndef QDSetDirtyRegion
1167	PyMac_PRECHECK(QDSetDirtyRegion);
1168#endif
1169	if (!PyArg_ParseTuple(_args, "O&",
1170	                      ResObj_Convert, &rgn))
1171		return NULL;
1172	_err = QDSetDirtyRegion(_self->ob_itself,
1173	                        rgn);
1174	if (_err != noErr) return PyMac_Error(_err);
1175	Py_INCREF(Py_None);
1176	_res = Py_None;
1177	return _res;
1178}
1179
1180static PyMethodDef GrafObj_methods[] = {
1181	{"MacSetPort", (PyCFunction)GrafObj_MacSetPort, 1,
1182	 PyDoc_STR("() -> None")},
1183	{"QDSwapPort", (PyCFunction)GrafObj_QDSwapPort, 1,
1184	 PyDoc_STR("() -> (Boolean _rv, CGrafPtr outOldPort)")},
1185	{"IsValidPort", (PyCFunction)GrafObj_IsValidPort, 1,
1186	 PyDoc_STR("() -> (Boolean _rv)")},
1187	{"GetPortPixMap", (PyCFunction)GrafObj_GetPortPixMap, 1,
1188	 PyDoc_STR("() -> (PixMapHandle _rv)")},
1189	{"GetPortBitMapForCopyBits", (PyCFunction)GrafObj_GetPortBitMapForCopyBits, 1,
1190	 PyDoc_STR("() -> (const BitMap * _rv)")},
1191	{"GetPortBounds", (PyCFunction)GrafObj_GetPortBounds, 1,
1192	 PyDoc_STR("() -> (Rect rect)")},
1193	{"GetPortForeColor", (PyCFunction)GrafObj_GetPortForeColor, 1,
1194	 PyDoc_STR("() -> (RGBColor foreColor)")},
1195	{"GetPortBackColor", (PyCFunction)GrafObj_GetPortBackColor, 1,
1196	 PyDoc_STR("() -> (RGBColor backColor)")},
1197	{"GetPortOpColor", (PyCFunction)GrafObj_GetPortOpColor, 1,
1198	 PyDoc_STR("() -> (RGBColor opColor)")},
1199	{"GetPortHiliteColor", (PyCFunction)GrafObj_GetPortHiliteColor, 1,
1200	 PyDoc_STR("() -> (RGBColor hiliteColor)")},
1201	{"GetPortTextFont", (PyCFunction)GrafObj_GetPortTextFont, 1,
1202	 PyDoc_STR("() -> (short _rv)")},
1203	{"GetPortTextFace", (PyCFunction)GrafObj_GetPortTextFace, 1,
1204	 PyDoc_STR("() -> (Style _rv)")},
1205	{"GetPortTextMode", (PyCFunction)GrafObj_GetPortTextMode, 1,
1206	 PyDoc_STR("() -> (short _rv)")},
1207	{"GetPortTextSize", (PyCFunction)GrafObj_GetPortTextSize, 1,
1208	 PyDoc_STR("() -> (short _rv)")},
1209	{"GetPortChExtra", (PyCFunction)GrafObj_GetPortChExtra, 1,
1210	 PyDoc_STR("() -> (short _rv)")},
1211	{"GetPortFracHPenLocation", (PyCFunction)GrafObj_GetPortFracHPenLocation, 1,
1212	 PyDoc_STR("() -> (short _rv)")},
1213	{"GetPortSpExtra", (PyCFunction)GrafObj_GetPortSpExtra, 1,
1214	 PyDoc_STR("() -> (Fixed _rv)")},
1215	{"GetPortPenVisibility", (PyCFunction)GrafObj_GetPortPenVisibility, 1,
1216	 PyDoc_STR("() -> (short _rv)")},
1217	{"GetPortVisibleRegion", (PyCFunction)GrafObj_GetPortVisibleRegion, 1,
1218	 PyDoc_STR("(RgnHandle visRgn) -> (RgnHandle _rv)")},
1219	{"GetPortClipRegion", (PyCFunction)GrafObj_GetPortClipRegion, 1,
1220	 PyDoc_STR("(RgnHandle clipRgn) -> (RgnHandle _rv)")},
1221	{"GetPortBackPixPat", (PyCFunction)GrafObj_GetPortBackPixPat, 1,
1222	 PyDoc_STR("(PixPatHandle backPattern) -> (PixPatHandle _rv)")},
1223	{"GetPortPenPixPat", (PyCFunction)GrafObj_GetPortPenPixPat, 1,
1224	 PyDoc_STR("(PixPatHandle penPattern) -> (PixPatHandle _rv)")},
1225	{"GetPortFillPixPat", (PyCFunction)GrafObj_GetPortFillPixPat, 1,
1226	 PyDoc_STR("(PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
1227	{"GetPortPenSize", (PyCFunction)GrafObj_GetPortPenSize, 1,
1228	 PyDoc_STR("(Point penSize) -> (Point penSize)")},
1229	{"GetPortPenMode", (PyCFunction)GrafObj_GetPortPenMode, 1,
1230	 PyDoc_STR("() -> (SInt32 _rv)")},
1231	{"GetPortPenLocation", (PyCFunction)GrafObj_GetPortPenLocation, 1,
1232	 PyDoc_STR("(Point penLocation) -> (Point penLocation)")},
1233	{"IsPortRegionBeingDefined", (PyCFunction)GrafObj_IsPortRegionBeingDefined, 1,
1234	 PyDoc_STR("() -> (Boolean _rv)")},
1235	{"IsPortPictureBeingDefined", (PyCFunction)GrafObj_IsPortPictureBeingDefined, 1,
1236	 PyDoc_STR("() -> (Boolean _rv)")},
1237	{"IsPortPolyBeingDefined", (PyCFunction)GrafObj_IsPortPolyBeingDefined, 1,
1238	 PyDoc_STR("() -> (Boolean _rv)")},
1239	{"IsPortOffscreen", (PyCFunction)GrafObj_IsPortOffscreen, 1,
1240	 PyDoc_STR("() -> (Boolean _rv)")},
1241	{"IsPortColor", (PyCFunction)GrafObj_IsPortColor, 1,
1242	 PyDoc_STR("() -> (Boolean _rv)")},
1243	{"IsPortVisibleRegionEmpty", (PyCFunction)GrafObj_IsPortVisibleRegionEmpty, 1,
1244	 PyDoc_STR("() -> (Boolean _rv)")},
1245	{"IsPortClipRegionEmpty", (PyCFunction)GrafObj_IsPortClipRegionEmpty, 1,
1246	 PyDoc_STR("() -> (Boolean _rv)")},
1247	{"SectRegionWithPortClipRegion", (PyCFunction)GrafObj_SectRegionWithPortClipRegion, 1,
1248	 PyDoc_STR("(RgnHandle ioRegion) -> None")},
1249	{"SectRegionWithPortVisibleRegion", (PyCFunction)GrafObj_SectRegionWithPortVisibleRegion, 1,
1250	 PyDoc_STR("(RgnHandle ioRegion) -> None")},
1251	{"SwapPortPicSaveHandle", (PyCFunction)GrafObj_SwapPortPicSaveHandle, 1,
1252	 PyDoc_STR("(Handle inPicSaveHdl) -> (Handle _rv)")},
1253	{"SwapPortPolySaveHandle", (PyCFunction)GrafObj_SwapPortPolySaveHandle, 1,
1254	 PyDoc_STR("(Handle inPolySaveHdl) -> (Handle _rv)")},
1255	{"SwapPortRegionSaveHandle", (PyCFunction)GrafObj_SwapPortRegionSaveHandle, 1,
1256	 PyDoc_STR("(Handle inRegionSaveHdl) -> (Handle _rv)")},
1257	{"SetPortBounds", (PyCFunction)GrafObj_SetPortBounds, 1,
1258	 PyDoc_STR("(Rect rect) -> None")},
1259	{"SetPortOpColor", (PyCFunction)GrafObj_SetPortOpColor, 1,
1260	 PyDoc_STR("(RGBColor opColor) -> None")},
1261	{"SetPortTextFont", (PyCFunction)GrafObj_SetPortTextFont, 1,
1262	 PyDoc_STR("(short txFont) -> None")},
1263	{"SetPortTextSize", (PyCFunction)GrafObj_SetPortTextSize, 1,
1264	 PyDoc_STR("(short txSize) -> None")},
1265	{"SetPortTextFace", (PyCFunction)GrafObj_SetPortTextFace, 1,
1266	 PyDoc_STR("(StyleParameter face) -> None")},
1267	{"SetPortTextMode", (PyCFunction)GrafObj_SetPortTextMode, 1,
1268	 PyDoc_STR("(short mode) -> None")},
1269	{"SetPortVisibleRegion", (PyCFunction)GrafObj_SetPortVisibleRegion, 1,
1270	 PyDoc_STR("(RgnHandle visRgn) -> None")},
1271	{"SetPortClipRegion", (PyCFunction)GrafObj_SetPortClipRegion, 1,
1272	 PyDoc_STR("(RgnHandle clipRgn) -> None")},
1273	{"SetPortPenPixPat", (PyCFunction)GrafObj_SetPortPenPixPat, 1,
1274	 PyDoc_STR("(PixPatHandle penPattern) -> None")},
1275	{"SetPortFillPixPat", (PyCFunction)GrafObj_SetPortFillPixPat, 1,
1276	 PyDoc_STR("(PixPatHandle penPattern) -> None")},
1277	{"SetPortBackPixPat", (PyCFunction)GrafObj_SetPortBackPixPat, 1,
1278	 PyDoc_STR("(PixPatHandle backPattern) -> None")},
1279	{"SetPortPenSize", (PyCFunction)GrafObj_SetPortPenSize, 1,
1280	 PyDoc_STR("(Point penSize) -> None")},
1281	{"SetPortPenMode", (PyCFunction)GrafObj_SetPortPenMode, 1,
1282	 PyDoc_STR("(SInt32 penMode) -> None")},
1283	{"SetPortFracHPenLocation", (PyCFunction)GrafObj_SetPortFracHPenLocation, 1,
1284	 PyDoc_STR("(short pnLocHFrac) -> None")},
1285	{"DisposePort", (PyCFunction)GrafObj_DisposePort, 1,
1286	 PyDoc_STR("() -> None")},
1287	{"QDLocalToGlobalPoint", (PyCFunction)GrafObj_QDLocalToGlobalPoint, 1,
1288	 PyDoc_STR("(Point point) -> (Point point)")},
1289	{"QDGlobalToLocalPoint", (PyCFunction)GrafObj_QDGlobalToLocalPoint, 1,
1290	 PyDoc_STR("(Point point) -> (Point point)")},
1291	{"QDLocalToGlobalRect", (PyCFunction)GrafObj_QDLocalToGlobalRect, 1,
1292	 PyDoc_STR("() -> (Rect bounds)")},
1293	{"QDGlobalToLocalRect", (PyCFunction)GrafObj_QDGlobalToLocalRect, 1,
1294	 PyDoc_STR("() -> (Rect bounds)")},
1295	{"QDLocalToGlobalRegion", (PyCFunction)GrafObj_QDLocalToGlobalRegion, 1,
1296	 PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")},
1297	{"QDGlobalToLocalRegion", (PyCFunction)GrafObj_QDGlobalToLocalRegion, 1,
1298	 PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")},
1299	{"QDIsPortBuffered", (PyCFunction)GrafObj_QDIsPortBuffered, 1,
1300	 PyDoc_STR("() -> (Boolean _rv)")},
1301	{"QDIsPortBufferDirty", (PyCFunction)GrafObj_QDIsPortBufferDirty, 1,
1302	 PyDoc_STR("() -> (Boolean _rv)")},
1303	{"QDFlushPortBuffer", (PyCFunction)GrafObj_QDFlushPortBuffer, 1,
1304	 PyDoc_STR("(RgnHandle region) -> None")},
1305	{"QDGetDirtyRegion", (PyCFunction)GrafObj_QDGetDirtyRegion, 1,
1306	 PyDoc_STR("(RgnHandle rgn) -> None")},
1307	{"QDSetDirtyRegion", (PyCFunction)GrafObj_QDSetDirtyRegion, 1,
1308	 PyDoc_STR("(RgnHandle rgn) -> None")},
1309	{NULL, NULL, 0}
1310};
1311
1312static PyObject *GrafObj_get_visRgn(GrafPortObject *self, void *closure)
1313{
1314	RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
1315	            return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
1316	            
1317}
1318
1319#define GrafObj_set_visRgn NULL
1320
1321static PyObject *GrafObj_get_clipRgn(GrafPortObject *self, void *closure)
1322{
1323	RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
1324	            return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
1325	            
1326}
1327
1328#define GrafObj_set_clipRgn NULL
1329
1330static PyGetSetDef GrafObj_getsetlist[] = {
1331	{"visRgn", (getter)GrafObj_get_visRgn, (setter)GrafObj_set_visRgn, "Convenience attribute: return a copy of the visible region"},
1332	{"clipRgn", (getter)GrafObj_get_clipRgn, (setter)GrafObj_set_clipRgn, "Convenience attribute: return a copy of the clipping region"},
1333	{NULL, NULL, NULL, NULL},
1334};
1335
1336
1337#define GrafObj_compare NULL
1338
1339#define GrafObj_repr NULL
1340
1341#define GrafObj_hash NULL
1342#define GrafObj_tp_init 0
1343
1344#define GrafObj_tp_alloc PyType_GenericAlloc
1345
1346static PyObject *GrafObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
1347{
1348	PyObject *_self;
1349	GrafPtr itself;
1350	char *kw[] = {"itself", 0};
1351
1352	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, GrafObj_Convert, &itself)) return NULL;
1353	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
1354	((GrafPortObject *)_self)->ob_itself = itself;
1355	return _self;
1356}
1357
1358#define GrafObj_tp_free PyObject_Del
1359
1360
1361PyTypeObject GrafPort_Type = {
1362	PyObject_HEAD_INIT(NULL)
1363	0, /*ob_size*/
1364	"_Qd.GrafPort", /*tp_name*/
1365	sizeof(GrafPortObject), /*tp_basicsize*/
1366	0, /*tp_itemsize*/
1367	/* methods */
1368	(destructor) GrafObj_dealloc, /*tp_dealloc*/
1369	0, /*tp_print*/
1370	(getattrfunc)0, /*tp_getattr*/
1371	(setattrfunc)0, /*tp_setattr*/
1372	(cmpfunc) GrafObj_compare, /*tp_compare*/
1373	(reprfunc) GrafObj_repr, /*tp_repr*/
1374	(PyNumberMethods *)0, /* tp_as_number */
1375	(PySequenceMethods *)0, /* tp_as_sequence */
1376	(PyMappingMethods *)0, /* tp_as_mapping */
1377	(hashfunc) GrafObj_hash, /*tp_hash*/
1378	0, /*tp_call*/
1379	0, /*tp_str*/
1380	PyObject_GenericGetAttr, /*tp_getattro*/
1381	PyObject_GenericSetAttr, /*tp_setattro */
1382	0, /*tp_as_buffer*/
1383	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
1384	0, /*tp_doc*/
1385	0, /*tp_traverse*/
1386	0, /*tp_clear*/
1387	0, /*tp_richcompare*/
1388	0, /*tp_weaklistoffset*/
1389	0, /*tp_iter*/
1390	0, /*tp_iternext*/
1391	GrafObj_methods, /* tp_methods */
1392	0, /*tp_members*/
1393	GrafObj_getsetlist, /*tp_getset*/
1394	0, /*tp_base*/
1395	0, /*tp_dict*/
1396	0, /*tp_descr_get*/
1397	0, /*tp_descr_set*/
1398	0, /*tp_dictoffset*/
1399	GrafObj_tp_init, /* tp_init */
1400	GrafObj_tp_alloc, /* tp_alloc */
1401	GrafObj_tp_new, /* tp_new */
1402	GrafObj_tp_free, /* tp_free */
1403};
1404
1405/* -------------------- End object type GrafPort -------------------- */
1406
1407
1408/* ----------------------- Object type BitMap ----------------------- */
1409
1410PyTypeObject BitMap_Type;
1411
1412#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type))
1413
1414typedef struct BitMapObject {
1415	PyObject_HEAD
1416	BitMapPtr ob_itself;
1417	PyObject *referred_object;
1418	BitMap *referred_bitmap;
1419} BitMapObject;
1420
1421PyObject *BMObj_New(BitMapPtr itself)
1422{
1423	BitMapObject *it;
1424	if (itself == NULL) return PyMac_Error(resNotFound);
1425	it = PyObject_NEW(BitMapObject, &BitMap_Type);
1426	if (it == NULL) return NULL;
1427	it->ob_itself = itself;
1428	it->referred_object = NULL;
1429	it->referred_bitmap = NULL;
1430	return (PyObject *)it;
1431}
1432
1433int BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
1434{
1435	if (!BMObj_Check(v))
1436	{
1437		PyErr_SetString(PyExc_TypeError, "BitMap required");
1438		return 0;
1439	}
1440	*p_itself = ((BitMapObject *)v)->ob_itself;
1441	return 1;
1442}
1443
1444static void BMObj_dealloc(BitMapObject *self)
1445{
1446	Py_XDECREF(self->referred_object);
1447	if (self->referred_bitmap) free(self->referred_bitmap);
1448	self->ob_type->tp_free((PyObject *)self);
1449}
1450
1451static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
1452{
1453	PyObject *_res = NULL;
1454
1455	int from, length;
1456	char *cp;
1457
1458	if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
1459	        return NULL;
1460	cp = _self->ob_itself->baseAddr+from;
1461	_res = PyString_FromStringAndSize(cp, length);
1462	return _res;
1463
1464}
1465
1466static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
1467{
1468	PyObject *_res = NULL;
1469
1470	int from, length;
1471	char *cp, *icp;
1472
1473	if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
1474	        return NULL;
1475	cp = _self->ob_itself->baseAddr+from;
1476	memcpy(cp, icp, length);
1477	Py_INCREF(Py_None);
1478	_res = Py_None;
1479	return _res;
1480
1481}
1482
1483static PyMethodDef BMObj_methods[] = {
1484	{"getdata", (PyCFunction)BMObj_getdata, 1,
1485	 PyDoc_STR("(int start, int size) -> string. Return bytes from the bitmap")},
1486	{"putdata", (PyCFunction)BMObj_putdata, 1,
1487	 PyDoc_STR("(int start, string data). Store bytes into the bitmap")},
1488	{NULL, NULL, 0}
1489};
1490
1491static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure)
1492{
1493	return PyInt_FromLong((long)self->ob_itself->baseAddr);
1494}
1495
1496#define BMObj_set_baseAddr NULL
1497
1498static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure)
1499{
1500	return PyInt_FromLong((long)self->ob_itself->rowBytes);
1501}
1502
1503#define BMObj_set_rowBytes NULL
1504
1505static PyObject *BMObj_get_bounds(BitMapObject *self, void *closure)
1506{
1507	return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
1508}
1509
1510#define BMObj_set_bounds NULL
1511
1512static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure)
1513{
1514	return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
1515}
1516
1517#define BMObj_set_bitmap_data NULL
1518
1519static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure)
1520{
1521	return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
1522}
1523
1524#define BMObj_set_pixmap_data NULL
1525
1526static PyGetSetDef BMObj_getsetlist[] = {
1527	{"baseAddr", (getter)BMObj_get_baseAddr, (setter)BMObj_set_baseAddr, NULL},
1528	{"rowBytes", (getter)BMObj_get_rowBytes, (setter)BMObj_set_rowBytes, NULL},
1529	{"bounds", (getter)BMObj_get_bounds, (setter)BMObj_set_bounds, NULL},
1530	{"bitmap_data", (getter)BMObj_get_bitmap_data, (setter)BMObj_set_bitmap_data, NULL},
1531	{"pixmap_data", (getter)BMObj_get_pixmap_data, (setter)BMObj_set_pixmap_data, NULL},
1532	{NULL, NULL, NULL, NULL},
1533};
1534
1535
1536#define BMObj_compare NULL
1537
1538#define BMObj_repr NULL
1539
1540#define BMObj_hash NULL
1541#define BMObj_tp_init 0
1542
1543#define BMObj_tp_alloc PyType_GenericAlloc
1544
1545static PyObject *BMObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
1546{
1547	PyObject *_self;
1548	BitMapPtr itself;
1549	char *kw[] = {"itself", 0};
1550
1551	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, BMObj_Convert, &itself)) return NULL;
1552	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
1553	((BitMapObject *)_self)->ob_itself = itself;
1554	return _self;
1555}
1556
1557#define BMObj_tp_free PyObject_Del
1558
1559
1560PyTypeObject BitMap_Type = {
1561	PyObject_HEAD_INIT(NULL)
1562	0, /*ob_size*/
1563	"_Qd.BitMap", /*tp_name*/
1564	sizeof(BitMapObject), /*tp_basicsize*/
1565	0, /*tp_itemsize*/
1566	/* methods */
1567	(destructor) BMObj_dealloc, /*tp_dealloc*/
1568	0, /*tp_print*/
1569	(getattrfunc)0, /*tp_getattr*/
1570	(setattrfunc)0, /*tp_setattr*/
1571	(cmpfunc) BMObj_compare, /*tp_compare*/
1572	(reprfunc) BMObj_repr, /*tp_repr*/
1573	(PyNumberMethods *)0, /* tp_as_number */
1574	(PySequenceMethods *)0, /* tp_as_sequence */
1575	(PyMappingMethods *)0, /* tp_as_mapping */
1576	(hashfunc) BMObj_hash, /*tp_hash*/
1577	0, /*tp_call*/
1578	0, /*tp_str*/
1579	PyObject_GenericGetAttr, /*tp_getattro*/
1580	PyObject_GenericSetAttr, /*tp_setattro */
1581	0, /*tp_as_buffer*/
1582	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
1583	0, /*tp_doc*/
1584	0, /*tp_traverse*/
1585	0, /*tp_clear*/
1586	0, /*tp_richcompare*/
1587	0, /*tp_weaklistoffset*/
1588	0, /*tp_iter*/
1589	0, /*tp_iternext*/
1590	BMObj_methods, /* tp_methods */
1591	0, /*tp_members*/
1592	BMObj_getsetlist, /*tp_getset*/
1593	0, /*tp_base*/
1594	0, /*tp_dict*/
1595	0, /*tp_descr_get*/
1596	0, /*tp_descr_set*/
1597	0, /*tp_dictoffset*/
1598	BMObj_tp_init, /* tp_init */
1599	BMObj_tp_alloc, /* tp_alloc */
1600	BMObj_tp_new, /* tp_new */
1601	BMObj_tp_free, /* tp_free */
1602};
1603
1604/* --------------------- End object type BitMap --------------------- */
1605
1606
1607static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
1608{
1609	PyObject *_res = NULL;
1610	GrafPtr port;
1611#ifndef GetPort
1612	PyMac_PRECHECK(GetPort);
1613#endif
1614	if (!PyArg_ParseTuple(_args, ""))
1615		return NULL;
1616	GetPort(&port);
1617	_res = Py_BuildValue("O&",
1618	                     GrafObj_New, port);
1619	return _res;
1620}
1621
1622static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
1623{
1624	PyObject *_res = NULL;
1625	short device;
1626#ifndef GrafDevice
1627	PyMac_PRECHECK(GrafDevice);
1628#endif
1629	if (!PyArg_ParseTuple(_args, "h",
1630	                      &device))
1631		return NULL;
1632	GrafDevice(device);
1633	Py_INCREF(Py_None);
1634	_res = Py_None;
1635	return _res;
1636}
1637
1638static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
1639{
1640	PyObject *_res = NULL;
1641	BitMapPtr bm;
1642#ifndef SetPortBits
1643	PyMac_PRECHECK(SetPortBits);
1644#endif
1645	if (!PyArg_ParseTuple(_args, "O&",
1646	                      BMObj_Convert, &bm))
1647		return NULL;
1648	SetPortBits(bm);
1649	Py_INCREF(Py_None);
1650	_res = Py_None;
1651	return _res;
1652}
1653
1654static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
1655{
1656	PyObject *_res = NULL;
1657	short width;
1658	short height;
1659#ifndef PortSize
1660	PyMac_PRECHECK(PortSize);
1661#endif
1662	if (!PyArg_ParseTuple(_args, "hh",
1663	                      &width,
1664	                      &height))
1665		return NULL;
1666	PortSize(width,
1667	         height);
1668	Py_INCREF(Py_None);
1669	_res = Py_None;
1670	return _res;
1671}
1672
1673static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
1674{
1675	PyObject *_res = NULL;
1676	short leftGlobal;
1677	short topGlobal;
1678#ifndef MovePortTo
1679	PyMac_PRECHECK(MovePortTo);
1680#endif
1681	if (!PyArg_ParseTuple(_args, "hh",
1682	                      &leftGlobal,
1683	                      &topGlobal))
1684		return NULL;
1685	MovePortTo(leftGlobal,
1686	           topGlobal);
1687	Py_INCREF(Py_None);
1688	_res = Py_None;
1689	return _res;
1690}
1691
1692static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
1693{
1694	PyObject *_res = NULL;
1695	short h;
1696	short v;
1697#ifndef SetOrigin
1698	PyMac_PRECHECK(SetOrigin);
1699#endif
1700	if (!PyArg_ParseTuple(_args, "hh",
1701	                      &h,
1702	                      &v))
1703		return NULL;
1704	SetOrigin(h,
1705	          v);
1706	Py_INCREF(Py_None);
1707	_res = Py_None;
1708	return _res;
1709}
1710
1711static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
1712{
1713	PyObject *_res = NULL;
1714	RgnHandle rgn;
1715#ifndef SetClip
1716	PyMac_PRECHECK(SetClip);
1717#endif
1718	if (!PyArg_ParseTuple(_args, "O&",
1719	                      ResObj_Convert, &rgn))
1720		return NULL;
1721	SetClip(rgn);
1722	Py_INCREF(Py_None);
1723	_res = Py_None;
1724	return _res;
1725}
1726
1727static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
1728{
1729	PyObject *_res = NULL;
1730	RgnHandle rgn;
1731#ifndef GetClip
1732	PyMac_PRECHECK(GetClip);
1733#endif
1734	if (!PyArg_ParseTuple(_args, "O&",
1735	                      ResObj_Convert, &rgn))
1736		return NULL;
1737	GetClip(rgn);
1738	Py_INCREF(Py_None);
1739	_res = Py_None;
1740	return _res;
1741}
1742
1743static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
1744{
1745	PyObject *_res = NULL;
1746	Rect r;
1747#ifndef ClipRect
1748	PyMac_PRECHECK(ClipRect);
1749#endif
1750	if (!PyArg_ParseTuple(_args, "O&",
1751	                      PyMac_GetRect, &r))
1752		return NULL;
1753	ClipRect(&r);
1754	Py_INCREF(Py_None);
1755	_res = Py_None;
1756	return _res;
1757}
1758
1759static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
1760{
1761	PyObject *_res = NULL;
1762	Pattern *pat__in__;
1763	int pat__in_len__;
1764#ifndef BackPat
1765	PyMac_PRECHECK(BackPat);
1766#endif
1767	if (!PyArg_ParseTuple(_args, "s#",
1768	                      (char **)&pat__in__, &pat__in_len__))
1769		return NULL;
1770	if (pat__in_len__ != sizeof(Pattern))
1771	{
1772		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1773		goto pat__error__;
1774	}
1775	BackPat(pat__in__);
1776	Py_INCREF(Py_None);
1777	_res = Py_None;
1778 pat__error__: ;
1779	return _res;
1780}
1781
1782static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
1783{
1784	PyObject *_res = NULL;
1785#ifndef InitCursor
1786	PyMac_PRECHECK(InitCursor);
1787#endif
1788	if (!PyArg_ParseTuple(_args, ""))
1789		return NULL;
1790	InitCursor();
1791	Py_INCREF(Py_None);
1792	_res = Py_None;
1793	return _res;
1794}
1795
1796static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
1797{
1798	PyObject *_res = NULL;
1799	Cursor *crsr__in__;
1800	int crsr__in_len__;
1801#ifndef MacSetCursor
1802	PyMac_PRECHECK(MacSetCursor);
1803#endif
1804	if (!PyArg_ParseTuple(_args, "s#",
1805	                      (char **)&crsr__in__, &crsr__in_len__))
1806		return NULL;
1807	if (crsr__in_len__ != sizeof(Cursor))
1808	{
1809		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
1810		goto crsr__error__;
1811	}
1812	MacSetCursor(crsr__in__);
1813	Py_INCREF(Py_None);
1814	_res = Py_None;
1815 crsr__error__: ;
1816	return _res;
1817}
1818
1819static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
1820{
1821	PyObject *_res = NULL;
1822#ifndef HideCursor
1823	PyMac_PRECHECK(HideCursor);
1824#endif
1825	if (!PyArg_ParseTuple(_args, ""))
1826		return NULL;
1827	HideCursor();
1828	Py_INCREF(Py_None);
1829	_res = Py_None;
1830	return _res;
1831}
1832
1833static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
1834{
1835	PyObject *_res = NULL;
1836#ifndef MacShowCursor
1837	PyMac_PRECHECK(MacShowCursor);
1838#endif
1839	if (!PyArg_ParseTuple(_args, ""))
1840		return NULL;
1841	MacShowCursor();
1842	Py_INCREF(Py_None);
1843	_res = Py_None;
1844	return _res;
1845}
1846
1847static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
1848{
1849	PyObject *_res = NULL;
1850#ifndef ObscureCursor
1851	PyMac_PRECHECK(ObscureCursor);
1852#endif
1853	if (!PyArg_ParseTuple(_args, ""))
1854		return NULL;
1855	ObscureCursor();
1856	Py_INCREF(Py_None);
1857	_res = Py_None;
1858	return _res;
1859}
1860
1861static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
1862{
1863	PyObject *_res = NULL;
1864#ifndef HidePen
1865	PyMac_PRECHECK(HidePen);
1866#endif
1867	if (!PyArg_ParseTuple(_args, ""))
1868		return NULL;
1869	HidePen();
1870	Py_INCREF(Py_None);
1871	_res = Py_None;
1872	return _res;
1873}
1874
1875stat

Large files files are truncated, but you can click here to view the full file