symbian-qemu-0.9.1-12/python-2.6.1/Mac/Modules/win/_Winmodule.c
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     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
       
    21 extern PyObject *_WinObj_New(WindowRef);
       
    22 extern PyObject *_WinObj_WhichWindow(WindowRef);
       
    23 extern 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 */
       
    36 static void
       
    37 PyMac_AutoDisposeWindow(WindowPtr w)
       
    38 {
       
    39         DisposeWindow(w);
       
    40 }
       
    41 
       
    42 static PyObject *Win_Error;
       
    43 
       
    44 /* ----------------------- Object type Window ----------------------- */
       
    45 
       
    46 PyTypeObject Window_Type;
       
    47 
       
    48 #define WinObj_Check(x) ((x)->ob_type == &Window_Type || PyObject_TypeCheck((x), &Window_Type))
       
    49 
       
    50 typedef struct WindowObject {
       
    51 	PyObject_HEAD
       
    52 	WindowPtr ob_itself;
       
    53 	void (*ob_freeit)(WindowPtr ptr);
       
    54 } WindowObject;
       
    55 
       
    56 PyObject *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 
       
    73 int 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 
       
    96 static 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 
       
   108 static 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 
       
   126 static 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 
       
   142 static 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 
       
   157 static 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 
       
   173 static 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 
       
   189 static 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 
       
   205 static 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 
       
   223 static 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 
       
   241 static 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 
       
   259 static 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 
       
   281 static 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 
       
   300 static 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 
       
   322 static 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 
       
   343 static 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 
       
   362 static 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 
       
   380 static 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 
       
   399 static 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 
       
   418 static 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 
       
   449 static 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 
       
   480 static 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 
       
   494 static 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 
       
   511 static 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 
       
   528 static 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 
       
   542 static 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 
       
   559 static 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 
       
   573 static 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 
       
   590 static 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 
       
   604 static 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 
       
   625 static 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 
       
   644 static 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 
       
   662 static 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 
       
   679 static 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 
       
   696 static 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 
       
   711 static 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 
       
   728 static 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 
       
   743 static 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 
       
   758 static 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 
       
   776 static 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 
       
   798 static 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 
       
   816 static 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 
       
   830 static 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 
       
   844 static 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 
       
   863 static 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 
       
   882 static 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 
       
   901 static 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 
       
   920 static 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 
       
   934 static 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 
       
   951 static 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 
       
   967 static 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 
       
   986 static 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 
       
  1004 static 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 
       
  1023 static 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 
       
  1041 static 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 
       
  1060 static 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 
       
  1078 static 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 
       
  1103 static 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 
       
  1121 static 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 
       
  1140 static 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 
       
  1156 static 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 
       
  1177 static 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 
       
  1196 static 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 
       
  1221 static 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 
       
  1240 static 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 
       
  1255 static 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 
       
  1274 static 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 
       
  1292 static 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 
       
  1313 static 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 
       
  1332 static 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 
       
  1357 static 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 
       
  1385 static 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 
       
  1408 static 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 
       
  1431 static 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 
       
  1452 static 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 
       
  1472 static 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 
       
  1492 static 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 
       
  1507 static 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 
       
  1522 static 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 
       
  1541 static 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 
       
  1562 static 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 
       
  1586 static 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 
       
  1608 static 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 
       
  1630 static 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 
       
  1652 static 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 
       
  1673 static 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 
       
  1694 static 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 
       
  1712 static 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 
       
  1731 static 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 
       
  1755 static 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 
       
  1782 static 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 
       
  1796 static 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 
       
  1810 static 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 
       
  1827 static 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 
       
  1842 static 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 
       
  1861 static 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 
       
  1877 static 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 
       
  1895 static 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 	                                   propertyTag,
       
  1912 	                                   &attributes);
       
  1913 	if (_err != noErr) return PyMac_Error(_err);
       
  1914 	_res = Py_BuildValue("l",
       
  1915 	                     attributes);
       
  1916 	return _res;
       
  1917 }
       
  1918 
       
  1919 static PyObject *WinObj_ChangeWindowPropertyAttributes(WindowObject *_self, PyObject *_args)
       
  1920 {
       
  1921 	PyObject *_res = NULL;
       
  1922 	OSStatus _err;
       
  1923 	OSType propertyCreator;
       
  1924 	OSType propertyTag;
       
  1925 	UInt32 attributesToSet;
       
  1926 	UInt32 attributesToClear;
       
  1927 #ifndef ChangeWindowPropertyAttributes
       
  1928 	PyMac_PRECHECK(ChangeWindowPropertyAttributes);
       
  1929 #endif
       
  1930 	if (!PyArg_ParseTuple(_args, "O&O&ll",
       
  1931 	                      PyMac_GetOSType, &propertyCreator,
       
  1932 	                      PyMac_GetOSType, &propertyTag,
       
  1933 	                      &attributesToSet,
       
  1934 	                      &attributesToClear))
       
  1935 		return NULL;
       
  1936 	_err = ChangeWindowPropertyAttributes(_self->ob_itself,
       
  1937 	                                      propertyCreator,
       
  1938 	                                      propertyTag,
       
  1939 	                                      attributesToSet,
       
  1940 	                                      attributesToClear);
       
  1941 	if (_err != noErr) return PyMac_Error(_err);
       
  1942 	Py_INCREF(Py_None);
       
  1943 	_res = Py_None;
       
  1944 	return _res;
       
  1945 }
       
  1946 
       
  1947 static PyObject *WinObj_TrackBox(WindowObject *_self, PyObject *_args)
       
  1948 {
       
  1949 	PyObject *_res = NULL;
       
  1950 	Boolean _rv;
       
  1951 	Point thePt;
       
  1952 	WindowPartCode partCode;
       
  1953 #ifndef TrackBox
       
  1954 	PyMac_PRECHECK(TrackBox);
       
  1955 #endif
       
  1956 	if (!PyArg_ParseTuple(_args, "O&h",
       
  1957 	                      PyMac_GetPoint, &thePt,
       
  1958 	                      &partCode))
       
  1959 		return NULL;
       
  1960 	_rv = TrackBox(_self->ob_itself,
       
  1961 	               thePt,
       
  1962 	               partCode);
       
  1963 	_res = Py_BuildValue("b",
       
  1964 	                     _rv);
       
  1965 	return _res;
       
  1966 }
       
  1967 
       
  1968 static PyObject *WinObj_TrackGoAway(WindowObject *_self, PyObject *_args)
       
  1969 {
       
  1970 	PyObject *_res = NULL;
       
  1971 	Boolean _rv;
       
  1972 	Point thePt;
       
  1973 #ifndef TrackGoAway
       
  1974 	PyMac_PRECHECK(TrackGoAway);
       
  1975 #endif
       
  1976 	if (!PyArg_ParseTuple(_args, "O&",
       
  1977 	                      PyMac_GetPoint, &thePt))
       
  1978 		return NULL;
       
  1979 	_rv = TrackGoAway(_self->ob_itself,
       
  1980 	                  thePt);
       
  1981 	_res = Py_BuildValue("b",
       
  1982 	                     _rv);
       
  1983 	return _res;
       
  1984 }
       
  1985 
       
  1986 static PyObject *WinObj_GetWindowPort(WindowObject *_self, PyObject *_args)
       
  1987 {
       
  1988 	PyObject *_res = NULL;
       
  1989 	CGrafPtr _rv;
       
  1990 #ifndef GetWindowPort
       
  1991 	PyMac_PRECHECK(GetWindowPort);
       
  1992 #endif
       
  1993 	if (!PyArg_ParseTuple(_args, ""))
       
  1994 		return NULL;
       
  1995 	_rv = GetWindowPort(_self->ob_itself);
       
  1996 	_res = Py_BuildValue("O&",
       
  1997 	                     GrafObj_New, _rv);
       
  1998 	return _res;
       
  1999 }
       
  2000 
       
  2001 static PyObject *WinObj_GetWindowStructurePort(WindowObject *_self, PyObject *_args)
       
  2002 {
       
  2003 	PyObject *_res = NULL;
       
  2004 	CGrafPtr _rv;
       
  2005 #ifndef GetWindowStructurePort
       
  2006 	PyMac_PRECHECK(GetWindowStructurePort);
       
  2007 #endif
       
  2008 	if (!PyArg_ParseTuple(_args, ""))
       
  2009 		return NULL;
       
  2010 	_rv = GetWindowStructurePort(_self->ob_itself);
       
  2011 	_res = Py_BuildValue("O&",
       
  2012 	                     GrafObj_New, _rv);
       
  2013 	return _res;
       
  2014 }
       
  2015 
       
  2016 static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args)
       
  2017 {
       
  2018 	PyObject *_res = NULL;
       
  2019 	short _rv;
       
  2020 #ifndef GetWindowKind
       
  2021 	PyMac_PRECHECK(GetWindowKind);
       
  2022 #endif
       
  2023 	if (!PyArg_ParseTuple(_args, ""))
       
  2024 		return NULL;
       
  2025 	_rv = GetWindowKind(_self->ob_itself);
       
  2026 	_res = Py_BuildValue("h",
       
  2027 	                     _rv);
       
  2028 	return _res;
       
  2029 }
       
  2030 
       
  2031 static PyObject *WinObj_IsWindowHilited(WindowObject *_self, PyObject *_args)
       
  2032 {
       
  2033 	PyObject *_res = NULL;
       
  2034 	Boolean _rv;
       
  2035 #ifndef IsWindowHilited
       
  2036 	PyMac_PRECHECK(IsWindowHilited);
       
  2037 #endif
       
  2038 	if (!PyArg_ParseTuple(_args, ""))
       
  2039 		return NULL;
       
  2040 	_rv = IsWindowHilited(_self->ob_itself);
       
  2041 	_res = Py_BuildValue("b",
       
  2042 	                     _rv);
       
  2043 	return _res;
       
  2044 }
       
  2045 
       
  2046 static PyObject *WinObj_IsWindowUpdatePending(WindowObject *_self, PyObject *_args)
       
  2047 {
       
  2048 	PyObject *_res = NULL;
       
  2049 	Boolean _rv;
       
  2050 #ifndef IsWindowUpdatePending
       
  2051 	PyMac_PRECHECK(IsWindowUpdatePending);
       
  2052 #endif
       
  2053 	if (!PyArg_ParseTuple(_args, ""))
       
  2054 		return NULL;
       
  2055 	_rv = IsWindowUpdatePending(_self->ob_itself);
       
  2056 	_res = Py_BuildValue("b",
       
  2057 	                     _rv);
       
  2058 	return _res;
       
  2059 }
       
  2060 
       
  2061 static PyObject *WinObj_MacGetNextWindow(WindowObject *_self, PyObject *_args)
       
  2062 {
       
  2063 	PyObject *_res = NULL;
       
  2064 	WindowPtr _rv;
       
  2065 #ifndef MacGetNextWindow
       
  2066 	PyMac_PRECHECK(MacGetNextWindow);
       
  2067 #endif
       
  2068 	if (!PyArg_ParseTuple(_args, ""))
       
  2069 		return NULL;
       
  2070 	_rv = MacGetNextWindow(_self->ob_itself);
       
  2071 	_res = Py_BuildValue("O&",
       
  2072 	                     WinObj_New, _rv);
       
  2073 	return _res;
       
  2074 }
       
  2075 
       
  2076 static PyObject *WinObj_GetWindowStandardState(WindowObject *_self, PyObject *_args)
       
  2077 {
       
  2078 	PyObject *_res = NULL;
       
  2079 	Rect rect;
       
  2080 #ifndef GetWindowStandardState
       
  2081 	PyMac_PRECHECK(GetWindowStandardState);
       
  2082 #endif
       
  2083 	if (!PyArg_ParseTuple(_args, ""))
       
  2084 		return NULL;
       
  2085 	GetWindowStandardState(_self->ob_itself,
       
  2086 	                       &rect);
       
  2087 	_res = Py_BuildValue("O&",
       
  2088 	                     PyMac_BuildRect, &rect);
       
  2089 	return _res;
       
  2090 }
       
  2091 
       
  2092 static PyObject *WinObj_GetWindowUserState(WindowObject *_self, PyObject *_args)
       
  2093 {
       
  2094 	PyObject *_res = NULL;
       
  2095 	Rect rect;
       
  2096 #ifndef GetWindowUserState
       
  2097 	PyMac_PRECHECK(GetWindowUserState);
       
  2098 #endif
       
  2099 	if (!PyArg_ParseTuple(_args, ""))
       
  2100 		return NULL;
       
  2101 	GetWindowUserState(_self->ob_itself,
       
  2102 	                   &rect);
       
  2103 	_res = Py_BuildValue("O&",
       
  2104 	                     PyMac_BuildRect, &rect);
       
  2105 	return _res;
       
  2106 }
       
  2107 
       
  2108 static PyObject *WinObj_SetWindowKind(WindowObject *_self, PyObject *_args)
       
  2109 {
       
  2110 	PyObject *_res = NULL;
       
  2111 	short kind;
       
  2112 #ifndef SetWindowKind
       
  2113 	PyMac_PRECHECK(SetWindowKind);
       
  2114 #endif
       
  2115 	if (!PyArg_ParseTuple(_args, "h",
       
  2116 	                      &kind))
       
  2117 		return NULL;
       
  2118 	SetWindowKind(_self->ob_itself,
       
  2119 	              kind);
       
  2120 	Py_INCREF(Py_None);
       
  2121 	_res = Py_None;
       
  2122 	return _res;
       
  2123 }
       
  2124 
       
  2125 static PyObject *WinObj_SetWindowStandardState(WindowObject *_self, PyObject *_args)
       
  2126 {
       
  2127 	PyObject *_res = NULL;
       
  2128 	Rect rect;
       
  2129 #ifndef SetWindowStandardState
       
  2130 	PyMac_PRECHECK(SetWindowStandardState);
       
  2131 #endif
       
  2132 	if (!PyArg_ParseTuple(_args, "O&",
       
  2133 	                      PyMac_GetRect, &rect))
       
  2134 		return NULL;
       
  2135 	SetWindowStandardState(_self->ob_itself,
       
  2136 	                       &rect);
       
  2137 	Py_INCREF(Py_None);
       
  2138 	_res = Py_None;
       
  2139 	return _res;
       
  2140 }
       
  2141 
       
  2142 static PyObject *WinObj_SetWindowUserState(WindowObject *_self, PyObject *_args)
       
  2143 {
       
  2144 	PyObject *_res = NULL;
       
  2145 	Rect rect;
       
  2146 #ifndef SetWindowUserState
       
  2147 	PyMac_PRECHECK(SetWindowUserState);
       
  2148 #endif
       
  2149 	if (!PyArg_ParseTuple(_args, "O&",
       
  2150 	                      PyMac_GetRect, &rect))
       
  2151 		return NULL;
       
  2152 	SetWindowUserState(_self->ob_itself,
       
  2153 	                   &rect);
       
  2154 	Py_INCREF(Py_None);
       
  2155 	_res = Py_None;
       
  2156 	return _res;
       
  2157 }
       
  2158 
       
  2159 static PyObject *WinObj_SetPortWindowPort(WindowObject *_self, PyObject *_args)
       
  2160 {
       
  2161 	PyObject *_res = NULL;
       
  2162 #ifndef SetPortWindowPort
       
  2163 	PyMac_PRECHECK(SetPortWindowPort);
       
  2164 #endif
       
  2165 	if (!PyArg_ParseTuple(_args, ""))
       
  2166 		return NULL;
       
  2167 	SetPortWindowPort(_self->ob_itself);
       
  2168 	Py_INCREF(Py_None);
       
  2169 	_res = Py_None;
       
  2170 	return _res;
       
  2171 }
       
  2172 
       
  2173 static PyObject *WinObj_GetWindowPortBounds(WindowObject *_self, PyObject *_args)
       
  2174 {
       
  2175 	PyObject *_res = NULL;
       
  2176 	Rect bounds;
       
  2177 #ifndef GetWindowPortBounds
       
  2178 	PyMac_PRECHECK(GetWindowPortBounds);
       
  2179 #endif
       
  2180 	if (!PyArg_ParseTuple(_args, ""))
       
  2181 		return NULL;
       
  2182 	GetWindowPortBounds(_self->ob_itself,
       
  2183 	                    &bounds);
       
  2184 	_res = Py_BuildValue("O&",
       
  2185 	                     PyMac_BuildRect, &bounds);
       
  2186 	return _res;
       
  2187 }
       
  2188 
       
  2189 static PyObject *WinObj_IsWindowVisible(WindowObject *_self, PyObject *_args)
       
  2190 {
       
  2191 	PyObject *_res = NULL;
       
  2192 	Boolean _rv;
       
  2193 #ifndef IsWindowVisible
       
  2194 	PyMac_PRECHECK(IsWindowVisible);
       
  2195 #endif
       
  2196 	if (!PyArg_ParseTuple(_args, ""))
       
  2197 		return NULL;
       
  2198 	_rv = IsWindowVisible(_self->ob_itself);
       
  2199 	_res = Py_BuildValue("b",
       
  2200 	                     _rv);
       
  2201 	return _res;
       
  2202 }
       
  2203 
       
  2204 static PyObject *WinObj_GetWindowStructureRgn(WindowObject *_self, PyObject *_args)
       
  2205 {
       
  2206 	PyObject *_res = NULL;
       
  2207 	RgnHandle r;
       
  2208 #ifndef GetWindowStructureRgn
       
  2209 	PyMac_PRECHECK(GetWindowStructureRgn);
       
  2210 #endif
       
  2211 	if (!PyArg_ParseTuple(_args, "O&",
       
  2212 	                      ResObj_Convert, &r))
       
  2213 		return NULL;
       
  2214 	GetWindowStructureRgn(_self->ob_itself,
       
  2215 	                      r);
       
  2216 	Py_INCREF(Py_None);
       
  2217 	_res = Py_None;
       
  2218 	return _res;
       
  2219 }
       
  2220 
       
  2221 static PyObject *WinObj_GetWindowContentRgn(WindowObject *_self, PyObject *_args)
       
  2222 {
       
  2223 	PyObject *_res = NULL;
       
  2224 	RgnHandle r;
       
  2225 #ifndef GetWindowContentRgn
       
  2226 	PyMac_PRECHECK(GetWindowContentRgn);
       
  2227 #endif
       
  2228 	if (!PyArg_ParseTuple(_args, "O&",
       
  2229 	                      ResObj_Convert, &r))
       
  2230 		return NULL;
       
  2231 	GetWindowContentRgn(_self->ob_itself,
       
  2232 	                    r);
       
  2233 	Py_INCREF(Py_None);
       
  2234 	_res = Py_None;
       
  2235 	return _res;
       
  2236 }
       
  2237 
       
  2238 static PyObject *WinObj_GetWindowUpdateRgn(WindowObject *_self, PyObject *_args)
       
  2239 {
       
  2240 	PyObject *_res = NULL;
       
  2241 	RgnHandle r;
       
  2242 #ifndef GetWindowUpdateRgn
       
  2243 	PyMac_PRECHECK(GetWindowUpdateRgn);
       
  2244 #endif
       
  2245 	if (!PyArg_ParseTuple(_args, "O&",
       
  2246 	                      ResObj_Convert, &r))
       
  2247 		return NULL;
       
  2248 	GetWindowUpdateRgn(_self->ob_itself,
       
  2249 	                   r);
       
  2250 	Py_INCREF(Py_None);
       
  2251 	_res = Py_None;
       
  2252 	return _res;
       
  2253 }
       
  2254 
       
  2255 static PyObject *WinObj_GetNextWindow(WindowObject *_self, PyObject *_args)
       
  2256 {
       
  2257 	PyObject *_res = NULL;
       
  2258 	WindowPtr _rv;
       
  2259 #ifndef GetNextWindow
       
  2260 	PyMac_PRECHECK(GetNextWindow);
       
  2261 #endif
       
  2262 	if (!PyArg_ParseTuple(_args, ""))
       
  2263 		return NULL;
       
  2264 	_rv = GetNextWindow(_self->ob_itself);
       
  2265 	_res = Py_BuildValue("O&",
       
  2266 	                     WinObj_WhichWindow, _rv);
       
  2267 	return _res;
       
  2268 }
       
  2269 
       
  2270 static PyObject *WinObj_MoveWindow(WindowObject *_self, PyObject *_args)
       
  2271 {
       
  2272 	PyObject *_res = NULL;
       
  2273 	short hGlobal;
       
  2274 	short vGlobal;
       
  2275 	Boolean front;
       
  2276 #ifndef MoveWindow
       
  2277 	PyMac_PRECHECK(MoveWindow);
       
  2278 #endif
       
  2279 	if (!PyArg_ParseTuple(_args, "hhb",
       
  2280 	                      &hGlobal,
       
  2281 	                      &vGlobal,
       
  2282 	                      &front))
       
  2283 		return NULL;
       
  2284 	MoveWindow(_self->ob_itself,
       
  2285 	           hGlobal,
       
  2286 	           vGlobal,
       
  2287 	           front);
       
  2288 	Py_INCREF(Py_None);
       
  2289 	_res = Py_None;
       
  2290 	return _res;
       
  2291 }
       
  2292 
       
  2293 static PyObject *WinObj_ShowWindow(WindowObject *_self, PyObject *_args)
       
  2294 {
       
  2295 	PyObject *_res = NULL;
       
  2296 #ifndef ShowWindow
       
  2297 	PyMac_PRECHECK(ShowWindow);
       
  2298 #endif
       
  2299 	if (!PyArg_ParseTuple(_args, ""))
       
  2300 		return NULL;
       
  2301 	ShowWindow(_self->ob_itself);
       
  2302 	Py_INCREF(Py_None);
       
  2303 	_res = Py_None;
       
  2304 	return _res;
       
  2305 }
       
  2306 
       
  2307 static PyObject *WinObj_AutoDispose(WindowObject *_self, PyObject *_args)
       
  2308 {
       
  2309 	PyObject *_res = NULL;
       
  2310 
       
  2311 	int onoff, old = 0;
       
  2312 	if (!PyArg_ParseTuple(_args, "i", &onoff))
       
  2313 	        return NULL;
       
  2314 	if ( _self->ob_freeit )
       
  2315 	        old = 1;
       
  2316 	if ( onoff )
       
  2317 	        _self->ob_freeit = PyMac_AutoDisposeWindow;
       
  2318 	else
       
  2319 	        _self->ob_freeit = NULL;
       
  2320 	_res = Py_BuildValue("i", old);
       
  2321 	return _res;
       
  2322 
       
  2323 }
       
  2324 
       
  2325 static PyMethodDef WinObj_methods[] = {
       
  2326 	{"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1,
       
  2327 	 PyDoc_STR("() -> (UInt32 outCount)")},
       
  2328 	{"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1,
       
  2329 	 PyDoc_STR("() -> None")},
       
  2330 	{"GetWindowRetainCount", (PyCFunction)WinObj_GetWindowRetainCount, 1,
       
  2331 	 PyDoc_STR("() -> (ItemCount _rv)")},
       
  2332 	{"RetainWindow", (PyCFunction)WinObj_RetainWindow, 1,
       
  2333 	 PyDoc_STR("() -> None")},
       
  2334 	{"ReleaseWindow", (PyCFunction)WinObj_ReleaseWindow, 1,
       
  2335 	 PyDoc_STR("() -> None")},
       
  2336 	{"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1,
       
  2337 	 PyDoc_STR("() -> None")},
       
  2338 	{"GetWindowWidgetHilite", (PyCFunction)WinObj_GetWindowWidgetHilite, 1,
       
  2339 	 PyDoc_STR("() -> (WindowDefPartCode outHilite)")},
       
  2340 	{"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1,
       
  2341 	 PyDoc_STR("() -> (WindowClass outClass)")},
       
  2342 	{"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1,
       
  2343 	 PyDoc_STR("() -> (WindowAttributes outAttributes)")},
       
  2344 	{"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1,
       
  2345 	 PyDoc_STR("(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None")},
       
  2346 	{"SetWindowClass", (PyCFunction)WinObj_SetWindowClass, 1,
       
  2347 	 PyDoc_STR("(WindowClass inWindowClass) -> None")},
       
  2348 	{"SetWindowModality", (PyCFunction)WinObj_SetWindowModality, 1,
       
  2349 	 PyDoc_STR("(WindowModality inModalKind, WindowPtr inUnavailableWindow) -> None")},
       
  2350 	{"GetWindowModality", (PyCFunction)WinObj_GetWindowModality, 1,
       
  2351 	 PyDoc_STR("() -> (WindowModality outModalKind, WindowPtr outUnavailableWindow)")},
       
  2352 	{"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1,
       
  2353 	 PyDoc_STR("(RGBColor color) -> None")},
       
  2354 	{"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1,
       
  2355 	 PyDoc_STR("() -> (RGBColor color)")},
       
  2356 	{"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1,
       
  2357 	 PyDoc_STR("(PixPatHandle outPixPat) -> None")},
       
  2358 	{"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1,
       
  2359 	 PyDoc_STR("(PixPatHandle pixPat) -> None")},
       
  2360 	{"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1,
       
  2361 	 PyDoc_STR("(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None")},
       
  2362 	{"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1,
       
  2363 	 PyDoc_STR("(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None")},
       
  2364 	{"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
       
  2365 	 PyDoc_STR("() -> None")},
       
  2366 	{"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
       
  2367 	 PyDoc_STR("(RgnHandle clobberedRgn) -> None")},
       
  2368 	{"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
       
  2369 	 PyDoc_STR("(RgnHandle clobberedRgn) -> None")},
       
  2370 	{"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
       
  2371 	 PyDoc_STR("() -> None")},
       
  2372 	{"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
       
  2373 	 PyDoc_STR("(RgnHandle clobberedRgn) -> None")},
       
  2374 	{"BringToFront", (PyCFunction)WinObj_BringToFront, 1,
       
  2375 	 PyDoc_STR("() -> None")},
       
  2376 	{"SendBehind", (PyCFunction)WinObj_SendBehind, 1,
       
  2377 	 PyDoc_STR("(WindowPtr behindWindow) -> None")},
       
  2378 	{"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1,
       
  2379 	 PyDoc_STR("() -> None")},
       
  2380 	{"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1,
       
  2381 	 PyDoc_STR("(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)")},
       
  2382 	{"SetWindowAlternateTitle", (PyCFunction)WinObj_SetWindowAlternateTitle, 1,
       
  2383 	 PyDoc_STR("(CFStringRef inTitle) -> None")},
       
  2384 	{"CopyWindowAlternateTitle", (PyCFunction)WinObj_CopyWindowAlternateTitle, 1,
       
  2385 	 PyDoc_STR("() -> (CFStringRef outTitle)")},
       
  2386 	{"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1,
       
  2387 	 PyDoc_STR("(Boolean fHilite) -> None")},
       
  2388 	{"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1,
       
  2389 	 PyDoc_STR("(long data) -> None")},
       
  2390 	{"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
       
  2391 	 PyDoc_STR("() -> (long _rv)")},
       
  2392 	{"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1,
       
  2393 	 PyDoc_STR("(PicHandle pic) -> None")},
       
  2394 	{"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
       
  2395 	 PyDoc_STR("() -> (PicHandle _rv)")},
       
  2396 	{"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1,
       
  2397 	 PyDoc_STR("() -> (short _rv)")},
       
  2398 	{"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1,
       
  2399 	 PyDoc_STR("() -> (UInt32 outFeatures)")},
       
  2400 	{"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1,
       
  2401 	 PyDoc_STR("(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None")},
       
  2402 	{"GetWindowStructureWidths", (PyCFunction)WinObj_GetWindowStructureWidths, 1,
       
  2403 	 PyDoc_STR("() -> (Rect outRect)")},
       
  2404 	{"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1,
       
  2405 	 PyDoc_STR("() -> None")},
       
  2406 	{"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1,
       
  2407 	 PyDoc_STR("() -> None")},
       
  2408 	{"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1,
       
  2409 	 PyDoc_STR("(RgnHandle region) -> None")},
       
  2410 	{"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1,
       
  2411 	 PyDoc_STR("(Rect bounds) -> None")},
       
  2412 	{"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1,
       
  2413 	 PyDoc_STR("(RgnHandle region) -> None")},
       
  2414 	{"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1,
       
  2415 	 PyDoc_STR("(Rect bounds) -> None")},
       
  2416 	{"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1,
       
  2417 	 PyDoc_STR("() -> None")},
       
  2418 	{"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1,
       
  2419 	 PyDoc_STR("(Str255 title) -> None")},
       
  2420 	{"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
       
  2421 	 PyDoc_STR("() -> (Str255 title)")},
       
  2422 	{"SetWindowTitleWithCFString", (PyCFunction)WinObj_SetWindowTitleWithCFString, 1,
       
  2423 	 PyDoc_STR("(CFStringRef inString) -> None")},
       
  2424 	{"CopyWindowTitleAsCFString", (PyCFunction)WinObj_CopyWindowTitleAsCFString, 1,
       
  2425 	 PyDoc_STR("() -> (CFStringRef outString)")},
       
  2426 	{"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1,
       
  2427 	 PyDoc_STR("(FSSpec inFile) -> None")},
       
  2428 	{"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1,
       
  2429 	 PyDoc_STR("() -> (FSSpec outFile)")},
       
  2430 	{"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1,
       
  2431 	 PyDoc_STR("(AliasHandle inAlias) -> None")},
       
  2432 	{"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1,
       
  2433 	 PyDoc_STR("() -> (AliasHandle alias)")},
       
  2434 	{"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1,
       
  2435 	 PyDoc_STR("(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None")},
       
  2436 	{"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1,
       
  2437 	 PyDoc_STR("() -> (IconRef outIcon)")},
       
  2438 	{"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1,
       
  2439 	 PyDoc_STR("(IconRef icon) -> None")},
       
  2440 	{"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1,
       
  2441 	 PyDoc_STR("() -> None")},
       
  2442 	{"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1,
       
  2443 	 PyDoc_STR("(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)")},
       
  2444 	{"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1,
       
  2445 	 PyDoc_STR("(DragReference theDrag) -> None")},
       
  2446 	{"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1,
       
  2447 	 PyDoc_STR("(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None")},
       
  2448 	{"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1,
       
  2449 	 PyDoc_STR("(Point startPt) -> None")},
       
  2450 	{"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1,
       
  2451 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2452 	{"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1,
       
  2453 	 PyDoc_STR("(Boolean modified) -> None")},
       
  2454 	{"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1,
       
  2455 	 PyDoc_STR("(EventRecord event) -> (Boolean _rv)")},
       
  2456 	{"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1,
       
  2457 	 PyDoc_STR("(MenuHandle menu) -> (SInt32 outMenuResult)")},
       
  2458 	{"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1,
       
  2459 	 PyDoc_STR("(Boolean hilited) -> None")},
       
  2460 	{"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1,
       
  2461 	 PyDoc_STR("(WindowTransitionEffect inEffect, WindowTransitionAction inAction, Rect inRect) -> None")},
       
  2462 	{"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1,
       
  2463 	 PyDoc_STR("(WindowPtr inParentWindow, WindowTransitionEffect inEffect, WindowTransitionAction inAction, Rect inRect) -> None")},
       
  2464 	{"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1,
       
  2465 	 PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")},
       
  2466 	{"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1,
       
  2467 	 PyDoc_STR("(short w, short h, Boolean fUpdate) -> None")},
       
  2468 	{"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1,
       
  2469 	 PyDoc_STR("(Point startPt, Rect bBox) -> (long _rv)")},
       
  2470 	{"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
       
  2471 	 PyDoc_STR("(Point startPt, Rect boundsRect) -> None")},
       
  2472 	{"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1,
       
  2473 	 PyDoc_STR("(WindowPartCode partCode, Boolean front) -> None")},
       
  2474 	{"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1,
       
  2475 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2476 	{"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1,
       
  2477 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2478 	{"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1,
       
  2479 	 PyDoc_STR("(Boolean collapse) -> None")},
       
  2480 	{"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1,
       
  2481 	 PyDoc_STR("(WindowRegionCode regionCode) -> (Rect globalBounds)")},
       
  2482 	{"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1,
       
  2483 	 PyDoc_STR("(Point inStartPoint, Rect inSizeConstraints) -> (Boolean _rv, Rect outNewContentRect)")},
       
  2484 	{"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1,
       
  2485 	 PyDoc_STR("(WindowRegionCode regionCode, Rect globalBounds) -> None")},
       
  2486 	{"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1,
       
  2487 	 PyDoc_STR("(WindowPtr parentWindow, WindowPositionMethod method) -> None")},
       
  2488 	{"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1,
       
  2489 	 PyDoc_STR("(short hGlobal, short vGlobal) -> None")},
       
  2490 	{"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1,
       
  2491 	 PyDoc_STR("(Point inIdealSize) -> (Boolean _rv, Rect outIdealStandardState)")},
       
  2492 	{"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1,
       
  2493 	 PyDoc_STR("(WindowPartCode inPartCode) -> (Point ioIdealSize)")},
       
  2494 	{"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1,
       
  2495 	 PyDoc_STR("() -> (Rect outUserState)")},
       
  2496 	{"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1,
       
  2497 	 PyDoc_STR("(Rect inUserState) -> None")},
       
  2498 	{"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1,
       
  2499 	 PyDoc_STR("(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)")},
       
  2500 	{"ConstrainWindowToScreen", (PyCFunction)WinObj_ConstrainWindowToScreen, 1,
       
  2501 	 PyDoc_STR("(WindowRegionCode inRegionCode, WindowConstrainOptions inOptions, Rect inScreenRect) -> (Rect outStructure)")},
       
  2502 	{"HideWindow", (PyCFunction)WinObj_HideWindow, 1,
       
  2503 	 PyDoc_STR("() -> None")},
       
  2504 	{"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1,
       
  2505 	 PyDoc_STR("() -> None")},
       
  2506 	{"ShowHide", (PyCFunction)WinObj_ShowHide, 1,
       
  2507 	 PyDoc_STR("(Boolean showFlag) -> None")},
       
  2508 	{"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1,
       
  2509 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2510 	{"ShowSheetWindow", (PyCFunction)WinObj_ShowSheetWindow, 1,
       
  2511 	 PyDoc_STR("(WindowPtr inParentWindow) -> None")},
       
  2512 	{"HideSheetWindow", (PyCFunction)WinObj_HideSheetWindow, 1,
       
  2513 	 PyDoc_STR("() -> None")},
       
  2514 	{"GetSheetWindowParent", (PyCFunction)WinObj_GetSheetWindowParent, 1,
       
  2515 	 PyDoc_STR("() -> (WindowPtr outParentWindow)")},
       
  2516 	{"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1,
       
  2517 	 PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
       
  2518 	{"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1,
       
  2519 	 PyDoc_STR("(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
       
  2520 	{"TrackBox", (PyCFunction)WinObj_TrackBox, 1,
       
  2521 	 PyDoc_STR("(Point thePt, WindowPartCode partCode) -> (Boolean _rv)")},
       
  2522 	{"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1,
       
  2523 	 PyDoc_STR("(Point thePt) -> (Boolean _rv)")},
       
  2524 	{"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
       
  2525 	 PyDoc_STR("() -> (CGrafPtr _rv)")},
       
  2526 	{"GetWindowStructurePort", (PyCFunction)WinObj_GetWindowStructurePort, 1,
       
  2527 	 PyDoc_STR("() -> (CGrafPtr _rv)")},
       
  2528 	{"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
       
  2529 	 PyDoc_STR("() -> (short _rv)")},
       
  2530 	{"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1,
       
  2531 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2532 	{"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1,
       
  2533 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2534 	{"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1,
       
  2535 	 PyDoc_STR("() -> (WindowPtr _rv)")},
       
  2536 	{"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
       
  2537 	 PyDoc_STR("() -> (Rect rect)")},
       
  2538 	{"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1,
       
  2539 	 PyDoc_STR("() -> (Rect rect)")},
       
  2540 	{"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1,
       
  2541 	 PyDoc_STR("(short kind) -> None")},
       
  2542 	{"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1,
       
  2543 	 PyDoc_STR("(Rect rect) -> None")},
       
  2544 	{"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
       
  2545 	 PyDoc_STR("(Rect rect) -> None")},
       
  2546 	{"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
       
  2547 	 PyDoc_STR("() -> None")},
       
  2548 	{"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1,
       
  2549 	 PyDoc_STR("() -> (Rect bounds)")},
       
  2550 	{"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
       
  2551 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  2552 	{"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
       
  2553 	 PyDoc_STR("(RgnHandle r) -> None")},
       
  2554 	{"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
       
  2555 	 PyDoc_STR("(RgnHandle r) -> None")},
       
  2556 	{"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
       
  2557 	 PyDoc_STR("(RgnHandle r) -> None")},
       
  2558 	{"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
       
  2559 	 PyDoc_STR("() -> (WindowPtr _rv)")},
       
  2560 	{"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
       
  2561 	 PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")},
       
  2562 	{"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1,
       
  2563 	 PyDoc_STR("() -> None")},
       
  2564 	{"AutoDispose", (PyCFunction)WinObj_AutoDispose, 1,
       
  2565 	 PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")},
       
  2566 	{NULL, NULL, 0}
       
  2567 };
       
  2568 
       
  2569 #define WinObj_getsetlist NULL
       
  2570 
       
  2571 
       
  2572 static int WinObj_compare(WindowObject *self, WindowObject *other)
       
  2573 {
       
  2574 	if ( self->ob_itself > other->ob_itself ) return 1;
       
  2575 	if ( self->ob_itself < other->ob_itself ) return -1;
       
  2576 	return 0;
       
  2577 }
       
  2578 
       
  2579 static PyObject * WinObj_repr(WindowObject *self)
       
  2580 {
       
  2581 	char buf[100];
       
  2582 	sprintf(buf, "<Window object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
       
  2583 	return PyString_FromString(buf);
       
  2584 }
       
  2585 
       
  2586 static int WinObj_hash(WindowObject *self)
       
  2587 {
       
  2588 	return (int)self->ob_itself;
       
  2589 }
       
  2590 #define WinObj_tp_init 0
       
  2591 
       
  2592 #define WinObj_tp_alloc PyType_GenericAlloc
       
  2593 
       
  2594 static PyObject *WinObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
       
  2595 {
       
  2596 	PyObject *_self;
       
  2597 	WindowPtr itself;
       
  2598 	char *kw[] = {"itself", 0};
       
  2599 
       
  2600 	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, WinObj_Convert, &itself)) return NULL;
       
  2601 	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
       
  2602 	((WindowObject *)_self)->ob_itself = itself;
       
  2603 	return _self;
       
  2604 }
       
  2605 
       
  2606 #define WinObj_tp_free PyObject_Del
       
  2607 
       
  2608 
       
  2609 PyTypeObject Window_Type = {
       
  2610 	PyObject_HEAD_INIT(NULL)
       
  2611 	0, /*ob_size*/
       
  2612 	"_Win.Window", /*tp_name*/
       
  2613 	sizeof(WindowObject), /*tp_basicsize*/
       
  2614 	0, /*tp_itemsize*/
       
  2615 	/* methods */
       
  2616 	(destructor) WinObj_dealloc, /*tp_dealloc*/
       
  2617 	0, /*tp_print*/
       
  2618 	(getattrfunc)0, /*tp_getattr*/
       
  2619 	(setattrfunc)0, /*tp_setattr*/
       
  2620 	(cmpfunc) WinObj_compare, /*tp_compare*/
       
  2621 	(reprfunc) WinObj_repr, /*tp_repr*/
       
  2622 	(PyNumberMethods *)0, /* tp_as_number */
       
  2623 	(PySequenceMethods *)0, /* tp_as_sequence */
       
  2624 	(PyMappingMethods *)0, /* tp_as_mapping */
       
  2625 	(hashfunc) WinObj_hash, /*tp_hash*/
       
  2626 	0, /*tp_call*/
       
  2627 	0, /*tp_str*/
       
  2628 	PyObject_GenericGetAttr, /*tp_getattro*/
       
  2629 	PyObject_GenericSetAttr, /*tp_setattro */
       
  2630 	0, /*tp_as_buffer*/
       
  2631 	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
       
  2632 	0, /*tp_doc*/
       
  2633 	0, /*tp_traverse*/
       
  2634 	0, /*tp_clear*/
       
  2635 	0, /*tp_richcompare*/
       
  2636 	0, /*tp_weaklistoffset*/
       
  2637 	0, /*tp_iter*/
       
  2638 	0, /*tp_iternext*/
       
  2639 	WinObj_methods, /* tp_methods */
       
  2640 	0, /*tp_members*/
       
  2641 	WinObj_getsetlist, /*tp_getset*/
       
  2642 	0, /*tp_base*/
       
  2643 	0, /*tp_dict*/
       
  2644 	0, /*tp_descr_get*/
       
  2645 	0, /*tp_descr_set*/
       
  2646 	0, /*tp_dictoffset*/
       
  2647 	WinObj_tp_init, /* tp_init */
       
  2648 	WinObj_tp_alloc, /* tp_alloc */
       
  2649 	WinObj_tp_new, /* tp_new */
       
  2650 	WinObj_tp_free, /* tp_free */
       
  2651 };
       
  2652 
       
  2653 /* --------------------- End object type Window --------------------- */
       
  2654 
       
  2655 
       
  2656 static PyObject *Win_GetNewCWindow(PyObject *_self, PyObject *_args)
       
  2657 {
       
  2658 	PyObject *_res = NULL;
       
  2659 	WindowPtr _rv;
       
  2660 	short windowID;
       
  2661 	WindowPtr behind;
       
  2662 #ifndef GetNewCWindow
       
  2663 	PyMac_PRECHECK(GetNewCWindow);
       
  2664 #endif
       
  2665 	if (!PyArg_ParseTuple(_args, "hO&",
       
  2666 	                      &windowID,
       
  2667 	                      WinObj_Convert, &behind))
       
  2668 		return NULL;
       
  2669 	_rv = GetNewCWindow(windowID,
       
  2670 	                    (void *)0,
       
  2671 	                    behind);
       
  2672 	_res = Py_BuildValue("O&",
       
  2673 	                     WinObj_New, _rv);
       
  2674 	return _res;
       
  2675 }
       
  2676 
       
  2677 static PyObject *Win_NewWindow(PyObject *_self, PyObject *_args)
       
  2678 {
       
  2679 	PyObject *_res = NULL;
       
  2680 	WindowPtr _rv;
       
  2681 	Rect boundsRect;
       
  2682 	Str255 title;
       
  2683 	Boolean visible;
       
  2684 	short theProc;
       
  2685 	WindowPtr behind;
       
  2686 	Boolean goAwayFlag;
       
  2687 	long refCon;
       
  2688 #ifndef NewWindow
       
  2689 	PyMac_PRECHECK(NewWindow);
       
  2690 #endif
       
  2691 	if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
       
  2692 	                      PyMac_GetRect, &boundsRect,
       
  2693 	                      PyMac_GetStr255, title,
       
  2694 	                      &visible,
       
  2695 	                      &theProc,
       
  2696 	                      WinObj_Convert, &behind,
       
  2697 	                      &goAwayFlag,
       
  2698 	                      &refCon))
       
  2699 		return NULL;
       
  2700 	_rv = NewWindow((void *)0,
       
  2701 	                &boundsRect,
       
  2702 	                title,
       
  2703 	                visible,
       
  2704 	                theProc,
       
  2705 	                behind,
       
  2706 	                goAwayFlag,
       
  2707 	                refCon);
       
  2708 	_res = Py_BuildValue("O&",
       
  2709 	                     WinObj_New, _rv);
       
  2710 	return _res;
       
  2711 }
       
  2712 
       
  2713 static PyObject *Win_GetNewWindow(PyObject *_self, PyObject *_args)
       
  2714 {
       
  2715 	PyObject *_res = NULL;
       
  2716 	WindowPtr _rv;
       
  2717 	short windowID;
       
  2718 	WindowPtr behind;
       
  2719 #ifndef GetNewWindow
       
  2720 	PyMac_PRECHECK(GetNewWindow);
       
  2721 #endif
       
  2722 	if (!PyArg_ParseTuple(_args, "hO&",
       
  2723 	                      &windowID,
       
  2724 	                      WinObj_Convert, &behind))
       
  2725 		return NULL;
       
  2726 	_rv = GetNewWindow(windowID,
       
  2727 	                   (void *)0,
       
  2728 	                   behind);
       
  2729 	_res = Py_BuildValue("O&",
       
  2730 	                     WinObj_New, _rv);
       
  2731 	return _res;
       
  2732 }
       
  2733 
       
  2734 static PyObject *Win_NewCWindow(PyObject *_self, PyObject *_args)
       
  2735 {
       
  2736 	PyObject *_res = NULL;
       
  2737 	WindowPtr _rv;
       
  2738 	Rect boundsRect;
       
  2739 	Str255 title;
       
  2740 	Boolean visible;
       
  2741 	short procID;
       
  2742 	WindowPtr behind;
       
  2743 	Boolean goAwayFlag;
       
  2744 	long refCon;
       
  2745 #ifndef NewCWindow
       
  2746 	PyMac_PRECHECK(NewCWindow);
       
  2747 #endif
       
  2748 	if (!PyArg_ParseTuple(_args, "O&O&bhO&bl",
       
  2749 	                      PyMac_GetRect, &boundsRect,
       
  2750 	                      PyMac_GetStr255, title,
       
  2751 	                      &visible,
       
  2752 	                      &procID,
       
  2753 	                      WinObj_Convert, &behind,
       
  2754 	                      &goAwayFlag,
       
  2755 	                      &refCon))
       
  2756 		return NULL;
       
  2757 	_rv = NewCWindow((void *)0,
       
  2758 	                 &boundsRect,
       
  2759 	                 title,
       
  2760 	                 visible,
       
  2761 	                 procID,
       
  2762 	                 behind,
       
  2763 	                 goAwayFlag,
       
  2764 	                 refCon);
       
  2765 	_res = Py_BuildValue("O&",
       
  2766 	                     WinObj_New, _rv);
       
  2767 	return _res;
       
  2768 }
       
  2769 
       
  2770 static PyObject *Win_CreateNewWindow(PyObject *_self, PyObject *_args)
       
  2771 {
       
  2772 	PyObject *_res = NULL;
       
  2773 	OSStatus _err;
       
  2774 	WindowClass windowClass;
       
  2775 	WindowAttributes attributes;
       
  2776 	Rect contentBounds;
       
  2777 	WindowPtr outWindow;
       
  2778 #ifndef CreateNewWindow
       
  2779 	PyMac_PRECHECK(CreateNewWindow);
       
  2780 #endif
       
  2781 	if (!PyArg_ParseTuple(_args, "llO&",
       
  2782 	                      &windowClass,
       
  2783 	                      &attributes,
       
  2784 	                      PyMac_GetRect, &contentBounds))
       
  2785 		return NULL;
       
  2786 	_err = CreateNewWindow(windowClass,
       
  2787 	                       attributes,
       
  2788 	                       &contentBounds,
       
  2789 	                       &outWindow);
       
  2790 	if (_err != noErr) return PyMac_Error(_err);
       
  2791 	_res = Py_BuildValue("O&",
       
  2792 	                     WinObj_New, outWindow);
       
  2793 	return _res;
       
  2794 }
       
  2795 
       
  2796 static PyObject *Win_CreateWindowFromResource(PyObject *_self, PyObject *_args)
       
  2797 {
       
  2798 	PyObject *_res = NULL;
       
  2799 	OSStatus _err;
       
  2800 	SInt16 resID;
       
  2801 	WindowPtr outWindow;
       
  2802 #ifndef CreateWindowFromResource
       
  2803 	PyMac_PRECHECK(CreateWindowFromResource);
       
  2804 #endif
       
  2805 	if (!PyArg_ParseTuple(_args, "h",
       
  2806 	                      &resID))
       
  2807 		return NULL;
       
  2808 	_err = CreateWindowFromResource(resID,
       
  2809 	                                &outWindow);
       
  2810 	if (_err != noErr) return PyMac_Error(_err);
       
  2811 	_res = Py_BuildValue("O&",
       
  2812 	                     WinObj_New, outWindow);
       
  2813 	return _res;
       
  2814 }
       
  2815 
       
  2816 static PyObject *Win_ShowFloatingWindows(PyObject *_self, PyObject *_args)
       
  2817 {
       
  2818 	PyObject *_res = NULL;
       
  2819 	OSStatus _err;
       
  2820 #ifndef ShowFloatingWindows
       
  2821 	PyMac_PRECHECK(ShowFloatingWindows);
       
  2822 #endif
       
  2823 	if (!PyArg_ParseTuple(_args, ""))
       
  2824 		return NULL;
       
  2825 	_err = ShowFloatingWindows();
       
  2826 	if (_err != noErr) return PyMac_Error(_err);
       
  2827 	Py_INCREF(Py_None);
       
  2828 	_res = Py_None;
       
  2829 	return _res;
       
  2830 }
       
  2831 
       
  2832 static PyObject *Win_HideFloatingWindows(PyObject *_self, PyObject *_args)
       
  2833 {
       
  2834 	PyObject *_res = NULL;
       
  2835 	OSStatus _err;
       
  2836 #ifndef HideFloatingWindows
       
  2837 	PyMac_PRECHECK(HideFloatingWindows);
       
  2838 #endif
       
  2839 	if (!PyArg_ParseTuple(_args, ""))
       
  2840 		return NULL;
       
  2841 	_err = HideFloatingWindows();
       
  2842 	if (_err != noErr) return PyMac_Error(_err);
       
  2843 	Py_INCREF(Py_None);
       
  2844 	_res = Py_None;
       
  2845 	return _res;
       
  2846 }
       
  2847 
       
  2848 static PyObject *Win_AreFloatingWindowsVisible(PyObject *_self, PyObject *_args)
       
  2849 {
       
  2850 	PyObject *_res = NULL;
       
  2851 	Boolean _rv;
       
  2852 #ifndef AreFloatingWindowsVisible
       
  2853 	PyMac_PRECHECK(AreFloatingWindowsVisible);
       
  2854 #endif
       
  2855 	if (!PyArg_ParseTuple(_args, ""))
       
  2856 		return NULL;
       
  2857 	_rv = AreFloatingWindowsVisible();
       
  2858 	_res = Py_BuildValue("b",
       
  2859 	                     _rv);
       
  2860 	return _res;
       
  2861 }
       
  2862 
       
  2863 static PyObject *Win_CheckUpdate(PyObject *_self, PyObject *_args)
       
  2864 {
       
  2865 	PyObject *_res = NULL;
       
  2866 	Boolean _rv;
       
  2867 	EventRecord theEvent;
       
  2868 #ifndef CheckUpdate
       
  2869 	PyMac_PRECHECK(CheckUpdate);
       
  2870 #endif
       
  2871 	if (!PyArg_ParseTuple(_args, ""))
       
  2872 		return NULL;
       
  2873 	_rv = CheckUpdate(&theEvent);
       
  2874 	_res = Py_BuildValue("bO&",
       
  2875 	                     _rv,
       
  2876 	                     PyMac_BuildEventRecord, &theEvent);
       
  2877 	return _res;
       
  2878 }
       
  2879 
       
  2880 static PyObject *Win_MacFindWindow(PyObject *_self, PyObject *_args)
       
  2881 {
       
  2882 	PyObject *_res = NULL;
       
  2883 	WindowPartCode _rv;
       
  2884 	Point thePoint;
       
  2885 	WindowPtr window;
       
  2886 #ifndef MacFindWindow
       
  2887 	PyMac_PRECHECK(MacFindWindow);
       
  2888 #endif
       
  2889 	if (!PyArg_ParseTuple(_args, "O&",
       
  2890 	                      PyMac_GetPoint, &thePoint))
       
  2891 		return NULL;
       
  2892 	_rv = MacFindWindow(thePoint,
       
  2893 	                    &window);
       
  2894 	_res = Py_BuildValue("hO&",
       
  2895 	                     _rv,
       
  2896 	                     WinObj_WhichWindow, window);
       
  2897 	return _res;
       
  2898 }
       
  2899 
       
  2900 static PyObject *Win_FrontWindow(PyObject *_self, PyObject *_args)
       
  2901 {
       
  2902 	PyObject *_res = NULL;
       
  2903 	WindowPtr _rv;
       
  2904 #ifndef FrontWindow
       
  2905 	PyMac_PRECHECK(FrontWindow);
       
  2906 #endif
       
  2907 	if (!PyArg_ParseTuple(_args, ""))
       
  2908 		return NULL;
       
  2909 	_rv = FrontWindow();
       
  2910 	_res = Py_BuildValue("O&",
       
  2911 	                     WinObj_WhichWindow, _rv);
       
  2912 	return _res;
       
  2913 }
       
  2914 
       
  2915 static PyObject *Win_FrontNonFloatingWindow(PyObject *_self, PyObject *_args)
       
  2916 {
       
  2917 	PyObject *_res = NULL;
       
  2918 	WindowPtr _rv;
       
  2919 #ifndef FrontNonFloatingWindow
       
  2920 	PyMac_PRECHECK(FrontNonFloatingWindow);
       
  2921 #endif
       
  2922 	if (!PyArg_ParseTuple(_args, ""))
       
  2923 		return NULL;
       
  2924 	_rv = FrontNonFloatingWindow();
       
  2925 	_res = Py_BuildValue("O&",
       
  2926 	                     WinObj_WhichWindow, _rv);
       
  2927 	return _res;
       
  2928 }
       
  2929 
       
  2930 static PyObject *Win_GetFrontWindowOfClass(PyObject *_self, PyObject *_args)
       
  2931 {
       
  2932 	PyObject *_res = NULL;
       
  2933 	WindowPtr _rv;
       
  2934 	WindowClass inWindowClass;
       
  2935 	Boolean mustBeVisible;
       
  2936 #ifndef GetFrontWindowOfClass
       
  2937 	PyMac_PRECHECK(GetFrontWindowOfClass);
       
  2938 #endif
       
  2939 	if (!PyArg_ParseTuple(_args, "lb",
       
  2940 	                      &inWindowClass,
       
  2941 	                      &mustBeVisible))
       
  2942 		return NULL;
       
  2943 	_rv = GetFrontWindowOfClass(inWindowClass,
       
  2944 	                            mustBeVisible);
       
  2945 	_res = Py_BuildValue("O&",
       
  2946 	                     WinObj_New, _rv);
       
  2947 	return _res;
       
  2948 }
       
  2949 
       
  2950 static PyObject *Win_FindWindowOfClass(PyObject *_self, PyObject *_args)
       
  2951 {
       
  2952 	PyObject *_res = NULL;
       
  2953 	OSStatus _err;
       
  2954 	Point where;
       
  2955 	WindowClass inWindowClass;
       
  2956 	WindowPtr outWindow;
       
  2957 	WindowPartCode outWindowPart;
       
  2958 #ifndef FindWindowOfClass
       
  2959 	PyMac_PRECHECK(FindWindowOfClass);
       
  2960 #endif
       
  2961 	if (!PyArg_ParseTuple(_args, "O&l",
       
  2962 	                      PyMac_GetPoint, &where,
       
  2963 	                      &inWindowClass))
       
  2964 		return NULL;
       
  2965 	_err = FindWindowOfClass(&where,
       
  2966 	                         inWindowClass,
       
  2967 	                         &outWindow,
       
  2968 	                         &outWindowPart);
       
  2969 	if (_err != noErr) return PyMac_Error(_err);
       
  2970 	_res = Py_BuildValue("O&h",
       
  2971 	                     WinObj_WhichWindow, outWindow,
       
  2972 	                     outWindowPart);
       
  2973 	return _res;
       
  2974 }
       
  2975 
       
  2976 static PyObject *Win_CreateStandardWindowMenu(PyObject *_self, PyObject *_args)
       
  2977 {
       
  2978 	PyObject *_res = NULL;
       
  2979 	OSStatus _err;
       
  2980 	OptionBits inOptions;
       
  2981 	MenuHandle outMenu;
       
  2982 #ifndef CreateStandardWindowMenu
       
  2983 	PyMac_PRECHECK(CreateStandardWindowMenu);
       
  2984 #endif
       
  2985 	if (!PyArg_ParseTuple(_args, "l",
       
  2986 	                      &inOptions))
       
  2987 		return NULL;
       
  2988 	_err = CreateStandardWindowMenu(inOptions,
       
  2989 	                                &outMenu);
       
  2990 	if (_err != noErr) return PyMac_Error(_err);
       
  2991 	_res = Py_BuildValue("O&",
       
  2992 	                     MenuObj_New, outMenu);
       
  2993 	return _res;
       
  2994 }
       
  2995 
       
  2996 static PyObject *Win_CollapseAllWindows(PyObject *_self, PyObject *_args)
       
  2997 {
       
  2998 	PyObject *_res = NULL;
       
  2999 	OSStatus _err;
       
  3000 	Boolean collapse;
       
  3001 #ifndef CollapseAllWindows
       
  3002 	PyMac_PRECHECK(CollapseAllWindows);
       
  3003 #endif
       
  3004 	if (!PyArg_ParseTuple(_args, "b",
       
  3005 	                      &collapse))
       
  3006 		return NULL;
       
  3007 	_err = CollapseAllWindows(collapse);
       
  3008 	if (_err != noErr) return PyMac_Error(_err);
       
  3009 	Py_INCREF(Py_None);
       
  3010 	_res = Py_None;
       
  3011 	return _res;
       
  3012 }
       
  3013 
       
  3014 static PyObject *Win_GetAvailableWindowPositioningBounds(PyObject *_self, PyObject *_args)
       
  3015 {
       
  3016 	PyObject *_res = NULL;
       
  3017 	OSStatus _err;
       
  3018 	GDHandle inDevice;
       
  3019 	Rect outAvailableRect;
       
  3020 #ifndef GetAvailableWindowPositioningBounds
       
  3021 	PyMac_PRECHECK(GetAvailableWindowPositioningBounds);
       
  3022 #endif
       
  3023 	if (!PyArg_ParseTuple(_args, "O&",
       
  3024 	                      ResObj_Convert, &inDevice))
       
  3025 		return NULL;
       
  3026 	_err = GetAvailableWindowPositioningBounds(inDevice,
       
  3027 	                                           &outAvailableRect);
       
  3028 	if (_err != noErr) return PyMac_Error(_err);
       
  3029 	_res = Py_BuildValue("O&",
       
  3030 	                     PyMac_BuildRect, &outAvailableRect);
       
  3031 	return _res;
       
  3032 }
       
  3033 
       
  3034 static PyObject *Win_DisableScreenUpdates(PyObject *_self, PyObject *_args)
       
  3035 {
       
  3036 	PyObject *_res = NULL;
       
  3037 	OSStatus _err;
       
  3038 #ifndef DisableScreenUpdates
       
  3039 	PyMac_PRECHECK(DisableScreenUpdates);
       
  3040 #endif
       
  3041 	if (!PyArg_ParseTuple(_args, ""))
       
  3042 		return NULL;
       
  3043 	_err = DisableScreenUpdates();
       
  3044 	if (_err != noErr) return PyMac_Error(_err);
       
  3045 	Py_INCREF(Py_None);
       
  3046 	_res = Py_None;
       
  3047 	return _res;
       
  3048 }
       
  3049 
       
  3050 static PyObject *Win_EnableScreenUpdates(PyObject *_self, PyObject *_args)
       
  3051 {
       
  3052 	PyObject *_res = NULL;
       
  3053 	OSStatus _err;
       
  3054 #ifndef EnableScreenUpdates
       
  3055 	PyMac_PRECHECK(EnableScreenUpdates);
       
  3056 #endif
       
  3057 	if (!PyArg_ParseTuple(_args, ""))
       
  3058 		return NULL;
       
  3059 	_err = EnableScreenUpdates();
       
  3060 	if (_err != noErr) return PyMac_Error(_err);
       
  3061 	Py_INCREF(Py_None);
       
  3062 	_res = Py_None;
       
  3063 	return _res;
       
  3064 }
       
  3065 
       
  3066 static PyObject *Win_PinRect(PyObject *_self, PyObject *_args)
       
  3067 {
       
  3068 	PyObject *_res = NULL;
       
  3069 	long _rv;
       
  3070 	Rect theRect;
       
  3071 	Point thePt;
       
  3072 #ifndef PinRect
       
  3073 	PyMac_PRECHECK(PinRect);
       
  3074 #endif
       
  3075 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3076 	                      PyMac_GetRect, &theRect,
       
  3077 	                      PyMac_GetPoint, &thePt))
       
  3078 		return NULL;
       
  3079 	_rv = PinRect(&theRect,
       
  3080 	              thePt);
       
  3081 	_res = Py_BuildValue("l",
       
  3082 	                     _rv);
       
  3083 	return _res;
       
  3084 }
       
  3085 
       
  3086 static PyObject *Win_GetGrayRgn(PyObject *_self, PyObject *_args)
       
  3087 {
       
  3088 	PyObject *_res = NULL;
       
  3089 	RgnHandle _rv;
       
  3090 #ifndef GetGrayRgn
       
  3091 	PyMac_PRECHECK(GetGrayRgn);
       
  3092 #endif
       
  3093 	if (!PyArg_ParseTuple(_args, ""))
       
  3094 		return NULL;
       
  3095 	_rv = GetGrayRgn();
       
  3096 	_res = Py_BuildValue("O&",
       
  3097 	                     ResObj_New, _rv);
       
  3098 	return _res;
       
  3099 }
       
  3100 
       
  3101 static PyObject *Win_GetWindowFromPort(PyObject *_self, PyObject *_args)
       
  3102 {
       
  3103 	PyObject *_res = NULL;
       
  3104 	WindowPtr _rv;
       
  3105 	CGrafPtr port;
       
  3106 #ifndef GetWindowFromPort
       
  3107 	PyMac_PRECHECK(GetWindowFromPort);
       
  3108 #endif
       
  3109 	if (!PyArg_ParseTuple(_args, "O&",
       
  3110 	                      GrafObj_Convert, &port))
       
  3111 		return NULL;
       
  3112 	_rv = GetWindowFromPort(port);
       
  3113 	_res = Py_BuildValue("O&",
       
  3114 	                     WinObj_New, _rv);
       
  3115 	return _res;
       
  3116 }
       
  3117 
       
  3118 static PyObject *Win_WhichWindow(PyObject *_self, PyObject *_args)
       
  3119 {
       
  3120 	PyObject *_res = NULL;
       
  3121 
       
  3122 	long ptr;
       
  3123 
       
  3124 	if ( !PyArg_ParseTuple(_args, "i", &ptr) )
       
  3125 	        return NULL;
       
  3126 	_res = WinObj_WhichWindow((WindowPtr)ptr);
       
  3127 	return _res;
       
  3128 
       
  3129 }
       
  3130 
       
  3131 static PyObject *Win_FindWindow(PyObject *_self, PyObject *_args)
       
  3132 {
       
  3133 	PyObject *_res = NULL;
       
  3134 	short _rv;
       
  3135 	Point thePoint;
       
  3136 	WindowPtr theWindow;
       
  3137 #ifndef FindWindow
       
  3138 	PyMac_PRECHECK(FindWindow);
       
  3139 #endif
       
  3140 	if (!PyArg_ParseTuple(_args, "O&",
       
  3141 	                      PyMac_GetPoint, &thePoint))
       
  3142 		return NULL;
       
  3143 	_rv = FindWindow(thePoint,
       
  3144 	                 &theWindow);
       
  3145 	_res = Py_BuildValue("hO&",
       
  3146 	                     _rv,
       
  3147 	                     WinObj_WhichWindow, theWindow);
       
  3148 	return _res;
       
  3149 }
       
  3150 #endif /* __LP64__ */
       
  3151 
       
  3152 static PyMethodDef Win_methods[] = {
       
  3153 #ifndef __LP64__
       
  3154 	{"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1,
       
  3155 	 PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")},
       
  3156 	{"NewWindow", (PyCFunction)Win_NewWindow, 1,
       
  3157 	 PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)")},
       
  3158 	{"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1,
       
  3159 	 PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")},
       
  3160 	{"NewCWindow", (PyCFunction)Win_NewCWindow, 1,
       
  3161 	 PyDoc_STR("(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)")},
       
  3162 	{"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1,
       
  3163 	 PyDoc_STR("(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)")},
       
  3164 	{"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1,
       
  3165 	 PyDoc_STR("(SInt16 resID) -> (WindowPtr outWindow)")},
       
  3166 	{"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1,
       
  3167 	 PyDoc_STR("() -> None")},
       
  3168 	{"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1,
       
  3169 	 PyDoc_STR("() -> None")},
       
  3170 	{"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1,
       
  3171 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  3172 	{"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
       
  3173 	 PyDoc_STR("() -> (Boolean _rv, EventRecord theEvent)")},
       
  3174 	{"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1,
       
  3175 	 PyDoc_STR("(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)")},
       
  3176 	{"FrontWindow", (PyCFunction)Win_FrontWindow, 1,
       
  3177 	 PyDoc_STR("() -> (WindowPtr _rv)")},
       
  3178 	{"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1,
       
  3179 	 PyDoc_STR("() -> (WindowPtr _rv)")},
       
  3180 	{"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1,
       
  3181 	 PyDoc_STR("(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)")},
       
  3182 	{"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1,
       
  3183 	 PyDoc_STR("(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)")},
       
  3184 	{"CreateStandardWindowMenu", (PyCFunction)Win_CreateStandardWindowMenu, 1,
       
  3185 	 PyDoc_STR("(OptionBits inOptions) -> (MenuHandle outMenu)")},
       
  3186 	{"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1,
       
  3187 	 PyDoc_STR("(Boolean collapse) -> None")},
       
  3188 	{"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1,
       
  3189 	 PyDoc_STR("(GDHandle inDevice) -> (Rect outAvailableRect)")},
       
  3190 	{"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1,
       
  3191 	 PyDoc_STR("() -> None")},
       
  3192 	{"EnableScreenUpdates", (PyCFunction)Win_EnableScreenUpdates, 1,
       
  3193 	 PyDoc_STR("() -> None")},
       
  3194 	{"PinRect", (PyCFunction)Win_PinRect, 1,
       
  3195 	 PyDoc_STR("(Rect theRect, Point thePt) -> (long _rv)")},
       
  3196 	{"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
       
  3197 	 PyDoc_STR("() -> (RgnHandle _rv)")},
       
  3198 	{"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1,
       
  3199 	 PyDoc_STR("(CGrafPtr port) -> (WindowPtr _rv)")},
       
  3200 	{"WhichWindow", (PyCFunction)Win_WhichWindow, 1,
       
  3201 	 PyDoc_STR("Resolve an integer WindowPtr address to a Window object")},
       
  3202 	{"FindWindow", (PyCFunction)Win_FindWindow, 1,
       
  3203 	 PyDoc_STR("(Point thePoint) -> (short _rv, WindowPtr theWindow)")},
       
  3204 	{NULL, NULL, 0}
       
  3205 #endif /* __LP64__ */
       
  3206 };
       
  3207 
       
  3208 
       
  3209 
       
  3210 #ifndef __LP64__
       
  3211 /* Return the object corresponding to the window, or NULL */
       
  3212 
       
  3213 PyObject *
       
  3214 WinObj_WhichWindow(WindowPtr w)
       
  3215 {
       
  3216         PyObject *it;
       
  3217 
       
  3218         if (w == NULL) {
       
  3219                 it = Py_None;
       
  3220                 Py_INCREF(it);
       
  3221         } else {
       
  3222                 it = (PyObject *) GetWRefCon(w);
       
  3223                 if (it == NULL || !IsPointerValid((Ptr)it) || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) {
       
  3224                         it = WinObj_New(w);
       
  3225                         ((WindowObject *)it)->ob_freeit = NULL;
       
  3226                 } else {
       
  3227                         Py_INCREF(it);
       
  3228                 }
       
  3229         }
       
  3230         return it;
       
  3231 }
       
  3232 
       
  3233 #endif /* __LP64__ */
       
  3234 
       
  3235 void init_Win(void)
       
  3236 {
       
  3237 	PyObject *m;
       
  3238 #ifndef __LP64__
       
  3239 	PyObject *d;
       
  3240 
       
  3241 	PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New);
       
  3242 	PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow);
       
  3243 	PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
       
  3244 
       
  3245 #endif /* __LP64__ */
       
  3246 
       
  3247 	m = Py_InitModule("_Win", Win_methods);
       
  3248 #ifndef __LP64__
       
  3249 	d = PyModule_GetDict(m);
       
  3250 	Win_Error = PyMac_GetOSErrException();
       
  3251 	if (Win_Error == NULL ||
       
  3252 	    PyDict_SetItemString(d, "Error", Win_Error) != 0)
       
  3253 		return;
       
  3254 	Window_Type.ob_type = &PyType_Type;
       
  3255 	if (PyType_Ready(&Window_Type) < 0) return;
       
  3256 	Py_INCREF(&Window_Type);
       
  3257 	PyModule_AddObject(m, "Window", (PyObject *)&Window_Type);
       
  3258 	/* Backward-compatible name */
       
  3259 	Py_INCREF(&Window_Type);
       
  3260 	PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type);
       
  3261 #endif /* __LP64__ */
       
  3262 }
       
  3263 
       
  3264 /* ======================== End module _Win ========================= */
       
  3265