PageRenderTime 163ms CodeModel.GetById 62ms app.highlight 82ms RepoModel.GetById 1ms app.codeStats 2ms

/Mac/Modules/win/_Winmodule.c

http://unladen-swallow.googlecode.com/
C | 3265 lines | 3056 code | 198 blank | 11 comment | 326 complexity | c6fb76daca4c71dd4064a7870f571f18 MD5 | raw file

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

   1
   2/* ========================== Module _Win =========================== */
   3
   4#include "Python.h"
   5
   6#ifndef __LP64__
   7
   8#include "pymactoolbox.h"
   9
  10/* Macro to test whether a weak-loaded CFM function exists */
  11#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
  12        PyErr_SetString(PyExc_NotImplementedError, \
  13        "Not available in this shared library/OS version"); \
  14        return NULL; \
  15    }} while(0)
  16
  17
  18#include <Carbon/Carbon.h>
  19
  20#ifdef USE_TOOLBOX_OBJECT_GLUE
  21extern PyObject *_WinObj_New(WindowRef);
  22extern PyObject *_WinObj_WhichWindow(WindowRef);
  23extern int _WinObj_Convert(PyObject *, WindowRef *);
  24
  25#define WinObj_New _WinObj_New
  26#define WinObj_WhichWindow _WinObj_WhichWindow
  27#define WinObj_Convert _WinObj_Convert
  28#endif
  29
  30/* Classic calls that we emulate in carbon mode */
  31#define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
  32#define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
  33#define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
  34
  35/* Function to dispose a window, with a "normal" calling sequence */
  36static void
  37PyMac_AutoDisposeWindow(WindowPtr w)
  38{
  39        DisposeWindow(w);
  40}
  41
  42static PyObject *Win_Error;
  43
  44/* ----------------------- Object type Window ----------------------- */
  45
  46PyTypeObject Window_Type;
  47
  48#define WinObj_Check(x) ((x)->ob_type == &Window_Type || PyObject_TypeCheck((x), &Window_Type))
  49
  50typedef struct WindowObject {
  51	PyObject_HEAD
  52	WindowPtr ob_itself;
  53	void (*ob_freeit)(WindowPtr ptr);
  54} WindowObject;
  55
  56PyObject *WinObj_New(WindowPtr itself)
  57{
  58	WindowObject *it;
  59	if (itself == NULL) return PyMac_Error(resNotFound);
  60	/* XXXX Or should we use WhichWindow code here? */
  61	it = PyObject_NEW(WindowObject, &Window_Type);
  62	if (it == NULL) return NULL;
  63	it->ob_itself = itself;
  64	it->ob_freeit = NULL;
  65	if (GetWRefCon(itself) == 0)
  66	{
  67		SetWRefCon(itself, (long)it);
  68		it->ob_freeit = PyMac_AutoDisposeWindow;
  69	}
  70	return (PyObject *)it;
  71}
  72
  73int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
  74{
  75
  76	if (v == Py_None) { *p_itself = NULL; return 1; }
  77	if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; }
  78
  79	{
  80		DialogRef dlg;
  81		if (DlgObj_Convert(v, &dlg) && dlg) {
  82			*p_itself = GetDialogWindow(dlg);
  83			return 1;
  84		}
  85		PyErr_Clear();
  86	}
  87	if (!WinObj_Check(v))
  88	{
  89		PyErr_SetString(PyExc_TypeError, "Window required");
  90		return 0;
  91	}
  92	*p_itself = ((WindowObject *)v)->ob_itself;
  93	return 1;
  94}
  95
  96static void WinObj_dealloc(WindowObject *self)
  97{
  98	if (self->ob_freeit && self->ob_itself)
  99	{
 100		SetWRefCon(self->ob_itself, 0);
 101		self->ob_freeit(self->ob_itself);
 102	}
 103	self->ob_itself = NULL;
 104	self->ob_freeit = NULL;
 105	self->ob_type->tp_free((PyObject *)self);
 106}
 107
 108static PyObject *WinObj_GetWindowOwnerCount(WindowObject *_self, PyObject *_args)
 109{
 110	PyObject *_res = NULL;
 111	OSStatus _err;
 112	UInt32 outCount;
 113#ifndef GetWindowOwnerCount
 114	PyMac_PRECHECK(GetWindowOwnerCount);
 115#endif
 116	if (!PyArg_ParseTuple(_args, ""))
 117		return NULL;
 118	_err = GetWindowOwnerCount(_self->ob_itself,
 119	                           &outCount);
 120	if (_err != noErr) return PyMac_Error(_err);
 121	_res = Py_BuildValue("l",
 122	                     outCount);
 123	return _res;
 124}
 125
 126static PyObject *WinObj_CloneWindow(WindowObject *_self, PyObject *_args)
 127{
 128	PyObject *_res = NULL;
 129	OSStatus _err;
 130#ifndef CloneWindow
 131	PyMac_PRECHECK(CloneWindow);
 132#endif
 133	if (!PyArg_ParseTuple(_args, ""))
 134		return NULL;
 135	_err = CloneWindow(_self->ob_itself);
 136	if (_err != noErr) return PyMac_Error(_err);
 137	Py_INCREF(Py_None);
 138	_res = Py_None;
 139	return _res;
 140}
 141
 142static PyObject *WinObj_GetWindowRetainCount(WindowObject *_self, PyObject *_args)
 143{
 144	PyObject *_res = NULL;
 145	ItemCount _rv;
 146#ifndef GetWindowRetainCount
 147	PyMac_PRECHECK(GetWindowRetainCount);
 148#endif
 149	if (!PyArg_ParseTuple(_args, ""))
 150		return NULL;
 151	_rv = GetWindowRetainCount(_self->ob_itself);
 152	_res = Py_BuildValue("l",
 153	                     _rv);
 154	return _res;
 155}
 156
 157static PyObject *WinObj_RetainWindow(WindowObject *_self, PyObject *_args)
 158{
 159	PyObject *_res = NULL;
 160	OSStatus _err;
 161#ifndef RetainWindow
 162	PyMac_PRECHECK(RetainWindow);
 163#endif
 164	if (!PyArg_ParseTuple(_args, ""))
 165		return NULL;
 166	_err = RetainWindow(_self->ob_itself);
 167	if (_err != noErr) return PyMac_Error(_err);
 168	Py_INCREF(Py_None);
 169	_res = Py_None;
 170	return _res;
 171}
 172
 173static PyObject *WinObj_ReleaseWindow(WindowObject *_self, PyObject *_args)
 174{
 175	PyObject *_res = NULL;
 176	OSStatus _err;
 177#ifndef ReleaseWindow
 178	PyMac_PRECHECK(ReleaseWindow);
 179#endif
 180	if (!PyArg_ParseTuple(_args, ""))
 181		return NULL;
 182	_err = ReleaseWindow(_self->ob_itself);
 183	if (_err != noErr) return PyMac_Error(_err);
 184	Py_INCREF(Py_None);
 185	_res = Py_None;
 186	return _res;
 187}
 188
 189static PyObject *WinObj_ReshapeCustomWindow(WindowObject *_self, PyObject *_args)
 190{
 191	PyObject *_res = NULL;
 192	OSStatus _err;
 193#ifndef ReshapeCustomWindow
 194	PyMac_PRECHECK(ReshapeCustomWindow);
 195#endif
 196	if (!PyArg_ParseTuple(_args, ""))
 197		return NULL;
 198	_err = ReshapeCustomWindow(_self->ob_itself);
 199	if (_err != noErr) return PyMac_Error(_err);
 200	Py_INCREF(Py_None);
 201	_res = Py_None;
 202	return _res;
 203}
 204
 205static PyObject *WinObj_GetWindowWidgetHilite(WindowObject *_self, PyObject *_args)
 206{
 207	PyObject *_res = NULL;
 208	OSStatus _err;
 209	WindowDefPartCode outHilite;
 210#ifndef GetWindowWidgetHilite
 211	PyMac_PRECHECK(GetWindowWidgetHilite);
 212#endif
 213	if (!PyArg_ParseTuple(_args, ""))
 214		return NULL;
 215	_err = GetWindowWidgetHilite(_self->ob_itself,
 216	                             &outHilite);
 217	if (_err != noErr) return PyMac_Error(_err);
 218	_res = Py_BuildValue("h",
 219	                     outHilite);
 220	return _res;
 221}
 222
 223static PyObject *WinObj_GetWindowClass(WindowObject *_self, PyObject *_args)
 224{
 225	PyObject *_res = NULL;
 226	OSStatus _err;
 227	WindowClass outClass;
 228#ifndef GetWindowClass
 229	PyMac_PRECHECK(GetWindowClass);
 230#endif
 231	if (!PyArg_ParseTuple(_args, ""))
 232		return NULL;
 233	_err = GetWindowClass(_self->ob_itself,
 234	                      &outClass);
 235	if (_err != noErr) return PyMac_Error(_err);
 236	_res = Py_BuildValue("l",
 237	                     outClass);
 238	return _res;
 239}
 240
 241static PyObject *WinObj_GetWindowAttributes(WindowObject *_self, PyObject *_args)
 242{
 243	PyObject *_res = NULL;
 244	OSStatus _err;
 245	WindowAttributes outAttributes;
 246#ifndef GetWindowAttributes
 247	PyMac_PRECHECK(GetWindowAttributes);
 248#endif
 249	if (!PyArg_ParseTuple(_args, ""))
 250		return NULL;
 251	_err = GetWindowAttributes(_self->ob_itself,
 252	                           &outAttributes);
 253	if (_err != noErr) return PyMac_Error(_err);
 254	_res = Py_BuildValue("l",
 255	                     outAttributes);
 256	return _res;
 257}
 258
 259static PyObject *WinObj_ChangeWindowAttributes(WindowObject *_self, PyObject *_args)
 260{
 261	PyObject *_res = NULL;
 262	OSStatus _err;
 263	WindowAttributes setTheseAttributes;
 264	WindowAttributes clearTheseAttributes;
 265#ifndef ChangeWindowAttributes
 266	PyMac_PRECHECK(ChangeWindowAttributes);
 267#endif
 268	if (!PyArg_ParseTuple(_args, "ll",
 269	                      &setTheseAttributes,
 270	                      &clearTheseAttributes))
 271		return NULL;
 272	_err = ChangeWindowAttributes(_self->ob_itself,
 273	                              setTheseAttributes,
 274	                              clearTheseAttributes);
 275	if (_err != noErr) return PyMac_Error(_err);
 276	Py_INCREF(Py_None);
 277	_res = Py_None;
 278	return _res;
 279}
 280
 281static PyObject *WinObj_SetWindowClass(WindowObject *_self, PyObject *_args)
 282{
 283	PyObject *_res = NULL;
 284	OSStatus _err;
 285	WindowClass inWindowClass;
 286#ifndef SetWindowClass
 287	PyMac_PRECHECK(SetWindowClass);
 288#endif
 289	if (!PyArg_ParseTuple(_args, "l",
 290	                      &inWindowClass))
 291		return NULL;
 292	_err = SetWindowClass(_self->ob_itself,
 293	                      inWindowClass);
 294	if (_err != noErr) return PyMac_Error(_err);
 295	Py_INCREF(Py_None);
 296	_res = Py_None;
 297	return _res;
 298}
 299
 300static PyObject *WinObj_SetWindowModality(WindowObject *_self, PyObject *_args)
 301{
 302	PyObject *_res = NULL;
 303	OSStatus _err;
 304	WindowModality inModalKind;
 305	WindowPtr inUnavailableWindow;
 306#ifndef SetWindowModality
 307	PyMac_PRECHECK(SetWindowModality);
 308#endif
 309	if (!PyArg_ParseTuple(_args, "lO&",
 310	                      &inModalKind,
 311	                      WinObj_Convert, &inUnavailableWindow))
 312		return NULL;
 313	_err = SetWindowModality(_self->ob_itself,
 314	                         inModalKind,
 315	                         inUnavailableWindow);
 316	if (_err != noErr) return PyMac_Error(_err);
 317	Py_INCREF(Py_None);
 318	_res = Py_None;
 319	return _res;
 320}
 321
 322static PyObject *WinObj_GetWindowModality(WindowObject *_self, PyObject *_args)
 323{
 324	PyObject *_res = NULL;
 325	OSStatus _err;
 326	WindowModality outModalKind;
 327	WindowPtr outUnavailableWindow;
 328#ifndef GetWindowModality
 329	PyMac_PRECHECK(GetWindowModality);
 330#endif
 331	if (!PyArg_ParseTuple(_args, ""))
 332		return NULL;
 333	_err = GetWindowModality(_self->ob_itself,
 334	                         &outModalKind,
 335	                         &outUnavailableWindow);
 336	if (_err != noErr) return PyMac_Error(_err);
 337	_res = Py_BuildValue("lO&",
 338	                     outModalKind,
 339	                     WinObj_WhichWindow, outUnavailableWindow);
 340	return _res;
 341}
 342
 343static PyObject *WinObj_SetWindowContentColor(WindowObject *_self, PyObject *_args)
 344{
 345	PyObject *_res = NULL;
 346	OSStatus _err;
 347	RGBColor color;
 348#ifndef SetWindowContentColor
 349	PyMac_PRECHECK(SetWindowContentColor);
 350#endif
 351	if (!PyArg_ParseTuple(_args, "O&",
 352	                      QdRGB_Convert, &color))
 353		return NULL;
 354	_err = SetWindowContentColor(_self->ob_itself,
 355	                             &color);
 356	if (_err != noErr) return PyMac_Error(_err);
 357	Py_INCREF(Py_None);
 358	_res = Py_None;
 359	return _res;
 360}
 361
 362static PyObject *WinObj_GetWindowContentColor(WindowObject *_self, PyObject *_args)
 363{
 364	PyObject *_res = NULL;
 365	OSStatus _err;
 366	RGBColor color;
 367#ifndef GetWindowContentColor
 368	PyMac_PRECHECK(GetWindowContentColor);
 369#endif
 370	if (!PyArg_ParseTuple(_args, ""))
 371		return NULL;
 372	_err = GetWindowContentColor(_self->ob_itself,
 373	                             &color);
 374	if (_err != noErr) return PyMac_Error(_err);
 375	_res = Py_BuildValue("O&",
 376	                     QdRGB_New, &color);
 377	return _res;
 378}
 379
 380static PyObject *WinObj_GetWindowContentPattern(WindowObject *_self, PyObject *_args)
 381{
 382	PyObject *_res = NULL;
 383	OSStatus _err;
 384	PixPatHandle outPixPat;
 385#ifndef GetWindowContentPattern
 386	PyMac_PRECHECK(GetWindowContentPattern);
 387#endif
 388	if (!PyArg_ParseTuple(_args, "O&",
 389	                      ResObj_Convert, &outPixPat))
 390		return NULL;
 391	_err = GetWindowContentPattern(_self->ob_itself,
 392	                               outPixPat);
 393	if (_err != noErr) return PyMac_Error(_err);
 394	Py_INCREF(Py_None);
 395	_res = Py_None;
 396	return _res;
 397}
 398
 399static PyObject *WinObj_SetWindowContentPattern(WindowObject *_self, PyObject *_args)
 400{
 401	PyObject *_res = NULL;
 402	OSStatus _err;
 403	PixPatHandle pixPat;
 404#ifndef SetWindowContentPattern
 405	PyMac_PRECHECK(SetWindowContentPattern);
 406#endif
 407	if (!PyArg_ParseTuple(_args, "O&",
 408	                      ResObj_Convert, &pixPat))
 409		return NULL;
 410	_err = SetWindowContentPattern(_self->ob_itself,
 411	                               pixPat);
 412	if (_err != noErr) return PyMac_Error(_err);
 413	Py_INCREF(Py_None);
 414	_res = Py_None;
 415	return _res;
 416}
 417
 418static PyObject *WinObj_ScrollWindowRect(WindowObject *_self, PyObject *_args)
 419{
 420	PyObject *_res = NULL;
 421	OSStatus _err;
 422	Rect inScrollRect;
 423	SInt16 inHPixels;
 424	SInt16 inVPixels;
 425	ScrollWindowOptions inOptions;
 426	RgnHandle outExposedRgn;
 427#ifndef ScrollWindowRect
 428	PyMac_PRECHECK(ScrollWindowRect);
 429#endif
 430	if (!PyArg_ParseTuple(_args, "O&hhlO&",
 431	                      PyMac_GetRect, &inScrollRect,
 432	                      &inHPixels,
 433	                      &inVPixels,
 434	                      &inOptions,
 435	                      ResObj_Convert, &outExposedRgn))
 436		return NULL;
 437	_err = ScrollWindowRect(_self->ob_itself,
 438	                        &inScrollRect,
 439	                        inHPixels,
 440	                        inVPixels,
 441	                        inOptions,
 442	                        outExposedRgn);
 443	if (_err != noErr) return PyMac_Error(_err);
 444	Py_INCREF(Py_None);
 445	_res = Py_None;
 446	return _res;
 447}
 448
 449static PyObject *WinObj_ScrollWindowRegion(WindowObject *_self, PyObject *_args)
 450{
 451	PyObject *_res = NULL;
 452	OSStatus _err;
 453	RgnHandle inScrollRgn;
 454	SInt16 inHPixels;
 455	SInt16 inVPixels;
 456	ScrollWindowOptions inOptions;
 457	RgnHandle outExposedRgn;
 458#ifndef ScrollWindowRegion
 459	PyMac_PRECHECK(ScrollWindowRegion);
 460#endif
 461	if (!PyArg_ParseTuple(_args, "O&hhlO&",
 462	                      ResObj_Convert, &inScrollRgn,
 463	                      &inHPixels,
 464	                      &inVPixels,
 465	                      &inOptions,
 466	                      ResObj_Convert, &outExposedRgn))
 467		return NULL;
 468	_err = ScrollWindowRegion(_self->ob_itself,
 469	                          inScrollRgn,
 470	                          inHPixels,
 471	                          inVPixels,
 472	                          inOptions,
 473	                          outExposedRgn);
 474	if (_err != noErr) return PyMac_Error(_err);
 475	Py_INCREF(Py_None);
 476	_res = Py_None;
 477	return _res;
 478}
 479
 480static PyObject *WinObj_ClipAbove(WindowObject *_self, PyObject *_args)
 481{
 482	PyObject *_res = NULL;
 483#ifndef ClipAbove
 484	PyMac_PRECHECK(ClipAbove);
 485#endif
 486	if (!PyArg_ParseTuple(_args, ""))
 487		return NULL;
 488	ClipAbove(_self->ob_itself);
 489	Py_INCREF(Py_None);
 490	_res = Py_None;
 491	return _res;
 492}
 493
 494static PyObject *WinObj_PaintOne(WindowObject *_self, PyObject *_args)
 495{
 496	PyObject *_res = NULL;
 497	RgnHandle clobberedRgn;
 498#ifndef PaintOne
 499	PyMac_PRECHECK(PaintOne);
 500#endif
 501	if (!PyArg_ParseTuple(_args, "O&",
 502	                      ResObj_Convert, &clobberedRgn))
 503		return NULL;
 504	PaintOne(_self->ob_itself,
 505	         clobberedRgn);
 506	Py_INCREF(Py_None);
 507	_res = Py_None;
 508	return _res;
 509}
 510
 511static PyObject *WinObj_PaintBehind(WindowObject *_self, PyObject *_args)
 512{
 513	PyObject *_res = NULL;
 514	RgnHandle clobberedRgn;
 515#ifndef PaintBehind
 516	PyMac_PRECHECK(PaintBehind);
 517#endif
 518	if (!PyArg_ParseTuple(_args, "O&",
 519	                      ResObj_Convert, &clobberedRgn))
 520		return NULL;
 521	PaintBehind(_self->ob_itself,
 522	            clobberedRgn);
 523	Py_INCREF(Py_None);
 524	_res = Py_None;
 525	return _res;
 526}
 527
 528static PyObject *WinObj_CalcVis(WindowObject *_self, PyObject *_args)
 529{
 530	PyObject *_res = NULL;
 531#ifndef CalcVis
 532	PyMac_PRECHECK(CalcVis);
 533#endif
 534	if (!PyArg_ParseTuple(_args, ""))
 535		return NULL;
 536	CalcVis(_self->ob_itself);
 537	Py_INCREF(Py_None);
 538	_res = Py_None;
 539	return _res;
 540}
 541
 542static PyObject *WinObj_CalcVisBehind(WindowObject *_self, PyObject *_args)
 543{
 544	PyObject *_res = NULL;
 545	RgnHandle clobberedRgn;
 546#ifndef CalcVisBehind
 547	PyMac_PRECHECK(CalcVisBehind);
 548#endif
 549	if (!PyArg_ParseTuple(_args, "O&",
 550	                      ResObj_Convert, &clobberedRgn))
 551		return NULL;
 552	CalcVisBehind(_self->ob_itself,
 553	              clobberedRgn);
 554	Py_INCREF(Py_None);
 555	_res = Py_None;
 556	return _res;
 557}
 558
 559static PyObject *WinObj_BringToFront(WindowObject *_self, PyObject *_args)
 560{
 561	PyObject *_res = NULL;
 562#ifndef BringToFront
 563	PyMac_PRECHECK(BringToFront);
 564#endif
 565	if (!PyArg_ParseTuple(_args, ""))
 566		return NULL;
 567	BringToFront(_self->ob_itself);
 568	Py_INCREF(Py_None);
 569	_res = Py_None;
 570	return _res;
 571}
 572
 573static PyObject *WinObj_SendBehind(WindowObject *_self, PyObject *_args)
 574{
 575	PyObject *_res = NULL;
 576	WindowPtr behindWindow;
 577#ifndef SendBehind
 578	PyMac_PRECHECK(SendBehind);
 579#endif
 580	if (!PyArg_ParseTuple(_args, "O&",
 581	                      WinObj_Convert, &behindWindow))
 582		return NULL;
 583	SendBehind(_self->ob_itself,
 584	           behindWindow);
 585	Py_INCREF(Py_None);
 586	_res = Py_None;
 587	return _res;
 588}
 589
 590static PyObject *WinObj_SelectWindow(WindowObject *_self, PyObject *_args)
 591{
 592	PyObject *_res = NULL;
 593#ifndef SelectWindow
 594	PyMac_PRECHECK(SelectWindow);
 595#endif
 596	if (!PyArg_ParseTuple(_args, ""))
 597		return NULL;
 598	SelectWindow(_self->ob_itself);
 599	Py_INCREF(Py_None);
 600	_res = Py_None;
 601	return _res;
 602}
 603
 604static PyObject *WinObj_GetNextWindowOfClass(WindowObject *_self, PyObject *_args)
 605{
 606	PyObject *_res = NULL;
 607	WindowPtr _rv;
 608	WindowClass inWindowClass;
 609	Boolean mustBeVisible;
 610#ifndef GetNextWindowOfClass
 611	PyMac_PRECHECK(GetNextWindowOfClass);
 612#endif
 613	if (!PyArg_ParseTuple(_args, "lb",
 614	                      &inWindowClass,
 615	                      &mustBeVisible))
 616		return NULL;
 617	_rv = GetNextWindowOfClass(_self->ob_itself,
 618	                           inWindowClass,
 619	                           mustBeVisible);
 620	_res = Py_BuildValue("O&",
 621	                     WinObj_New, _rv);
 622	return _res;
 623}
 624
 625static PyObject *WinObj_SetWindowAlternateTitle(WindowObject *_self, PyObject *_args)
 626{
 627	PyObject *_res = NULL;
 628	OSStatus _err;
 629	CFStringRef inTitle;
 630#ifndef SetWindowAlternateTitle
 631	PyMac_PRECHECK(SetWindowAlternateTitle);
 632#endif
 633	if (!PyArg_ParseTuple(_args, "O&",
 634	                      CFStringRefObj_Convert, &inTitle))
 635		return NULL;
 636	_err = SetWindowAlternateTitle(_self->ob_itself,
 637	                               inTitle);
 638	if (_err != noErr) return PyMac_Error(_err);
 639	Py_INCREF(Py_None);
 640	_res = Py_None;
 641	return _res;
 642}
 643
 644static PyObject *WinObj_CopyWindowAlternateTitle(WindowObject *_self, PyObject *_args)
 645{
 646	PyObject *_res = NULL;
 647	OSStatus _err;
 648	CFStringRef outTitle;
 649#ifndef CopyWindowAlternateTitle
 650	PyMac_PRECHECK(CopyWindowAlternateTitle);
 651#endif
 652	if (!PyArg_ParseTuple(_args, ""))
 653		return NULL;
 654	_err = CopyWindowAlternateTitle(_self->ob_itself,
 655	                                &outTitle);
 656	if (_err != noErr) return PyMac_Error(_err);
 657	_res = Py_BuildValue("O&",
 658	                     CFStringRefObj_New, outTitle);
 659	return _res;
 660}
 661
 662static PyObject *WinObj_HiliteWindow(WindowObject *_self, PyObject *_args)
 663{
 664	PyObject *_res = NULL;
 665	Boolean fHilite;
 666#ifndef HiliteWindow
 667	PyMac_PRECHECK(HiliteWindow);
 668#endif
 669	if (!PyArg_ParseTuple(_args, "b",
 670	                      &fHilite))
 671		return NULL;
 672	HiliteWindow(_self->ob_itself,
 673	             fHilite);
 674	Py_INCREF(Py_None);
 675	_res = Py_None;
 676	return _res;
 677}
 678
 679static PyObject *WinObj_SetWRefCon(WindowObject *_self, PyObject *_args)
 680{
 681	PyObject *_res = NULL;
 682	long data;
 683#ifndef SetWRefCon
 684	PyMac_PRECHECK(SetWRefCon);
 685#endif
 686	if (!PyArg_ParseTuple(_args, "l",
 687	                      &data))
 688		return NULL;
 689	SetWRefCon(_self->ob_itself,
 690	           data);
 691	Py_INCREF(Py_None);
 692	_res = Py_None;
 693	return _res;
 694}
 695
 696static PyObject *WinObj_GetWRefCon(WindowObject *_self, PyObject *_args)
 697{
 698	PyObject *_res = NULL;
 699	long _rv;
 700#ifndef GetWRefCon
 701	PyMac_PRECHECK(GetWRefCon);
 702#endif
 703	if (!PyArg_ParseTuple(_args, ""))
 704		return NULL;
 705	_rv = GetWRefCon(_self->ob_itself);
 706	_res = Py_BuildValue("l",
 707	                     _rv);
 708	return _res;
 709}
 710
 711static PyObject *WinObj_SetWindowPic(WindowObject *_self, PyObject *_args)
 712{
 713	PyObject *_res = NULL;
 714	PicHandle pic;
 715#ifndef SetWindowPic
 716	PyMac_PRECHECK(SetWindowPic);
 717#endif
 718	if (!PyArg_ParseTuple(_args, "O&",
 719	                      ResObj_Convert, &pic))
 720		return NULL;
 721	SetWindowPic(_self->ob_itself,
 722	             pic);
 723	Py_INCREF(Py_None);
 724	_res = Py_None;
 725	return _res;
 726}
 727
 728static PyObject *WinObj_GetWindowPic(WindowObject *_self, PyObject *_args)
 729{
 730	PyObject *_res = NULL;
 731	PicHandle _rv;
 732#ifndef GetWindowPic
 733	PyMac_PRECHECK(GetWindowPic);
 734#endif
 735	if (!PyArg_ParseTuple(_args, ""))
 736		return NULL;
 737	_rv = GetWindowPic(_self->ob_itself);
 738	_res = Py_BuildValue("O&",
 739	                     ResObj_New, _rv);
 740	return _res;
 741}
 742
 743static PyObject *WinObj_GetWVariant(WindowObject *_self, PyObject *_args)
 744{
 745	PyObject *_res = NULL;
 746	short _rv;
 747#ifndef GetWVariant
 748	PyMac_PRECHECK(GetWVariant);
 749#endif
 750	if (!PyArg_ParseTuple(_args, ""))
 751		return NULL;
 752	_rv = GetWVariant(_self->ob_itself);
 753	_res = Py_BuildValue("h",
 754	                     _rv);
 755	return _res;
 756}
 757
 758static PyObject *WinObj_GetWindowFeatures(WindowObject *_self, PyObject *_args)
 759{
 760	PyObject *_res = NULL;
 761	OSStatus _err;
 762	UInt32 outFeatures;
 763#ifndef GetWindowFeatures
 764	PyMac_PRECHECK(GetWindowFeatures);
 765#endif
 766	if (!PyArg_ParseTuple(_args, ""))
 767		return NULL;
 768	_err = GetWindowFeatures(_self->ob_itself,
 769	                         &outFeatures);
 770	if (_err != noErr) return PyMac_Error(_err);
 771	_res = Py_BuildValue("l",
 772	                     outFeatures);
 773	return _res;
 774}
 775
 776static PyObject *WinObj_GetWindowRegion(WindowObject *_self, PyObject *_args)
 777{
 778	PyObject *_res = NULL;
 779	OSStatus _err;
 780	WindowRegionCode inRegionCode;
 781	RgnHandle ioWinRgn;
 782#ifndef GetWindowRegion
 783	PyMac_PRECHECK(GetWindowRegion);
 784#endif
 785	if (!PyArg_ParseTuple(_args, "HO&",
 786	                      &inRegionCode,
 787	                      ResObj_Convert, &ioWinRgn))
 788		return NULL;
 789	_err = GetWindowRegion(_self->ob_itself,
 790	                       inRegionCode,
 791	                       ioWinRgn);
 792	if (_err != noErr) return PyMac_Error(_err);
 793	Py_INCREF(Py_None);
 794	_res = Py_None;
 795	return _res;
 796}
 797
 798static PyObject *WinObj_GetWindowStructureWidths(WindowObject *_self, PyObject *_args)
 799{
 800	PyObject *_res = NULL;
 801	OSStatus _err;
 802	Rect outRect;
 803#ifndef GetWindowStructureWidths
 804	PyMac_PRECHECK(GetWindowStructureWidths);
 805#endif
 806	if (!PyArg_ParseTuple(_args, ""))
 807		return NULL;
 808	_err = GetWindowStructureWidths(_self->ob_itself,
 809	                                &outRect);
 810	if (_err != noErr) return PyMac_Error(_err);
 811	_res = Py_BuildValue("O&",
 812	                     PyMac_BuildRect, &outRect);
 813	return _res;
 814}
 815
 816static PyObject *WinObj_BeginUpdate(WindowObject *_self, PyObject *_args)
 817{
 818	PyObject *_res = NULL;
 819#ifndef BeginUpdate
 820	PyMac_PRECHECK(BeginUpdate);
 821#endif
 822	if (!PyArg_ParseTuple(_args, ""))
 823		return NULL;
 824	BeginUpdate(_self->ob_itself);
 825	Py_INCREF(Py_None);
 826	_res = Py_None;
 827	return _res;
 828}
 829
 830static PyObject *WinObj_EndUpdate(WindowObject *_self, PyObject *_args)
 831{
 832	PyObject *_res = NULL;
 833#ifndef EndUpdate
 834	PyMac_PRECHECK(EndUpdate);
 835#endif
 836	if (!PyArg_ParseTuple(_args, ""))
 837		return NULL;
 838	EndUpdate(_self->ob_itself);
 839	Py_INCREF(Py_None);
 840	_res = Py_None;
 841	return _res;
 842}
 843
 844static PyObject *WinObj_InvalWindowRgn(WindowObject *_self, PyObject *_args)
 845{
 846	PyObject *_res = NULL;
 847	OSStatus _err;
 848	RgnHandle region;
 849#ifndef InvalWindowRgn
 850	PyMac_PRECHECK(InvalWindowRgn);
 851#endif
 852	if (!PyArg_ParseTuple(_args, "O&",
 853	                      ResObj_Convert, &region))
 854		return NULL;
 855	_err = InvalWindowRgn(_self->ob_itself,
 856	                      region);
 857	if (_err != noErr) return PyMac_Error(_err);
 858	Py_INCREF(Py_None);
 859	_res = Py_None;
 860	return _res;
 861}
 862
 863static PyObject *WinObj_InvalWindowRect(WindowObject *_self, PyObject *_args)
 864{
 865	PyObject *_res = NULL;
 866	OSStatus _err;
 867	Rect bounds;
 868#ifndef InvalWindowRect
 869	PyMac_PRECHECK(InvalWindowRect);
 870#endif
 871	if (!PyArg_ParseTuple(_args, "O&",
 872	                      PyMac_GetRect, &bounds))
 873		return NULL;
 874	_err = InvalWindowRect(_self->ob_itself,
 875	                       &bounds);
 876	if (_err != noErr) return PyMac_Error(_err);
 877	Py_INCREF(Py_None);
 878	_res = Py_None;
 879	return _res;
 880}
 881
 882static PyObject *WinObj_ValidWindowRgn(WindowObject *_self, PyObject *_args)
 883{
 884	PyObject *_res = NULL;
 885	OSStatus _err;
 886	RgnHandle region;
 887#ifndef ValidWindowRgn
 888	PyMac_PRECHECK(ValidWindowRgn);
 889#endif
 890	if (!PyArg_ParseTuple(_args, "O&",
 891	                      ResObj_Convert, &region))
 892		return NULL;
 893	_err = ValidWindowRgn(_self->ob_itself,
 894	                      region);
 895	if (_err != noErr) return PyMac_Error(_err);
 896	Py_INCREF(Py_None);
 897	_res = Py_None;
 898	return _res;
 899}
 900
 901static PyObject *WinObj_ValidWindowRect(WindowObject *_self, PyObject *_args)
 902{
 903	PyObject *_res = NULL;
 904	OSStatus _err;
 905	Rect bounds;
 906#ifndef ValidWindowRect
 907	PyMac_PRECHECK(ValidWindowRect);
 908#endif
 909	if (!PyArg_ParseTuple(_args, "O&",
 910	                      PyMac_GetRect, &bounds))
 911		return NULL;
 912	_err = ValidWindowRect(_self->ob_itself,
 913	                       &bounds);
 914	if (_err != noErr) return PyMac_Error(_err);
 915	Py_INCREF(Py_None);
 916	_res = Py_None;
 917	return _res;
 918}
 919
 920static PyObject *WinObj_DrawGrowIcon(WindowObject *_self, PyObject *_args)
 921{
 922	PyObject *_res = NULL;
 923#ifndef DrawGrowIcon
 924	PyMac_PRECHECK(DrawGrowIcon);
 925#endif
 926	if (!PyArg_ParseTuple(_args, ""))
 927		return NULL;
 928	DrawGrowIcon(_self->ob_itself);
 929	Py_INCREF(Py_None);
 930	_res = Py_None;
 931	return _res;
 932}
 933
 934static PyObject *WinObj_SetWTitle(WindowObject *_self, PyObject *_args)
 935{
 936	PyObject *_res = NULL;
 937	Str255 title;
 938#ifndef SetWTitle
 939	PyMac_PRECHECK(SetWTitle);
 940#endif
 941	if (!PyArg_ParseTuple(_args, "O&",
 942	                      PyMac_GetStr255, title))
 943		return NULL;
 944	SetWTitle(_self->ob_itself,
 945	          title);
 946	Py_INCREF(Py_None);
 947	_res = Py_None;
 948	return _res;
 949}
 950
 951static PyObject *WinObj_GetWTitle(WindowObject *_self, PyObject *_args)
 952{
 953	PyObject *_res = NULL;
 954	Str255 title;
 955#ifndef GetWTitle
 956	PyMac_PRECHECK(GetWTitle);
 957#endif
 958	if (!PyArg_ParseTuple(_args, ""))
 959		return NULL;
 960	GetWTitle(_self->ob_itself,
 961	          title);
 962	_res = Py_BuildValue("O&",
 963	                     PyMac_BuildStr255, title);
 964	return _res;
 965}
 966
 967static PyObject *WinObj_SetWindowTitleWithCFString(WindowObject *_self, PyObject *_args)
 968{
 969	PyObject *_res = NULL;
 970	OSStatus _err;
 971	CFStringRef inString;
 972#ifndef SetWindowTitleWithCFString
 973	PyMac_PRECHECK(SetWindowTitleWithCFString);
 974#endif
 975	if (!PyArg_ParseTuple(_args, "O&",
 976	                      CFStringRefObj_Convert, &inString))
 977		return NULL;
 978	_err = SetWindowTitleWithCFString(_self->ob_itself,
 979	                                  inString);
 980	if (_err != noErr) return PyMac_Error(_err);
 981	Py_INCREF(Py_None);
 982	_res = Py_None;
 983	return _res;
 984}
 985
 986static PyObject *WinObj_CopyWindowTitleAsCFString(WindowObject *_self, PyObject *_args)
 987{
 988	PyObject *_res = NULL;
 989	OSStatus _err;
 990	CFStringRef outString;
 991#ifndef CopyWindowTitleAsCFString
 992	PyMac_PRECHECK(CopyWindowTitleAsCFString);
 993#endif
 994	if (!PyArg_ParseTuple(_args, ""))
 995		return NULL;
 996	_err = CopyWindowTitleAsCFString(_self->ob_itself,
 997	                                 &outString);
 998	if (_err != noErr) return PyMac_Error(_err);
 999	_res = Py_BuildValue("O&",
1000	                     CFStringRefObj_New, outString);
1001	return _res;
1002}
1003
1004static PyObject *WinObj_SetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
1005{
1006	PyObject *_res = NULL;
1007	OSStatus _err;
1008	FSSpec inFile;
1009#ifndef SetWindowProxyFSSpec
1010	PyMac_PRECHECK(SetWindowProxyFSSpec);
1011#endif
1012	if (!PyArg_ParseTuple(_args, "O&",
1013	                      PyMac_GetFSSpec, &inFile))
1014		return NULL;
1015	_err = SetWindowProxyFSSpec(_self->ob_itself,
1016	                            &inFile);
1017	if (_err != noErr) return PyMac_Error(_err);
1018	Py_INCREF(Py_None);
1019	_res = Py_None;
1020	return _res;
1021}
1022
1023static PyObject *WinObj_GetWindowProxyFSSpec(WindowObject *_self, PyObject *_args)
1024{
1025	PyObject *_res = NULL;
1026	OSStatus _err;
1027	FSSpec outFile;
1028#ifndef GetWindowProxyFSSpec
1029	PyMac_PRECHECK(GetWindowProxyFSSpec);
1030#endif
1031	if (!PyArg_ParseTuple(_args, ""))
1032		return NULL;
1033	_err = GetWindowProxyFSSpec(_self->ob_itself,
1034	                            &outFile);
1035	if (_err != noErr) return PyMac_Error(_err);
1036	_res = Py_BuildValue("O&",
1037	                     PyMac_BuildFSSpec, &outFile);
1038	return _res;
1039}
1040
1041static PyObject *WinObj_SetWindowProxyAlias(WindowObject *_self, PyObject *_args)
1042{
1043	PyObject *_res = NULL;
1044	OSStatus _err;
1045	AliasHandle inAlias;
1046#ifndef SetWindowProxyAlias
1047	PyMac_PRECHECK(SetWindowProxyAlias);
1048#endif
1049	if (!PyArg_ParseTuple(_args, "O&",
1050	                      ResObj_Convert, &inAlias))
1051		return NULL;
1052	_err = SetWindowProxyAlias(_self->ob_itself,
1053	                           inAlias);
1054	if (_err != noErr) return PyMac_Error(_err);
1055	Py_INCREF(Py_None);
1056	_res = Py_None;
1057	return _res;
1058}
1059
1060static PyObject *WinObj_GetWindowProxyAlias(WindowObject *_self, PyObject *_args)
1061{
1062	PyObject *_res = NULL;
1063	OSStatus _err;
1064	AliasHandle alias;
1065#ifndef GetWindowProxyAlias
1066	PyMac_PRECHECK(GetWindowProxyAlias);
1067#endif
1068	if (!PyArg_ParseTuple(_args, ""))
1069		return NULL;
1070	_err = GetWindowProxyAlias(_self->ob_itself,
1071	                           &alias);
1072	if (_err != noErr) return PyMac_Error(_err);
1073	_res = Py_BuildValue("O&",
1074	                     ResObj_New, alias);
1075	return _res;
1076}
1077
1078static PyObject *WinObj_SetWindowProxyCreatorAndType(WindowObject *_self, PyObject *_args)
1079{
1080	PyObject *_res = NULL;
1081	OSStatus _err;
1082	OSType fileCreator;
1083	OSType fileType;
1084	SInt16 vRefNum;
1085#ifndef SetWindowProxyCreatorAndType
1086	PyMac_PRECHECK(SetWindowProxyCreatorAndType);
1087#endif
1088	if (!PyArg_ParseTuple(_args, "O&O&h",
1089	                      PyMac_GetOSType, &fileCreator,
1090	                      PyMac_GetOSType, &fileType,
1091	                      &vRefNum))
1092		return NULL;
1093	_err = SetWindowProxyCreatorAndType(_self->ob_itself,
1094	                                    fileCreator,
1095	                                    fileType,
1096	                                    vRefNum);
1097	if (_err != noErr) return PyMac_Error(_err);
1098	Py_INCREF(Py_None);
1099	_res = Py_None;
1100	return _res;
1101}
1102
1103static PyObject *WinObj_GetWindowProxyIcon(WindowObject *_self, PyObject *_args)
1104{
1105	PyObject *_res = NULL;
1106	OSStatus _err;
1107	IconRef outIcon;
1108#ifndef GetWindowProxyIcon
1109	PyMac_PRECHECK(GetWindowProxyIcon);
1110#endif
1111	if (!PyArg_ParseTuple(_args, ""))
1112		return NULL;
1113	_err = GetWindowProxyIcon(_self->ob_itself,
1114	                          &outIcon);
1115	if (_err != noErr) return PyMac_Error(_err);
1116	_res = Py_BuildValue("O&",
1117	                     ResObj_New, outIcon);
1118	return _res;
1119}
1120
1121static PyObject *WinObj_SetWindowProxyIcon(WindowObject *_self, PyObject *_args)
1122{
1123	PyObject *_res = NULL;
1124	OSStatus _err;
1125	IconRef icon;
1126#ifndef SetWindowProxyIcon
1127	PyMac_PRECHECK(SetWindowProxyIcon);
1128#endif
1129	if (!PyArg_ParseTuple(_args, "O&",
1130	                      ResObj_Convert, &icon))
1131		return NULL;
1132	_err = SetWindowProxyIcon(_self->ob_itself,
1133	                          icon);
1134	if (_err != noErr) return PyMac_Error(_err);
1135	Py_INCREF(Py_None);
1136	_res = Py_None;
1137	return _res;
1138}
1139
1140static PyObject *WinObj_RemoveWindowProxy(WindowObject *_self, PyObject *_args)
1141{
1142	PyObject *_res = NULL;
1143	OSStatus _err;
1144#ifndef RemoveWindowProxy
1145	PyMac_PRECHECK(RemoveWindowProxy);
1146#endif
1147	if (!PyArg_ParseTuple(_args, ""))
1148		return NULL;
1149	_err = RemoveWindowProxy(_self->ob_itself);
1150	if (_err != noErr) return PyMac_Error(_err);
1151	Py_INCREF(Py_None);
1152	_res = Py_None;
1153	return _res;
1154}
1155
1156static PyObject *WinObj_BeginWindowProxyDrag(WindowObject *_self, PyObject *_args)
1157{
1158	PyObject *_res = NULL;
1159	OSStatus _err;
1160	DragReference outNewDrag;
1161	RgnHandle outDragOutlineRgn;
1162#ifndef BeginWindowProxyDrag
1163	PyMac_PRECHECK(BeginWindowProxyDrag);
1164#endif
1165	if (!PyArg_ParseTuple(_args, "O&",
1166	                      ResObj_Convert, &outDragOutlineRgn))
1167		return NULL;
1168	_err = BeginWindowProxyDrag(_self->ob_itself,
1169	                            &outNewDrag,
1170	                            outDragOutlineRgn);
1171	if (_err != noErr) return PyMac_Error(_err);
1172	_res = Py_BuildValue("O&",
1173	                     DragObj_New, outNewDrag);
1174	return _res;
1175}
1176
1177static PyObject *WinObj_EndWindowProxyDrag(WindowObject *_self, PyObject *_args)
1178{
1179	PyObject *_res = NULL;
1180	OSStatus _err;
1181	DragReference theDrag;
1182#ifndef EndWindowProxyDrag
1183	PyMac_PRECHECK(EndWindowProxyDrag);
1184#endif
1185	if (!PyArg_ParseTuple(_args, "O&",
1186	                      DragObj_Convert, &theDrag))
1187		return NULL;
1188	_err = EndWindowProxyDrag(_self->ob_itself,
1189	                          theDrag);
1190	if (_err != noErr) return PyMac_Error(_err);
1191	Py_INCREF(Py_None);
1192	_res = Py_None;
1193	return _res;
1194}
1195
1196static PyObject *WinObj_TrackWindowProxyFromExistingDrag(WindowObject *_self, PyObject *_args)
1197{
1198	PyObject *_res = NULL;
1199	OSStatus _err;
1200	Point startPt;
1201	DragReference drag;
1202	RgnHandle inDragOutlineRgn;
1203#ifndef TrackWindowProxyFromExistingDrag
1204	PyMac_PRECHECK(TrackWindowProxyFromExistingDrag);
1205#endif
1206	if (!PyArg_ParseTuple(_args, "O&O&O&",
1207	                      PyMac_GetPoint, &startPt,
1208	                      DragObj_Convert, &drag,
1209	                      ResObj_Convert, &inDragOutlineRgn))
1210		return NULL;
1211	_err = TrackWindowProxyFromExistingDrag(_self->ob_itself,
1212	                                        startPt,
1213	                                        drag,
1214	                                        inDragOutlineRgn);
1215	if (_err != noErr) return PyMac_Error(_err);
1216	Py_INCREF(Py_None);
1217	_res = Py_None;
1218	return _res;
1219}
1220
1221static PyObject *WinObj_TrackWindowProxyDrag(WindowObject *_self, PyObject *_args)
1222{
1223	PyObject *_res = NULL;
1224	OSStatus _err;
1225	Point startPt;
1226#ifndef TrackWindowProxyDrag
1227	PyMac_PRECHECK(TrackWindowProxyDrag);
1228#endif
1229	if (!PyArg_ParseTuple(_args, "O&",
1230	                      PyMac_GetPoint, &startPt))
1231		return NULL;
1232	_err = TrackWindowProxyDrag(_self->ob_itself,
1233	                            startPt);
1234	if (_err != noErr) return PyMac_Error(_err);
1235	Py_INCREF(Py_None);
1236	_res = Py_None;
1237	return _res;
1238}
1239
1240static PyObject *WinObj_IsWindowModified(WindowObject *_self, PyObject *_args)
1241{
1242	PyObject *_res = NULL;
1243	Boolean _rv;
1244#ifndef IsWindowModified
1245	PyMac_PRECHECK(IsWindowModified);
1246#endif
1247	if (!PyArg_ParseTuple(_args, ""))
1248		return NULL;
1249	_rv = IsWindowModified(_self->ob_itself);
1250	_res = Py_BuildValue("b",
1251	                     _rv);
1252	return _res;
1253}
1254
1255static PyObject *WinObj_SetWindowModified(WindowObject *_self, PyObject *_args)
1256{
1257	PyObject *_res = NULL;
1258	OSStatus _err;
1259	Boolean modified;
1260#ifndef SetWindowModified
1261	PyMac_PRECHECK(SetWindowModified);
1262#endif
1263	if (!PyArg_ParseTuple(_args, "b",
1264	                      &modified))
1265		return NULL;
1266	_err = SetWindowModified(_self->ob_itself,
1267	                         modified);
1268	if (_err != noErr) return PyMac_Error(_err);
1269	Py_INCREF(Py_None);
1270	_res = Py_None;
1271	return _res;
1272}
1273
1274static PyObject *WinObj_IsWindowPathSelectClick(WindowObject *_self, PyObject *_args)
1275{
1276	PyObject *_res = NULL;
1277	Boolean _rv;
1278	EventRecord event;
1279#ifndef IsWindowPathSelectClick
1280	PyMac_PRECHECK(IsWindowPathSelectClick);
1281#endif
1282	if (!PyArg_ParseTuple(_args, "O&",
1283	                      PyMac_GetEventRecord, &event))
1284		return NULL;
1285	_rv = IsWindowPathSelectClick(_self->ob_itself,
1286	                              &event);
1287	_res = Py_BuildValue("b",
1288	                     _rv);
1289	return _res;
1290}
1291
1292static PyObject *WinObj_WindowPathSelect(WindowObject *_self, PyObject *_args)
1293{
1294	PyObject *_res = NULL;
1295	OSStatus _err;
1296	MenuHandle menu;
1297	SInt32 outMenuResult;
1298#ifndef WindowPathSelect
1299	PyMac_PRECHECK(WindowPathSelect);
1300#endif
1301	if (!PyArg_ParseTuple(_args, "O&",
1302	                      MenuObj_Convert, &menu))
1303		return NULL;
1304	_err = WindowPathSelect(_self->ob_itself,
1305	                        menu,
1306	                        &outMenuResult);
1307	if (_err != noErr) return PyMac_Error(_err);
1308	_res = Py_BuildValue("l",
1309	                     outMenuResult);
1310	return _res;
1311}
1312
1313static PyObject *WinObj_HiliteWindowFrameForDrag(WindowObject *_self, PyObject *_args)
1314{
1315	PyObject *_res = NULL;
1316	OSStatus _err;
1317	Boolean hilited;
1318#ifndef HiliteWindowFrameForDrag
1319	PyMac_PRECHECK(HiliteWindowFrameForDrag);
1320#endif
1321	if (!PyArg_ParseTuple(_args, "b",
1322	                      &hilited))
1323		return NULL;
1324	_err = HiliteWindowFrameForDrag(_self->ob_itself,
1325	                                hilited);
1326	if (_err != noErr) return PyMac_Error(_err);
1327	Py_INCREF(Py_None);
1328	_res = Py_None;
1329	return _res;
1330}
1331
1332static PyObject *WinObj_TransitionWindow(WindowObject *_self, PyObject *_args)
1333{
1334	PyObject *_res = NULL;
1335	OSStatus _err;
1336	WindowTransitionEffect inEffect;
1337	WindowTransitionAction inAction;
1338	Rect inRect;
1339#ifndef TransitionWindow
1340	PyMac_PRECHECK(TransitionWindow);
1341#endif
1342	if (!PyArg_ParseTuple(_args, "llO&",
1343	                      &inEffect,
1344	                      &inAction,
1345	                      PyMac_GetRect, &inRect))
1346		return NULL;
1347	_err = TransitionWindow(_self->ob_itself,
1348	                        inEffect,
1349	                        inAction,
1350	                        &inRect);
1351	if (_err != noErr) return PyMac_Error(_err);
1352	Py_INCREF(Py_None);
1353	_res = Py_None;
1354	return _res;
1355}
1356
1357static PyObject *WinObj_TransitionWindowAndParent(WindowObject *_self, PyObject *_args)
1358{
1359	PyObject *_res = NULL;
1360	OSStatus _err;
1361	WindowPtr inParentWindow;
1362	WindowTransitionEffect inEffect;
1363	WindowTransitionAction inAction;
1364	Rect inRect;
1365#ifndef TransitionWindowAndParent
1366	PyMac_PRECHECK(TransitionWindowAndParent);
1367#endif
1368	if (!PyArg_ParseTuple(_args, "O&llO&",
1369	                      WinObj_Convert, &inParentWindow,
1370	                      &inEffect,
1371	                      &inAction,
1372	                      PyMac_GetRect, &inRect))
1373		return NULL;
1374	_err = TransitionWindowAndParent(_self->ob_itself,
1375	                                 inParentWindow,
1376	                                 inEffect,
1377	                                 inAction,
1378	                                 &inRect);
1379	if (_err != noErr) return PyMac_Error(_err);
1380	Py_INCREF(Py_None);
1381	_res = Py_None;
1382	return _res;
1383}
1384
1385static PyObject *WinObj_MacMoveWindow(WindowObject *_self, PyObject *_args)
1386{
1387	PyObject *_res = NULL;
1388	short hGlobal;
1389	short vGlobal;
1390	Boolean front;
1391#ifndef MacMoveWindow
1392	PyMac_PRECHECK(MacMoveWindow);
1393#endif
1394	if (!PyArg_ParseTuple(_args, "hhb",
1395	                      &hGlobal,
1396	                      &vGlobal,
1397	                      &front))
1398		return NULL;
1399	MacMoveWindow(_self->ob_itself,
1400	              hGlobal,
1401	              vGlobal,
1402	              front);
1403	Py_INCREF(Py_None);
1404	_res = Py_None;
1405	return _res;
1406}
1407
1408static PyObject *WinObj_SizeWindow(WindowObject *_self, PyObject *_args)
1409{
1410	PyObject *_res = NULL;
1411	short w;
1412	short h;
1413	Boolean fUpdate;
1414#ifndef SizeWindow
1415	PyMac_PRECHECK(SizeWindow);
1416#endif
1417	if (!PyArg_ParseTuple(_args, "hhb",
1418	                      &w,
1419	                      &h,
1420	                      &fUpdate))
1421		return NULL;
1422	SizeWindow(_self->ob_itself,
1423	           w,
1424	           h,
1425	           fUpdate);
1426	Py_INCREF(Py_None);
1427	_res = Py_None;
1428	return _res;
1429}
1430
1431static PyObject *WinObj_GrowWindow(WindowObject *_self, PyObject *_args)
1432{
1433	PyObject *_res = NULL;
1434	long _rv;
1435	Point startPt;
1436	Rect bBox;
1437#ifndef GrowWindow
1438	PyMac_PRECHECK(GrowWindow);
1439#endif
1440	if (!PyArg_ParseTuple(_args, "O&O&",
1441	                      PyMac_GetPoint, &startPt,
1442	                      PyMac_GetRect, &bBox))
1443		return NULL;
1444	_rv = GrowWindow(_self->ob_itself,
1445	                 startPt,
1446	                 &bBox);
1447	_res = Py_BuildValue("l",
1448	                     _rv);
1449	return _res;
1450}
1451
1452static PyObject *WinObj_DragWindow(WindowObject *_self, PyObject *_args)
1453{
1454	PyObject *_res = NULL;
1455	Point startPt;
1456	Rect boundsRect;
1457#ifndef DragWindow
1458	PyMac_PRECHECK(DragWindow);
1459#endif
1460	if (!PyArg_ParseTuple(_args, "O&O&",
1461	                      PyMac_GetPoint, &startPt,
1462	                      PyMac_GetRect, &boundsRect))
1463		return NULL;
1464	DragWindow(_self->ob_itself,
1465	           startPt,
1466	           &boundsRect);
1467	Py_INCREF(Py_None);
1468	_res = Py_None;
1469	return _res;
1470}
1471
1472static PyObject *WinObj_ZoomWindow(WindowObject *_self, PyObject *_args)
1473{
1474	PyObject *_res = NULL;
1475	WindowPartCode partCode;
1476	Boolean front;
1477#ifndef ZoomWindow
1478	PyMac_PRECHECK(ZoomWindow);
1479#endif
1480	if (!PyArg_ParseTuple(_args, "hb",
1481	                      &partCode,
1482	                      &front))
1483		return NULL;
1484	ZoomWindow(_self->ob_itself,
1485	           partCode,
1486	           front);
1487	Py_INCREF(Py_None);
1488	_res = Py_None;
1489	return _res;
1490}
1491
1492static PyObject *WinObj_IsWindowCollapsable(WindowObject *_self, PyObject *_args)
1493{
1494	PyObject *_res = NULL;
1495	Boolean _rv;
1496#ifndef IsWindowCollapsable
1497	PyMac_PRECHECK(IsWindowCollapsable);
1498#endif
1499	if (!PyArg_ParseTuple(_args, ""))
1500		return NULL;
1501	_rv = IsWindowCollapsable(_self->ob_itself);
1502	_res = Py_BuildValue("b",
1503	                     _rv);
1504	return _res;
1505}
1506
1507static PyObject *WinObj_IsWindowCollapsed(WindowObject *_self, PyObject *_args)
1508{
1509	PyObject *_res = NULL;
1510	Boolean _rv;
1511#ifndef IsWindowCollapsed
1512	PyMac_PRECHECK(IsWindowCollapsed);
1513#endif
1514	if (!PyArg_ParseTuple(_args, ""))
1515		return NULL;
1516	_rv = IsWindowCollapsed(_self->ob_itself);
1517	_res = Py_BuildValue("b",
1518	                     _rv);
1519	return _res;
1520}
1521
1522static PyObject *WinObj_CollapseWindow(WindowObject *_self, PyObject *_args)
1523{
1524	PyObject *_res = NULL;
1525	OSStatus _err;
1526	Boolean collapse;
1527#ifndef CollapseWindow
1528	PyMac_PRECHECK(CollapseWindow);
1529#endif
1530	if (!PyArg_ParseTuple(_args, "b",
1531	                      &collapse))
1532		return NULL;
1533	_err = CollapseWindow(_self->ob_itself,
1534	                      collapse);
1535	if (_err != noErr) return PyMac_Error(_err);
1536	Py_INCREF(Py_None);
1537	_res = Py_None;
1538	return _res;
1539}
1540
1541static PyObject *WinObj_GetWindowBounds(WindowObject *_self, PyObject *_args)
1542{
1543	PyObject *_res = NULL;
1544	OSStatus _err;
1545	WindowRegionCode regionCode;
1546	Rect globalBounds;
1547#ifndef GetWindowBounds
1548	PyMac_PRECHECK(GetWindowBounds);
1549#endif
1550	if (!PyArg_ParseTuple(_args, "H",
1551	                      &regionCode))
1552		return NULL;
1553	_err = GetWindowBounds(_self->ob_itself,
1554	                       regionCode,
1555	                       &globalBounds);
1556	if (_err != noErr) return PyMac_Error(_err);
1557	_res = Py_BuildValue("O&",
1558	                     PyMac_BuildRect, &globalBounds);
1559	return _res;
1560}
1561
1562static PyObject *WinObj_ResizeWindow(WindowObject *_self, PyObject *_args)
1563{
1564	PyObject *_res = NULL;
1565	Boolean _rv;
1566	Point inStartPoint;
1567	Rect inSizeConstraints;
1568	Rect outNewContentRect;
1569#ifndef ResizeWindow
1570	PyMac_PRECHECK(ResizeWindow);
1571#endif
1572	if (!PyArg_ParseTuple(_args, "O&O&",
1573	                      PyMac_GetPoint, &inStartPoint,
1574	                      PyMac_GetRect, &inSizeConstraints))
1575		return NULL;
1576	_rv = ResizeWindow(_self->ob_itself,
1577	                   inStartPoint,
1578	                   &inSizeConstraints,
1579	                   &outNewContentRect);
1580	_res = Py_BuildValue("bO&",
1581	                     _rv,
1582	                     PyMac_BuildRect, &outNewContentRect);
1583	return _res;
1584}
1585
1586static PyObject *WinObj_SetWindowBounds(WindowObject *_self, PyObject *_args)
1587{
1588	PyObject *_res = NULL;
1589	OSStatus _err;
1590	WindowRegionCode regionCode;
1591	Rect globalBounds;
1592#ifndef SetWindowBounds
1593	PyMac_PRECHECK(SetWindowBounds);
1594#endif
1595	if (!PyArg_ParseTuple(_args, "HO&",
1596	                      &regionCode,
1597	                      PyMac_GetRect, &globalBounds))
1598		return NULL;
1599	_err = SetWindowBounds(_self->ob_itself,
1600	                       regionCode,
1601	                       &globalBounds);
1602	if (_err != noErr) return PyMac_Error(_err);
1603	Py_INCREF(Py_None);
1604	_res = Py_None;
1605	return _res;
1606}
1607
1608static PyObject *WinObj_RepositionWindow(WindowObject *_self, PyObject *_args)
1609{
1610	PyObject *_res = NULL;
1611	OSStatus _err;
1612	WindowPtr parentWindow;
1613	WindowPositionMethod method;
1614#ifndef RepositionWindow
1615	PyMac_PRECHECK(RepositionWindow);
1616#endif
1617	if (!PyArg_ParseTuple(_args, "O&l",
1618	                      WinObj_Convert, &parentWindow,
1619	                      &method))
1620		return NULL;
1621	_err = RepositionWindow(_self->ob_itself,
1622	                        parentWindow,
1623	                        method);
1624	if (_err != noErr) return PyMac_Error(_err);
1625	Py_INCREF(Py_None);
1626	_res = Py_None;
1627	return _res;
1628}
1629
1630static PyObject *WinObj_MoveWindowStructure(WindowObject *_self, PyObject *_args)
1631{
1632	PyObject *_res = NULL;
1633	OSStatus _err;
1634	short hGlobal;
1635	short vGlobal;
1636#ifndef MoveWindowStructure
1637	PyMac_PRECHECK(MoveWindowStructure);
1638#endif
1639	if (!PyArg_ParseTuple(_args, "hh",
1640	                      &hGlobal,
1641	                      &vGlobal))
1642		return NULL;
1643	_err = MoveWindowStructure(_self->ob_itself,
1644	                           hGlobal,
1645	                           vGlobal);
1646	if (_err != noErr) return PyMac_Error(_err);
1647	Py_INCREF(Py_None);
1648	_res = Py_None;
1649	return _res;
1650}
1651
1652static PyObject *WinObj_IsWindowInStandardState(WindowObject *_self, PyObject *_args)
1653{
1654	PyObject *_res = NULL;
1655	Boolean _rv;
1656	Point inIdealSize;
1657	Rect outIdealStandardState;
1658#ifndef IsWindowInStandardState
1659	PyMac_PRECHECK(IsWindowInStandardState);
1660#endif
1661	if (!PyArg_ParseTuple(_args, "O&",
1662	                      PyMac_GetPoint, &inIdealSize))
1663		return NULL;
1664	_rv = IsWindowInStandardState(_self->ob_itself,
1665	                              &inIdealSize,
1666	                              &outIdealStandardState);
1667	_res = Py_BuildValue("bO&",
1668	                     _rv,
1669	                     PyMac_BuildRect, &outIdealStandardState);
1670	return _res;
1671}
1672
1673static PyObject *WinObj_ZoomWindowIdeal(WindowObject *_self, PyObject *_args)
1674{
1675	PyObject *_res = NULL;
1676	OSStatus _err;
1677	WindowPartCode inPartCode;
1678	Point ioIdealSize;
1679#ifndef ZoomWindowIdeal
1680	PyMac_PRECHECK(ZoomWindowIdeal);
1681#endif
1682	if (!PyArg_ParseTuple(_args, "h",
1683	                      &inPartCode))
1684		return NULL;
1685	_err = ZoomWindowIdeal(_self->ob_itself,
1686	                       inPartCode,
1687	                       &ioIdealSize);
1688	if (_err != noErr) return PyMac_Error(_err);
1689	_res = Py_BuildValue("O&",
1690	                     PyMac_BuildPoint, ioIdealSize);
1691	return _res;
1692}
1693
1694static PyObject *WinObj_GetWindowIdealUserState(WindowObject *_self, PyObject *_args)
1695{
1696	PyObject *_res = NULL;
1697	OSStatus _err;
1698	Rect outUserState;
1699#ifndef GetWindowIdealUserState
1700	PyMac_PRECHECK(GetWindowIdealUserState);
1701#endif
1702	if (!PyArg_ParseTuple(_args, ""))
1703		return NULL;
1704	_err = GetWindowIdealUserState(_self->ob_itself,
1705	                               &outUserState);
1706	if (_err != noErr) return PyMac_Error(_err);
1707	_res = Py_BuildValue("O&",
1708	                     PyMac_BuildRect, &outUserState);
1709	return _res;
1710}
1711
1712static PyObject *WinObj_SetWindowIdealUserState(WindowObject *_self, PyObject *_args)
1713{
1714	PyObject *_res = NULL;
1715	OSStatus _err;
1716	Rect inUserState;
1717#ifndef SetWindowIdealUserState
1718	PyMac_PRECHECK(SetWindowIdealUserState);
1719#endif
1720	if (!PyArg_ParseTuple(_args, "O&",
1721	                      PyMac_GetRect, &inUserState))
1722		return NULL;
1723	_err = SetWindowIdealUserState(_self->ob_itself,
1724	                               &inUserState);
1725	if (_err != noErr) return PyMac_Error(_err);
1726	Py_INCREF(Py_None);
1727	_res = Py_None;
1728	return _res;
1729}
1730
1731static PyObject *WinObj_GetWindowGreatestAreaDevice(WindowObject *_self, PyObject *_args)
1732{
1733	PyObject *_res = NULL;
1734	OSStatus _err;
1735	WindowRegionCode inRegion;
1736	GDHandle outGreatestDevice;
1737	Rect outGreatestDeviceRect;
1738#ifndef GetWindowGreatestAreaDevice
1739	PyMac_PRECHECK(GetWindowGreatestAreaDevice);
1740#endif
1741	if (!PyArg_ParseTuple(_args, "H",
1742	                      &inRegion))
1743		return NULL;
1744	_err = GetWindowGreatestAreaDevice(_self->ob_itself,
1745	                                   inRegion,
1746	                                   &outGreatestDevice,
1747	                                   &outGreatestDeviceRect);
1748	if (_err != noErr) return PyMac_Error(_err);
1749	_res = Py_BuildValue("O&O&",
1750	                     ResObj_New, outGreatestDevice,
1751	                     PyMac_BuildRect, &outGreatestDeviceRect);
1752	return _res;
1753}
1754
1755static PyObject *WinObj_ConstrainWindowToScreen(WindowObject *_self, PyObject *_args)
1756{
1757	PyObject *_res = NULL;
1758	OSStatus _err;
1759	WindowRegionCode inRegionCode;
1760	WindowConstrainOptions inOptions;
1761	Rect inScreenRect;
1762	Rect outStructure;
1763#ifndef ConstrainWindowToScreen
1764	PyMac_PRECHECK(ConstrainWindowToScreen);
1765#endif
1766	if (!PyArg_ParseTuple(_args, "HlO&",
1767	                      &inRegionCode,
1768	                      &inOptions,
1769	                      PyMac_GetRect, &inScreenRect))
1770		return NULL;
1771	_err = ConstrainWindowToScreen(_self->ob_itself,
1772	                               inRegionCode,
1773	                               inOptions,
1774	                               &inScreenRect,
1775	                               &outStructure);
1776	if (_err != noErr) return PyMac_Error(_err);
1777	_res = Py_BuildValue("O&",
1778	                     PyMac_BuildRect, &outStructure);
1779	return _res;
1780}
1781
1782static PyObject *WinObj_HideWindow(WindowObject *_self, PyObject *_args)
1783{
1784	PyObject *_res = NULL;
1785#ifndef HideWindow
1786	PyMac_PRECHECK(HideWindow);
1787#endif
1788	if (!PyArg_ParseTuple(_args, ""))
1789		return NULL;
1790	HideWindow(_self->ob_itself);
1791	Py_INCREF(Py_None);
1792	_res = Py_None;
1793	return _res;
1794}
1795
1796static PyObject *WinObj_MacShowWindow(WindowObject *_self, PyObject *_args)
1797{
1798	PyObject *_res = NULL;
1799#ifndef MacShowWindow
1800	PyMac_PRECHECK(MacShowWindow);
1801#endif
1802	if (!PyArg_ParseTuple(_args, ""))
1803		return NULL;
1804	MacShowWindow(_self->ob_itself);
1805	Py_INCREF(Py_None);
1806	_res = Py_None;
1807	return _res;
1808}
1809
1810static PyObject *WinObj_ShowHide(WindowObject *_self, PyObject *_args)
1811{
1812	PyObject *_res = NULL;
1813	Boolean showFlag;
1814#ifndef ShowHide
1815	PyMac_PRECHECK(ShowHide);
1816#endif
1817	if (!PyArg_ParseTuple(_args, "b",
1818	                      &showFlag))
1819		return NULL;
1820	ShowHide(_self->ob_itself,
1821	         showFlag);
1822	Py_INCREF(Py_None);
1823	_res = Py_None;
1824	return _res;
1825}
1826
1827static PyObject *WinObj_MacIsWindowVisible(WindowObject *_self, PyObject *_args)
1828{
1829	PyObject *_res = NULL;
1830	Boolean _rv;
1831#ifndef MacIsWindowVisible
1832	PyMac_PRECHECK(MacIsWindowVisible);
1833#endif
1834	if (!PyArg_ParseTuple(_args, ""))
1835		return NULL;
1836	_rv = MacIsWindowVisible(_self->ob_itself);
1837	_res = Py_BuildValue("b",
1838	                     _rv);
1839	return _res;
1840}
1841
1842static PyObject *WinObj_ShowSheetWindow(WindowObject *_self, PyObject *_args)
1843{
1844	PyObject *_res = NULL;
1845	OSStatus _err;
1846	WindowPtr inParentWindow;
1847#ifndef ShowSheetWindow
1848	PyMac_PRECHECK(ShowSheetWindow);
1849#endif
1850	if (!PyArg_ParseTuple(_args, "O&",
1851	                      WinObj_Convert, &inParentWindow))
1852		return NULL;
1853	_err = ShowSheetWindow(_self->ob_itself,
1854	                       inParentWindow);
1855	if (_err != noErr) return PyMac_Error(_err);
1856	Py_INCREF(Py_None);
1857	_res = Py_None;
1858	return _res;
1859}
1860
1861static PyObject *WinObj_HideSheetWindow(WindowObject *_self, PyObject *_args)
1862{
1863	PyObject *_res = NULL;
1864	OSStatus _err;
1865#ifndef HideSheetWindow
1866	PyMac_PRECHECK(HideSheetWindow);
1867#endif
1868	if (!PyArg_ParseTuple(_args, ""))
1869		return NULL;
1870	_err = HideSheetWindow(_self->ob_itself);
1871	if (_err != noErr) return PyMac_Error(_err);
1872	Py_INCREF(Py_None);
1873	_res = Py_None;
1874	return _res;
1875}
1876
1877static PyObject *WinObj_GetSheetWindowParent(WindowObject *_self, PyObject *_args)
1878{
1879	PyObject *_res = NULL;
1880	OSStatus _err;
1881	WindowPtr outParentWindow;
1882#ifndef GetSheetWindowParent
1883	PyMac_PRECHECK(GetSheetWindowParent);
1884#endif
1885	if (!PyArg_ParseTuple(_args, ""))
1886		return NULL;
1887	_err = GetSheetWindowParent(_self->ob_itself,
1888	                            &outParentWindow);
1889	if (_err != noErr) return PyMac_Error(_err);
1890	_res = Py_BuildValue("O&",
1891	                     WinObj_WhichWindow, outParentWindow);
1892	return _res;
1893}
1894
1895static PyObject *WinObj_GetWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
1896{
1897	PyObject *_res = NULL;
1898	OSStatus _err;
1899	OSType propertyCreator;
1900	OSType propertyTag;
1901	UInt32 attributes;
1902#ifndef GetWindowPropertyAttributes
1903	PyMac_PRECHECK(GetWindowPropertyAttributes);
1904#endif
1905	if (!PyArg_ParseTuple(_args, "O&O&",
1906	                      PyMac_GetOSType, &propertyCreator,
1907	                      PyMac_GetOSType, &propertyTag))
1908		return NULL;
1909	_err = GetWindowPropertyAttributes(_self->ob_itself,
1910	                                   propertyCreator,
1911	                            

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