Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* =========================== Module Win =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #define SystemSevenOrLater 1 |
| 9 | |
| 10 | #include "macglue.h" |
| 11 | #include <Memory.h> |
| 12 | #include <Dialogs.h> |
| 13 | #include <Menus.h> |
| 14 | #include <Controls.h> |
| 15 | |
| 16 | extern PyObject *ResObj_New(Handle); |
| 17 | extern int ResObj_Convert(PyObject *, Handle *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 18 | extern PyObject *OptResObj_New(Handle); |
| 19 | extern int OptResObj_Convert(PyObject *, Handle *); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 20 | |
| 21 | extern PyObject *WinObj_New(WindowPtr); |
| 22 | extern int WinObj_Convert(PyObject *, WindowPtr *); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 23 | extern PyTypeObject Window_Type; |
| 24 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 25 | |
| 26 | extern PyObject *DlgObj_New(DialogPtr); |
| 27 | extern int DlgObj_Convert(PyObject *, DialogPtr *); |
| 28 | extern PyTypeObject Dialog_Type; |
| 29 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 30 | |
| 31 | extern PyObject *MenuObj_New(MenuHandle); |
| 32 | extern int MenuObj_Convert(PyObject *, MenuHandle *); |
| 33 | |
| 34 | extern PyObject *CtlObj_New(ControlHandle); |
| 35 | extern int CtlObj_Convert(PyObject *, ControlHandle *); |
| 36 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 37 | extern PyObject *GrafObj_New(GrafPtr); |
| 38 | extern int GrafObj_Convert(PyObject *, GrafPtr *); |
| 39 | |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 40 | extern PyObject *BMObj_New(BitMapPtr); |
| 41 | extern int BMObj_Convert(PyObject *, BitMapPtr *); |
| 42 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 43 | extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
| 45 | #include <Windows.h> |
| 46 | |
| 47 | #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ |
| 48 | |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 49 | #ifdef HAVE_UNIVERSAL_HEADERS |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 50 | #define WindowPeek WindowPtr |
| 51 | #endif |
| 52 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 53 | static PyObject *Win_Error; |
| 54 | |
| 55 | /* ----------------------- Object type Window ----------------------- */ |
| 56 | |
| 57 | PyTypeObject Window_Type; |
| 58 | |
| 59 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
| 60 | |
| 61 | typedef struct WindowObject { |
| 62 | PyObject_HEAD |
| 63 | WindowPtr ob_itself; |
| 64 | } WindowObject; |
| 65 | |
| 66 | PyObject *WinObj_New(itself) |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 67 | WindowPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 68 | { |
| 69 | WindowObject *it; |
| 70 | if (itself == NULL) return PyMac_Error(resNotFound); |
| 71 | it = PyObject_NEW(WindowObject, &Window_Type); |
| 72 | if (it == NULL) return NULL; |
| 73 | it->ob_itself = itself; |
| 74 | SetWRefCon(itself, (long)it); |
| 75 | return (PyObject *)it; |
| 76 | } |
| 77 | WinObj_Convert(v, p_itself) |
| 78 | PyObject *v; |
| 79 | WindowPtr *p_itself; |
| 80 | { |
| 81 | if (DlgObj_Check(v)) { |
| 82 | *p_itself = ((WindowObject *)v)->ob_itself; |
| 83 | return 1; |
| 84 | } |
| 85 | |
| 86 | if (v == Py_None) { *p_itself = NULL; return 1; } |
| 87 | if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } |
| 88 | |
| 89 | if (!WinObj_Check(v)) |
| 90 | { |
| 91 | PyErr_SetString(PyExc_TypeError, "Window required"); |
| 92 | return 0; |
| 93 | } |
| 94 | *p_itself = ((WindowObject *)v)->ob_itself; |
| 95 | return 1; |
| 96 | } |
| 97 | |
| 98 | static void WinObj_dealloc(self) |
| 99 | WindowObject *self; |
| 100 | { |
| 101 | DisposeWindow(self->ob_itself); |
| 102 | PyMem_DEL(self); |
| 103 | } |
| 104 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 105 | static PyObject *WinObj_SetWinColor(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 106 | WindowObject *_self; |
| 107 | PyObject *_args; |
| 108 | { |
| 109 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 110 | WCTabHandle newColorTable; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 111 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 112 | ResObj_Convert, &newColorTable)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 113 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 114 | SetWinColor(_self->ob_itself, |
| 115 | newColorTable); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 116 | Py_INCREF(Py_None); |
| 117 | _res = Py_None; |
| 118 | return _res; |
| 119 | } |
| 120 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 121 | static PyObject *WinObj_ClipAbove(_self, _args) |
| 122 | WindowObject *_self; |
| 123 | PyObject *_args; |
| 124 | { |
| 125 | PyObject *_res = NULL; |
| 126 | if (!PyArg_ParseTuple(_args, "")) |
| 127 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 128 | ClipAbove(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 129 | Py_INCREF(Py_None); |
| 130 | _res = Py_None; |
| 131 | return _res; |
| 132 | } |
| 133 | |
| 134 | static PyObject *WinObj_SaveOld(_self, _args) |
| 135 | WindowObject *_self; |
| 136 | PyObject *_args; |
| 137 | { |
| 138 | PyObject *_res = NULL; |
| 139 | if (!PyArg_ParseTuple(_args, "")) |
| 140 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 141 | SaveOld(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 142 | Py_INCREF(Py_None); |
| 143 | _res = Py_None; |
| 144 | return _res; |
| 145 | } |
| 146 | |
| 147 | static PyObject *WinObj_DrawNew(_self, _args) |
| 148 | WindowObject *_self; |
| 149 | PyObject *_args; |
| 150 | { |
| 151 | PyObject *_res = NULL; |
| 152 | Boolean update; |
| 153 | if (!PyArg_ParseTuple(_args, "b", |
| 154 | &update)) |
| 155 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 156 | DrawNew(_self->ob_itself, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 157 | update); |
| 158 | Py_INCREF(Py_None); |
| 159 | _res = Py_None; |
| 160 | return _res; |
| 161 | } |
| 162 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 163 | static PyObject *WinObj_PaintOne(_self, _args) |
| 164 | WindowObject *_self; |
| 165 | PyObject *_args; |
| 166 | { |
| 167 | PyObject *_res = NULL; |
| 168 | RgnHandle clobberedRgn; |
| 169 | if (!PyArg_ParseTuple(_args, "O&", |
| 170 | ResObj_Convert, &clobberedRgn)) |
| 171 | return NULL; |
| 172 | PaintOne(_self->ob_itself, |
| 173 | clobberedRgn); |
| 174 | Py_INCREF(Py_None); |
| 175 | _res = Py_None; |
| 176 | return _res; |
| 177 | } |
| 178 | |
| 179 | static PyObject *WinObj_PaintBehind(_self, _args) |
| 180 | WindowObject *_self; |
| 181 | PyObject *_args; |
| 182 | { |
| 183 | PyObject *_res = NULL; |
| 184 | RgnHandle clobberedRgn; |
| 185 | if (!PyArg_ParseTuple(_args, "O&", |
| 186 | ResObj_Convert, &clobberedRgn)) |
| 187 | return NULL; |
| 188 | PaintBehind(_self->ob_itself, |
| 189 | clobberedRgn); |
| 190 | Py_INCREF(Py_None); |
| 191 | _res = Py_None; |
| 192 | return _res; |
| 193 | } |
| 194 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 195 | static PyObject *WinObj_CalcVis(_self, _args) |
| 196 | WindowObject *_self; |
| 197 | PyObject *_args; |
| 198 | { |
| 199 | PyObject *_res = NULL; |
| 200 | if (!PyArg_ParseTuple(_args, "")) |
| 201 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 202 | CalcVis(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 203 | Py_INCREF(Py_None); |
| 204 | _res = Py_None; |
| 205 | return _res; |
| 206 | } |
| 207 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 208 | static PyObject *WinObj_CalcVisBehind(_self, _args) |
| 209 | WindowObject *_self; |
| 210 | PyObject *_args; |
| 211 | { |
| 212 | PyObject *_res = NULL; |
| 213 | RgnHandle clobberedRgn; |
| 214 | if (!PyArg_ParseTuple(_args, "O&", |
| 215 | ResObj_Convert, &clobberedRgn)) |
| 216 | return NULL; |
| 217 | CalcVisBehind(_self->ob_itself, |
| 218 | clobberedRgn); |
| 219 | Py_INCREF(Py_None); |
| 220 | _res = Py_None; |
| 221 | return _res; |
| 222 | } |
| 223 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 224 | static PyObject *WinObj_BringToFront(_self, _args) |
| 225 | WindowObject *_self; |
| 226 | PyObject *_args; |
| 227 | { |
| 228 | PyObject *_res = NULL; |
| 229 | if (!PyArg_ParseTuple(_args, "")) |
| 230 | return NULL; |
| 231 | BringToFront(_self->ob_itself); |
| 232 | Py_INCREF(Py_None); |
| 233 | _res = Py_None; |
| 234 | return _res; |
| 235 | } |
| 236 | |
| 237 | static PyObject *WinObj_SendBehind(_self, _args) |
| 238 | WindowObject *_self; |
| 239 | PyObject *_args; |
| 240 | { |
| 241 | PyObject *_res = NULL; |
| 242 | WindowPtr behindWindow; |
| 243 | if (!PyArg_ParseTuple(_args, "O&", |
| 244 | WinObj_Convert, &behindWindow)) |
| 245 | return NULL; |
| 246 | SendBehind(_self->ob_itself, |
| 247 | behindWindow); |
| 248 | Py_INCREF(Py_None); |
| 249 | _res = Py_None; |
| 250 | return _res; |
| 251 | } |
| 252 | |
| 253 | static PyObject *WinObj_SelectWindow(_self, _args) |
| 254 | WindowObject *_self; |
| 255 | PyObject *_args; |
| 256 | { |
| 257 | PyObject *_res = NULL; |
| 258 | if (!PyArg_ParseTuple(_args, "")) |
| 259 | return NULL; |
| 260 | SelectWindow(_self->ob_itself); |
| 261 | Py_INCREF(Py_None); |
| 262 | _res = Py_None; |
| 263 | return _res; |
| 264 | } |
| 265 | |
| 266 | static PyObject *WinObj_GetWindowFeatures(_self, _args) |
| 267 | WindowObject *_self; |
| 268 | PyObject *_args; |
| 269 | { |
| 270 | PyObject *_res = NULL; |
| 271 | OSStatus _rv; |
| 272 | UInt32 outFeatures; |
| 273 | if (!PyArg_ParseTuple(_args, "")) |
| 274 | return NULL; |
| 275 | _rv = GetWindowFeatures(_self->ob_itself, |
| 276 | &outFeatures); |
| 277 | _res = Py_BuildValue("ll", |
| 278 | _rv, |
| 279 | outFeatures); |
| 280 | return _res; |
| 281 | } |
| 282 | |
| 283 | static PyObject *WinObj_GetWindowRegion(_self, _args) |
| 284 | WindowObject *_self; |
| 285 | PyObject *_args; |
| 286 | { |
| 287 | PyObject *_res = NULL; |
| 288 | OSStatus _rv; |
| 289 | WindowRegionCode inRegionCode; |
| 290 | RgnHandle ioWinRgn; |
| 291 | if (!PyArg_ParseTuple(_args, "hO&", |
| 292 | &inRegionCode, |
| 293 | ResObj_Convert, &ioWinRgn)) |
| 294 | return NULL; |
| 295 | _rv = GetWindowRegion(_self->ob_itself, |
| 296 | inRegionCode, |
| 297 | ioWinRgn); |
| 298 | _res = Py_BuildValue("l", |
| 299 | _rv); |
| 300 | return _res; |
| 301 | } |
| 302 | |
| 303 | static PyObject *WinObj_SetWRefCon(_self, _args) |
| 304 | WindowObject *_self; |
| 305 | PyObject *_args; |
| 306 | { |
| 307 | PyObject *_res = NULL; |
| 308 | long data; |
| 309 | if (!PyArg_ParseTuple(_args, "l", |
| 310 | &data)) |
| 311 | return NULL; |
| 312 | SetWRefCon(_self->ob_itself, |
| 313 | data); |
| 314 | Py_INCREF(Py_None); |
| 315 | _res = Py_None; |
| 316 | return _res; |
| 317 | } |
| 318 | |
| 319 | static PyObject *WinObj_GetWRefCon(_self, _args) |
| 320 | WindowObject *_self; |
| 321 | PyObject *_args; |
| 322 | { |
| 323 | PyObject *_res = NULL; |
| 324 | long _rv; |
| 325 | if (!PyArg_ParseTuple(_args, "")) |
| 326 | return NULL; |
| 327 | _rv = GetWRefCon(_self->ob_itself); |
| 328 | _res = Py_BuildValue("l", |
| 329 | _rv); |
| 330 | return _res; |
| 331 | } |
| 332 | |
| 333 | static PyObject *WinObj_SetWindowPic(_self, _args) |
| 334 | WindowObject *_self; |
| 335 | PyObject *_args; |
| 336 | { |
| 337 | PyObject *_res = NULL; |
| 338 | PicHandle pic; |
| 339 | if (!PyArg_ParseTuple(_args, "O&", |
| 340 | ResObj_Convert, &pic)) |
| 341 | return NULL; |
| 342 | SetWindowPic(_self->ob_itself, |
| 343 | pic); |
| 344 | Py_INCREF(Py_None); |
| 345 | _res = Py_None; |
| 346 | return _res; |
| 347 | } |
| 348 | |
| 349 | static PyObject *WinObj_GetWindowPic(_self, _args) |
| 350 | WindowObject *_self; |
| 351 | PyObject *_args; |
| 352 | { |
| 353 | PyObject *_res = NULL; |
| 354 | PicHandle _rv; |
| 355 | if (!PyArg_ParseTuple(_args, "")) |
| 356 | return NULL; |
| 357 | _rv = GetWindowPic(_self->ob_itself); |
| 358 | _res = Py_BuildValue("O&", |
| 359 | ResObj_New, _rv); |
| 360 | return _res; |
| 361 | } |
| 362 | |
| 363 | static PyObject *WinObj_GetWVariant(_self, _args) |
| 364 | WindowObject *_self; |
| 365 | PyObject *_args; |
| 366 | { |
| 367 | PyObject *_res = NULL; |
| 368 | short _rv; |
| 369 | if (!PyArg_ParseTuple(_args, "")) |
| 370 | return NULL; |
| 371 | _rv = GetWVariant(_self->ob_itself); |
| 372 | _res = Py_BuildValue("h", |
| 373 | _rv); |
| 374 | return _res; |
| 375 | } |
| 376 | |
| 377 | static PyObject *WinObj_BeginUpdate(_self, _args) |
| 378 | WindowObject *_self; |
| 379 | PyObject *_args; |
| 380 | { |
| 381 | PyObject *_res = NULL; |
| 382 | if (!PyArg_ParseTuple(_args, "")) |
| 383 | return NULL; |
| 384 | BeginUpdate(_self->ob_itself); |
| 385 | Py_INCREF(Py_None); |
| 386 | _res = Py_None; |
| 387 | return _res; |
| 388 | } |
| 389 | |
| 390 | static PyObject *WinObj_EndUpdate(_self, _args) |
| 391 | WindowObject *_self; |
| 392 | PyObject *_args; |
| 393 | { |
| 394 | PyObject *_res = NULL; |
| 395 | if (!PyArg_ParseTuple(_args, "")) |
| 396 | return NULL; |
| 397 | EndUpdate(_self->ob_itself); |
| 398 | Py_INCREF(Py_None); |
| 399 | _res = Py_None; |
| 400 | return _res; |
| 401 | } |
| 402 | |
| 403 | static PyObject *WinObj_DrawGrowIcon(_self, _args) |
| 404 | WindowObject *_self; |
| 405 | PyObject *_args; |
| 406 | { |
| 407 | PyObject *_res = NULL; |
| 408 | if (!PyArg_ParseTuple(_args, "")) |
| 409 | return NULL; |
| 410 | DrawGrowIcon(_self->ob_itself); |
| 411 | Py_INCREF(Py_None); |
| 412 | _res = Py_None; |
| 413 | return _res; |
| 414 | } |
| 415 | |
| 416 | static PyObject *WinObj_HiliteWindow(_self, _args) |
| 417 | WindowObject *_self; |
| 418 | PyObject *_args; |
| 419 | { |
| 420 | PyObject *_res = NULL; |
| 421 | Boolean fHilite; |
| 422 | if (!PyArg_ParseTuple(_args, "b", |
| 423 | &fHilite)) |
| 424 | return NULL; |
| 425 | HiliteWindow(_self->ob_itself, |
| 426 | fHilite); |
| 427 | Py_INCREF(Py_None); |
| 428 | _res = Py_None; |
| 429 | return _res; |
| 430 | } |
| 431 | |
| 432 | static PyObject *WinObj_SetWTitle(_self, _args) |
| 433 | WindowObject *_self; |
| 434 | PyObject *_args; |
| 435 | { |
| 436 | PyObject *_res = NULL; |
| 437 | Str255 title; |
| 438 | if (!PyArg_ParseTuple(_args, "O&", |
| 439 | PyMac_GetStr255, title)) |
| 440 | return NULL; |
| 441 | SetWTitle(_self->ob_itself, |
| 442 | title); |
| 443 | Py_INCREF(Py_None); |
| 444 | _res = Py_None; |
| 445 | return _res; |
| 446 | } |
| 447 | |
| 448 | static PyObject *WinObj_GetWTitle(_self, _args) |
| 449 | WindowObject *_self; |
| 450 | PyObject *_args; |
| 451 | { |
| 452 | PyObject *_res = NULL; |
| 453 | Str255 title; |
| 454 | if (!PyArg_ParseTuple(_args, "")) |
| 455 | return NULL; |
| 456 | GetWTitle(_self->ob_itself, |
| 457 | title); |
| 458 | _res = Py_BuildValue("O&", |
| 459 | PyMac_BuildStr255, title); |
| 460 | return _res; |
| 461 | } |
| 462 | |
| 463 | static PyObject *WinObj_IsWindowCollapsable(_self, _args) |
| 464 | WindowObject *_self; |
| 465 | PyObject *_args; |
| 466 | { |
| 467 | PyObject *_res = NULL; |
| 468 | Boolean _rv; |
| 469 | if (!PyArg_ParseTuple(_args, "")) |
| 470 | return NULL; |
| 471 | _rv = IsWindowCollapsable(_self->ob_itself); |
| 472 | _res = Py_BuildValue("b", |
| 473 | _rv); |
| 474 | return _res; |
| 475 | } |
| 476 | |
| 477 | static PyObject *WinObj_IsWindowCollapsed(_self, _args) |
| 478 | WindowObject *_self; |
| 479 | PyObject *_args; |
| 480 | { |
| 481 | PyObject *_res = NULL; |
| 482 | Boolean _rv; |
| 483 | if (!PyArg_ParseTuple(_args, "")) |
| 484 | return NULL; |
| 485 | _rv = IsWindowCollapsed(_self->ob_itself); |
| 486 | _res = Py_BuildValue("b", |
| 487 | _rv); |
| 488 | return _res; |
| 489 | } |
| 490 | |
| 491 | static PyObject *WinObj_CollapseWindow(_self, _args) |
| 492 | WindowObject *_self; |
| 493 | PyObject *_args; |
| 494 | { |
| 495 | PyObject *_res = NULL; |
| 496 | OSStatus _rv; |
| 497 | Boolean inCollapseIt; |
| 498 | if (!PyArg_ParseTuple(_args, "b", |
| 499 | &inCollapseIt)) |
| 500 | return NULL; |
| 501 | _rv = CollapseWindow(_self->ob_itself, |
| 502 | inCollapseIt); |
| 503 | _res = Py_BuildValue("l", |
| 504 | _rv); |
| 505 | return _res; |
| 506 | } |
| 507 | |
| 508 | static PyObject *WinObj_MoveWindow(_self, _args) |
| 509 | WindowObject *_self; |
| 510 | PyObject *_args; |
| 511 | { |
| 512 | PyObject *_res = NULL; |
| 513 | short hGlobal; |
| 514 | short vGlobal; |
| 515 | Boolean front; |
| 516 | if (!PyArg_ParseTuple(_args, "hhb", |
| 517 | &hGlobal, |
| 518 | &vGlobal, |
| 519 | &front)) |
| 520 | return NULL; |
| 521 | MoveWindow(_self->ob_itself, |
| 522 | hGlobal, |
| 523 | vGlobal, |
| 524 | front); |
| 525 | Py_INCREF(Py_None); |
| 526 | _res = Py_None; |
| 527 | return _res; |
| 528 | } |
| 529 | |
| 530 | static PyObject *WinObj_SizeWindow(_self, _args) |
| 531 | WindowObject *_self; |
| 532 | PyObject *_args; |
| 533 | { |
| 534 | PyObject *_res = NULL; |
| 535 | short w; |
| 536 | short h; |
| 537 | Boolean fUpdate; |
| 538 | if (!PyArg_ParseTuple(_args, "hhb", |
| 539 | &w, |
| 540 | &h, |
| 541 | &fUpdate)) |
| 542 | return NULL; |
| 543 | SizeWindow(_self->ob_itself, |
| 544 | w, |
| 545 | h, |
| 546 | fUpdate); |
| 547 | Py_INCREF(Py_None); |
| 548 | _res = Py_None; |
| 549 | return _res; |
| 550 | } |
| 551 | |
| 552 | static PyObject *WinObj_ZoomWindow(_self, _args) |
| 553 | WindowObject *_self; |
| 554 | PyObject *_args; |
| 555 | { |
| 556 | PyObject *_res = NULL; |
| 557 | short partCode; |
| 558 | Boolean front; |
| 559 | if (!PyArg_ParseTuple(_args, "hb", |
| 560 | &partCode, |
| 561 | &front)) |
| 562 | return NULL; |
| 563 | ZoomWindow(_self->ob_itself, |
| 564 | partCode, |
| 565 | front); |
| 566 | Py_INCREF(Py_None); |
| 567 | _res = Py_None; |
| 568 | return _res; |
| 569 | } |
| 570 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 571 | static PyObject *WinObj_GrowWindow(_self, _args) |
| 572 | WindowObject *_self; |
| 573 | PyObject *_args; |
| 574 | { |
| 575 | PyObject *_res = NULL; |
| 576 | long _rv; |
| 577 | Point startPt; |
| 578 | Rect bBox; |
| 579 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 580 | PyMac_GetPoint, &startPt, |
| 581 | PyMac_GetRect, &bBox)) |
| 582 | return NULL; |
| 583 | _rv = GrowWindow(_self->ob_itself, |
| 584 | startPt, |
| 585 | &bBox); |
| 586 | _res = Py_BuildValue("l", |
| 587 | _rv); |
| 588 | return _res; |
| 589 | } |
| 590 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 591 | static PyObject *WinObj_DragWindow(_self, _args) |
| 592 | WindowObject *_self; |
| 593 | PyObject *_args; |
| 594 | { |
| 595 | PyObject *_res = NULL; |
| 596 | Point startPt; |
| 597 | Rect boundsRect; |
| 598 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 599 | PyMac_GetPoint, &startPt, |
| 600 | PyMac_GetRect, &boundsRect)) |
| 601 | return NULL; |
| 602 | DragWindow(_self->ob_itself, |
| 603 | startPt, |
| 604 | &boundsRect); |
| 605 | Py_INCREF(Py_None); |
| 606 | _res = Py_None; |
| 607 | return _res; |
| 608 | } |
| 609 | |
| 610 | static PyObject *WinObj_HideWindow(_self, _args) |
| 611 | WindowObject *_self; |
| 612 | PyObject *_args; |
| 613 | { |
| 614 | PyObject *_res = NULL; |
| 615 | if (!PyArg_ParseTuple(_args, "")) |
| 616 | return NULL; |
| 617 | HideWindow(_self->ob_itself); |
| 618 | Py_INCREF(Py_None); |
| 619 | _res = Py_None; |
| 620 | return _res; |
| 621 | } |
| 622 | |
| 623 | static PyObject *WinObj_ShowWindow(_self, _args) |
| 624 | WindowObject *_self; |
| 625 | PyObject *_args; |
| 626 | { |
| 627 | PyObject *_res = NULL; |
| 628 | if (!PyArg_ParseTuple(_args, "")) |
| 629 | return NULL; |
| 630 | ShowWindow(_self->ob_itself); |
| 631 | Py_INCREF(Py_None); |
| 632 | _res = Py_None; |
| 633 | return _res; |
| 634 | } |
| 635 | |
| 636 | static PyObject *WinObj_ShowHide(_self, _args) |
| 637 | WindowObject *_self; |
| 638 | PyObject *_args; |
| 639 | { |
| 640 | PyObject *_res = NULL; |
| 641 | Boolean showFlag; |
| 642 | if (!PyArg_ParseTuple(_args, "b", |
| 643 | &showFlag)) |
| 644 | return NULL; |
| 645 | ShowHide(_self->ob_itself, |
| 646 | showFlag); |
| 647 | Py_INCREF(Py_None); |
| 648 | _res = Py_None; |
| 649 | return _res; |
| 650 | } |
| 651 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 652 | static PyObject *WinObj_TrackBox(_self, _args) |
| 653 | WindowObject *_self; |
| 654 | PyObject *_args; |
| 655 | { |
| 656 | PyObject *_res = NULL; |
| 657 | Boolean _rv; |
| 658 | Point thePt; |
| 659 | short partCode; |
| 660 | if (!PyArg_ParseTuple(_args, "O&h", |
| 661 | PyMac_GetPoint, &thePt, |
| 662 | &partCode)) |
| 663 | return NULL; |
| 664 | _rv = TrackBox(_self->ob_itself, |
| 665 | thePt, |
| 666 | partCode); |
| 667 | _res = Py_BuildValue("b", |
| 668 | _rv); |
| 669 | return _res; |
| 670 | } |
| 671 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 672 | static PyObject *WinObj_TrackGoAway(_self, _args) |
| 673 | WindowObject *_self; |
| 674 | PyObject *_args; |
| 675 | { |
| 676 | PyObject *_res = NULL; |
| 677 | Boolean _rv; |
| 678 | Point thePt; |
| 679 | if (!PyArg_ParseTuple(_args, "O&", |
| 680 | PyMac_GetPoint, &thePt)) |
| 681 | return NULL; |
| 682 | _rv = TrackGoAway(_self->ob_itself, |
| 683 | thePt); |
| 684 | _res = Py_BuildValue("b", |
| 685 | _rv); |
| 686 | return _res; |
| 687 | } |
| 688 | |
Jack Jansen | 8f0fab7 | 1997-08-15 14:38:05 +0000 | [diff] [blame] | 689 | static PyObject *WinObj_GetAuxWin(_self, _args) |
| 690 | WindowObject *_self; |
| 691 | PyObject *_args; |
| 692 | { |
| 693 | PyObject *_res = NULL; |
| 694 | Boolean _rv; |
| 695 | AuxWinHandle awHndl; |
| 696 | if (!PyArg_ParseTuple(_args, "")) |
| 697 | return NULL; |
| 698 | _rv = GetAuxWin(_self->ob_itself, |
| 699 | &awHndl); |
| 700 | _res = Py_BuildValue("bO&", |
| 701 | _rv, |
| 702 | ResObj_New, awHndl); |
| 703 | return _res; |
| 704 | } |
| 705 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 706 | static PyObject *WinObj_GetWindowPort(_self, _args) |
| 707 | WindowObject *_self; |
| 708 | PyObject *_args; |
| 709 | { |
| 710 | PyObject *_res = NULL; |
| 711 | CGrafPtr _rv; |
| 712 | if (!PyArg_ParseTuple(_args, "")) |
| 713 | return NULL; |
| 714 | _rv = GetWindowPort(_self->ob_itself); |
| 715 | _res = Py_BuildValue("O&", |
| 716 | GrafObj_New, _rv); |
| 717 | return _res; |
| 718 | } |
| 719 | |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 720 | static PyObject *WinObj_SetPortWindowPort(_self, _args) |
| 721 | WindowObject *_self; |
| 722 | PyObject *_args; |
| 723 | { |
| 724 | PyObject *_res = NULL; |
| 725 | if (!PyArg_ParseTuple(_args, "")) |
| 726 | return NULL; |
| 727 | SetPortWindowPort(_self->ob_itself); |
| 728 | Py_INCREF(Py_None); |
| 729 | _res = Py_None; |
| 730 | return _res; |
| 731 | } |
| 732 | |
| 733 | static PyObject *WinObj_GetWindowKind(_self, _args) |
| 734 | WindowObject *_self; |
| 735 | PyObject *_args; |
| 736 | { |
| 737 | PyObject *_res = NULL; |
| 738 | short _rv; |
| 739 | if (!PyArg_ParseTuple(_args, "")) |
| 740 | return NULL; |
| 741 | _rv = GetWindowKind(_self->ob_itself); |
| 742 | _res = Py_BuildValue("h", |
| 743 | _rv); |
| 744 | return _res; |
| 745 | } |
| 746 | |
| 747 | static PyObject *WinObj_SetWindowKind(_self, _args) |
| 748 | WindowObject *_self; |
| 749 | PyObject *_args; |
| 750 | { |
| 751 | PyObject *_res = NULL; |
| 752 | short wKind; |
| 753 | if (!PyArg_ParseTuple(_args, "h", |
| 754 | &wKind)) |
| 755 | return NULL; |
| 756 | SetWindowKind(_self->ob_itself, |
| 757 | wKind); |
| 758 | Py_INCREF(Py_None); |
| 759 | _res = Py_None; |
| 760 | return _res; |
| 761 | } |
| 762 | |
| 763 | static PyObject *WinObj_IsWindowVisible(_self, _args) |
| 764 | WindowObject *_self; |
| 765 | PyObject *_args; |
| 766 | { |
| 767 | PyObject *_res = NULL; |
| 768 | Boolean _rv; |
| 769 | if (!PyArg_ParseTuple(_args, "")) |
| 770 | return NULL; |
| 771 | _rv = IsWindowVisible(_self->ob_itself); |
| 772 | _res = Py_BuildValue("b", |
| 773 | _rv); |
| 774 | return _res; |
| 775 | } |
| 776 | |
| 777 | static PyObject *WinObj_IsWindowHilited(_self, _args) |
| 778 | WindowObject *_self; |
| 779 | PyObject *_args; |
| 780 | { |
| 781 | PyObject *_res = NULL; |
| 782 | Boolean _rv; |
| 783 | if (!PyArg_ParseTuple(_args, "")) |
| 784 | return NULL; |
| 785 | _rv = IsWindowHilited(_self->ob_itself); |
| 786 | _res = Py_BuildValue("b", |
| 787 | _rv); |
| 788 | return _res; |
| 789 | } |
| 790 | |
| 791 | static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args) |
| 792 | WindowObject *_self; |
| 793 | PyObject *_args; |
| 794 | { |
| 795 | PyObject *_res = NULL; |
| 796 | Boolean _rv; |
| 797 | if (!PyArg_ParseTuple(_args, "")) |
| 798 | return NULL; |
| 799 | _rv = GetWindowGoAwayFlag(_self->ob_itself); |
| 800 | _res = Py_BuildValue("b", |
| 801 | _rv); |
| 802 | return _res; |
| 803 | } |
| 804 | |
| 805 | static PyObject *WinObj_GetWindowZoomFlag(_self, _args) |
| 806 | WindowObject *_self; |
| 807 | PyObject *_args; |
| 808 | { |
| 809 | PyObject *_res = NULL; |
| 810 | Boolean _rv; |
| 811 | if (!PyArg_ParseTuple(_args, "")) |
| 812 | return NULL; |
| 813 | _rv = GetWindowZoomFlag(_self->ob_itself); |
| 814 | _res = Py_BuildValue("b", |
| 815 | _rv); |
| 816 | return _res; |
| 817 | } |
| 818 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 819 | static PyObject *WinObj_GetWindowStructureRgn(_self, _args) |
| 820 | WindowObject *_self; |
| 821 | PyObject *_args; |
| 822 | { |
| 823 | PyObject *_res = NULL; |
| 824 | RgnHandle r; |
| 825 | if (!PyArg_ParseTuple(_args, "O&", |
| 826 | ResObj_Convert, &r)) |
| 827 | return NULL; |
| 828 | GetWindowStructureRgn(_self->ob_itself, |
| 829 | r); |
| 830 | Py_INCREF(Py_None); |
| 831 | _res = Py_None; |
| 832 | return _res; |
| 833 | } |
| 834 | |
| 835 | static PyObject *WinObj_GetWindowContentRgn(_self, _args) |
| 836 | WindowObject *_self; |
| 837 | PyObject *_args; |
| 838 | { |
| 839 | PyObject *_res = NULL; |
| 840 | RgnHandle r; |
| 841 | if (!PyArg_ParseTuple(_args, "O&", |
| 842 | ResObj_Convert, &r)) |
| 843 | return NULL; |
| 844 | GetWindowContentRgn(_self->ob_itself, |
| 845 | r); |
| 846 | Py_INCREF(Py_None); |
| 847 | _res = Py_None; |
| 848 | return _res; |
| 849 | } |
| 850 | |
| 851 | static PyObject *WinObj_GetWindowUpdateRgn(_self, _args) |
| 852 | WindowObject *_self; |
| 853 | PyObject *_args; |
| 854 | { |
| 855 | PyObject *_res = NULL; |
| 856 | RgnHandle r; |
| 857 | if (!PyArg_ParseTuple(_args, "O&", |
| 858 | ResObj_Convert, &r)) |
| 859 | return NULL; |
| 860 | GetWindowUpdateRgn(_self->ob_itself, |
| 861 | r); |
| 862 | Py_INCREF(Py_None); |
| 863 | _res = Py_None; |
| 864 | return _res; |
| 865 | } |
| 866 | |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 867 | static PyObject *WinObj_GetWindowTitleWidth(_self, _args) |
| 868 | WindowObject *_self; |
| 869 | PyObject *_args; |
| 870 | { |
| 871 | PyObject *_res = NULL; |
| 872 | short _rv; |
| 873 | if (!PyArg_ParseTuple(_args, "")) |
| 874 | return NULL; |
| 875 | _rv = GetWindowTitleWidth(_self->ob_itself); |
| 876 | _res = Py_BuildValue("h", |
| 877 | _rv); |
| 878 | return _res; |
| 879 | } |
| 880 | |
| 881 | static PyObject *WinObj_GetNextWindow(_self, _args) |
| 882 | WindowObject *_self; |
| 883 | PyObject *_args; |
| 884 | { |
| 885 | PyObject *_res = NULL; |
| 886 | WindowPtr _rv; |
| 887 | if (!PyArg_ParseTuple(_args, "")) |
| 888 | return NULL; |
| 889 | _rv = GetNextWindow(_self->ob_itself); |
| 890 | _res = Py_BuildValue("O&", |
| 891 | WinObj_WhichWindow, _rv); |
| 892 | return _res; |
| 893 | } |
| 894 | |
| 895 | static PyObject *WinObj_GetWindowStandardState(_self, _args) |
| 896 | WindowObject *_self; |
| 897 | PyObject *_args; |
| 898 | { |
| 899 | PyObject *_res = NULL; |
| 900 | Rect r; |
| 901 | if (!PyArg_ParseTuple(_args, "")) |
| 902 | return NULL; |
| 903 | GetWindowStandardState(_self->ob_itself, |
| 904 | &r); |
| 905 | _res = Py_BuildValue("O&", |
| 906 | PyMac_BuildRect, &r); |
| 907 | return _res; |
| 908 | } |
| 909 | |
| 910 | static PyObject *WinObj_GetWindowUserState(_self, _args) |
| 911 | WindowObject *_self; |
| 912 | PyObject *_args; |
| 913 | { |
| 914 | PyObject *_res = NULL; |
| 915 | Rect r; |
| 916 | if (!PyArg_ParseTuple(_args, "")) |
| 917 | return NULL; |
| 918 | GetWindowUserState(_self->ob_itself, |
| 919 | &r); |
| 920 | _res = Py_BuildValue("O&", |
| 921 | PyMac_BuildRect, &r); |
| 922 | return _res; |
| 923 | } |
| 924 | |
| 925 | static PyObject *WinObj_SetWindowStandardState(_self, _args) |
| 926 | WindowObject *_self; |
| 927 | PyObject *_args; |
| 928 | { |
| 929 | PyObject *_res = NULL; |
| 930 | Rect r; |
| 931 | if (!PyArg_ParseTuple(_args, "O&", |
| 932 | PyMac_GetRect, &r)) |
| 933 | return NULL; |
| 934 | SetWindowStandardState(_self->ob_itself, |
| 935 | &r); |
| 936 | Py_INCREF(Py_None); |
| 937 | _res = Py_None; |
| 938 | return _res; |
| 939 | } |
| 940 | |
| 941 | static PyObject *WinObj_SetWindowUserState(_self, _args) |
| 942 | WindowObject *_self; |
| 943 | PyObject *_args; |
| 944 | { |
| 945 | PyObject *_res = NULL; |
| 946 | Rect r; |
| 947 | if (!PyArg_ParseTuple(_args, "O&", |
| 948 | PyMac_GetRect, &r)) |
| 949 | return NULL; |
| 950 | SetWindowUserState(_self->ob_itself, |
| 951 | &r); |
| 952 | Py_INCREF(Py_None); |
| 953 | _res = Py_None; |
| 954 | return _res; |
| 955 | } |
| 956 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 957 | static PyMethodDef WinObj_methods[] = { |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 958 | {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, |
| 959 | "(WCTabHandle newColorTable) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 960 | {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, |
| 961 | "() -> None"}, |
| 962 | {"SaveOld", (PyCFunction)WinObj_SaveOld, 1, |
| 963 | "() -> None"}, |
| 964 | {"DrawNew", (PyCFunction)WinObj_DrawNew, 1, |
| 965 | "(Boolean update) -> None"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 966 | {"PaintOne", (PyCFunction)WinObj_PaintOne, 1, |
| 967 | "(RgnHandle clobberedRgn) -> None"}, |
| 968 | {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1, |
| 969 | "(RgnHandle clobberedRgn) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 970 | {"CalcVis", (PyCFunction)WinObj_CalcVis, 1, |
| 971 | "() -> None"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 972 | {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1, |
| 973 | "(RgnHandle clobberedRgn) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 974 | {"BringToFront", (PyCFunction)WinObj_BringToFront, 1, |
| 975 | "() -> None"}, |
| 976 | {"SendBehind", (PyCFunction)WinObj_SendBehind, 1, |
| 977 | "(WindowPtr behindWindow) -> None"}, |
| 978 | {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1, |
| 979 | "() -> None"}, |
| 980 | {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1, |
| 981 | "() -> (OSStatus _rv, UInt32 outFeatures)"}, |
| 982 | {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, |
| 983 | "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> (OSStatus _rv)"}, |
| 984 | {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1, |
| 985 | "(long data) -> None"}, |
| 986 | {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1, |
| 987 | "() -> (long _rv)"}, |
| 988 | {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1, |
| 989 | "(PicHandle pic) -> None"}, |
| 990 | {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1, |
| 991 | "() -> (PicHandle _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 992 | {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1, |
| 993 | "() -> (short _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 994 | {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1, |
| 995 | "() -> None"}, |
| 996 | {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1, |
| 997 | "() -> None"}, |
| 998 | {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1, |
| 999 | "() -> None"}, |
| 1000 | {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1, |
| 1001 | "(Boolean fHilite) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1002 | {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1, |
| 1003 | "(Str255 title) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1004 | {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1, |
| 1005 | "() -> (Str255 title)"}, |
| 1006 | {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, |
| 1007 | "() -> (Boolean _rv)"}, |
| 1008 | {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, |
| 1009 | "() -> (Boolean _rv)"}, |
| 1010 | {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, |
| 1011 | "(Boolean inCollapseIt) -> (OSStatus _rv)"}, |
| 1012 | {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1, |
| 1013 | "(short hGlobal, short vGlobal, Boolean front) -> None"}, |
| 1014 | {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1, |
| 1015 | "(short w, short h, Boolean fUpdate) -> None"}, |
| 1016 | {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, |
| 1017 | "(short partCode, Boolean front) -> None"}, |
| 1018 | {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1, |
| 1019 | "(Point startPt, Rect bBox) -> (long _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1020 | {"DragWindow", (PyCFunction)WinObj_DragWindow, 1, |
| 1021 | "(Point startPt, Rect boundsRect) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1022 | {"HideWindow", (PyCFunction)WinObj_HideWindow, 1, |
| 1023 | "() -> None"}, |
| 1024 | {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, |
| 1025 | "() -> None"}, |
| 1026 | {"ShowHide", (PyCFunction)WinObj_ShowHide, 1, |
| 1027 | "(Boolean showFlag) -> None"}, |
| 1028 | {"TrackBox", (PyCFunction)WinObj_TrackBox, 1, |
| 1029 | "(Point thePt, short partCode) -> (Boolean _rv)"}, |
| 1030 | {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1, |
| 1031 | "(Point thePt) -> (Boolean _rv)"}, |
Jack Jansen | 8f0fab7 | 1997-08-15 14:38:05 +0000 | [diff] [blame] | 1032 | {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1, |
| 1033 | "() -> (Boolean _rv, AuxWinHandle awHndl)"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1034 | {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, |
| 1035 | "() -> (CGrafPtr _rv)"}, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1036 | {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, |
| 1037 | "() -> None"}, |
| 1038 | {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, |
| 1039 | "() -> (short _rv)"}, |
| 1040 | {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1, |
| 1041 | "(short wKind) -> None"}, |
| 1042 | {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1, |
| 1043 | "() -> (Boolean _rv)"}, |
| 1044 | {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1, |
| 1045 | "() -> (Boolean _rv)"}, |
| 1046 | {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, |
| 1047 | "() -> (Boolean _rv)"}, |
| 1048 | {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1, |
| 1049 | "() -> (Boolean _rv)"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1050 | {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1, |
| 1051 | "(RgnHandle r) -> None"}, |
| 1052 | {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1, |
| 1053 | "(RgnHandle r) -> None"}, |
| 1054 | {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1, |
| 1055 | "(RgnHandle r) -> None"}, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1056 | {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1, |
| 1057 | "() -> (short _rv)"}, |
| 1058 | {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1, |
| 1059 | "() -> (WindowPtr _rv)"}, |
| 1060 | {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1, |
| 1061 | "() -> (Rect r)"}, |
| 1062 | {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1, |
| 1063 | "() -> (Rect r)"}, |
| 1064 | {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1, |
| 1065 | "(Rect r) -> None"}, |
| 1066 | {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1, |
| 1067 | "(Rect r) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1068 | {NULL, NULL, 0} |
| 1069 | }; |
| 1070 | |
| 1071 | PyMethodChain WinObj_chain = { WinObj_methods, NULL }; |
| 1072 | |
| 1073 | static PyObject *WinObj_getattr(self, name) |
| 1074 | WindowObject *self; |
| 1075 | char *name; |
| 1076 | { |
| 1077 | return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name); |
| 1078 | } |
| 1079 | |
| 1080 | #define WinObj_setattr NULL |
| 1081 | |
| 1082 | PyTypeObject Window_Type = { |
| 1083 | PyObject_HEAD_INIT(&PyType_Type) |
| 1084 | 0, /*ob_size*/ |
| 1085 | "Window", /*tp_name*/ |
| 1086 | sizeof(WindowObject), /*tp_basicsize*/ |
| 1087 | 0, /*tp_itemsize*/ |
| 1088 | /* methods */ |
| 1089 | (destructor) WinObj_dealloc, /*tp_dealloc*/ |
| 1090 | 0, /*tp_print*/ |
| 1091 | (getattrfunc) WinObj_getattr, /*tp_getattr*/ |
| 1092 | (setattrfunc) WinObj_setattr, /*tp_setattr*/ |
| 1093 | }; |
| 1094 | |
| 1095 | /* --------------------- End object type Window --------------------- */ |
| 1096 | |
| 1097 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1098 | static PyObject *Win_GetNewCWindow(_self, _args) |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1099 | PyObject *_self; |
| 1100 | PyObject *_args; |
| 1101 | { |
| 1102 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1103 | WindowPtr _rv; |
| 1104 | short windowID; |
| 1105 | WindowPtr behind; |
| 1106 | if (!PyArg_ParseTuple(_args, "hO&", |
| 1107 | &windowID, |
| 1108 | WinObj_Convert, &behind)) |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1109 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1110 | _rv = GetNewCWindow(windowID, |
| 1111 | (void *)0, |
| 1112 | behind); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1113 | _res = Py_BuildValue("O&", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1114 | WinObj_New, _rv); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1115 | return _res; |
| 1116 | } |
| 1117 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1118 | static PyObject *Win_NewWindow(_self, _args) |
| 1119 | PyObject *_self; |
| 1120 | PyObject *_args; |
| 1121 | { |
| 1122 | PyObject *_res = NULL; |
| 1123 | WindowPtr _rv; |
| 1124 | Rect boundsRect; |
| 1125 | Str255 title; |
| 1126 | Boolean visible; |
| 1127 | short theProc; |
| 1128 | WindowPtr behind; |
| 1129 | Boolean goAwayFlag; |
| 1130 | long refCon; |
| 1131 | if (!PyArg_ParseTuple(_args, "O&O&bhO&bl", |
| 1132 | PyMac_GetRect, &boundsRect, |
| 1133 | PyMac_GetStr255, title, |
| 1134 | &visible, |
| 1135 | &theProc, |
| 1136 | WinObj_Convert, &behind, |
| 1137 | &goAwayFlag, |
| 1138 | &refCon)) |
| 1139 | return NULL; |
| 1140 | _rv = NewWindow((void *)0, |
| 1141 | &boundsRect, |
| 1142 | title, |
| 1143 | visible, |
| 1144 | theProc, |
| 1145 | behind, |
| 1146 | goAwayFlag, |
| 1147 | refCon); |
| 1148 | _res = Py_BuildValue("O&", |
| 1149 | WinObj_New, _rv); |
| 1150 | return _res; |
| 1151 | } |
| 1152 | |
| 1153 | static PyObject *Win_GetNewWindow(_self, _args) |
| 1154 | PyObject *_self; |
| 1155 | PyObject *_args; |
| 1156 | { |
| 1157 | PyObject *_res = NULL; |
| 1158 | WindowPtr _rv; |
| 1159 | short windowID; |
| 1160 | WindowPtr behind; |
| 1161 | if (!PyArg_ParseTuple(_args, "hO&", |
| 1162 | &windowID, |
| 1163 | WinObj_Convert, &behind)) |
| 1164 | return NULL; |
| 1165 | _rv = GetNewWindow(windowID, |
| 1166 | (void *)0, |
| 1167 | behind); |
| 1168 | _res = Py_BuildValue("O&", |
| 1169 | WinObj_New, _rv); |
| 1170 | return _res; |
| 1171 | } |
| 1172 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1173 | static PyObject *Win_NewCWindow(_self, _args) |
| 1174 | PyObject *_self; |
| 1175 | PyObject *_args; |
| 1176 | { |
| 1177 | PyObject *_res = NULL; |
| 1178 | WindowPtr _rv; |
| 1179 | Rect boundsRect; |
| 1180 | Str255 title; |
| 1181 | Boolean visible; |
| 1182 | short procID; |
| 1183 | WindowPtr behind; |
| 1184 | Boolean goAwayFlag; |
| 1185 | long refCon; |
| 1186 | if (!PyArg_ParseTuple(_args, "O&O&bhO&bl", |
| 1187 | PyMac_GetRect, &boundsRect, |
| 1188 | PyMac_GetStr255, title, |
| 1189 | &visible, |
| 1190 | &procID, |
| 1191 | WinObj_Convert, &behind, |
| 1192 | &goAwayFlag, |
| 1193 | &refCon)) |
| 1194 | return NULL; |
| 1195 | _rv = NewCWindow((void *)0, |
| 1196 | &boundsRect, |
| 1197 | title, |
| 1198 | visible, |
| 1199 | procID, |
| 1200 | behind, |
| 1201 | goAwayFlag, |
| 1202 | refCon); |
| 1203 | _res = Py_BuildValue("O&", |
| 1204 | WinObj_New, _rv); |
| 1205 | return _res; |
| 1206 | } |
| 1207 | |
| 1208 | static PyObject *Win_SetDeskCPat(_self, _args) |
| 1209 | PyObject *_self; |
| 1210 | PyObject *_args; |
| 1211 | { |
| 1212 | PyObject *_res = NULL; |
| 1213 | PixPatHandle deskPixPat; |
| 1214 | if (!PyArg_ParseTuple(_args, "O&", |
| 1215 | ResObj_Convert, &deskPixPat)) |
| 1216 | return NULL; |
| 1217 | SetDeskCPat(deskPixPat); |
| 1218 | Py_INCREF(Py_None); |
| 1219 | _res = Py_None; |
| 1220 | return _res; |
| 1221 | } |
| 1222 | |
| 1223 | static PyObject *Win_CheckUpdate(_self, _args) |
| 1224 | PyObject *_self; |
| 1225 | PyObject *_args; |
| 1226 | { |
| 1227 | PyObject *_res = NULL; |
| 1228 | Boolean _rv; |
| 1229 | EventRecord theEvent; |
| 1230 | if (!PyArg_ParseTuple(_args, "")) |
| 1231 | return NULL; |
| 1232 | _rv = CheckUpdate(&theEvent); |
| 1233 | _res = Py_BuildValue("bO&", |
| 1234 | _rv, |
| 1235 | PyMac_BuildEventRecord, &theEvent); |
| 1236 | return _res; |
| 1237 | } |
| 1238 | |
| 1239 | static PyObject *Win_FindWindow(_self, _args) |
| 1240 | PyObject *_self; |
| 1241 | PyObject *_args; |
| 1242 | { |
| 1243 | PyObject *_res = NULL; |
| 1244 | short _rv; |
| 1245 | Point thePoint; |
| 1246 | WindowPtr theWindow; |
| 1247 | if (!PyArg_ParseTuple(_args, "O&", |
| 1248 | PyMac_GetPoint, &thePoint)) |
| 1249 | return NULL; |
| 1250 | _rv = FindWindow(thePoint, |
| 1251 | &theWindow); |
| 1252 | _res = Py_BuildValue("hO&", |
| 1253 | _rv, |
| 1254 | WinObj_WhichWindow, theWindow); |
| 1255 | return _res; |
| 1256 | } |
| 1257 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1258 | static PyObject *Win_FrontWindow(_self, _args) |
| 1259 | PyObject *_self; |
| 1260 | PyObject *_args; |
| 1261 | { |
| 1262 | PyObject *_res = NULL; |
| 1263 | WindowPtr _rv; |
| 1264 | if (!PyArg_ParseTuple(_args, "")) |
| 1265 | return NULL; |
| 1266 | _rv = FrontWindow(); |
| 1267 | _res = Py_BuildValue("O&", |
Guido van Rossum | ea39abd | 1995-02-28 09:49:02 +0000 | [diff] [blame] | 1268 | WinObj_WhichWindow, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1269 | return _res; |
| 1270 | } |
| 1271 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1272 | static PyObject *Win_InitWindows(_self, _args) |
| 1273 | PyObject *_self; |
| 1274 | PyObject *_args; |
| 1275 | { |
| 1276 | PyObject *_res = NULL; |
| 1277 | if (!PyArg_ParseTuple(_args, "")) |
| 1278 | return NULL; |
| 1279 | InitWindows(); |
| 1280 | Py_INCREF(Py_None); |
| 1281 | _res = Py_None; |
| 1282 | return _res; |
| 1283 | } |
| 1284 | |
| 1285 | static PyObject *Win_GetWMgrPort(_self, _args) |
| 1286 | PyObject *_self; |
| 1287 | PyObject *_args; |
| 1288 | { |
| 1289 | PyObject *_res = NULL; |
| 1290 | GrafPtr wPort; |
| 1291 | if (!PyArg_ParseTuple(_args, "")) |
| 1292 | return NULL; |
| 1293 | GetWMgrPort(&wPort); |
| 1294 | _res = Py_BuildValue("O&", |
| 1295 | GrafObj_New, wPort); |
| 1296 | return _res; |
| 1297 | } |
| 1298 | |
| 1299 | static PyObject *Win_GetCWMgrPort(_self, _args) |
| 1300 | PyObject *_self; |
| 1301 | PyObject *_args; |
| 1302 | { |
| 1303 | PyObject *_res = NULL; |
| 1304 | CGrafPtr wMgrCPort; |
| 1305 | if (!PyArg_ParseTuple(_args, "")) |
| 1306 | return NULL; |
| 1307 | GetCWMgrPort(&wMgrCPort); |
| 1308 | _res = Py_BuildValue("O&", |
| 1309 | GrafObj_New, wMgrCPort); |
| 1310 | return _res; |
| 1311 | } |
| 1312 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1313 | static PyObject *Win_InvalRect(_self, _args) |
| 1314 | PyObject *_self; |
| 1315 | PyObject *_args; |
| 1316 | { |
| 1317 | PyObject *_res = NULL; |
| 1318 | Rect badRect; |
| 1319 | if (!PyArg_ParseTuple(_args, "O&", |
| 1320 | PyMac_GetRect, &badRect)) |
| 1321 | return NULL; |
| 1322 | InvalRect(&badRect); |
| 1323 | Py_INCREF(Py_None); |
| 1324 | _res = Py_None; |
| 1325 | return _res; |
| 1326 | } |
| 1327 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1328 | static PyObject *Win_InvalRgn(_self, _args) |
| 1329 | PyObject *_self; |
| 1330 | PyObject *_args; |
| 1331 | { |
| 1332 | PyObject *_res = NULL; |
| 1333 | RgnHandle badRgn; |
| 1334 | if (!PyArg_ParseTuple(_args, "O&", |
| 1335 | ResObj_Convert, &badRgn)) |
| 1336 | return NULL; |
| 1337 | InvalRgn(badRgn); |
| 1338 | Py_INCREF(Py_None); |
| 1339 | _res = Py_None; |
| 1340 | return _res; |
| 1341 | } |
| 1342 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1343 | static PyObject *Win_ValidRect(_self, _args) |
| 1344 | PyObject *_self; |
| 1345 | PyObject *_args; |
| 1346 | { |
| 1347 | PyObject *_res = NULL; |
| 1348 | Rect goodRect; |
| 1349 | if (!PyArg_ParseTuple(_args, "O&", |
| 1350 | PyMac_GetRect, &goodRect)) |
| 1351 | return NULL; |
| 1352 | ValidRect(&goodRect); |
| 1353 | Py_INCREF(Py_None); |
| 1354 | _res = Py_None; |
| 1355 | return _res; |
| 1356 | } |
| 1357 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1358 | static PyObject *Win_ValidRgn(_self, _args) |
| 1359 | PyObject *_self; |
| 1360 | PyObject *_args; |
| 1361 | { |
| 1362 | PyObject *_res = NULL; |
| 1363 | RgnHandle goodRgn; |
| 1364 | if (!PyArg_ParseTuple(_args, "O&", |
| 1365 | ResObj_Convert, &goodRgn)) |
| 1366 | return NULL; |
| 1367 | ValidRgn(goodRgn); |
| 1368 | Py_INCREF(Py_None); |
| 1369 | _res = Py_None; |
| 1370 | return _res; |
| 1371 | } |
| 1372 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1373 | static PyObject *Win_CollapseAllWindows(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1374 | PyObject *_self; |
| 1375 | PyObject *_args; |
| 1376 | { |
| 1377 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1378 | OSStatus _rv; |
| 1379 | Boolean inCollapseEm; |
| 1380 | if (!PyArg_ParseTuple(_args, "b", |
| 1381 | &inCollapseEm)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1382 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1383 | _rv = CollapseAllWindows(inCollapseEm); |
| 1384 | _res = Py_BuildValue("l", |
| 1385 | _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1386 | return _res; |
| 1387 | } |
| 1388 | |
| 1389 | static PyObject *Win_PinRect(_self, _args) |
| 1390 | PyObject *_self; |
| 1391 | PyObject *_args; |
| 1392 | { |
| 1393 | PyObject *_res = NULL; |
| 1394 | long _rv; |
| 1395 | Rect theRect; |
| 1396 | Point thePt; |
| 1397 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1398 | PyMac_GetRect, &theRect, |
| 1399 | PyMac_GetPoint, &thePt)) |
| 1400 | return NULL; |
| 1401 | _rv = PinRect(&theRect, |
| 1402 | thePt); |
| 1403 | _res = Py_BuildValue("l", |
| 1404 | _rv); |
| 1405 | return _res; |
| 1406 | } |
| 1407 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1408 | static PyObject *Win_GetGrayRgn(_self, _args) |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1409 | PyObject *_self; |
| 1410 | PyObject *_args; |
| 1411 | { |
| 1412 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1413 | RgnHandle _rv; |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1414 | if (!PyArg_ParseTuple(_args, "")) |
| 1415 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1416 | _rv = GetGrayRgn(); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1417 | _res = Py_BuildValue("O&", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1418 | ResObj_New, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1419 | return _res; |
| 1420 | } |
| 1421 | |
Jack Jansen | d4c2646 | 1995-08-17 14:35:56 +0000 | [diff] [blame] | 1422 | static PyObject *Win_WhichWindow(_self, _args) |
| 1423 | PyObject *_self; |
| 1424 | PyObject *_args; |
| 1425 | { |
| 1426 | PyObject *_res = NULL; |
| 1427 | |
| 1428 | long ptr; |
| 1429 | |
| 1430 | if ( !PyArg_ParseTuple(_args, "i", &ptr) ) |
| 1431 | return NULL; |
| 1432 | return WinObj_WhichWindow((WindowPtr)ptr); |
| 1433 | |
| 1434 | } |
| 1435 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1436 | static PyMethodDef Win_methods[] = { |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1437 | {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1, |
| 1438 | "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1439 | {"NewWindow", (PyCFunction)Win_NewWindow, 1, |
| 1440 | "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, |
| 1441 | {"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1, |
| 1442 | "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1443 | {"NewCWindow", (PyCFunction)Win_NewCWindow, 1, |
| 1444 | "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, |
| 1445 | {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, |
| 1446 | "(PixPatHandle deskPixPat) -> None"}, |
| 1447 | {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, |
| 1448 | "() -> (Boolean _rv, EventRecord theEvent)"}, |
| 1449 | {"FindWindow", (PyCFunction)Win_FindWindow, 1, |
| 1450 | "(Point thePoint) -> (short _rv, WindowPtr theWindow)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1451 | {"FrontWindow", (PyCFunction)Win_FrontWindow, 1, |
| 1452 | "() -> (WindowPtr _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1453 | {"InitWindows", (PyCFunction)Win_InitWindows, 1, |
| 1454 | "() -> None"}, |
| 1455 | {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1, |
| 1456 | "() -> (GrafPtr wPort)"}, |
| 1457 | {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1, |
| 1458 | "() -> (CGrafPtr wMgrCPort)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1459 | {"InvalRect", (PyCFunction)Win_InvalRect, 1, |
| 1460 | "(Rect badRect) -> None"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1461 | {"InvalRgn", (PyCFunction)Win_InvalRgn, 1, |
| 1462 | "(RgnHandle badRgn) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1463 | {"ValidRect", (PyCFunction)Win_ValidRect, 1, |
| 1464 | "(Rect goodRect) -> None"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1465 | {"ValidRgn", (PyCFunction)Win_ValidRgn, 1, |
| 1466 | "(RgnHandle goodRgn) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1467 | {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, |
| 1468 | "(Boolean inCollapseEm) -> (OSStatus _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1469 | {"PinRect", (PyCFunction)Win_PinRect, 1, |
| 1470 | "(Rect theRect, Point thePt) -> (long _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1471 | {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, |
| 1472 | "() -> (RgnHandle _rv)"}, |
Jack Jansen | d4c2646 | 1995-08-17 14:35:56 +0000 | [diff] [blame] | 1473 | {"WhichWindow", (PyCFunction)Win_WhichWindow, 1, |
| 1474 | "Resolve an integer WindowPtr address to a Window object"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1475 | {NULL, NULL, 0} |
| 1476 | }; |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | /* Return the object corresponding to the window, or NULL */ |
| 1481 | |
| 1482 | PyObject * |
| 1483 | WinObj_WhichWindow(w) |
| 1484 | WindowPtr w; |
| 1485 | { |
| 1486 | PyObject *it; |
| 1487 | |
| 1488 | /* XXX What if we find a stdwin window or a window belonging |
| 1489 | to some other package? */ |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 1490 | if (w == NULL) |
| 1491 | it = NULL; |
| 1492 | else |
| 1493 | it = (PyObject *) GetWRefCon(w); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1494 | if (it == NULL || ((WindowObject *)it)->ob_itself != w) |
| 1495 | it = Py_None; |
| 1496 | Py_INCREF(it); |
| 1497 | return it; |
| 1498 | } |
| 1499 | |
| 1500 | |
| 1501 | void initWin() |
| 1502 | { |
| 1503 | PyObject *m; |
| 1504 | PyObject *d; |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
| 1509 | m = Py_InitModule("Win", Win_methods); |
| 1510 | d = PyModule_GetDict(m); |
| 1511 | Win_Error = PyMac_GetOSErrException(); |
| 1512 | if (Win_Error == NULL || |
| 1513 | PyDict_SetItemString(d, "Error", Win_Error) != 0) |
| 1514 | Py_FatalError("can't initialize Win.Error"); |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 1515 | Window_Type.ob_type = &PyType_Type; |
| 1516 | Py_INCREF(&Window_Type); |
| 1517 | if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0) |
| 1518 | Py_FatalError("can't initialize WindowType"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1519 | } |
| 1520 | |
| 1521 | /* ========================= End module Win ========================= */ |
| 1522 | |