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 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 8 | #include "macglue.h" |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 9 | #include "pymactoolbox.h" |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 10 | |
| 11 | #include <Windows.h> |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 12 | |
| 13 | #if !ACCESSOR_CALLS_ARE_FUNCTIONS |
| 14 | #define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag) |
| 15 | #define GetWindowFromPort(port) ((WindowRef)(port)) |
| 16 | #define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect) |
| 17 | #endif |
| 18 | |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 19 | /* Function to dispose a window, with a "normal" calling sequence */ |
| 20 | static void |
| 21 | PyMac_AutoDisposeWindow(WindowPtr w) |
| 22 | { |
| 23 | DisposeWindow(w); |
| 24 | } |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 25 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 26 | static PyObject *Win_Error; |
| 27 | |
| 28 | /* ----------------------- Object type Window ----------------------- */ |
| 29 | |
| 30 | PyTypeObject Window_Type; |
| 31 | |
| 32 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
| 33 | |
| 34 | typedef struct WindowObject { |
| 35 | PyObject_HEAD |
| 36 | WindowPtr ob_itself; |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 37 | void (*ob_freeit)(WindowPtr ptr); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 38 | } WindowObject; |
| 39 | |
| 40 | PyObject *WinObj_New(itself) |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 41 | WindowPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 42 | { |
| 43 | WindowObject *it; |
| 44 | if (itself == NULL) return PyMac_Error(resNotFound); |
| 45 | it = PyObject_NEW(WindowObject, &Window_Type); |
| 46 | if (it == NULL) return NULL; |
| 47 | it->ob_itself = itself; |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 48 | it->ob_freeit = NULL; |
| 49 | if (GetWRefCon(itself) == 0) |
| 50 | { |
| 51 | SetWRefCon(itself, (long)it); |
| 52 | it->ob_freeit = PyMac_AutoDisposeWindow; |
| 53 | } |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 54 | return (PyObject *)it; |
| 55 | } |
| 56 | WinObj_Convert(v, p_itself) |
| 57 | PyObject *v; |
| 58 | WindowPtr *p_itself; |
| 59 | { |
| 60 | if (DlgObj_Check(v)) { |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 61 | *p_itself = DlgObj_ConvertToWindow(v); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 62 | return 1; |
| 63 | } |
| 64 | |
| 65 | if (v == Py_None) { *p_itself = NULL; return 1; } |
| 66 | if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } |
| 67 | |
| 68 | if (!WinObj_Check(v)) |
| 69 | { |
| 70 | PyErr_SetString(PyExc_TypeError, "Window required"); |
| 71 | return 0; |
| 72 | } |
| 73 | *p_itself = ((WindowObject *)v)->ob_itself; |
| 74 | return 1; |
| 75 | } |
| 76 | |
| 77 | static void WinObj_dealloc(self) |
| 78 | WindowObject *self; |
| 79 | { |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 80 | if (self->ob_freeit && self->ob_itself) |
| 81 | { |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 82 | SetWRefCon(self->ob_itself, 0); |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 83 | self->ob_freeit(self->ob_itself); |
| 84 | } |
| 85 | self->ob_itself = NULL; |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 86 | self->ob_freeit = NULL; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 87 | PyMem_DEL(self); |
| 88 | } |
| 89 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 90 | static PyObject *WinObj_GetWindowOwnerCount(_self, _args) |
| 91 | WindowObject *_self; |
| 92 | PyObject *_args; |
| 93 | { |
| 94 | PyObject *_res = NULL; |
| 95 | OSStatus _err; |
| 96 | UInt32 outCount; |
| 97 | if (!PyArg_ParseTuple(_args, "")) |
| 98 | return NULL; |
| 99 | _err = GetWindowOwnerCount(_self->ob_itself, |
| 100 | &outCount); |
| 101 | if (_err != noErr) return PyMac_Error(_err); |
| 102 | _res = Py_BuildValue("l", |
| 103 | outCount); |
| 104 | return _res; |
| 105 | } |
| 106 | |
| 107 | static PyObject *WinObj_CloneWindow(_self, _args) |
| 108 | WindowObject *_self; |
| 109 | PyObject *_args; |
| 110 | { |
| 111 | PyObject *_res = NULL; |
| 112 | OSStatus _err; |
| 113 | if (!PyArg_ParseTuple(_args, "")) |
| 114 | return NULL; |
| 115 | _err = CloneWindow(_self->ob_itself); |
| 116 | if (_err != noErr) return PyMac_Error(_err); |
| 117 | Py_INCREF(Py_None); |
| 118 | _res = Py_None; |
| 119 | return _res; |
| 120 | } |
| 121 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 122 | #if TARGET_API_MAC_CARBON |
| 123 | |
| 124 | static PyObject *WinObj_ReshapeCustomWindow(_self, _args) |
| 125 | WindowObject *_self; |
| 126 | PyObject *_args; |
| 127 | { |
| 128 | PyObject *_res = NULL; |
| 129 | OSStatus _err; |
| 130 | if (!PyArg_ParseTuple(_args, "")) |
| 131 | return NULL; |
| 132 | _err = ReshapeCustomWindow(_self->ob_itself); |
| 133 | if (_err != noErr) return PyMac_Error(_err); |
| 134 | Py_INCREF(Py_None); |
| 135 | _res = Py_None; |
| 136 | return _res; |
| 137 | } |
| 138 | #endif |
| 139 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 140 | static PyObject *WinObj_GetWindowClass(_self, _args) |
| 141 | WindowObject *_self; |
| 142 | PyObject *_args; |
| 143 | { |
| 144 | PyObject *_res = NULL; |
| 145 | OSStatus _err; |
| 146 | WindowClass outClass; |
| 147 | if (!PyArg_ParseTuple(_args, "")) |
| 148 | return NULL; |
| 149 | _err = GetWindowClass(_self->ob_itself, |
| 150 | &outClass); |
| 151 | if (_err != noErr) return PyMac_Error(_err); |
| 152 | _res = Py_BuildValue("l", |
| 153 | outClass); |
| 154 | return _res; |
| 155 | } |
| 156 | |
| 157 | static PyObject *WinObj_GetWindowAttributes(_self, _args) |
| 158 | WindowObject *_self; |
| 159 | PyObject *_args; |
| 160 | { |
| 161 | PyObject *_res = NULL; |
| 162 | OSStatus _err; |
| 163 | WindowAttributes outAttributes; |
| 164 | if (!PyArg_ParseTuple(_args, "")) |
| 165 | return NULL; |
| 166 | _err = GetWindowAttributes(_self->ob_itself, |
| 167 | &outAttributes); |
| 168 | if (_err != noErr) return PyMac_Error(_err); |
| 169 | _res = Py_BuildValue("l", |
| 170 | outAttributes); |
| 171 | return _res; |
| 172 | } |
| 173 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 174 | #if TARGET_API_MAC_CARBON |
| 175 | |
| 176 | static PyObject *WinObj_ChangeWindowAttributes(_self, _args) |
| 177 | WindowObject *_self; |
| 178 | PyObject *_args; |
| 179 | { |
| 180 | PyObject *_res = NULL; |
| 181 | OSStatus _err; |
| 182 | WindowAttributes setTheseAttributes; |
| 183 | WindowAttributes clearTheseAttributes; |
| 184 | if (!PyArg_ParseTuple(_args, "ll", |
| 185 | &setTheseAttributes, |
| 186 | &clearTheseAttributes)) |
| 187 | return NULL; |
| 188 | _err = ChangeWindowAttributes(_self->ob_itself, |
| 189 | setTheseAttributes, |
| 190 | clearTheseAttributes); |
| 191 | if (_err != noErr) return PyMac_Error(_err); |
| 192 | Py_INCREF(Py_None); |
| 193 | _res = Py_None; |
| 194 | return _res; |
| 195 | } |
| 196 | #endif |
| 197 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 198 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 199 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 200 | static PyObject *WinObj_SetWinColor(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 201 | WindowObject *_self; |
| 202 | PyObject *_args; |
| 203 | { |
| 204 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 205 | WCTabHandle newColorTable; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 206 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 207 | ResObj_Convert, &newColorTable)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 208 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 209 | SetWinColor(_self->ob_itself, |
| 210 | newColorTable); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 211 | Py_INCREF(Py_None); |
| 212 | _res = Py_None; |
| 213 | return _res; |
| 214 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 215 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 216 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 217 | static PyObject *WinObj_SetWindowContentColor(_self, _args) |
| 218 | WindowObject *_self; |
| 219 | PyObject *_args; |
| 220 | { |
| 221 | PyObject *_res = NULL; |
| 222 | OSStatus _err; |
| 223 | RGBColor color; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 224 | if (!PyArg_ParseTuple(_args, "O&", |
| 225 | QdRGB_Convert, &color)) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 226 | return NULL; |
| 227 | _err = SetWindowContentColor(_self->ob_itself, |
| 228 | &color); |
| 229 | if (_err != noErr) return PyMac_Error(_err); |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 230 | Py_INCREF(Py_None); |
| 231 | _res = Py_None; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 232 | return _res; |
| 233 | } |
| 234 | |
| 235 | static PyObject *WinObj_GetWindowContentColor(_self, _args) |
| 236 | WindowObject *_self; |
| 237 | PyObject *_args; |
| 238 | { |
| 239 | PyObject *_res = NULL; |
| 240 | OSStatus _err; |
| 241 | RGBColor color; |
| 242 | if (!PyArg_ParseTuple(_args, "")) |
| 243 | return NULL; |
| 244 | _err = GetWindowContentColor(_self->ob_itself, |
| 245 | &color); |
| 246 | if (_err != noErr) return PyMac_Error(_err); |
| 247 | _res = Py_BuildValue("O&", |
| 248 | QdRGB_New, &color); |
| 249 | return _res; |
| 250 | } |
| 251 | |
| 252 | static PyObject *WinObj_GetWindowContentPattern(_self, _args) |
| 253 | WindowObject *_self; |
| 254 | PyObject *_args; |
| 255 | { |
| 256 | PyObject *_res = NULL; |
| 257 | OSStatus _err; |
| 258 | PixPatHandle outPixPat; |
| 259 | if (!PyArg_ParseTuple(_args, "O&", |
| 260 | ResObj_Convert, &outPixPat)) |
| 261 | return NULL; |
| 262 | _err = GetWindowContentPattern(_self->ob_itself, |
| 263 | outPixPat); |
| 264 | if (_err != noErr) return PyMac_Error(_err); |
| 265 | Py_INCREF(Py_None); |
| 266 | _res = Py_None; |
| 267 | return _res; |
| 268 | } |
| 269 | |
| 270 | static PyObject *WinObj_SetWindowContentPattern(_self, _args) |
| 271 | WindowObject *_self; |
| 272 | PyObject *_args; |
| 273 | { |
| 274 | PyObject *_res = NULL; |
| 275 | OSStatus _err; |
| 276 | PixPatHandle pixPat; |
| 277 | if (!PyArg_ParseTuple(_args, "O&", |
| 278 | ResObj_Convert, &pixPat)) |
| 279 | return NULL; |
| 280 | _err = SetWindowContentPattern(_self->ob_itself, |
| 281 | pixPat); |
| 282 | if (_err != noErr) return PyMac_Error(_err); |
| 283 | Py_INCREF(Py_None); |
| 284 | _res = Py_None; |
| 285 | return _res; |
| 286 | } |
| 287 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 288 | #if TARGET_API_MAC_CARBON |
| 289 | |
| 290 | static PyObject *WinObj_ScrollWindowRect(_self, _args) |
| 291 | WindowObject *_self; |
| 292 | PyObject *_args; |
| 293 | { |
| 294 | PyObject *_res = NULL; |
| 295 | OSStatus _err; |
| 296 | Rect inScrollRect; |
| 297 | SInt16 inHPixels; |
| 298 | SInt16 inVPixels; |
| 299 | ScrollWindowOptions inOptions; |
| 300 | RgnHandle outExposedRgn; |
| 301 | if (!PyArg_ParseTuple(_args, "O&hhlO&", |
| 302 | PyMac_GetRect, &inScrollRect, |
| 303 | &inHPixels, |
| 304 | &inVPixels, |
| 305 | &inOptions, |
| 306 | ResObj_Convert, &outExposedRgn)) |
| 307 | return NULL; |
| 308 | _err = ScrollWindowRect(_self->ob_itself, |
| 309 | &inScrollRect, |
| 310 | inHPixels, |
| 311 | inVPixels, |
| 312 | inOptions, |
| 313 | outExposedRgn); |
| 314 | if (_err != noErr) return PyMac_Error(_err); |
| 315 | Py_INCREF(Py_None); |
| 316 | _res = Py_None; |
| 317 | return _res; |
| 318 | } |
| 319 | #endif |
| 320 | |
| 321 | #if TARGET_API_MAC_CARBON |
| 322 | |
| 323 | static PyObject *WinObj_ScrollWindowRegion(_self, _args) |
| 324 | WindowObject *_self; |
| 325 | PyObject *_args; |
| 326 | { |
| 327 | PyObject *_res = NULL; |
| 328 | OSStatus _err; |
| 329 | RgnHandle inScrollRgn; |
| 330 | SInt16 inHPixels; |
| 331 | SInt16 inVPixels; |
| 332 | ScrollWindowOptions inOptions; |
| 333 | RgnHandle outExposedRgn; |
| 334 | if (!PyArg_ParseTuple(_args, "O&hhlO&", |
| 335 | ResObj_Convert, &inScrollRgn, |
| 336 | &inHPixels, |
| 337 | &inVPixels, |
| 338 | &inOptions, |
| 339 | ResObj_Convert, &outExposedRgn)) |
| 340 | return NULL; |
| 341 | _err = ScrollWindowRegion(_self->ob_itself, |
| 342 | inScrollRgn, |
| 343 | inHPixels, |
| 344 | inVPixels, |
| 345 | inOptions, |
| 346 | outExposedRgn); |
| 347 | if (_err != noErr) return PyMac_Error(_err); |
| 348 | Py_INCREF(Py_None); |
| 349 | _res = Py_None; |
| 350 | return _res; |
| 351 | } |
| 352 | #endif |
| 353 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 354 | static PyObject *WinObj_ClipAbove(_self, _args) |
| 355 | WindowObject *_self; |
| 356 | PyObject *_args; |
| 357 | { |
| 358 | PyObject *_res = NULL; |
| 359 | if (!PyArg_ParseTuple(_args, "")) |
| 360 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 361 | ClipAbove(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 362 | Py_INCREF(Py_None); |
| 363 | _res = Py_None; |
| 364 | return _res; |
| 365 | } |
| 366 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 367 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 368 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 369 | static PyObject *WinObj_SaveOld(_self, _args) |
| 370 | WindowObject *_self; |
| 371 | PyObject *_args; |
| 372 | { |
| 373 | PyObject *_res = NULL; |
| 374 | if (!PyArg_ParseTuple(_args, "")) |
| 375 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 376 | SaveOld(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 377 | Py_INCREF(Py_None); |
| 378 | _res = Py_None; |
| 379 | return _res; |
| 380 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 381 | #endif |
| 382 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 383 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 384 | |
| 385 | static PyObject *WinObj_DrawNew(_self, _args) |
| 386 | WindowObject *_self; |
| 387 | PyObject *_args; |
| 388 | { |
| 389 | PyObject *_res = NULL; |
| 390 | Boolean update; |
| 391 | if (!PyArg_ParseTuple(_args, "b", |
| 392 | &update)) |
| 393 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 394 | DrawNew(_self->ob_itself, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 395 | update); |
| 396 | Py_INCREF(Py_None); |
| 397 | _res = Py_None; |
| 398 | return _res; |
| 399 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 400 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 401 | |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 402 | static PyObject *WinObj_PaintOne(_self, _args) |
| 403 | WindowObject *_self; |
| 404 | PyObject *_args; |
| 405 | { |
| 406 | PyObject *_res = NULL; |
| 407 | RgnHandle clobberedRgn; |
| 408 | if (!PyArg_ParseTuple(_args, "O&", |
| 409 | ResObj_Convert, &clobberedRgn)) |
| 410 | return NULL; |
| 411 | PaintOne(_self->ob_itself, |
| 412 | clobberedRgn); |
| 413 | Py_INCREF(Py_None); |
| 414 | _res = Py_None; |
| 415 | return _res; |
| 416 | } |
| 417 | |
| 418 | static PyObject *WinObj_PaintBehind(_self, _args) |
| 419 | WindowObject *_self; |
| 420 | PyObject *_args; |
| 421 | { |
| 422 | PyObject *_res = NULL; |
| 423 | RgnHandle clobberedRgn; |
| 424 | if (!PyArg_ParseTuple(_args, "O&", |
| 425 | ResObj_Convert, &clobberedRgn)) |
| 426 | return NULL; |
| 427 | PaintBehind(_self->ob_itself, |
| 428 | clobberedRgn); |
| 429 | Py_INCREF(Py_None); |
| 430 | _res = Py_None; |
| 431 | return _res; |
| 432 | } |
| 433 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 434 | static PyObject *WinObj_CalcVis(_self, _args) |
| 435 | WindowObject *_self; |
| 436 | PyObject *_args; |
| 437 | { |
| 438 | PyObject *_res = NULL; |
| 439 | if (!PyArg_ParseTuple(_args, "")) |
| 440 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 441 | CalcVis(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 442 | Py_INCREF(Py_None); |
| 443 | _res = Py_None; |
| 444 | return _res; |
| 445 | } |
| 446 | |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 447 | static PyObject *WinObj_CalcVisBehind(_self, _args) |
| 448 | WindowObject *_self; |
| 449 | PyObject *_args; |
| 450 | { |
| 451 | PyObject *_res = NULL; |
| 452 | RgnHandle clobberedRgn; |
| 453 | if (!PyArg_ParseTuple(_args, "O&", |
| 454 | ResObj_Convert, &clobberedRgn)) |
| 455 | return NULL; |
| 456 | CalcVisBehind(_self->ob_itself, |
| 457 | clobberedRgn); |
| 458 | Py_INCREF(Py_None); |
| 459 | _res = Py_None; |
| 460 | return _res; |
| 461 | } |
| 462 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 463 | static PyObject *WinObj_BringToFront(_self, _args) |
| 464 | WindowObject *_self; |
| 465 | PyObject *_args; |
| 466 | { |
| 467 | PyObject *_res = NULL; |
| 468 | if (!PyArg_ParseTuple(_args, "")) |
| 469 | return NULL; |
| 470 | BringToFront(_self->ob_itself); |
| 471 | Py_INCREF(Py_None); |
| 472 | _res = Py_None; |
| 473 | return _res; |
| 474 | } |
| 475 | |
| 476 | static PyObject *WinObj_SendBehind(_self, _args) |
| 477 | WindowObject *_self; |
| 478 | PyObject *_args; |
| 479 | { |
| 480 | PyObject *_res = NULL; |
| 481 | WindowPtr behindWindow; |
| 482 | if (!PyArg_ParseTuple(_args, "O&", |
| 483 | WinObj_Convert, &behindWindow)) |
| 484 | return NULL; |
| 485 | SendBehind(_self->ob_itself, |
| 486 | behindWindow); |
| 487 | Py_INCREF(Py_None); |
| 488 | _res = Py_None; |
| 489 | return _res; |
| 490 | } |
| 491 | |
| 492 | static PyObject *WinObj_SelectWindow(_self, _args) |
| 493 | WindowObject *_self; |
| 494 | PyObject *_args; |
| 495 | { |
| 496 | PyObject *_res = NULL; |
| 497 | if (!PyArg_ParseTuple(_args, "")) |
| 498 | return NULL; |
| 499 | SelectWindow(_self->ob_itself); |
| 500 | Py_INCREF(Py_None); |
| 501 | _res = Py_None; |
| 502 | return _res; |
| 503 | } |
| 504 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 505 | #if TARGET_API_MAC_CARBON |
| 506 | |
| 507 | static PyObject *WinObj_GetNextWindowOfClass(_self, _args) |
| 508 | WindowObject *_self; |
| 509 | PyObject *_args; |
| 510 | { |
| 511 | PyObject *_res = NULL; |
| 512 | WindowPtr _rv; |
| 513 | WindowClass inWindowClass; |
| 514 | Boolean mustBeVisible; |
| 515 | if (!PyArg_ParseTuple(_args, "lb", |
| 516 | &inWindowClass, |
| 517 | &mustBeVisible)) |
| 518 | return NULL; |
| 519 | _rv = GetNextWindowOfClass(_self->ob_itself, |
| 520 | inWindowClass, |
| 521 | mustBeVisible); |
| 522 | _res = Py_BuildValue("O&", |
| 523 | WinObj_New, _rv); |
| 524 | return _res; |
| 525 | } |
| 526 | #endif |
| 527 | |
| 528 | #if !TARGET_API_MAC_CARBON |
| 529 | |
| 530 | static PyObject *WinObj_IsValidWindowPtr(_self, _args) |
| 531 | WindowObject *_self; |
| 532 | PyObject *_args; |
| 533 | { |
| 534 | PyObject *_res = NULL; |
| 535 | Boolean _rv; |
| 536 | if (!PyArg_ParseTuple(_args, "")) |
| 537 | return NULL; |
| 538 | _rv = IsValidWindowPtr(_self->ob_itself); |
| 539 | _res = Py_BuildValue("b", |
| 540 | _rv); |
| 541 | return _res; |
| 542 | } |
| 543 | #endif |
| 544 | |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 545 | static PyObject *WinObj_HiliteWindow(_self, _args) |
| 546 | WindowObject *_self; |
| 547 | PyObject *_args; |
| 548 | { |
| 549 | PyObject *_res = NULL; |
| 550 | Boolean fHilite; |
| 551 | if (!PyArg_ParseTuple(_args, "b", |
| 552 | &fHilite)) |
| 553 | return NULL; |
| 554 | HiliteWindow(_self->ob_itself, |
| 555 | fHilite); |
| 556 | Py_INCREF(Py_None); |
| 557 | _res = Py_None; |
| 558 | return _res; |
| 559 | } |
| 560 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 561 | static PyObject *WinObj_SetWRefCon(_self, _args) |
| 562 | WindowObject *_self; |
| 563 | PyObject *_args; |
| 564 | { |
| 565 | PyObject *_res = NULL; |
| 566 | long data; |
| 567 | if (!PyArg_ParseTuple(_args, "l", |
| 568 | &data)) |
| 569 | return NULL; |
| 570 | SetWRefCon(_self->ob_itself, |
| 571 | data); |
| 572 | Py_INCREF(Py_None); |
| 573 | _res = Py_None; |
| 574 | return _res; |
| 575 | } |
| 576 | |
| 577 | static PyObject *WinObj_GetWRefCon(_self, _args) |
| 578 | WindowObject *_self; |
| 579 | PyObject *_args; |
| 580 | { |
| 581 | PyObject *_res = NULL; |
| 582 | long _rv; |
| 583 | if (!PyArg_ParseTuple(_args, "")) |
| 584 | return NULL; |
| 585 | _rv = GetWRefCon(_self->ob_itself); |
| 586 | _res = Py_BuildValue("l", |
| 587 | _rv); |
| 588 | return _res; |
| 589 | } |
| 590 | |
| 591 | static PyObject *WinObj_SetWindowPic(_self, _args) |
| 592 | WindowObject *_self; |
| 593 | PyObject *_args; |
| 594 | { |
| 595 | PyObject *_res = NULL; |
| 596 | PicHandle pic; |
| 597 | if (!PyArg_ParseTuple(_args, "O&", |
| 598 | ResObj_Convert, &pic)) |
| 599 | return NULL; |
| 600 | SetWindowPic(_self->ob_itself, |
| 601 | pic); |
| 602 | Py_INCREF(Py_None); |
| 603 | _res = Py_None; |
| 604 | return _res; |
| 605 | } |
| 606 | |
| 607 | static PyObject *WinObj_GetWindowPic(_self, _args) |
| 608 | WindowObject *_self; |
| 609 | PyObject *_args; |
| 610 | { |
| 611 | PyObject *_res = NULL; |
| 612 | PicHandle _rv; |
| 613 | if (!PyArg_ParseTuple(_args, "")) |
| 614 | return NULL; |
| 615 | _rv = GetWindowPic(_self->ob_itself); |
| 616 | _res = Py_BuildValue("O&", |
| 617 | ResObj_New, _rv); |
| 618 | return _res; |
| 619 | } |
| 620 | |
| 621 | static PyObject *WinObj_GetWVariant(_self, _args) |
| 622 | WindowObject *_self; |
| 623 | PyObject *_args; |
| 624 | { |
| 625 | PyObject *_res = NULL; |
| 626 | short _rv; |
| 627 | if (!PyArg_ParseTuple(_args, "")) |
| 628 | return NULL; |
| 629 | _rv = GetWVariant(_self->ob_itself); |
| 630 | _res = Py_BuildValue("h", |
| 631 | _rv); |
| 632 | return _res; |
| 633 | } |
| 634 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 635 | static PyObject *WinObj_GetWindowFeatures(_self, _args) |
| 636 | WindowObject *_self; |
| 637 | PyObject *_args; |
| 638 | { |
| 639 | PyObject *_res = NULL; |
| 640 | OSStatus _err; |
| 641 | UInt32 outFeatures; |
| 642 | if (!PyArg_ParseTuple(_args, "")) |
| 643 | return NULL; |
| 644 | _err = GetWindowFeatures(_self->ob_itself, |
| 645 | &outFeatures); |
| 646 | if (_err != noErr) return PyMac_Error(_err); |
| 647 | _res = Py_BuildValue("l", |
| 648 | outFeatures); |
| 649 | return _res; |
| 650 | } |
| 651 | |
| 652 | static PyObject *WinObj_GetWindowRegion(_self, _args) |
| 653 | WindowObject *_self; |
| 654 | PyObject *_args; |
| 655 | { |
| 656 | PyObject *_res = NULL; |
| 657 | OSStatus _err; |
| 658 | WindowRegionCode inRegionCode; |
| 659 | RgnHandle ioWinRgn; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 660 | if (!PyArg_ParseTuple(_args, "HO&", |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 661 | &inRegionCode, |
| 662 | ResObj_Convert, &ioWinRgn)) |
| 663 | return NULL; |
| 664 | _err = GetWindowRegion(_self->ob_itself, |
| 665 | inRegionCode, |
| 666 | ioWinRgn); |
| 667 | if (_err != noErr) return PyMac_Error(_err); |
| 668 | Py_INCREF(Py_None); |
| 669 | _res = Py_None; |
| 670 | return _res; |
| 671 | } |
| 672 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 673 | static PyObject *WinObj_BeginUpdate(_self, _args) |
| 674 | WindowObject *_self; |
| 675 | PyObject *_args; |
| 676 | { |
| 677 | PyObject *_res = NULL; |
| 678 | if (!PyArg_ParseTuple(_args, "")) |
| 679 | return NULL; |
| 680 | BeginUpdate(_self->ob_itself); |
| 681 | Py_INCREF(Py_None); |
| 682 | _res = Py_None; |
| 683 | return _res; |
| 684 | } |
| 685 | |
| 686 | static PyObject *WinObj_EndUpdate(_self, _args) |
| 687 | WindowObject *_self; |
| 688 | PyObject *_args; |
| 689 | { |
| 690 | PyObject *_res = NULL; |
| 691 | if (!PyArg_ParseTuple(_args, "")) |
| 692 | return NULL; |
| 693 | EndUpdate(_self->ob_itself); |
| 694 | Py_INCREF(Py_None); |
| 695 | _res = Py_None; |
| 696 | return _res; |
| 697 | } |
| 698 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 699 | static PyObject *WinObj_InvalWindowRgn(_self, _args) |
| 700 | WindowObject *_self; |
| 701 | PyObject *_args; |
| 702 | { |
| 703 | PyObject *_res = NULL; |
| 704 | OSStatus _err; |
| 705 | RgnHandle region; |
| 706 | if (!PyArg_ParseTuple(_args, "O&", |
| 707 | ResObj_Convert, ®ion)) |
| 708 | return NULL; |
| 709 | _err = InvalWindowRgn(_self->ob_itself, |
| 710 | region); |
| 711 | if (_err != noErr) return PyMac_Error(_err); |
| 712 | Py_INCREF(Py_None); |
| 713 | _res = Py_None; |
| 714 | return _res; |
| 715 | } |
| 716 | |
| 717 | static PyObject *WinObj_InvalWindowRect(_self, _args) |
| 718 | WindowObject *_self; |
| 719 | PyObject *_args; |
| 720 | { |
| 721 | PyObject *_res = NULL; |
| 722 | OSStatus _err; |
| 723 | Rect bounds; |
| 724 | if (!PyArg_ParseTuple(_args, "O&", |
| 725 | PyMac_GetRect, &bounds)) |
| 726 | return NULL; |
| 727 | _err = InvalWindowRect(_self->ob_itself, |
| 728 | &bounds); |
| 729 | if (_err != noErr) return PyMac_Error(_err); |
| 730 | Py_INCREF(Py_None); |
| 731 | _res = Py_None; |
| 732 | return _res; |
| 733 | } |
| 734 | |
| 735 | static PyObject *WinObj_ValidWindowRgn(_self, _args) |
| 736 | WindowObject *_self; |
| 737 | PyObject *_args; |
| 738 | { |
| 739 | PyObject *_res = NULL; |
| 740 | OSStatus _err; |
| 741 | RgnHandle region; |
| 742 | if (!PyArg_ParseTuple(_args, "O&", |
| 743 | ResObj_Convert, ®ion)) |
| 744 | return NULL; |
| 745 | _err = ValidWindowRgn(_self->ob_itself, |
| 746 | region); |
| 747 | if (_err != noErr) return PyMac_Error(_err); |
| 748 | Py_INCREF(Py_None); |
| 749 | _res = Py_None; |
| 750 | return _res; |
| 751 | } |
| 752 | |
| 753 | static PyObject *WinObj_ValidWindowRect(_self, _args) |
| 754 | WindowObject *_self; |
| 755 | PyObject *_args; |
| 756 | { |
| 757 | PyObject *_res = NULL; |
| 758 | OSStatus _err; |
| 759 | Rect bounds; |
| 760 | if (!PyArg_ParseTuple(_args, "O&", |
| 761 | PyMac_GetRect, &bounds)) |
| 762 | return NULL; |
| 763 | _err = ValidWindowRect(_self->ob_itself, |
| 764 | &bounds); |
| 765 | if (_err != noErr) return PyMac_Error(_err); |
| 766 | Py_INCREF(Py_None); |
| 767 | _res = Py_None; |
| 768 | return _res; |
| 769 | } |
| 770 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 771 | static PyObject *WinObj_DrawGrowIcon(_self, _args) |
| 772 | WindowObject *_self; |
| 773 | PyObject *_args; |
| 774 | { |
| 775 | PyObject *_res = NULL; |
| 776 | if (!PyArg_ParseTuple(_args, "")) |
| 777 | return NULL; |
| 778 | DrawGrowIcon(_self->ob_itself); |
| 779 | Py_INCREF(Py_None); |
| 780 | _res = Py_None; |
| 781 | return _res; |
| 782 | } |
| 783 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 784 | static PyObject *WinObj_SetWTitle(_self, _args) |
| 785 | WindowObject *_self; |
| 786 | PyObject *_args; |
| 787 | { |
| 788 | PyObject *_res = NULL; |
| 789 | Str255 title; |
| 790 | if (!PyArg_ParseTuple(_args, "O&", |
| 791 | PyMac_GetStr255, title)) |
| 792 | return NULL; |
| 793 | SetWTitle(_self->ob_itself, |
| 794 | title); |
| 795 | Py_INCREF(Py_None); |
| 796 | _res = Py_None; |
| 797 | return _res; |
| 798 | } |
| 799 | |
| 800 | static PyObject *WinObj_GetWTitle(_self, _args) |
| 801 | WindowObject *_self; |
| 802 | PyObject *_args; |
| 803 | { |
| 804 | PyObject *_res = NULL; |
| 805 | Str255 title; |
| 806 | if (!PyArg_ParseTuple(_args, "")) |
| 807 | return NULL; |
| 808 | GetWTitle(_self->ob_itself, |
| 809 | title); |
| 810 | _res = Py_BuildValue("O&", |
| 811 | PyMac_BuildStr255, title); |
| 812 | return _res; |
| 813 | } |
| 814 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 815 | static PyObject *WinObj_SetWindowProxyFSSpec(_self, _args) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 816 | WindowObject *_self; |
| 817 | PyObject *_args; |
| 818 | { |
| 819 | PyObject *_res = NULL; |
Jack Jansen | e4349e8 | 1999-03-04 22:53:24 +0000 | [diff] [blame] | 820 | OSStatus _err; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 821 | FSSpec inFile; |
| 822 | if (!PyArg_ParseTuple(_args, "O&", |
| 823 | PyMac_GetFSSpec, &inFile)) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 824 | return NULL; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 825 | _err = SetWindowProxyFSSpec(_self->ob_itself, |
| 826 | &inFile); |
| 827 | if (_err != noErr) return PyMac_Error(_err); |
| 828 | Py_INCREF(Py_None); |
| 829 | _res = Py_None; |
| 830 | return _res; |
| 831 | } |
| 832 | |
| 833 | static PyObject *WinObj_GetWindowProxyFSSpec(_self, _args) |
| 834 | WindowObject *_self; |
| 835 | PyObject *_args; |
| 836 | { |
| 837 | PyObject *_res = NULL; |
| 838 | OSStatus _err; |
| 839 | FSSpec outFile; |
| 840 | if (!PyArg_ParseTuple(_args, "")) |
| 841 | return NULL; |
| 842 | _err = GetWindowProxyFSSpec(_self->ob_itself, |
| 843 | &outFile); |
| 844 | if (_err != noErr) return PyMac_Error(_err); |
| 845 | _res = Py_BuildValue("O&", |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 846 | PyMac_BuildFSSpec, outFile); |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 847 | return _res; |
| 848 | } |
| 849 | |
| 850 | static PyObject *WinObj_SetWindowProxyAlias(_self, _args) |
| 851 | WindowObject *_self; |
| 852 | PyObject *_args; |
| 853 | { |
| 854 | PyObject *_res = NULL; |
| 855 | OSStatus _err; |
| 856 | AliasHandle alias; |
| 857 | if (!PyArg_ParseTuple(_args, "O&", |
| 858 | ResObj_Convert, &alias)) |
| 859 | return NULL; |
| 860 | _err = SetWindowProxyAlias(_self->ob_itself, |
| 861 | alias); |
| 862 | if (_err != noErr) return PyMac_Error(_err); |
| 863 | Py_INCREF(Py_None); |
| 864 | _res = Py_None; |
| 865 | return _res; |
| 866 | } |
| 867 | |
| 868 | static PyObject *WinObj_GetWindowProxyAlias(_self, _args) |
| 869 | WindowObject *_self; |
| 870 | PyObject *_args; |
| 871 | { |
| 872 | PyObject *_res = NULL; |
| 873 | OSStatus _err; |
| 874 | AliasHandle alias; |
| 875 | if (!PyArg_ParseTuple(_args, "")) |
| 876 | return NULL; |
| 877 | _err = GetWindowProxyAlias(_self->ob_itself, |
| 878 | &alias); |
| 879 | if (_err != noErr) return PyMac_Error(_err); |
| 880 | _res = Py_BuildValue("O&", |
| 881 | ResObj_New, alias); |
| 882 | return _res; |
| 883 | } |
| 884 | |
| 885 | static PyObject *WinObj_SetWindowProxyCreatorAndType(_self, _args) |
| 886 | WindowObject *_self; |
| 887 | PyObject *_args; |
| 888 | { |
| 889 | PyObject *_res = NULL; |
| 890 | OSStatus _err; |
| 891 | OSType fileCreator; |
| 892 | OSType fileType; |
| 893 | SInt16 vRefNum; |
| 894 | if (!PyArg_ParseTuple(_args, "O&O&h", |
| 895 | PyMac_GetOSType, &fileCreator, |
| 896 | PyMac_GetOSType, &fileType, |
| 897 | &vRefNum)) |
| 898 | return NULL; |
| 899 | _err = SetWindowProxyCreatorAndType(_self->ob_itself, |
| 900 | fileCreator, |
| 901 | fileType, |
| 902 | vRefNum); |
| 903 | if (_err != noErr) return PyMac_Error(_err); |
| 904 | Py_INCREF(Py_None); |
| 905 | _res = Py_None; |
| 906 | return _res; |
| 907 | } |
| 908 | |
| 909 | static PyObject *WinObj_GetWindowProxyIcon(_self, _args) |
| 910 | WindowObject *_self; |
| 911 | PyObject *_args; |
| 912 | { |
| 913 | PyObject *_res = NULL; |
| 914 | OSStatus _err; |
| 915 | IconRef outIcon; |
| 916 | if (!PyArg_ParseTuple(_args, "")) |
| 917 | return NULL; |
| 918 | _err = GetWindowProxyIcon(_self->ob_itself, |
| 919 | &outIcon); |
| 920 | if (_err != noErr) return PyMac_Error(_err); |
| 921 | _res = Py_BuildValue("O&", |
| 922 | ResObj_New, outIcon); |
| 923 | return _res; |
| 924 | } |
| 925 | |
| 926 | static PyObject *WinObj_SetWindowProxyIcon(_self, _args) |
| 927 | WindowObject *_self; |
| 928 | PyObject *_args; |
| 929 | { |
| 930 | PyObject *_res = NULL; |
| 931 | OSStatus _err; |
| 932 | IconRef icon; |
| 933 | if (!PyArg_ParseTuple(_args, "O&", |
| 934 | ResObj_Convert, &icon)) |
| 935 | return NULL; |
| 936 | _err = SetWindowProxyIcon(_self->ob_itself, |
| 937 | icon); |
| 938 | if (_err != noErr) return PyMac_Error(_err); |
| 939 | Py_INCREF(Py_None); |
| 940 | _res = Py_None; |
| 941 | return _res; |
| 942 | } |
| 943 | |
| 944 | static PyObject *WinObj_RemoveWindowProxy(_self, _args) |
| 945 | WindowObject *_self; |
| 946 | PyObject *_args; |
| 947 | { |
| 948 | PyObject *_res = NULL; |
| 949 | OSStatus _err; |
| 950 | if (!PyArg_ParseTuple(_args, "")) |
| 951 | return NULL; |
| 952 | _err = RemoveWindowProxy(_self->ob_itself); |
| 953 | if (_err != noErr) return PyMac_Error(_err); |
| 954 | Py_INCREF(Py_None); |
| 955 | _res = Py_None; |
| 956 | return _res; |
| 957 | } |
| 958 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 959 | static PyObject *WinObj_BeginWindowProxyDrag(_self, _args) |
| 960 | WindowObject *_self; |
| 961 | PyObject *_args; |
| 962 | { |
| 963 | PyObject *_res = NULL; |
| 964 | OSStatus _err; |
| 965 | DragReference outNewDrag; |
| 966 | RgnHandle outDragOutlineRgn; |
| 967 | if (!PyArg_ParseTuple(_args, "O&", |
| 968 | ResObj_Convert, &outDragOutlineRgn)) |
| 969 | return NULL; |
| 970 | _err = BeginWindowProxyDrag(_self->ob_itself, |
| 971 | &outNewDrag, |
| 972 | outDragOutlineRgn); |
| 973 | if (_err != noErr) return PyMac_Error(_err); |
| 974 | _res = Py_BuildValue("O&", |
| 975 | DragObj_New, outNewDrag); |
| 976 | return _res; |
| 977 | } |
| 978 | |
| 979 | static PyObject *WinObj_EndWindowProxyDrag(_self, _args) |
| 980 | WindowObject *_self; |
| 981 | PyObject *_args; |
| 982 | { |
| 983 | PyObject *_res = NULL; |
| 984 | OSStatus _err; |
| 985 | DragReference theDrag; |
| 986 | if (!PyArg_ParseTuple(_args, "O&", |
| 987 | DragObj_Convert, &theDrag)) |
| 988 | return NULL; |
| 989 | _err = EndWindowProxyDrag(_self->ob_itself, |
| 990 | theDrag); |
| 991 | if (_err != noErr) return PyMac_Error(_err); |
| 992 | Py_INCREF(Py_None); |
| 993 | _res = Py_None; |
| 994 | return _res; |
| 995 | } |
| 996 | |
| 997 | static PyObject *WinObj_TrackWindowProxyFromExistingDrag(_self, _args) |
| 998 | WindowObject *_self; |
| 999 | PyObject *_args; |
| 1000 | { |
| 1001 | PyObject *_res = NULL; |
| 1002 | OSStatus _err; |
| 1003 | Point startPt; |
| 1004 | DragReference drag; |
| 1005 | RgnHandle inDragOutlineRgn; |
| 1006 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1007 | PyMac_GetPoint, &startPt, |
| 1008 | DragObj_Convert, &drag, |
| 1009 | ResObj_Convert, &inDragOutlineRgn)) |
| 1010 | return NULL; |
| 1011 | _err = TrackWindowProxyFromExistingDrag(_self->ob_itself, |
| 1012 | startPt, |
| 1013 | drag, |
| 1014 | inDragOutlineRgn); |
| 1015 | if (_err != noErr) return PyMac_Error(_err); |
| 1016 | Py_INCREF(Py_None); |
| 1017 | _res = Py_None; |
| 1018 | return _res; |
| 1019 | } |
| 1020 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1021 | static PyObject *WinObj_TrackWindowProxyDrag(_self, _args) |
| 1022 | WindowObject *_self; |
| 1023 | PyObject *_args; |
| 1024 | { |
| 1025 | PyObject *_res = NULL; |
| 1026 | OSStatus _err; |
| 1027 | Point startPt; |
| 1028 | if (!PyArg_ParseTuple(_args, "O&", |
| 1029 | PyMac_GetPoint, &startPt)) |
| 1030 | return NULL; |
| 1031 | _err = TrackWindowProxyDrag(_self->ob_itself, |
| 1032 | startPt); |
| 1033 | if (_err != noErr) return PyMac_Error(_err); |
| 1034 | Py_INCREF(Py_None); |
| 1035 | _res = Py_None; |
| 1036 | return _res; |
| 1037 | } |
| 1038 | |
| 1039 | static PyObject *WinObj_IsWindowModified(_self, _args) |
| 1040 | WindowObject *_self; |
| 1041 | PyObject *_args; |
| 1042 | { |
| 1043 | PyObject *_res = NULL; |
| 1044 | Boolean _rv; |
| 1045 | if (!PyArg_ParseTuple(_args, "")) |
| 1046 | return NULL; |
| 1047 | _rv = IsWindowModified(_self->ob_itself); |
| 1048 | _res = Py_BuildValue("b", |
| 1049 | _rv); |
| 1050 | return _res; |
| 1051 | } |
| 1052 | |
| 1053 | static PyObject *WinObj_SetWindowModified(_self, _args) |
| 1054 | WindowObject *_self; |
| 1055 | PyObject *_args; |
| 1056 | { |
| 1057 | PyObject *_res = NULL; |
| 1058 | OSStatus _err; |
| 1059 | Boolean modified; |
| 1060 | if (!PyArg_ParseTuple(_args, "b", |
| 1061 | &modified)) |
| 1062 | return NULL; |
| 1063 | _err = SetWindowModified(_self->ob_itself, |
| 1064 | modified); |
| 1065 | if (_err != noErr) return PyMac_Error(_err); |
| 1066 | Py_INCREF(Py_None); |
| 1067 | _res = Py_None; |
| 1068 | return _res; |
| 1069 | } |
| 1070 | |
| 1071 | static PyObject *WinObj_IsWindowPathSelectClick(_self, _args) |
| 1072 | WindowObject *_self; |
| 1073 | PyObject *_args; |
| 1074 | { |
| 1075 | PyObject *_res = NULL; |
| 1076 | Boolean _rv; |
| 1077 | EventRecord event; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1078 | if (!PyArg_ParseTuple(_args, "O&", |
| 1079 | PyMac_GetEventRecord, &event)) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1080 | return NULL; |
| 1081 | _rv = IsWindowPathSelectClick(_self->ob_itself, |
| 1082 | &event); |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1083 | _res = Py_BuildValue("b", |
| 1084 | _rv); |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1085 | return _res; |
| 1086 | } |
| 1087 | |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 1088 | static PyObject *WinObj_WindowPathSelect(_self, _args) |
| 1089 | WindowObject *_self; |
| 1090 | PyObject *_args; |
| 1091 | { |
| 1092 | PyObject *_res = NULL; |
| 1093 | OSStatus _err; |
| 1094 | MenuHandle menu; |
| 1095 | SInt32 outMenuResult; |
| 1096 | if (!PyArg_ParseTuple(_args, "O&", |
| 1097 | MenuObj_Convert, &menu)) |
| 1098 | return NULL; |
| 1099 | _err = WindowPathSelect(_self->ob_itself, |
| 1100 | menu, |
| 1101 | &outMenuResult); |
| 1102 | if (_err != noErr) return PyMac_Error(_err); |
| 1103 | _res = Py_BuildValue("l", |
| 1104 | outMenuResult); |
| 1105 | return _res; |
| 1106 | } |
| 1107 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1108 | static PyObject *WinObj_HiliteWindowFrameForDrag(_self, _args) |
| 1109 | WindowObject *_self; |
| 1110 | PyObject *_args; |
| 1111 | { |
| 1112 | PyObject *_res = NULL; |
| 1113 | OSStatus _err; |
| 1114 | Boolean hilited; |
| 1115 | if (!PyArg_ParseTuple(_args, "b", |
| 1116 | &hilited)) |
| 1117 | return NULL; |
| 1118 | _err = HiliteWindowFrameForDrag(_self->ob_itself, |
| 1119 | hilited); |
| 1120 | if (_err != noErr) return PyMac_Error(_err); |
| 1121 | Py_INCREF(Py_None); |
| 1122 | _res = Py_None; |
| 1123 | return _res; |
| 1124 | } |
| 1125 | |
| 1126 | static PyObject *WinObj_TransitionWindow(_self, _args) |
| 1127 | WindowObject *_self; |
| 1128 | PyObject *_args; |
| 1129 | { |
| 1130 | PyObject *_res = NULL; |
| 1131 | OSStatus _err; |
| 1132 | WindowTransitionEffect effect; |
| 1133 | WindowTransitionAction action; |
| 1134 | Rect rect; |
| 1135 | if (!PyArg_ParseTuple(_args, "llO&", |
| 1136 | &effect, |
| 1137 | &action, |
| 1138 | PyMac_GetRect, &rect)) |
| 1139 | return NULL; |
| 1140 | _err = TransitionWindow(_self->ob_itself, |
| 1141 | effect, |
| 1142 | action, |
| 1143 | &rect); |
Jack Jansen | e4349e8 | 1999-03-04 22:53:24 +0000 | [diff] [blame] | 1144 | if (_err != noErr) return PyMac_Error(_err); |
| 1145 | Py_INCREF(Py_None); |
| 1146 | _res = Py_None; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1147 | return _res; |
| 1148 | } |
| 1149 | |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 1150 | static PyObject *WinObj_MacMoveWindow(_self, _args) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1151 | WindowObject *_self; |
| 1152 | PyObject *_args; |
| 1153 | { |
| 1154 | PyObject *_res = NULL; |
| 1155 | short hGlobal; |
| 1156 | short vGlobal; |
| 1157 | Boolean front; |
| 1158 | if (!PyArg_ParseTuple(_args, "hhb", |
| 1159 | &hGlobal, |
| 1160 | &vGlobal, |
| 1161 | &front)) |
| 1162 | return NULL; |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 1163 | MacMoveWindow(_self->ob_itself, |
| 1164 | hGlobal, |
| 1165 | vGlobal, |
| 1166 | front); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1167 | Py_INCREF(Py_None); |
| 1168 | _res = Py_None; |
| 1169 | return _res; |
| 1170 | } |
| 1171 | |
| 1172 | static PyObject *WinObj_SizeWindow(_self, _args) |
| 1173 | WindowObject *_self; |
| 1174 | PyObject *_args; |
| 1175 | { |
| 1176 | PyObject *_res = NULL; |
| 1177 | short w; |
| 1178 | short h; |
| 1179 | Boolean fUpdate; |
| 1180 | if (!PyArg_ParseTuple(_args, "hhb", |
| 1181 | &w, |
| 1182 | &h, |
| 1183 | &fUpdate)) |
| 1184 | return NULL; |
| 1185 | SizeWindow(_self->ob_itself, |
| 1186 | w, |
| 1187 | h, |
| 1188 | fUpdate); |
| 1189 | Py_INCREF(Py_None); |
| 1190 | _res = Py_None; |
| 1191 | return _res; |
| 1192 | } |
| 1193 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1194 | static PyObject *WinObj_GrowWindow(_self, _args) |
| 1195 | WindowObject *_self; |
| 1196 | PyObject *_args; |
| 1197 | { |
| 1198 | PyObject *_res = NULL; |
| 1199 | long _rv; |
| 1200 | Point startPt; |
| 1201 | Rect bBox; |
| 1202 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1203 | PyMac_GetPoint, &startPt, |
| 1204 | PyMac_GetRect, &bBox)) |
| 1205 | return NULL; |
| 1206 | _rv = GrowWindow(_self->ob_itself, |
| 1207 | startPt, |
| 1208 | &bBox); |
| 1209 | _res = Py_BuildValue("l", |
| 1210 | _rv); |
| 1211 | return _res; |
| 1212 | } |
| 1213 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1214 | static PyObject *WinObj_DragWindow(_self, _args) |
| 1215 | WindowObject *_self; |
| 1216 | PyObject *_args; |
| 1217 | { |
| 1218 | PyObject *_res = NULL; |
| 1219 | Point startPt; |
| 1220 | Rect boundsRect; |
| 1221 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1222 | PyMac_GetPoint, &startPt, |
| 1223 | PyMac_GetRect, &boundsRect)) |
| 1224 | return NULL; |
| 1225 | DragWindow(_self->ob_itself, |
| 1226 | startPt, |
| 1227 | &boundsRect); |
| 1228 | Py_INCREF(Py_None); |
| 1229 | _res = Py_None; |
| 1230 | return _res; |
| 1231 | } |
| 1232 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1233 | static PyObject *WinObj_ZoomWindow(_self, _args) |
| 1234 | WindowObject *_self; |
| 1235 | PyObject *_args; |
| 1236 | { |
| 1237 | PyObject *_res = NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1238 | WindowPartCode partCode; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1239 | Boolean front; |
| 1240 | if (!PyArg_ParseTuple(_args, "hb", |
| 1241 | &partCode, |
| 1242 | &front)) |
| 1243 | return NULL; |
| 1244 | ZoomWindow(_self->ob_itself, |
| 1245 | partCode, |
| 1246 | front); |
| 1247 | Py_INCREF(Py_None); |
| 1248 | _res = Py_None; |
| 1249 | return _res; |
| 1250 | } |
| 1251 | |
| 1252 | static PyObject *WinObj_IsWindowCollapsable(_self, _args) |
| 1253 | WindowObject *_self; |
| 1254 | PyObject *_args; |
| 1255 | { |
| 1256 | PyObject *_res = NULL; |
| 1257 | Boolean _rv; |
| 1258 | if (!PyArg_ParseTuple(_args, "")) |
| 1259 | return NULL; |
| 1260 | _rv = IsWindowCollapsable(_self->ob_itself); |
| 1261 | _res = Py_BuildValue("b", |
| 1262 | _rv); |
| 1263 | return _res; |
| 1264 | } |
| 1265 | |
| 1266 | static PyObject *WinObj_IsWindowCollapsed(_self, _args) |
| 1267 | WindowObject *_self; |
| 1268 | PyObject *_args; |
| 1269 | { |
| 1270 | PyObject *_res = NULL; |
| 1271 | Boolean _rv; |
| 1272 | if (!PyArg_ParseTuple(_args, "")) |
| 1273 | return NULL; |
| 1274 | _rv = IsWindowCollapsed(_self->ob_itself); |
| 1275 | _res = Py_BuildValue("b", |
| 1276 | _rv); |
| 1277 | return _res; |
| 1278 | } |
| 1279 | |
| 1280 | static PyObject *WinObj_CollapseWindow(_self, _args) |
| 1281 | WindowObject *_self; |
| 1282 | PyObject *_args; |
| 1283 | { |
| 1284 | PyObject *_res = NULL; |
| 1285 | OSStatus _err; |
| 1286 | Boolean collapse; |
| 1287 | if (!PyArg_ParseTuple(_args, "b", |
| 1288 | &collapse)) |
| 1289 | return NULL; |
| 1290 | _err = CollapseWindow(_self->ob_itself, |
| 1291 | collapse); |
| 1292 | if (_err != noErr) return PyMac_Error(_err); |
| 1293 | Py_INCREF(Py_None); |
| 1294 | _res = Py_None; |
| 1295 | return _res; |
| 1296 | } |
| 1297 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1298 | static PyObject *WinObj_GetWindowBounds(_self, _args) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1299 | WindowObject *_self; |
| 1300 | PyObject *_args; |
| 1301 | { |
| 1302 | PyObject *_res = NULL; |
| 1303 | OSStatus _err; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1304 | WindowRegionCode regionCode; |
| 1305 | Rect globalBounds; |
| 1306 | if (!PyArg_ParseTuple(_args, "H", |
| 1307 | ®ionCode)) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1308 | return NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1309 | _err = GetWindowBounds(_self->ob_itself, |
| 1310 | regionCode, |
| 1311 | &globalBounds); |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1312 | if (_err != noErr) return PyMac_Error(_err); |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1313 | _res = Py_BuildValue("O&", |
| 1314 | PyMac_BuildRect, &globalBounds); |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1315 | return _res; |
| 1316 | } |
| 1317 | |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 1318 | static PyObject *WinObj_ResizeWindow(_self, _args) |
| 1319 | WindowObject *_self; |
| 1320 | PyObject *_args; |
| 1321 | { |
| 1322 | PyObject *_res = NULL; |
| 1323 | Boolean _rv; |
| 1324 | Point startPoint; |
| 1325 | Rect sizeConstraints; |
| 1326 | Rect newContentRect; |
| 1327 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1328 | PyMac_GetPoint, &startPoint, |
| 1329 | PyMac_GetRect, &sizeConstraints)) |
| 1330 | return NULL; |
| 1331 | _rv = ResizeWindow(_self->ob_itself, |
| 1332 | startPoint, |
| 1333 | &sizeConstraints, |
| 1334 | &newContentRect); |
| 1335 | _res = Py_BuildValue("bO&", |
| 1336 | _rv, |
| 1337 | PyMac_BuildRect, &newContentRect); |
| 1338 | return _res; |
| 1339 | } |
| 1340 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1341 | static PyObject *WinObj_SetWindowBounds(_self, _args) |
| 1342 | WindowObject *_self; |
| 1343 | PyObject *_args; |
| 1344 | { |
| 1345 | PyObject *_res = NULL; |
| 1346 | OSStatus _err; |
| 1347 | WindowRegionCode regionCode; |
| 1348 | Rect globalBounds; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 1349 | if (!PyArg_ParseTuple(_args, "HO&", |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1350 | ®ionCode, |
| 1351 | PyMac_GetRect, &globalBounds)) |
| 1352 | return NULL; |
| 1353 | _err = SetWindowBounds(_self->ob_itself, |
| 1354 | regionCode, |
| 1355 | &globalBounds); |
| 1356 | if (_err != noErr) return PyMac_Error(_err); |
| 1357 | Py_INCREF(Py_None); |
| 1358 | _res = Py_None; |
| 1359 | return _res; |
| 1360 | } |
| 1361 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1362 | static PyObject *WinObj_RepositionWindow(_self, _args) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1363 | WindowObject *_self; |
| 1364 | PyObject *_args; |
| 1365 | { |
| 1366 | PyObject *_res = NULL; |
| 1367 | OSStatus _err; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1368 | WindowPtr parentWindow; |
| 1369 | WindowPositionMethod method; |
| 1370 | if (!PyArg_ParseTuple(_args, "O&l", |
| 1371 | WinObj_Convert, &parentWindow, |
| 1372 | &method)) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1373 | return NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1374 | _err = RepositionWindow(_self->ob_itself, |
| 1375 | parentWindow, |
| 1376 | method); |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1377 | if (_err != noErr) return PyMac_Error(_err); |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1378 | Py_INCREF(Py_None); |
| 1379 | _res = Py_None; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1380 | return _res; |
| 1381 | } |
| 1382 | |
| 1383 | static PyObject *WinObj_MoveWindowStructure(_self, _args) |
| 1384 | WindowObject *_self; |
| 1385 | PyObject *_args; |
| 1386 | { |
| 1387 | PyObject *_res = NULL; |
| 1388 | OSStatus _err; |
| 1389 | short hGlobal; |
| 1390 | short vGlobal; |
| 1391 | if (!PyArg_ParseTuple(_args, "hh", |
| 1392 | &hGlobal, |
| 1393 | &vGlobal)) |
| 1394 | return NULL; |
| 1395 | _err = MoveWindowStructure(_self->ob_itself, |
| 1396 | hGlobal, |
| 1397 | vGlobal); |
| 1398 | if (_err != noErr) return PyMac_Error(_err); |
| 1399 | Py_INCREF(Py_None); |
| 1400 | _res = Py_None; |
| 1401 | return _res; |
| 1402 | } |
| 1403 | |
| 1404 | static PyObject *WinObj_IsWindowInStandardState(_self, _args) |
| 1405 | WindowObject *_self; |
| 1406 | PyObject *_args; |
| 1407 | { |
| 1408 | PyObject *_res = NULL; |
| 1409 | Boolean _rv; |
| 1410 | Point idealSize; |
| 1411 | Rect idealStandardState; |
| 1412 | if (!PyArg_ParseTuple(_args, "")) |
| 1413 | return NULL; |
| 1414 | _rv = IsWindowInStandardState(_self->ob_itself, |
| 1415 | &idealSize, |
| 1416 | &idealStandardState); |
| 1417 | _res = Py_BuildValue("bO&O&", |
| 1418 | _rv, |
| 1419 | PyMac_BuildPoint, idealSize, |
| 1420 | PyMac_BuildRect, &idealStandardState); |
| 1421 | return _res; |
| 1422 | } |
| 1423 | |
| 1424 | static PyObject *WinObj_ZoomWindowIdeal(_self, _args) |
| 1425 | WindowObject *_self; |
| 1426 | PyObject *_args; |
| 1427 | { |
| 1428 | PyObject *_res = NULL; |
| 1429 | OSStatus _err; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1430 | WindowPartCode partCode; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1431 | Point ioIdealSize; |
| 1432 | if (!PyArg_ParseTuple(_args, "h", |
| 1433 | &partCode)) |
| 1434 | return NULL; |
| 1435 | _err = ZoomWindowIdeal(_self->ob_itself, |
| 1436 | partCode, |
| 1437 | &ioIdealSize); |
| 1438 | if (_err != noErr) return PyMac_Error(_err); |
| 1439 | _res = Py_BuildValue("O&", |
| 1440 | PyMac_BuildPoint, ioIdealSize); |
| 1441 | return _res; |
| 1442 | } |
| 1443 | |
| 1444 | static PyObject *WinObj_GetWindowIdealUserState(_self, _args) |
| 1445 | WindowObject *_self; |
| 1446 | PyObject *_args; |
| 1447 | { |
| 1448 | PyObject *_res = NULL; |
| 1449 | OSStatus _err; |
| 1450 | Rect userState; |
| 1451 | if (!PyArg_ParseTuple(_args, "")) |
| 1452 | return NULL; |
| 1453 | _err = GetWindowIdealUserState(_self->ob_itself, |
| 1454 | &userState); |
| 1455 | if (_err != noErr) return PyMac_Error(_err); |
| 1456 | _res = Py_BuildValue("O&", |
| 1457 | PyMac_BuildRect, &userState); |
| 1458 | return _res; |
| 1459 | } |
| 1460 | |
| 1461 | static PyObject *WinObj_SetWindowIdealUserState(_self, _args) |
| 1462 | WindowObject *_self; |
| 1463 | PyObject *_args; |
| 1464 | { |
| 1465 | PyObject *_res = NULL; |
| 1466 | OSStatus _err; |
| 1467 | Rect userState; |
| 1468 | if (!PyArg_ParseTuple(_args, "")) |
| 1469 | return NULL; |
| 1470 | _err = SetWindowIdealUserState(_self->ob_itself, |
| 1471 | &userState); |
| 1472 | if (_err != noErr) return PyMac_Error(_err); |
| 1473 | _res = Py_BuildValue("O&", |
| 1474 | PyMac_BuildRect, &userState); |
| 1475 | return _res; |
| 1476 | } |
| 1477 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1478 | static PyObject *WinObj_HideWindow(_self, _args) |
| 1479 | WindowObject *_self; |
| 1480 | PyObject *_args; |
| 1481 | { |
| 1482 | PyObject *_res = NULL; |
| 1483 | if (!PyArg_ParseTuple(_args, "")) |
| 1484 | return NULL; |
| 1485 | HideWindow(_self->ob_itself); |
| 1486 | Py_INCREF(Py_None); |
| 1487 | _res = Py_None; |
| 1488 | return _res; |
| 1489 | } |
| 1490 | |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 1491 | static PyObject *WinObj_MacShowWindow(_self, _args) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1492 | WindowObject *_self; |
| 1493 | PyObject *_args; |
| 1494 | { |
| 1495 | PyObject *_res = NULL; |
| 1496 | if (!PyArg_ParseTuple(_args, "")) |
| 1497 | return NULL; |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 1498 | MacShowWindow(_self->ob_itself); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1499 | Py_INCREF(Py_None); |
| 1500 | _res = Py_None; |
| 1501 | return _res; |
| 1502 | } |
| 1503 | |
| 1504 | static PyObject *WinObj_ShowHide(_self, _args) |
| 1505 | WindowObject *_self; |
| 1506 | PyObject *_args; |
| 1507 | { |
| 1508 | PyObject *_res = NULL; |
| 1509 | Boolean showFlag; |
| 1510 | if (!PyArg_ParseTuple(_args, "b", |
| 1511 | &showFlag)) |
| 1512 | return NULL; |
| 1513 | ShowHide(_self->ob_itself, |
| 1514 | showFlag); |
| 1515 | Py_INCREF(Py_None); |
| 1516 | _res = Py_None; |
| 1517 | return _res; |
| 1518 | } |
| 1519 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1520 | #if TARGET_API_MAC_CARBON |
| 1521 | |
| 1522 | static PyObject *WinObj_GetWindowPropertyAttributes(_self, _args) |
| 1523 | WindowObject *_self; |
| 1524 | PyObject *_args; |
| 1525 | { |
| 1526 | PyObject *_res = NULL; |
| 1527 | OSStatus _err; |
| 1528 | OSType propertyCreator; |
| 1529 | OSType propertyTag; |
| 1530 | UInt32 attributes; |
| 1531 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1532 | PyMac_GetOSType, &propertyCreator, |
| 1533 | PyMac_GetOSType, &propertyTag)) |
| 1534 | return NULL; |
| 1535 | _err = GetWindowPropertyAttributes(_self->ob_itself, |
| 1536 | propertyCreator, |
| 1537 | propertyTag, |
| 1538 | &attributes); |
| 1539 | if (_err != noErr) return PyMac_Error(_err); |
| 1540 | _res = Py_BuildValue("l", |
| 1541 | attributes); |
| 1542 | return _res; |
| 1543 | } |
| 1544 | #endif |
| 1545 | |
| 1546 | #if TARGET_API_MAC_CARBON |
| 1547 | |
| 1548 | static PyObject *WinObj_ChangeWindowPropertyAttributes(_self, _args) |
| 1549 | WindowObject *_self; |
| 1550 | PyObject *_args; |
| 1551 | { |
| 1552 | PyObject *_res = NULL; |
| 1553 | OSStatus _err; |
| 1554 | OSType propertyCreator; |
| 1555 | OSType propertyTag; |
| 1556 | UInt32 attributesToSet; |
| 1557 | UInt32 attributesToClear; |
| 1558 | if (!PyArg_ParseTuple(_args, "O&O&ll", |
| 1559 | PyMac_GetOSType, &propertyCreator, |
| 1560 | PyMac_GetOSType, &propertyTag, |
| 1561 | &attributesToSet, |
| 1562 | &attributesToClear)) |
| 1563 | return NULL; |
| 1564 | _err = ChangeWindowPropertyAttributes(_self->ob_itself, |
| 1565 | propertyCreator, |
| 1566 | propertyTag, |
| 1567 | attributesToSet, |
| 1568 | attributesToClear); |
| 1569 | if (_err != noErr) return PyMac_Error(_err); |
| 1570 | Py_INCREF(Py_None); |
| 1571 | _res = Py_None; |
| 1572 | return _res; |
| 1573 | } |
| 1574 | #endif |
| 1575 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1576 | static PyObject *WinObj_TrackBox(_self, _args) |
| 1577 | WindowObject *_self; |
| 1578 | PyObject *_args; |
| 1579 | { |
| 1580 | PyObject *_res = NULL; |
| 1581 | Boolean _rv; |
| 1582 | Point thePt; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1583 | WindowPartCode partCode; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1584 | if (!PyArg_ParseTuple(_args, "O&h", |
| 1585 | PyMac_GetPoint, &thePt, |
| 1586 | &partCode)) |
| 1587 | return NULL; |
| 1588 | _rv = TrackBox(_self->ob_itself, |
| 1589 | thePt, |
| 1590 | partCode); |
| 1591 | _res = Py_BuildValue("b", |
| 1592 | _rv); |
| 1593 | return _res; |
| 1594 | } |
| 1595 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1596 | static PyObject *WinObj_TrackGoAway(_self, _args) |
| 1597 | WindowObject *_self; |
| 1598 | PyObject *_args; |
| 1599 | { |
| 1600 | PyObject *_res = NULL; |
| 1601 | Boolean _rv; |
| 1602 | Point thePt; |
| 1603 | if (!PyArg_ParseTuple(_args, "O&", |
| 1604 | PyMac_GetPoint, &thePt)) |
| 1605 | return NULL; |
| 1606 | _rv = TrackGoAway(_self->ob_itself, |
| 1607 | thePt); |
| 1608 | _res = Py_BuildValue("b", |
| 1609 | _rv); |
| 1610 | return _res; |
| 1611 | } |
| 1612 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 1613 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1614 | |
Jack Jansen | 8f0fab7 | 1997-08-15 14:38:05 +0000 | [diff] [blame] | 1615 | static PyObject *WinObj_GetAuxWin(_self, _args) |
| 1616 | WindowObject *_self; |
| 1617 | PyObject *_args; |
| 1618 | { |
| 1619 | PyObject *_res = NULL; |
| 1620 | Boolean _rv; |
| 1621 | AuxWinHandle awHndl; |
| 1622 | if (!PyArg_ParseTuple(_args, "")) |
| 1623 | return NULL; |
| 1624 | _rv = GetAuxWin(_self->ob_itself, |
| 1625 | &awHndl); |
| 1626 | _res = Py_BuildValue("bO&", |
| 1627 | _rv, |
| 1628 | ResObj_New, awHndl); |
| 1629 | return _res; |
| 1630 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1631 | #endif |
Jack Jansen | 8f0fab7 | 1997-08-15 14:38:05 +0000 | [diff] [blame] | 1632 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1633 | static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args) |
| 1634 | WindowObject *_self; |
| 1635 | PyObject *_args; |
| 1636 | { |
| 1637 | PyObject *_res = NULL; |
| 1638 | Boolean _rv; |
| 1639 | if (!PyArg_ParseTuple(_args, "")) |
| 1640 | return NULL; |
| 1641 | _rv = GetWindowGoAwayFlag(_self->ob_itself); |
| 1642 | _res = Py_BuildValue("b", |
| 1643 | _rv); |
| 1644 | return _res; |
| 1645 | } |
| 1646 | |
| 1647 | static PyObject *WinObj_GetWindowSpareFlag(_self, _args) |
| 1648 | WindowObject *_self; |
| 1649 | PyObject *_args; |
| 1650 | { |
| 1651 | PyObject *_res = NULL; |
| 1652 | Boolean _rv; |
| 1653 | if (!PyArg_ParseTuple(_args, "")) |
| 1654 | return NULL; |
| 1655 | _rv = GetWindowSpareFlag(_self->ob_itself); |
| 1656 | _res = Py_BuildValue("b", |
| 1657 | _rv); |
| 1658 | return _res; |
| 1659 | } |
| 1660 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 1661 | static PyObject *WinObj_GetWindowPort(_self, _args) |
| 1662 | WindowObject *_self; |
| 1663 | PyObject *_args; |
| 1664 | { |
| 1665 | PyObject *_res = NULL; |
| 1666 | CGrafPtr _rv; |
| 1667 | if (!PyArg_ParseTuple(_args, "")) |
| 1668 | return NULL; |
| 1669 | _rv = GetWindowPort(_self->ob_itself); |
| 1670 | _res = Py_BuildValue("O&", |
| 1671 | GrafObj_New, _rv); |
| 1672 | return _res; |
| 1673 | } |
| 1674 | |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1675 | static PyObject *WinObj_GetWindowKind(_self, _args) |
| 1676 | WindowObject *_self; |
| 1677 | PyObject *_args; |
| 1678 | { |
| 1679 | PyObject *_res = NULL; |
| 1680 | short _rv; |
| 1681 | if (!PyArg_ParseTuple(_args, "")) |
| 1682 | return NULL; |
| 1683 | _rv = GetWindowKind(_self->ob_itself); |
| 1684 | _res = Py_BuildValue("h", |
| 1685 | _rv); |
| 1686 | return _res; |
| 1687 | } |
| 1688 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1689 | static PyObject *WinObj_MacIsWindowVisible(_self, _args) |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1690 | WindowObject *_self; |
| 1691 | PyObject *_args; |
| 1692 | { |
| 1693 | PyObject *_res = NULL; |
| 1694 | Boolean _rv; |
| 1695 | if (!PyArg_ParseTuple(_args, "")) |
| 1696 | return NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1697 | _rv = MacIsWindowVisible(_self->ob_itself); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1698 | _res = Py_BuildValue("b", |
| 1699 | _rv); |
| 1700 | return _res; |
| 1701 | } |
| 1702 | |
| 1703 | static PyObject *WinObj_IsWindowHilited(_self, _args) |
| 1704 | WindowObject *_self; |
| 1705 | PyObject *_args; |
| 1706 | { |
| 1707 | PyObject *_res = NULL; |
| 1708 | Boolean _rv; |
| 1709 | if (!PyArg_ParseTuple(_args, "")) |
| 1710 | return NULL; |
| 1711 | _rv = IsWindowHilited(_self->ob_itself); |
| 1712 | _res = Py_BuildValue("b", |
| 1713 | _rv); |
| 1714 | return _res; |
| 1715 | } |
| 1716 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1717 | #if TARGET_API_MAC_CARBON |
| 1718 | |
| 1719 | static PyObject *WinObj_IsWindowUpdatePending(_self, _args) |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1720 | WindowObject *_self; |
| 1721 | PyObject *_args; |
| 1722 | { |
| 1723 | PyObject *_res = NULL; |
| 1724 | Boolean _rv; |
| 1725 | if (!PyArg_ParseTuple(_args, "")) |
| 1726 | return NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1727 | _rv = IsWindowUpdatePending(_self->ob_itself); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1728 | _res = Py_BuildValue("b", |
| 1729 | _rv); |
| 1730 | return _res; |
| 1731 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1732 | #endif |
| 1733 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1734 | static PyObject *WinObj_MacGetNextWindow(_self, _args) |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1735 | WindowObject *_self; |
| 1736 | PyObject *_args; |
| 1737 | { |
| 1738 | PyObject *_res = NULL; |
| 1739 | WindowPtr _rv; |
| 1740 | if (!PyArg_ParseTuple(_args, "")) |
| 1741 | return NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1742 | _rv = MacGetNextWindow(_self->ob_itself); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1743 | _res = Py_BuildValue("O&", |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1744 | WinObj_New, _rv); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1745 | return _res; |
| 1746 | } |
| 1747 | |
| 1748 | static PyObject *WinObj_GetWindowStandardState(_self, _args) |
| 1749 | WindowObject *_self; |
| 1750 | PyObject *_args; |
| 1751 | { |
| 1752 | PyObject *_res = NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1753 | Rect rect; |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1754 | if (!PyArg_ParseTuple(_args, "")) |
| 1755 | return NULL; |
| 1756 | GetWindowStandardState(_self->ob_itself, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1757 | &rect); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1758 | _res = Py_BuildValue("O&", |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1759 | PyMac_BuildRect, &rect); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1760 | return _res; |
| 1761 | } |
| 1762 | |
| 1763 | static PyObject *WinObj_GetWindowUserState(_self, _args) |
| 1764 | WindowObject *_self; |
| 1765 | PyObject *_args; |
| 1766 | { |
| 1767 | PyObject *_res = NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1768 | Rect rect; |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1769 | if (!PyArg_ParseTuple(_args, "")) |
| 1770 | return NULL; |
| 1771 | GetWindowUserState(_self->ob_itself, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1772 | &rect); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1773 | _res = Py_BuildValue("O&", |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1774 | PyMac_BuildRect, &rect); |
| 1775 | return _res; |
| 1776 | } |
| 1777 | |
| 1778 | static PyObject *WinObj_SetWindowKind(_self, _args) |
| 1779 | WindowObject *_self; |
| 1780 | PyObject *_args; |
| 1781 | { |
| 1782 | PyObject *_res = NULL; |
| 1783 | short kind; |
| 1784 | if (!PyArg_ParseTuple(_args, "h", |
| 1785 | &kind)) |
| 1786 | return NULL; |
| 1787 | SetWindowKind(_self->ob_itself, |
| 1788 | kind); |
| 1789 | Py_INCREF(Py_None); |
| 1790 | _res = Py_None; |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1791 | return _res; |
| 1792 | } |
| 1793 | |
| 1794 | static PyObject *WinObj_SetWindowStandardState(_self, _args) |
| 1795 | WindowObject *_self; |
| 1796 | PyObject *_args; |
| 1797 | { |
| 1798 | PyObject *_res = NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1799 | Rect rect; |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1800 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1801 | PyMac_GetRect, &rect)) |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1802 | return NULL; |
| 1803 | SetWindowStandardState(_self->ob_itself, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1804 | &rect); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1805 | Py_INCREF(Py_None); |
| 1806 | _res = Py_None; |
| 1807 | return _res; |
| 1808 | } |
| 1809 | |
| 1810 | static PyObject *WinObj_SetWindowUserState(_self, _args) |
| 1811 | WindowObject *_self; |
| 1812 | PyObject *_args; |
| 1813 | { |
| 1814 | PyObject *_res = NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1815 | Rect rect; |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1816 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1817 | PyMac_GetRect, &rect)) |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1818 | return NULL; |
| 1819 | SetWindowUserState(_self->ob_itself, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1820 | &rect); |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 1821 | Py_INCREF(Py_None); |
| 1822 | _res = Py_None; |
| 1823 | return _res; |
| 1824 | } |
| 1825 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1826 | static PyObject *WinObj_SetPortWindowPort(_self, _args) |
| 1827 | WindowObject *_self; |
| 1828 | PyObject *_args; |
| 1829 | { |
| 1830 | PyObject *_res = NULL; |
| 1831 | if (!PyArg_ParseTuple(_args, "")) |
| 1832 | return NULL; |
| 1833 | SetPortWindowPort(_self->ob_itself); |
| 1834 | Py_INCREF(Py_None); |
| 1835 | _res = Py_None; |
| 1836 | return _res; |
| 1837 | } |
| 1838 | |
| 1839 | static PyObject *WinObj_GetWindowPortBounds(_self, _args) |
| 1840 | WindowObject *_self; |
| 1841 | PyObject *_args; |
| 1842 | { |
| 1843 | PyObject *_res = NULL; |
| 1844 | Rect bounds; |
| 1845 | if (!PyArg_ParseTuple(_args, "")) |
| 1846 | return NULL; |
| 1847 | GetWindowPortBounds(_self->ob_itself, |
| 1848 | &bounds); |
| 1849 | _res = Py_BuildValue("O&", |
| 1850 | PyMac_BuildRect, &bounds); |
| 1851 | return _res; |
| 1852 | } |
| 1853 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 1854 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | cdcbd1f | 1998-10-22 15:08:00 +0000 | [diff] [blame] | 1855 | |
Jack Jansen | e180d99 | 1998-04-24 10:28:20 +0000 | [diff] [blame] | 1856 | static PyObject *WinObj_CloseWindow(_self, _args) |
| 1857 | WindowObject *_self; |
| 1858 | PyObject *_args; |
| 1859 | { |
| 1860 | PyObject *_res = NULL; |
| 1861 | if (!PyArg_ParseTuple(_args, "")) |
| 1862 | return NULL; |
| 1863 | CloseWindow(_self->ob_itself); |
| 1864 | Py_INCREF(Py_None); |
| 1865 | _res = Py_None; |
| 1866 | return _res; |
| 1867 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1868 | #endif |
Jack Jansen | e180d99 | 1998-04-24 10:28:20 +0000 | [diff] [blame] | 1869 | |
| 1870 | static PyObject *WinObj_MoveWindow(_self, _args) |
| 1871 | WindowObject *_self; |
| 1872 | PyObject *_args; |
| 1873 | { |
| 1874 | PyObject *_res = NULL; |
| 1875 | short hGlobal; |
| 1876 | short vGlobal; |
| 1877 | Boolean front; |
| 1878 | if (!PyArg_ParseTuple(_args, "hhb", |
| 1879 | &hGlobal, |
| 1880 | &vGlobal, |
| 1881 | &front)) |
| 1882 | return NULL; |
| 1883 | MoveWindow(_self->ob_itself, |
| 1884 | hGlobal, |
| 1885 | vGlobal, |
| 1886 | front); |
| 1887 | Py_INCREF(Py_None); |
| 1888 | _res = Py_None; |
| 1889 | return _res; |
| 1890 | } |
| 1891 | |
| 1892 | static PyObject *WinObj_ShowWindow(_self, _args) |
| 1893 | WindowObject *_self; |
| 1894 | PyObject *_args; |
| 1895 | { |
| 1896 | PyObject *_res = NULL; |
| 1897 | if (!PyArg_ParseTuple(_args, "")) |
| 1898 | return NULL; |
| 1899 | ShowWindow(_self->ob_itself); |
| 1900 | Py_INCREF(Py_None); |
| 1901 | _res = Py_None; |
| 1902 | return _res; |
| 1903 | } |
| 1904 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1905 | static PyMethodDef WinObj_methods[] = { |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1906 | {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, |
| 1907 | "() -> (UInt32 outCount)"}, |
| 1908 | {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, |
| 1909 | "() -> None"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1910 | |
| 1911 | #if TARGET_API_MAC_CARBON |
| 1912 | {"ReshapeCustomWindow", (PyCFunction)WinObj_ReshapeCustomWindow, 1, |
| 1913 | "() -> None"}, |
| 1914 | #endif |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1915 | {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1, |
| 1916 | "() -> (WindowClass outClass)"}, |
| 1917 | {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, |
| 1918 | "() -> (WindowAttributes outAttributes)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1919 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1920 | #if TARGET_API_MAC_CARBON |
| 1921 | {"ChangeWindowAttributes", (PyCFunction)WinObj_ChangeWindowAttributes, 1, |
| 1922 | "(WindowAttributes setTheseAttributes, WindowAttributes clearTheseAttributes) -> None"}, |
| 1923 | #endif |
| 1924 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 1925 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1926 | {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, |
| 1927 | "(WCTabHandle newColorTable) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1928 | #endif |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1929 | {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1930 | "(RGBColor color) -> None"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1931 | {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1, |
| 1932 | "() -> (RGBColor color)"}, |
| 1933 | {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1, |
| 1934 | "(PixPatHandle outPixPat) -> None"}, |
| 1935 | {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1, |
| 1936 | "(PixPatHandle pixPat) -> None"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1937 | |
| 1938 | #if TARGET_API_MAC_CARBON |
| 1939 | {"ScrollWindowRect", (PyCFunction)WinObj_ScrollWindowRect, 1, |
| 1940 | "(Rect inScrollRect, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, |
| 1941 | #endif |
| 1942 | |
| 1943 | #if TARGET_API_MAC_CARBON |
| 1944 | {"ScrollWindowRegion", (PyCFunction)WinObj_ScrollWindowRegion, 1, |
| 1945 | "(RgnHandle inScrollRgn, SInt16 inHPixels, SInt16 inVPixels, ScrollWindowOptions inOptions, RgnHandle outExposedRgn) -> None"}, |
| 1946 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1947 | {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, |
| 1948 | "() -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1949 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 1950 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1951 | {"SaveOld", (PyCFunction)WinObj_SaveOld, 1, |
| 1952 | "() -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1953 | #endif |
| 1954 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 1955 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1956 | {"DrawNew", (PyCFunction)WinObj_DrawNew, 1, |
| 1957 | "(Boolean update) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 1958 | #endif |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 1959 | {"PaintOne", (PyCFunction)WinObj_PaintOne, 1, |
| 1960 | "(RgnHandle clobberedRgn) -> None"}, |
| 1961 | {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1, |
| 1962 | "(RgnHandle clobberedRgn) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1963 | {"CalcVis", (PyCFunction)WinObj_CalcVis, 1, |
| 1964 | "() -> None"}, |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 1965 | {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1, |
| 1966 | "(RgnHandle clobberedRgn) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1967 | {"BringToFront", (PyCFunction)WinObj_BringToFront, 1, |
| 1968 | "() -> None"}, |
| 1969 | {"SendBehind", (PyCFunction)WinObj_SendBehind, 1, |
| 1970 | "(WindowPtr behindWindow) -> None"}, |
| 1971 | {"SelectWindow", (PyCFunction)WinObj_SelectWindow, 1, |
| 1972 | "() -> None"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 1973 | |
| 1974 | #if TARGET_API_MAC_CARBON |
| 1975 | {"GetNextWindowOfClass", (PyCFunction)WinObj_GetNextWindowOfClass, 1, |
| 1976 | "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, |
| 1977 | #endif |
| 1978 | |
| 1979 | #if !TARGET_API_MAC_CARBON |
| 1980 | {"IsValidWindowPtr", (PyCFunction)WinObj_IsValidWindowPtr, 1, |
| 1981 | "() -> (Boolean _rv)"}, |
| 1982 | #endif |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 1983 | {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1, |
| 1984 | "(Boolean fHilite) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1985 | {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1, |
| 1986 | "(long data) -> None"}, |
| 1987 | {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1, |
| 1988 | "() -> (long _rv)"}, |
| 1989 | {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1, |
| 1990 | "(PicHandle pic) -> None"}, |
| 1991 | {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1, |
| 1992 | "() -> (PicHandle _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1993 | {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1, |
| 1994 | "() -> (short _rv)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1995 | {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1, |
| 1996 | "() -> (UInt32 outFeatures)"}, |
| 1997 | {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, |
| 1998 | "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1999 | {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1, |
| 2000 | "() -> None"}, |
| 2001 | {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1, |
| 2002 | "() -> None"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2003 | {"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1, |
| 2004 | "(RgnHandle region) -> None"}, |
| 2005 | {"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1, |
| 2006 | "(Rect bounds) -> None"}, |
| 2007 | {"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1, |
| 2008 | "(RgnHandle region) -> None"}, |
| 2009 | {"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1, |
| 2010 | "(Rect bounds) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2011 | {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1, |
| 2012 | "() -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2013 | {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1, |
| 2014 | "(Str255 title) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2015 | {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1, |
| 2016 | "() -> (Str255 title)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2017 | {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1, |
| 2018 | "(FSSpec inFile) -> None"}, |
| 2019 | {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1, |
| 2020 | "() -> (FSSpec outFile)"}, |
| 2021 | {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1, |
| 2022 | "(AliasHandle alias) -> None"}, |
| 2023 | {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1, |
| 2024 | "() -> (AliasHandle alias)"}, |
| 2025 | {"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1, |
| 2026 | "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"}, |
| 2027 | {"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1, |
| 2028 | "() -> (IconRef outIcon)"}, |
| 2029 | {"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1, |
| 2030 | "(IconRef icon) -> None"}, |
| 2031 | {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1, |
| 2032 | "() -> None"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2033 | {"BeginWindowProxyDrag", (PyCFunction)WinObj_BeginWindowProxyDrag, 1, |
| 2034 | "(RgnHandle outDragOutlineRgn) -> (DragReference outNewDrag)"}, |
| 2035 | {"EndWindowProxyDrag", (PyCFunction)WinObj_EndWindowProxyDrag, 1, |
| 2036 | "(DragReference theDrag) -> None"}, |
| 2037 | {"TrackWindowProxyFromExistingDrag", (PyCFunction)WinObj_TrackWindowProxyFromExistingDrag, 1, |
| 2038 | "(Point startPt, DragReference drag, RgnHandle inDragOutlineRgn) -> None"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2039 | {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1, |
| 2040 | "(Point startPt) -> None"}, |
| 2041 | {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1, |
| 2042 | "() -> (Boolean _rv)"}, |
| 2043 | {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1, |
| 2044 | "(Boolean modified) -> None"}, |
| 2045 | {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2046 | "(EventRecord event) -> (Boolean _rv)"}, |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 2047 | {"WindowPathSelect", (PyCFunction)WinObj_WindowPathSelect, 1, |
| 2048 | "(MenuHandle menu) -> (SInt32 outMenuResult)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2049 | {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1, |
| 2050 | "(Boolean hilited) -> None"}, |
| 2051 | {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, |
| 2052 | "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"}, |
| 2053 | {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, |
| 2054 | "(short hGlobal, short vGlobal, Boolean front) -> None"}, |
| 2055 | {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1, |
| 2056 | "(short w, short h, Boolean fUpdate) -> None"}, |
| 2057 | {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1, |
| 2058 | "(Point startPt, Rect bBox) -> (long _rv)"}, |
| 2059 | {"DragWindow", (PyCFunction)WinObj_DragWindow, 1, |
| 2060 | "(Point startPt, Rect boundsRect) -> None"}, |
| 2061 | {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2062 | "(WindowPartCode partCode, Boolean front) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2063 | {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, |
| 2064 | "() -> (Boolean _rv)"}, |
| 2065 | {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, |
| 2066 | "() -> (Boolean _rv)"}, |
| 2067 | {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2068 | "(Boolean collapse) -> None"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2069 | {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1, |
| 2070 | "(WindowRegionCode regionCode) -> (Rect globalBounds)"}, |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 2071 | {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1, |
| 2072 | "(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2073 | {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, |
| 2074 | "(WindowRegionCode regionCode, Rect globalBounds) -> None"}, |
| 2075 | {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1, |
| 2076 | "(WindowPtr parentWindow, WindowPositionMethod method) -> None"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2077 | {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1, |
| 2078 | "(short hGlobal, short vGlobal) -> None"}, |
| 2079 | {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, |
| 2080 | "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"}, |
| 2081 | {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2082 | "(WindowPartCode partCode) -> (Point ioIdealSize)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2083 | {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, |
| 2084 | "() -> (Rect userState)"}, |
| 2085 | {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, |
| 2086 | "() -> (Rect userState)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2087 | {"HideWindow", (PyCFunction)WinObj_HideWindow, 1, |
| 2088 | "() -> None"}, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 2089 | {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2090 | "() -> None"}, |
| 2091 | {"ShowHide", (PyCFunction)WinObj_ShowHide, 1, |
| 2092 | "(Boolean showFlag) -> None"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2093 | |
| 2094 | #if TARGET_API_MAC_CARBON |
| 2095 | {"GetWindowPropertyAttributes", (PyCFunction)WinObj_GetWindowPropertyAttributes, 1, |
| 2096 | "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"}, |
| 2097 | #endif |
| 2098 | |
| 2099 | #if TARGET_API_MAC_CARBON |
| 2100 | {"ChangeWindowPropertyAttributes", (PyCFunction)WinObj_ChangeWindowPropertyAttributes, 1, |
| 2101 | "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"}, |
| 2102 | #endif |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2103 | {"TrackBox", (PyCFunction)WinObj_TrackBox, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2104 | "(Point thePt, WindowPartCode partCode) -> (Boolean _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2105 | {"TrackGoAway", (PyCFunction)WinObj_TrackGoAway, 1, |
| 2106 | "(Point thePt) -> (Boolean _rv)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2107 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2108 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 8f0fab7 | 1997-08-15 14:38:05 +0000 | [diff] [blame] | 2109 | {"GetAuxWin", (PyCFunction)WinObj_GetAuxWin, 1, |
| 2110 | "() -> (Boolean _rv, AuxWinHandle awHndl)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2111 | #endif |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2112 | {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1, |
| 2113 | "() -> (Boolean _rv)"}, |
| 2114 | {"GetWindowSpareFlag", (PyCFunction)WinObj_GetWindowSpareFlag, 1, |
| 2115 | "() -> (Boolean _rv)"}, |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2116 | {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, |
| 2117 | "() -> (CGrafPtr _rv)"}, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2118 | {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, |
| 2119 | "() -> (short _rv)"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2120 | {"MacIsWindowVisible", (PyCFunction)WinObj_MacIsWindowVisible, 1, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2121 | "() -> (Boolean _rv)"}, |
| 2122 | {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1, |
| 2123 | "() -> (Boolean _rv)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2124 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2125 | #if TARGET_API_MAC_CARBON |
| 2126 | {"IsWindowUpdatePending", (PyCFunction)WinObj_IsWindowUpdatePending, 1, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2127 | "() -> (Boolean _rv)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2128 | #endif |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2129 | {"MacGetNextWindow", (PyCFunction)WinObj_MacGetNextWindow, 1, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2130 | "() -> (WindowPtr _rv)"}, |
| 2131 | {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2132 | "() -> (Rect rect)"}, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2133 | {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2134 | "() -> (Rect rect)"}, |
| 2135 | {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1, |
| 2136 | "(short kind) -> None"}, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2137 | {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2138 | "(Rect rect) -> None"}, |
Jack Jansen | 330f576 | 1995-11-14 10:48:54 +0000 | [diff] [blame] | 2139 | {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2140 | "(Rect rect) -> None"}, |
| 2141 | {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1, |
| 2142 | "() -> None"}, |
| 2143 | {"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1, |
| 2144 | "() -> (Rect bounds)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2145 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2146 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e180d99 | 1998-04-24 10:28:20 +0000 | [diff] [blame] | 2147 | {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1, |
| 2148 | "() -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2149 | #endif |
Jack Jansen | e180d99 | 1998-04-24 10:28:20 +0000 | [diff] [blame] | 2150 | {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1, |
| 2151 | "(short hGlobal, short vGlobal, Boolean front) -> None"}, |
| 2152 | {"ShowWindow", (PyCFunction)WinObj_ShowWindow, 1, |
| 2153 | "() -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2154 | {NULL, NULL, 0} |
| 2155 | }; |
| 2156 | |
| 2157 | PyMethodChain WinObj_chain = { WinObj_methods, NULL }; |
| 2158 | |
| 2159 | static PyObject *WinObj_getattr(self, name) |
| 2160 | WindowObject *self; |
| 2161 | char *name; |
| 2162 | { |
| 2163 | return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name); |
| 2164 | } |
| 2165 | |
| 2166 | #define WinObj_setattr NULL |
| 2167 | |
Jack Jansen | 87a3092 | 2000-12-19 21:34:55 +0000 | [diff] [blame^] | 2168 | static int WinObj_compare(self, other) |
| 2169 | WindowObject *self, *other; |
| 2170 | { |
| 2171 | if ( self->ob_itself > other->ob_itself ) return 1; |
| 2172 | if ( self->ob_itself < other->ob_itself ) return -1; |
| 2173 | return 0; |
| 2174 | } |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2175 | |
| 2176 | #define WinObj_repr NULL |
| 2177 | |
Jack Jansen | 87a3092 | 2000-12-19 21:34:55 +0000 | [diff] [blame^] | 2178 | static int WinObj_hash(self) |
| 2179 | WindowObject *self; |
| 2180 | { |
| 2181 | return (int)self->ob_itself; |
| 2182 | } |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2183 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2184 | PyTypeObject Window_Type = { |
| 2185 | PyObject_HEAD_INIT(&PyType_Type) |
| 2186 | 0, /*ob_size*/ |
| 2187 | "Window", /*tp_name*/ |
| 2188 | sizeof(WindowObject), /*tp_basicsize*/ |
| 2189 | 0, /*tp_itemsize*/ |
| 2190 | /* methods */ |
| 2191 | (destructor) WinObj_dealloc, /*tp_dealloc*/ |
| 2192 | 0, /*tp_print*/ |
| 2193 | (getattrfunc) WinObj_getattr, /*tp_getattr*/ |
| 2194 | (setattrfunc) WinObj_setattr, /*tp_setattr*/ |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2195 | (cmpfunc) WinObj_compare, /*tp_compare*/ |
| 2196 | (reprfunc) WinObj_repr, /*tp_repr*/ |
| 2197 | (PyNumberMethods *)0, /* tp_as_number */ |
| 2198 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 2199 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 2200 | (hashfunc) WinObj_hash, /*tp_hash*/ |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2201 | }; |
| 2202 | |
| 2203 | /* --------------------- End object type Window --------------------- */ |
| 2204 | |
| 2205 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2206 | static PyObject *Win_GetNewCWindow(_self, _args) |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2207 | PyObject *_self; |
| 2208 | PyObject *_args; |
| 2209 | { |
| 2210 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2211 | WindowPtr _rv; |
| 2212 | short windowID; |
| 2213 | WindowPtr behind; |
| 2214 | if (!PyArg_ParseTuple(_args, "hO&", |
| 2215 | &windowID, |
| 2216 | WinObj_Convert, &behind)) |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2217 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2218 | _rv = GetNewCWindow(windowID, |
| 2219 | (void *)0, |
| 2220 | behind); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2221 | _res = Py_BuildValue("O&", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2222 | WinObj_New, _rv); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2223 | return _res; |
| 2224 | } |
| 2225 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2226 | static PyObject *Win_NewWindow(_self, _args) |
| 2227 | PyObject *_self; |
| 2228 | PyObject *_args; |
| 2229 | { |
| 2230 | PyObject *_res = NULL; |
| 2231 | WindowPtr _rv; |
| 2232 | Rect boundsRect; |
| 2233 | Str255 title; |
| 2234 | Boolean visible; |
| 2235 | short theProc; |
| 2236 | WindowPtr behind; |
| 2237 | Boolean goAwayFlag; |
| 2238 | long refCon; |
| 2239 | if (!PyArg_ParseTuple(_args, "O&O&bhO&bl", |
| 2240 | PyMac_GetRect, &boundsRect, |
| 2241 | PyMac_GetStr255, title, |
| 2242 | &visible, |
| 2243 | &theProc, |
| 2244 | WinObj_Convert, &behind, |
| 2245 | &goAwayFlag, |
| 2246 | &refCon)) |
| 2247 | return NULL; |
| 2248 | _rv = NewWindow((void *)0, |
| 2249 | &boundsRect, |
| 2250 | title, |
| 2251 | visible, |
| 2252 | theProc, |
| 2253 | behind, |
| 2254 | goAwayFlag, |
| 2255 | refCon); |
| 2256 | _res = Py_BuildValue("O&", |
| 2257 | WinObj_New, _rv); |
| 2258 | return _res; |
| 2259 | } |
| 2260 | |
| 2261 | static PyObject *Win_GetNewWindow(_self, _args) |
| 2262 | PyObject *_self; |
| 2263 | PyObject *_args; |
| 2264 | { |
| 2265 | PyObject *_res = NULL; |
| 2266 | WindowPtr _rv; |
| 2267 | short windowID; |
| 2268 | WindowPtr behind; |
| 2269 | if (!PyArg_ParseTuple(_args, "hO&", |
| 2270 | &windowID, |
| 2271 | WinObj_Convert, &behind)) |
| 2272 | return NULL; |
| 2273 | _rv = GetNewWindow(windowID, |
| 2274 | (void *)0, |
| 2275 | behind); |
| 2276 | _res = Py_BuildValue("O&", |
| 2277 | WinObj_New, _rv); |
| 2278 | return _res; |
| 2279 | } |
| 2280 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2281 | static PyObject *Win_NewCWindow(_self, _args) |
| 2282 | PyObject *_self; |
| 2283 | PyObject *_args; |
| 2284 | { |
| 2285 | PyObject *_res = NULL; |
| 2286 | WindowPtr _rv; |
| 2287 | Rect boundsRect; |
| 2288 | Str255 title; |
| 2289 | Boolean visible; |
| 2290 | short procID; |
| 2291 | WindowPtr behind; |
| 2292 | Boolean goAwayFlag; |
| 2293 | long refCon; |
| 2294 | if (!PyArg_ParseTuple(_args, "O&O&bhO&bl", |
| 2295 | PyMac_GetRect, &boundsRect, |
| 2296 | PyMac_GetStr255, title, |
| 2297 | &visible, |
| 2298 | &procID, |
| 2299 | WinObj_Convert, &behind, |
| 2300 | &goAwayFlag, |
| 2301 | &refCon)) |
| 2302 | return NULL; |
| 2303 | _rv = NewCWindow((void *)0, |
| 2304 | &boundsRect, |
| 2305 | title, |
| 2306 | visible, |
| 2307 | procID, |
| 2308 | behind, |
| 2309 | goAwayFlag, |
| 2310 | refCon); |
| 2311 | _res = Py_BuildValue("O&", |
| 2312 | WinObj_New, _rv); |
| 2313 | return _res; |
| 2314 | } |
| 2315 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2316 | static PyObject *Win_CreateNewWindow(_self, _args) |
| 2317 | PyObject *_self; |
| 2318 | PyObject *_args; |
| 2319 | { |
| 2320 | PyObject *_res = NULL; |
| 2321 | OSStatus _err; |
| 2322 | WindowClass windowClass; |
| 2323 | WindowAttributes attributes; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2324 | Rect contentBounds; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2325 | WindowPtr outWindow; |
| 2326 | if (!PyArg_ParseTuple(_args, "llO&", |
| 2327 | &windowClass, |
| 2328 | &attributes, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2329 | PyMac_GetRect, &contentBounds)) |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2330 | return NULL; |
| 2331 | _err = CreateNewWindow(windowClass, |
| 2332 | attributes, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2333 | &contentBounds, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2334 | &outWindow); |
| 2335 | if (_err != noErr) return PyMac_Error(_err); |
| 2336 | _res = Py_BuildValue("O&", |
| 2337 | WinObj_WhichWindow, outWindow); |
| 2338 | return _res; |
| 2339 | } |
| 2340 | |
| 2341 | static PyObject *Win_CreateWindowFromResource(_self, _args) |
| 2342 | PyObject *_self; |
| 2343 | PyObject *_args; |
| 2344 | { |
| 2345 | PyObject *_res = NULL; |
| 2346 | OSStatus _err; |
| 2347 | SInt16 resID; |
| 2348 | WindowPtr outWindow; |
| 2349 | if (!PyArg_ParseTuple(_args, "h", |
| 2350 | &resID)) |
| 2351 | return NULL; |
| 2352 | _err = CreateWindowFromResource(resID, |
| 2353 | &outWindow); |
| 2354 | if (_err != noErr) return PyMac_Error(_err); |
| 2355 | _res = Py_BuildValue("O&", |
| 2356 | WinObj_WhichWindow, outWindow); |
| 2357 | return _res; |
| 2358 | } |
| 2359 | |
| 2360 | static PyObject *Win_ShowFloatingWindows(_self, _args) |
| 2361 | PyObject *_self; |
| 2362 | PyObject *_args; |
| 2363 | { |
| 2364 | PyObject *_res = NULL; |
| 2365 | OSStatus _err; |
| 2366 | if (!PyArg_ParseTuple(_args, "")) |
| 2367 | return NULL; |
| 2368 | _err = ShowFloatingWindows(); |
| 2369 | if (_err != noErr) return PyMac_Error(_err); |
| 2370 | Py_INCREF(Py_None); |
| 2371 | _res = Py_None; |
| 2372 | return _res; |
| 2373 | } |
| 2374 | |
| 2375 | static PyObject *Win_HideFloatingWindows(_self, _args) |
| 2376 | PyObject *_self; |
| 2377 | PyObject *_args; |
| 2378 | { |
| 2379 | PyObject *_res = NULL; |
| 2380 | OSStatus _err; |
| 2381 | if (!PyArg_ParseTuple(_args, "")) |
| 2382 | return NULL; |
| 2383 | _err = HideFloatingWindows(); |
| 2384 | if (_err != noErr) return PyMac_Error(_err); |
| 2385 | Py_INCREF(Py_None); |
| 2386 | _res = Py_None; |
| 2387 | return _res; |
| 2388 | } |
| 2389 | |
| 2390 | static PyObject *Win_AreFloatingWindowsVisible(_self, _args) |
| 2391 | PyObject *_self; |
| 2392 | PyObject *_args; |
| 2393 | { |
| 2394 | PyObject *_res = NULL; |
| 2395 | Boolean _rv; |
| 2396 | if (!PyArg_ParseTuple(_args, "")) |
| 2397 | return NULL; |
| 2398 | _rv = AreFloatingWindowsVisible(); |
| 2399 | _res = Py_BuildValue("b", |
| 2400 | _rv); |
| 2401 | return _res; |
| 2402 | } |
| 2403 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2404 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2405 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2406 | static PyObject *Win_SetDeskCPat(_self, _args) |
| 2407 | PyObject *_self; |
| 2408 | PyObject *_args; |
| 2409 | { |
| 2410 | PyObject *_res = NULL; |
| 2411 | PixPatHandle deskPixPat; |
| 2412 | if (!PyArg_ParseTuple(_args, "O&", |
| 2413 | ResObj_Convert, &deskPixPat)) |
| 2414 | return NULL; |
| 2415 | SetDeskCPat(deskPixPat); |
| 2416 | Py_INCREF(Py_None); |
| 2417 | _res = Py_None; |
| 2418 | return _res; |
| 2419 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2420 | #endif |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2421 | |
| 2422 | static PyObject *Win_CheckUpdate(_self, _args) |
| 2423 | PyObject *_self; |
| 2424 | PyObject *_args; |
| 2425 | { |
| 2426 | PyObject *_res = NULL; |
| 2427 | Boolean _rv; |
| 2428 | EventRecord theEvent; |
| 2429 | if (!PyArg_ParseTuple(_args, "")) |
| 2430 | return NULL; |
| 2431 | _rv = CheckUpdate(&theEvent); |
| 2432 | _res = Py_BuildValue("bO&", |
| 2433 | _rv, |
| 2434 | PyMac_BuildEventRecord, &theEvent); |
| 2435 | return _res; |
| 2436 | } |
| 2437 | |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 2438 | static PyObject *Win_MacFindWindow(_self, _args) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2439 | PyObject *_self; |
| 2440 | PyObject *_args; |
| 2441 | { |
| 2442 | PyObject *_res = NULL; |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2443 | WindowPartCode _rv; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2444 | Point thePoint; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2445 | WindowPtr window; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2446 | if (!PyArg_ParseTuple(_args, "O&", |
| 2447 | PyMac_GetPoint, &thePoint)) |
| 2448 | return NULL; |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 2449 | _rv = MacFindWindow(thePoint, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2450 | &window); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2451 | _res = Py_BuildValue("hO&", |
| 2452 | _rv, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2453 | WinObj_WhichWindow, window); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2454 | return _res; |
| 2455 | } |
| 2456 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2457 | static PyObject *Win_FrontWindow(_self, _args) |
| 2458 | PyObject *_self; |
| 2459 | PyObject *_args; |
| 2460 | { |
| 2461 | PyObject *_res = NULL; |
| 2462 | WindowPtr _rv; |
| 2463 | if (!PyArg_ParseTuple(_args, "")) |
| 2464 | return NULL; |
| 2465 | _rv = FrontWindow(); |
| 2466 | _res = Py_BuildValue("O&", |
Guido van Rossum | ea39abd | 1995-02-28 09:49:02 +0000 | [diff] [blame] | 2467 | WinObj_WhichWindow, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2468 | return _res; |
| 2469 | } |
| 2470 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2471 | static PyObject *Win_FrontNonFloatingWindow(_self, _args) |
| 2472 | PyObject *_self; |
| 2473 | PyObject *_args; |
| 2474 | { |
| 2475 | PyObject *_res = NULL; |
| 2476 | WindowPtr _rv; |
| 2477 | if (!PyArg_ParseTuple(_args, "")) |
| 2478 | return NULL; |
| 2479 | _rv = FrontNonFloatingWindow(); |
| 2480 | _res = Py_BuildValue("O&", |
| 2481 | WinObj_WhichWindow, _rv); |
| 2482 | return _res; |
| 2483 | } |
| 2484 | |
| 2485 | #if TARGET_API_MAC_CARBON |
| 2486 | |
| 2487 | static PyObject *Win_GetFrontWindowOfClass(_self, _args) |
| 2488 | PyObject *_self; |
| 2489 | PyObject *_args; |
| 2490 | { |
| 2491 | PyObject *_res = NULL; |
| 2492 | WindowPtr _rv; |
| 2493 | WindowClass inWindowClass; |
| 2494 | Boolean mustBeVisible; |
| 2495 | if (!PyArg_ParseTuple(_args, "lb", |
| 2496 | &inWindowClass, |
| 2497 | &mustBeVisible)) |
| 2498 | return NULL; |
| 2499 | _rv = GetFrontWindowOfClass(inWindowClass, |
| 2500 | mustBeVisible); |
| 2501 | _res = Py_BuildValue("O&", |
| 2502 | WinObj_New, _rv); |
| 2503 | return _res; |
| 2504 | } |
| 2505 | #endif |
| 2506 | |
| 2507 | #if TARGET_API_MAC_CARBON |
| 2508 | |
| 2509 | static PyObject *Win_FindWindowOfClass(_self, _args) |
| 2510 | PyObject *_self; |
| 2511 | PyObject *_args; |
| 2512 | { |
| 2513 | PyObject *_res = NULL; |
| 2514 | OSStatus _err; |
| 2515 | Point where; |
| 2516 | WindowClass inWindowClass; |
| 2517 | WindowPtr outWindow; |
| 2518 | WindowPartCode outWindowPart; |
| 2519 | if (!PyArg_ParseTuple(_args, "O&l", |
| 2520 | PyMac_GetPoint, &where, |
| 2521 | &inWindowClass)) |
| 2522 | return NULL; |
| 2523 | _err = FindWindowOfClass(&where, |
| 2524 | inWindowClass, |
| 2525 | &outWindow, |
| 2526 | &outWindowPart); |
| 2527 | if (_err != noErr) return PyMac_Error(_err); |
| 2528 | _res = Py_BuildValue("O&h", |
| 2529 | WinObj_WhichWindow, outWindow, |
| 2530 | outWindowPart); |
| 2531 | return _res; |
| 2532 | } |
| 2533 | #endif |
| 2534 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2535 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2536 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2537 | static PyObject *Win_InitWindows(_self, _args) |
| 2538 | PyObject *_self; |
| 2539 | PyObject *_args; |
| 2540 | { |
| 2541 | PyObject *_res = NULL; |
| 2542 | if (!PyArg_ParseTuple(_args, "")) |
| 2543 | return NULL; |
| 2544 | InitWindows(); |
| 2545 | Py_INCREF(Py_None); |
| 2546 | _res = Py_None; |
| 2547 | return _res; |
| 2548 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2549 | #endif |
| 2550 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2551 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2552 | |
| 2553 | static PyObject *Win_GetWMgrPort(_self, _args) |
| 2554 | PyObject *_self; |
| 2555 | PyObject *_args; |
| 2556 | { |
| 2557 | PyObject *_res = NULL; |
| 2558 | GrafPtr wPort; |
| 2559 | if (!PyArg_ParseTuple(_args, "")) |
| 2560 | return NULL; |
| 2561 | GetWMgrPort(&wPort); |
| 2562 | _res = Py_BuildValue("O&", |
| 2563 | GrafObj_New, wPort); |
| 2564 | return _res; |
| 2565 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2566 | #endif |
| 2567 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2568 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2569 | |
| 2570 | static PyObject *Win_GetCWMgrPort(_self, _args) |
| 2571 | PyObject *_self; |
| 2572 | PyObject *_args; |
| 2573 | { |
| 2574 | PyObject *_res = NULL; |
| 2575 | CGrafPtr wMgrCPort; |
| 2576 | if (!PyArg_ParseTuple(_args, "")) |
| 2577 | return NULL; |
| 2578 | GetCWMgrPort(&wMgrCPort); |
| 2579 | _res = Py_BuildValue("O&", |
| 2580 | GrafObj_New, wMgrCPort); |
| 2581 | return _res; |
| 2582 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2583 | #endif |
| 2584 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2585 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2586 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2587 | static PyObject *Win_InitFloatingWindows(_self, _args) |
| 2588 | PyObject *_self; |
| 2589 | PyObject *_args; |
| 2590 | { |
| 2591 | PyObject *_res = NULL; |
| 2592 | OSStatus _err; |
| 2593 | if (!PyArg_ParseTuple(_args, "")) |
| 2594 | return NULL; |
| 2595 | _err = InitFloatingWindows(); |
| 2596 | if (_err != noErr) return PyMac_Error(_err); |
| 2597 | Py_INCREF(Py_None); |
| 2598 | _res = Py_None; |
| 2599 | return _res; |
| 2600 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2601 | #endif |
| 2602 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2603 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2604 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2605 | static PyObject *Win_InvalRect(_self, _args) |
| 2606 | PyObject *_self; |
| 2607 | PyObject *_args; |
| 2608 | { |
| 2609 | PyObject *_res = NULL; |
| 2610 | Rect badRect; |
| 2611 | if (!PyArg_ParseTuple(_args, "O&", |
| 2612 | PyMac_GetRect, &badRect)) |
| 2613 | return NULL; |
| 2614 | InvalRect(&badRect); |
| 2615 | Py_INCREF(Py_None); |
| 2616 | _res = Py_None; |
| 2617 | return _res; |
| 2618 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2619 | #endif |
| 2620 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2621 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2622 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2623 | static PyObject *Win_InvalRgn(_self, _args) |
| 2624 | PyObject *_self; |
| 2625 | PyObject *_args; |
| 2626 | { |
| 2627 | PyObject *_res = NULL; |
| 2628 | RgnHandle badRgn; |
| 2629 | if (!PyArg_ParseTuple(_args, "O&", |
| 2630 | ResObj_Convert, &badRgn)) |
| 2631 | return NULL; |
| 2632 | InvalRgn(badRgn); |
| 2633 | Py_INCREF(Py_None); |
| 2634 | _res = Py_None; |
| 2635 | return _res; |
| 2636 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2637 | #endif |
| 2638 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2639 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2640 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2641 | static PyObject *Win_ValidRect(_self, _args) |
| 2642 | PyObject *_self; |
| 2643 | PyObject *_args; |
| 2644 | { |
| 2645 | PyObject *_res = NULL; |
| 2646 | Rect goodRect; |
| 2647 | if (!PyArg_ParseTuple(_args, "O&", |
| 2648 | PyMac_GetRect, &goodRect)) |
| 2649 | return NULL; |
| 2650 | ValidRect(&goodRect); |
| 2651 | Py_INCREF(Py_None); |
| 2652 | _res = Py_None; |
| 2653 | return _res; |
| 2654 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2655 | #endif |
| 2656 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2657 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2658 | |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2659 | static PyObject *Win_ValidRgn(_self, _args) |
| 2660 | PyObject *_self; |
| 2661 | PyObject *_args; |
| 2662 | { |
| 2663 | PyObject *_res = NULL; |
| 2664 | RgnHandle goodRgn; |
| 2665 | if (!PyArg_ParseTuple(_args, "O&", |
| 2666 | ResObj_Convert, &goodRgn)) |
| 2667 | return NULL; |
| 2668 | ValidRgn(goodRgn); |
| 2669 | Py_INCREF(Py_None); |
| 2670 | _res = Py_None; |
| 2671 | return _res; |
| 2672 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2673 | #endif |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2674 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2675 | static PyObject *Win_CollapseAllWindows(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2676 | PyObject *_self; |
| 2677 | PyObject *_args; |
| 2678 | { |
| 2679 | PyObject *_res = NULL; |
Jack Jansen | e4349e8 | 1999-03-04 22:53:24 +0000 | [diff] [blame] | 2680 | OSStatus _err; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2681 | Boolean collapse; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2682 | if (!PyArg_ParseTuple(_args, "b", |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2683 | &collapse)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2684 | return NULL; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2685 | _err = CollapseAllWindows(collapse); |
Jack Jansen | e4349e8 | 1999-03-04 22:53:24 +0000 | [diff] [blame] | 2686 | if (_err != noErr) return PyMac_Error(_err); |
| 2687 | Py_INCREF(Py_None); |
| 2688 | _res = Py_None; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2689 | return _res; |
| 2690 | } |
| 2691 | |
| 2692 | static PyObject *Win_PinRect(_self, _args) |
| 2693 | PyObject *_self; |
| 2694 | PyObject *_args; |
| 2695 | { |
| 2696 | PyObject *_res = NULL; |
| 2697 | long _rv; |
| 2698 | Rect theRect; |
| 2699 | Point thePt; |
| 2700 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2701 | PyMac_GetRect, &theRect, |
| 2702 | PyMac_GetPoint, &thePt)) |
| 2703 | return NULL; |
| 2704 | _rv = PinRect(&theRect, |
| 2705 | thePt); |
| 2706 | _res = Py_BuildValue("l", |
| 2707 | _rv); |
| 2708 | return _res; |
| 2709 | } |
| 2710 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2711 | static PyObject *Win_GetGrayRgn(_self, _args) |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2712 | PyObject *_self; |
| 2713 | PyObject *_args; |
| 2714 | { |
| 2715 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2716 | RgnHandle _rv; |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2717 | if (!PyArg_ParseTuple(_args, "")) |
| 2718 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2719 | _rv = GetGrayRgn(); |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2720 | _res = Py_BuildValue("O&", |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2721 | ResObj_New, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2722 | return _res; |
| 2723 | } |
| 2724 | |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2725 | static PyObject *Win_GetWindowFromPort(_self, _args) |
| 2726 | PyObject *_self; |
| 2727 | PyObject *_args; |
| 2728 | { |
| 2729 | PyObject *_res = NULL; |
| 2730 | WindowPtr _rv; |
| 2731 | CGrafPtr port; |
| 2732 | if (!PyArg_ParseTuple(_args, "O&", |
| 2733 | GrafObj_Convert, &port)) |
| 2734 | return NULL; |
| 2735 | _rv = GetWindowFromPort(port); |
| 2736 | _res = Py_BuildValue("O&", |
| 2737 | WinObj_New, _rv); |
| 2738 | return _res; |
| 2739 | } |
| 2740 | |
Jack Jansen | d4c2646 | 1995-08-17 14:35:56 +0000 | [diff] [blame] | 2741 | static PyObject *Win_WhichWindow(_self, _args) |
| 2742 | PyObject *_self; |
| 2743 | PyObject *_args; |
| 2744 | { |
| 2745 | PyObject *_res = NULL; |
| 2746 | |
| 2747 | long ptr; |
| 2748 | |
| 2749 | if ( !PyArg_ParseTuple(_args, "i", &ptr) ) |
| 2750 | return NULL; |
| 2751 | return WinObj_WhichWindow((WindowPtr)ptr); |
| 2752 | |
| 2753 | } |
| 2754 | |
Jack Jansen | e180d99 | 1998-04-24 10:28:20 +0000 | [diff] [blame] | 2755 | static PyObject *Win_FindWindow(_self, _args) |
| 2756 | PyObject *_self; |
| 2757 | PyObject *_args; |
| 2758 | { |
| 2759 | PyObject *_res = NULL; |
| 2760 | short _rv; |
| 2761 | Point thePoint; |
| 2762 | WindowPtr theWindow; |
| 2763 | if (!PyArg_ParseTuple(_args, "O&", |
| 2764 | PyMac_GetPoint, &thePoint)) |
| 2765 | return NULL; |
| 2766 | _rv = FindWindow(thePoint, |
| 2767 | &theWindow); |
| 2768 | _res = Py_BuildValue("hO&", |
| 2769 | _rv, |
| 2770 | WinObj_WhichWindow, theWindow); |
| 2771 | return _res; |
| 2772 | } |
| 2773 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2774 | static PyMethodDef Win_methods[] = { |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2775 | {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1, |
| 2776 | "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2777 | {"NewWindow", (PyCFunction)Win_NewWindow, 1, |
| 2778 | "(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, |
| 2779 | {"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1, |
| 2780 | "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2781 | {"NewCWindow", (PyCFunction)Win_NewCWindow, 1, |
| 2782 | "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2783 | {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2784 | "(WindowClass windowClass, WindowAttributes attributes, Rect contentBounds) -> (WindowPtr outWindow)"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2785 | {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1, |
| 2786 | "(SInt16 resID) -> (WindowPtr outWindow)"}, |
| 2787 | {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1, |
| 2788 | "() -> None"}, |
| 2789 | {"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1, |
| 2790 | "() -> None"}, |
| 2791 | {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1, |
| 2792 | "() -> (Boolean _rv)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2793 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2794 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2795 | {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, |
| 2796 | "(PixPatHandle deskPixPat) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2797 | #endif |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2798 | {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, |
| 2799 | "() -> (Boolean _rv, EventRecord theEvent)"}, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 2800 | {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2801 | "(Point thePoint) -> (WindowPartCode _rv, WindowPtr window)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2802 | {"FrontWindow", (PyCFunction)Win_FrontWindow, 1, |
| 2803 | "() -> (WindowPtr _rv)"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2804 | {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, |
| 2805 | "() -> (WindowPtr _rv)"}, |
| 2806 | |
| 2807 | #if TARGET_API_MAC_CARBON |
| 2808 | {"GetFrontWindowOfClass", (PyCFunction)Win_GetFrontWindowOfClass, 1, |
| 2809 | "(WindowClass inWindowClass, Boolean mustBeVisible) -> (WindowPtr _rv)"}, |
| 2810 | #endif |
| 2811 | |
| 2812 | #if TARGET_API_MAC_CARBON |
| 2813 | {"FindWindowOfClass", (PyCFunction)Win_FindWindowOfClass, 1, |
| 2814 | "(Point where, WindowClass inWindowClass) -> (WindowPtr outWindow, WindowPartCode outWindowPart)"}, |
| 2815 | #endif |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2816 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2817 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2818 | {"InitWindows", (PyCFunction)Win_InitWindows, 1, |
| 2819 | "() -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2820 | #endif |
| 2821 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2822 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2823 | {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1, |
| 2824 | "() -> (GrafPtr wPort)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2825 | #endif |
| 2826 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2827 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2828 | {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1, |
| 2829 | "() -> (CGrafPtr wMgrCPort)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2830 | #endif |
| 2831 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2832 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2833 | {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1, |
| 2834 | "() -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2835 | #endif |
| 2836 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2837 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2838 | {"InvalRect", (PyCFunction)Win_InvalRect, 1, |
| 2839 | "(Rect badRect) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2840 | #endif |
| 2841 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2842 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2843 | {"InvalRgn", (PyCFunction)Win_InvalRgn, 1, |
| 2844 | "(RgnHandle badRgn) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2845 | #endif |
| 2846 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2847 | #if !TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2848 | {"ValidRect", (PyCFunction)Win_ValidRect, 1, |
| 2849 | "(Rect goodRect) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2850 | #endif |
| 2851 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 2852 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | b7abb18 | 1995-11-15 15:18:47 +0000 | [diff] [blame] | 2853 | {"ValidRgn", (PyCFunction)Win_ValidRgn, 1, |
| 2854 | "(RgnHandle goodRgn) -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 2855 | #endif |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2856 | {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 2857 | "(Boolean collapse) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2858 | {"PinRect", (PyCFunction)Win_PinRect, 1, |
| 2859 | "(Rect theRect, Point thePt) -> (long _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 2860 | {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, |
| 2861 | "() -> (RgnHandle _rv)"}, |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2862 | {"GetWindowFromPort", (PyCFunction)Win_GetWindowFromPort, 1, |
| 2863 | "(CGrafPtr port) -> (WindowPtr _rv)"}, |
Jack Jansen | d4c2646 | 1995-08-17 14:35:56 +0000 | [diff] [blame] | 2864 | {"WhichWindow", (PyCFunction)Win_WhichWindow, 1, |
| 2865 | "Resolve an integer WindowPtr address to a Window object"}, |
Jack Jansen | e180d99 | 1998-04-24 10:28:20 +0000 | [diff] [blame] | 2866 | {"FindWindow", (PyCFunction)Win_FindWindow, 1, |
| 2867 | "(Point thePoint) -> (short _rv, WindowPtr theWindow)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2868 | {NULL, NULL, 0} |
| 2869 | }; |
| 2870 | |
| 2871 | |
| 2872 | |
| 2873 | /* Return the object corresponding to the window, or NULL */ |
| 2874 | |
| 2875 | PyObject * |
| 2876 | WinObj_WhichWindow(w) |
| 2877 | WindowPtr w; |
| 2878 | { |
| 2879 | PyObject *it; |
| 2880 | |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 2881 | if (w == NULL) { |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2882 | it = Py_None; |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 2883 | Py_INCREF(it); |
| 2884 | } else { |
| 2885 | it = (PyObject *) GetWRefCon(w); |
Jack Jansen | 80716f0 | 2000-12-14 22:29:00 +0000 | [diff] [blame] | 2886 | if (it == NULL || ((WindowObject *)it)->ob_itself != w || !WinObj_Check(it)) { |
Jack Jansen | 0aee0e6 | 2000-08-25 22:17:51 +0000 | [diff] [blame] | 2887 | it = WinObj_New(w); |
| 2888 | ((WindowObject *)it)->ob_freeit = NULL; |
| 2889 | } else { |
| 2890 | Py_INCREF(it); |
| 2891 | } |
| 2892 | } |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2893 | return it; |
| 2894 | } |
| 2895 | |
| 2896 | |
| 2897 | void initWin() |
| 2898 | { |
| 2899 | PyObject *m; |
| 2900 | PyObject *d; |
| 2901 | |
| 2902 | |
| 2903 | |
| 2904 | |
| 2905 | m = Py_InitModule("Win", Win_methods); |
| 2906 | d = PyModule_GetDict(m); |
| 2907 | Win_Error = PyMac_GetOSErrException(); |
| 2908 | if (Win_Error == NULL || |
| 2909 | PyDict_SetItemString(d, "Error", Win_Error) != 0) |
Jack Jansen | 723ad8a | 2000-12-12 22:10:21 +0000 | [diff] [blame] | 2910 | return; |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 2911 | Window_Type.ob_type = &PyType_Type; |
| 2912 | Py_INCREF(&Window_Type); |
| 2913 | if (PyDict_SetItemString(d, "WindowType", (PyObject *)&Window_Type) != 0) |
| 2914 | Py_FatalError("can't initialize WindowType"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 2915 | } |
| 2916 | |
| 2917 | /* ========================= End module Win ========================= */ |
| 2918 | |