Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* =========================== Module Dlg =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #define SystemSevenOrLater 1 |
| 9 | |
| 10 | #include "macglue.h" |
| 11 | #include <Memory.h> |
| 12 | #include <Dialogs.h> |
| 13 | #include <Menus.h> |
| 14 | #include <Controls.h> |
| 15 | |
| 16 | extern PyObject *ResObj_New(Handle); |
| 17 | extern int ResObj_Convert(PyObject *, Handle *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 18 | extern PyObject *OptResObj_New(Handle); |
| 19 | extern int OptResObj_Convert(PyObject *, Handle *); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 20 | |
| 21 | extern PyObject *WinObj_New(WindowPtr); |
| 22 | extern int WinObj_Convert(PyObject *, WindowPtr *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 23 | extern PyTypeObject Window_Type; |
| 24 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 25 | |
| 26 | extern PyObject *DlgObj_New(DialogPtr); |
| 27 | extern int DlgObj_Convert(PyObject *, DialogPtr *); |
| 28 | extern PyTypeObject Dialog_Type; |
| 29 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 30 | |
| 31 | extern PyObject *MenuObj_New(MenuHandle); |
| 32 | extern int MenuObj_Convert(PyObject *, MenuHandle *); |
| 33 | |
| 34 | extern PyObject *CtlObj_New(ControlHandle); |
| 35 | extern int CtlObj_Convert(PyObject *, ControlHandle *); |
| 36 | |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 37 | extern PyObject *GrafObj_New(GrafPtr); |
| 38 | extern int GrafObj_Convert(PyObject *, GrafPtr *); |
| 39 | |
| 40 | extern PyObject *BMObj_New(BitMapPtr); |
| 41 | extern int BMObj_Convert(PyObject *, BitMapPtr *); |
| 42 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 43 | extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
| 45 | #include <Dialogs.h> |
| 46 | |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 47 | #ifndef HAVE_UNIVERSAL_HEADERS |
| 48 | #define NewModalFilterProc(x) (x) |
| 49 | #endif |
| 50 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 51 | #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ |
| 52 | |
| 53 | /* XXX Shouldn't this be a stack? */ |
| 54 | static PyObject *Dlg_FilterProc_callback = NULL; |
| 55 | |
| 56 | static PyObject *DlgObj_New(DialogPtr); /* Forward */ |
| 57 | |
| 58 | static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, |
| 59 | EventRecord *event, |
| 60 | short *itemHit) |
| 61 | { |
| 62 | Boolean rv; |
| 63 | PyObject *args, *res; |
| 64 | PyObject *callback = Dlg_FilterProc_callback; |
| 65 | if (callback == NULL) |
| 66 | return 0; /* Default behavior */ |
| 67 | Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */ |
Guido van Rossum | 0437e89 | 1995-02-21 20:56:21 +0000 | [diff] [blame] | 68 | args = Py_BuildValue("O&O&", WinObj_WhichWindow, dialog, PyMac_BuildEventRecord, event); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 69 | if (args == NULL) |
| 70 | res = NULL; |
| 71 | else { |
| 72 | res = PyEval_CallObject(callback, args); |
| 73 | Py_DECREF(args); |
| 74 | } |
| 75 | if (res == NULL) { |
| 76 | fprintf(stderr, "Exception in Dialog Filter\n"); |
| 77 | PyErr_Print(); |
| 78 | *itemHit = -1; /* Fake return item */ |
| 79 | return 1; /* We handled it */ |
| 80 | } |
| 81 | else { |
| 82 | Dlg_FilterProc_callback = callback; |
| 83 | if (PyInt_Check(res)) { |
| 84 | *itemHit = PyInt_AsLong(res); |
| 85 | rv = 1; |
| 86 | } |
| 87 | else |
| 88 | rv = PyObject_IsTrue(res); |
| 89 | } |
| 90 | Py_DECREF(res); |
| 91 | return rv; |
| 92 | } |
| 93 | |
| 94 | static ModalFilterProcPtr |
| 95 | Dlg_PassFilterProc(PyObject *callback) |
| 96 | { |
| 97 | PyObject *tmp = Dlg_FilterProc_callback; |
| 98 | Dlg_FilterProc_callback = NULL; |
| 99 | if (callback == Py_None) { |
| 100 | Py_XDECREF(tmp); |
| 101 | return NULL; |
| 102 | } |
| 103 | Py_INCREF(callback); |
| 104 | Dlg_FilterProc_callback = callback; |
| 105 | Py_XDECREF(tmp); |
| 106 | return &Dlg_UnivFilterProc; |
| 107 | } |
| 108 | |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 109 | static PyObject *Dlg_UserItemProc_callback = NULL; |
| 110 | |
| 111 | static pascal void Dlg_UnivUserItemProc(DialogPtr dialog, |
| 112 | short item) |
| 113 | { |
| 114 | PyObject *args, *res; |
| 115 | |
| 116 | if (Dlg_UserItemProc_callback == NULL) |
| 117 | return; /* Default behavior */ |
| 118 | Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */ |
| 119 | args = Py_BuildValue("O&h", WinObj_WhichWindow, dialog, item); |
| 120 | if (args == NULL) |
| 121 | res = NULL; |
| 122 | else { |
| 123 | res = PyEval_CallObject(Dlg_UserItemProc_callback, args); |
| 124 | Py_DECREF(args); |
| 125 | } |
| 126 | if (res == NULL) { |
| 127 | fprintf(stderr, "Exception in Dialog UserItem proc\n"); |
| 128 | PyErr_Print(); |
| 129 | } |
| 130 | Py_XDECREF(res); |
| 131 | return; |
| 132 | } |
| 133 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 134 | extern PyMethodChain WinObj_chain; |
| 135 | |
| 136 | static PyObject *Dlg_Error; |
| 137 | |
| 138 | /* ----------------------- Object type Dialog ----------------------- */ |
| 139 | |
| 140 | PyTypeObject Dialog_Type; |
| 141 | |
| 142 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 143 | |
| 144 | typedef struct DialogObject { |
| 145 | PyObject_HEAD |
| 146 | DialogPtr ob_itself; |
| 147 | } DialogObject; |
| 148 | |
| 149 | PyObject *DlgObj_New(itself) |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 150 | DialogPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 151 | { |
| 152 | DialogObject *it; |
| 153 | if (itself == NULL) return Py_None; |
| 154 | it = PyObject_NEW(DialogObject, &Dialog_Type); |
| 155 | if (it == NULL) return NULL; |
| 156 | it->ob_itself = itself; |
| 157 | SetWRefCon(itself, (long)it); |
| 158 | return (PyObject *)it; |
| 159 | } |
| 160 | DlgObj_Convert(v, p_itself) |
| 161 | PyObject *v; |
| 162 | DialogPtr *p_itself; |
| 163 | { |
| 164 | if (v == Py_None) { *p_itself = NULL; return 1; } |
| 165 | if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v); |
| 166 | return 1; } |
| 167 | if (!DlgObj_Check(v)) |
| 168 | { |
| 169 | PyErr_SetString(PyExc_TypeError, "Dialog required"); |
| 170 | return 0; |
| 171 | } |
| 172 | *p_itself = ((DialogObject *)v)->ob_itself; |
| 173 | return 1; |
| 174 | } |
| 175 | |
| 176 | static void DlgObj_dealloc(self) |
| 177 | DialogObject *self; |
| 178 | { |
| 179 | DisposeDialog(self->ob_itself); |
| 180 | PyMem_DEL(self); |
| 181 | } |
| 182 | |
| 183 | static PyObject *DlgObj_DrawDialog(_self, _args) |
| 184 | DialogObject *_self; |
| 185 | PyObject *_args; |
| 186 | { |
| 187 | PyObject *_res = NULL; |
| 188 | if (!PyArg_ParseTuple(_args, "")) |
| 189 | return NULL; |
| 190 | DrawDialog(_self->ob_itself); |
| 191 | Py_INCREF(Py_None); |
| 192 | _res = Py_None; |
| 193 | return _res; |
| 194 | } |
| 195 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 196 | static PyObject *DlgObj_UpdateDialog(_self, _args) |
| 197 | DialogObject *_self; |
| 198 | PyObject *_args; |
| 199 | { |
| 200 | PyObject *_res = NULL; |
Jack Jansen | 2b72417 | 1996-04-10 14:48:19 +0000 | [diff] [blame] | 201 | RgnHandle updateRgn; |
| 202 | if (!PyArg_ParseTuple(_args, "O&", |
| 203 | ResObj_Convert, &updateRgn)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 204 | return NULL; |
| 205 | UpdateDialog(_self->ob_itself, |
Jack Jansen | 2b72417 | 1996-04-10 14:48:19 +0000 | [diff] [blame] | 206 | updateRgn); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 207 | Py_INCREF(Py_None); |
| 208 | _res = Py_None; |
| 209 | return _res; |
| 210 | } |
| 211 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 212 | static PyObject *DlgObj_HideDialogItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 213 | DialogObject *_self; |
| 214 | PyObject *_args; |
| 215 | { |
| 216 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 217 | DialogItemIndex itemNo; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 218 | if (!PyArg_ParseTuple(_args, "h", |
| 219 | &itemNo)) |
| 220 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 221 | HideDialogItem(_self->ob_itself, |
| 222 | itemNo); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 223 | Py_INCREF(Py_None); |
| 224 | _res = Py_None; |
| 225 | return _res; |
| 226 | } |
| 227 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 228 | static PyObject *DlgObj_ShowDialogItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 229 | DialogObject *_self; |
| 230 | PyObject *_args; |
| 231 | { |
| 232 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 233 | DialogItemIndex itemNo; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 234 | if (!PyArg_ParseTuple(_args, "h", |
| 235 | &itemNo)) |
| 236 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 237 | ShowDialogItem(_self->ob_itself, |
| 238 | itemNo); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 239 | Py_INCREF(Py_None); |
| 240 | _res = Py_None; |
| 241 | return _res; |
| 242 | } |
| 243 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 244 | static PyObject *DlgObj_FindDialogItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 245 | DialogObject *_self; |
| 246 | PyObject *_args; |
| 247 | { |
| 248 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 249 | DialogItemIndexZeroBased _rv; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 250 | Point thePt; |
| 251 | if (!PyArg_ParseTuple(_args, "O&", |
| 252 | PyMac_GetPoint, &thePt)) |
| 253 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 254 | _rv = FindDialogItem(_self->ob_itself, |
| 255 | thePt); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 256 | _res = Py_BuildValue("h", |
| 257 | _rv); |
| 258 | return _res; |
| 259 | } |
| 260 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 261 | static PyObject *DlgObj_DialogCut(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 262 | DialogObject *_self; |
| 263 | PyObject *_args; |
| 264 | { |
| 265 | PyObject *_res = NULL; |
| 266 | if (!PyArg_ParseTuple(_args, "")) |
| 267 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 268 | DialogCut(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 269 | Py_INCREF(Py_None); |
| 270 | _res = Py_None; |
| 271 | return _res; |
| 272 | } |
| 273 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 274 | static PyObject *DlgObj_DialogPaste(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 275 | DialogObject *_self; |
| 276 | PyObject *_args; |
| 277 | { |
| 278 | PyObject *_res = NULL; |
| 279 | if (!PyArg_ParseTuple(_args, "")) |
| 280 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 281 | DialogPaste(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 282 | Py_INCREF(Py_None); |
| 283 | _res = Py_None; |
| 284 | return _res; |
| 285 | } |
| 286 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 287 | static PyObject *DlgObj_DialogCopy(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 288 | DialogObject *_self; |
| 289 | PyObject *_args; |
| 290 | { |
| 291 | PyObject *_res = NULL; |
| 292 | if (!PyArg_ParseTuple(_args, "")) |
| 293 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 294 | DialogCopy(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 295 | Py_INCREF(Py_None); |
| 296 | _res = Py_None; |
| 297 | return _res; |
| 298 | } |
| 299 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 300 | static PyObject *DlgObj_DialogDelete(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 301 | DialogObject *_self; |
| 302 | PyObject *_args; |
| 303 | { |
| 304 | PyObject *_res = NULL; |
| 305 | if (!PyArg_ParseTuple(_args, "")) |
| 306 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 307 | DialogDelete(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 308 | Py_INCREF(Py_None); |
| 309 | _res = Py_None; |
| 310 | return _res; |
| 311 | } |
| 312 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 313 | static PyObject *DlgObj_GetDialogItem(_self, _args) |
| 314 | DialogObject *_self; |
| 315 | PyObject *_args; |
| 316 | { |
| 317 | PyObject *_res = NULL; |
| 318 | DialogItemIndex itemNo; |
| 319 | DialogItemType itemType; |
| 320 | Handle item; |
| 321 | Rect box; |
| 322 | if (!PyArg_ParseTuple(_args, "h", |
| 323 | &itemNo)) |
| 324 | return NULL; |
| 325 | GetDialogItem(_self->ob_itself, |
| 326 | itemNo, |
| 327 | &itemType, |
| 328 | &item, |
| 329 | &box); |
| 330 | _res = Py_BuildValue("hO&O&", |
| 331 | itemType, |
| 332 | OptResObj_New, item, |
| 333 | PyMac_BuildRect, &box); |
| 334 | return _res; |
| 335 | } |
| 336 | |
| 337 | static PyObject *DlgObj_SetDialogItem(_self, _args) |
| 338 | DialogObject *_self; |
| 339 | PyObject *_args; |
| 340 | { |
| 341 | PyObject *_res = NULL; |
| 342 | DialogItemIndex itemNo; |
| 343 | DialogItemType itemType; |
| 344 | Handle item; |
| 345 | Rect box; |
| 346 | if (!PyArg_ParseTuple(_args, "hhO&O&", |
| 347 | &itemNo, |
| 348 | &itemType, |
| 349 | ResObj_Convert, &item, |
| 350 | PyMac_GetRect, &box)) |
| 351 | return NULL; |
| 352 | SetDialogItem(_self->ob_itself, |
| 353 | itemNo, |
| 354 | itemType, |
| 355 | item, |
| 356 | &box); |
| 357 | Py_INCREF(Py_None); |
| 358 | _res = Py_None; |
| 359 | return _res; |
| 360 | } |
| 361 | |
| 362 | static PyObject *DlgObj_SelectDialogItemText(_self, _args) |
| 363 | DialogObject *_self; |
| 364 | PyObject *_args; |
| 365 | { |
| 366 | PyObject *_res = NULL; |
| 367 | DialogItemIndex itemNo; |
| 368 | SInt16 strtSel; |
| 369 | SInt16 endSel; |
| 370 | if (!PyArg_ParseTuple(_args, "hhh", |
| 371 | &itemNo, |
| 372 | &strtSel, |
| 373 | &endSel)) |
| 374 | return NULL; |
| 375 | SelectDialogItemText(_self->ob_itself, |
| 376 | itemNo, |
| 377 | strtSel, |
| 378 | endSel); |
| 379 | Py_INCREF(Py_None); |
| 380 | _res = Py_None; |
| 381 | return _res; |
| 382 | } |
| 383 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 384 | static PyObject *DlgObj_AppendDITL(_self, _args) |
| 385 | DialogObject *_self; |
| 386 | PyObject *_args; |
| 387 | { |
| 388 | PyObject *_res = NULL; |
| 389 | Handle theHandle; |
| 390 | DITLMethod method; |
| 391 | if (!PyArg_ParseTuple(_args, "O&h", |
| 392 | ResObj_Convert, &theHandle, |
| 393 | &method)) |
| 394 | return NULL; |
| 395 | AppendDITL(_self->ob_itself, |
| 396 | theHandle, |
| 397 | method); |
| 398 | Py_INCREF(Py_None); |
| 399 | _res = Py_None; |
| 400 | return _res; |
| 401 | } |
| 402 | |
| 403 | static PyObject *DlgObj_CountDITL(_self, _args) |
| 404 | DialogObject *_self; |
| 405 | PyObject *_args; |
| 406 | { |
| 407 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 408 | DialogItemIndex _rv; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 409 | if (!PyArg_ParseTuple(_args, "")) |
| 410 | return NULL; |
| 411 | _rv = CountDITL(_self->ob_itself); |
| 412 | _res = Py_BuildValue("h", |
| 413 | _rv); |
| 414 | return _res; |
| 415 | } |
| 416 | |
| 417 | static PyObject *DlgObj_ShortenDITL(_self, _args) |
| 418 | DialogObject *_self; |
| 419 | PyObject *_args; |
| 420 | { |
| 421 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 422 | DialogItemIndex numberItems; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 423 | if (!PyArg_ParseTuple(_args, "h", |
| 424 | &numberItems)) |
| 425 | return NULL; |
| 426 | ShortenDITL(_self->ob_itself, |
| 427 | numberItems); |
| 428 | Py_INCREF(Py_None); |
| 429 | _res = Py_None; |
| 430 | return _res; |
| 431 | } |
| 432 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 433 | static PyObject *DlgObj_StdFilterProc(_self, _args) |
| 434 | DialogObject *_self; |
| 435 | PyObject *_args; |
| 436 | { |
| 437 | PyObject *_res = NULL; |
| 438 | Boolean _rv; |
| 439 | EventRecord event; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 440 | DialogItemIndex itemHit; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 441 | if (!PyArg_ParseTuple(_args, "")) |
| 442 | return NULL; |
| 443 | _rv = StdFilterProc(_self->ob_itself, |
| 444 | &event, |
| 445 | &itemHit); |
| 446 | _res = Py_BuildValue("bO&h", |
| 447 | _rv, |
| 448 | PyMac_BuildEventRecord, &event, |
| 449 | itemHit); |
| 450 | return _res; |
| 451 | } |
| 452 | |
| 453 | static PyObject *DlgObj_SetDialogDefaultItem(_self, _args) |
| 454 | DialogObject *_self; |
| 455 | PyObject *_args; |
| 456 | { |
| 457 | PyObject *_res = NULL; |
| 458 | OSErr _err; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 459 | DialogItemIndex newItem; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 460 | if (!PyArg_ParseTuple(_args, "h", |
| 461 | &newItem)) |
| 462 | return NULL; |
| 463 | _err = SetDialogDefaultItem(_self->ob_itself, |
| 464 | newItem); |
| 465 | if (_err != noErr) return PyMac_Error(_err); |
| 466 | Py_INCREF(Py_None); |
| 467 | _res = Py_None; |
| 468 | return _res; |
| 469 | } |
| 470 | |
| 471 | static PyObject *DlgObj_SetDialogCancelItem(_self, _args) |
| 472 | DialogObject *_self; |
| 473 | PyObject *_args; |
| 474 | { |
| 475 | PyObject *_res = NULL; |
| 476 | OSErr _err; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 477 | DialogItemIndex newItem; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 478 | if (!PyArg_ParseTuple(_args, "h", |
| 479 | &newItem)) |
| 480 | return NULL; |
| 481 | _err = SetDialogCancelItem(_self->ob_itself, |
| 482 | newItem); |
| 483 | if (_err != noErr) return PyMac_Error(_err); |
| 484 | Py_INCREF(Py_None); |
| 485 | _res = Py_None; |
| 486 | return _res; |
| 487 | } |
| 488 | |
| 489 | static PyObject *DlgObj_SetDialogTracksCursor(_self, _args) |
| 490 | DialogObject *_self; |
| 491 | PyObject *_args; |
| 492 | { |
| 493 | PyObject *_res = NULL; |
| 494 | OSErr _err; |
| 495 | Boolean tracks; |
| 496 | if (!PyArg_ParseTuple(_args, "b", |
| 497 | &tracks)) |
| 498 | return NULL; |
| 499 | _err = SetDialogTracksCursor(_self->ob_itself, |
| 500 | tracks); |
| 501 | if (_err != noErr) return PyMac_Error(_err); |
| 502 | Py_INCREF(Py_None); |
| 503 | _res = Py_None; |
| 504 | return _res; |
| 505 | } |
| 506 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 507 | static PyObject *DlgObj_AutoSizeDialog(_self, _args) |
| 508 | DialogObject *_self; |
| 509 | PyObject *_args; |
| 510 | { |
| 511 | PyObject *_res = NULL; |
| 512 | OSErr _err; |
| 513 | if (!PyArg_ParseTuple(_args, "")) |
| 514 | return NULL; |
| 515 | _err = AutoSizeDialog(_self->ob_itself); |
| 516 | if (_err != noErr) return PyMac_Error(_err); |
| 517 | Py_INCREF(Py_None); |
| 518 | _res = Py_None; |
| 519 | return _res; |
| 520 | } |
| 521 | |
| 522 | static PyObject *DlgObj_GetDialogItemAsControl(_self, _args) |
| 523 | DialogObject *_self; |
| 524 | PyObject *_args; |
| 525 | { |
| 526 | PyObject *_res = NULL; |
| 527 | OSErr _err; |
| 528 | SInt16 inItemNo; |
| 529 | ControlHandle outControl; |
| 530 | if (!PyArg_ParseTuple(_args, "h", |
| 531 | &inItemNo)) |
| 532 | return NULL; |
| 533 | _err = GetDialogItemAsControl(_self->ob_itself, |
| 534 | inItemNo, |
| 535 | &outControl); |
| 536 | if (_err != noErr) return PyMac_Error(_err); |
| 537 | _res = Py_BuildValue("O&", |
| 538 | CtlObj_New, outControl); |
| 539 | return _res; |
| 540 | } |
| 541 | |
| 542 | static PyObject *DlgObj_MoveDialogItem(_self, _args) |
| 543 | DialogObject *_self; |
| 544 | PyObject *_args; |
| 545 | { |
| 546 | PyObject *_res = NULL; |
| 547 | OSErr _err; |
| 548 | SInt16 inItemNo; |
| 549 | SInt16 inHoriz; |
| 550 | SInt16 inVert; |
| 551 | if (!PyArg_ParseTuple(_args, "hhh", |
| 552 | &inItemNo, |
| 553 | &inHoriz, |
| 554 | &inVert)) |
| 555 | return NULL; |
| 556 | _err = MoveDialogItem(_self->ob_itself, |
| 557 | inItemNo, |
| 558 | inHoriz, |
| 559 | inVert); |
| 560 | if (_err != noErr) return PyMac_Error(_err); |
| 561 | Py_INCREF(Py_None); |
| 562 | _res = Py_None; |
| 563 | return _res; |
| 564 | } |
| 565 | |
| 566 | static PyObject *DlgObj_SizeDialogItem(_self, _args) |
| 567 | DialogObject *_self; |
| 568 | PyObject *_args; |
| 569 | { |
| 570 | PyObject *_res = NULL; |
| 571 | OSErr _err; |
| 572 | SInt16 inItemNo; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 573 | SInt16 inWidth; |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 574 | SInt16 inHeight; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 575 | if (!PyArg_ParseTuple(_args, "hhh", |
| 576 | &inItemNo, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 577 | &inWidth, |
| 578 | &inHeight)) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 579 | return NULL; |
| 580 | _err = SizeDialogItem(_self->ob_itself, |
| 581 | inItemNo, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 582 | inWidth, |
| 583 | inHeight); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 584 | if (_err != noErr) return PyMac_Error(_err); |
| 585 | Py_INCREF(Py_None); |
| 586 | _res = Py_None; |
| 587 | return _res; |
| 588 | } |
| 589 | |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 590 | static PyObject *DlgObj_GetDialogWindow(_self, _args) |
| 591 | DialogObject *_self; |
| 592 | PyObject *_args; |
| 593 | { |
| 594 | PyObject *_res = NULL; |
| 595 | DialogPtr _rv; |
| 596 | if (!PyArg_ParseTuple(_args, "")) |
| 597 | return NULL; |
| 598 | _rv = GetDialogWindow(_self->ob_itself); |
| 599 | _res = Py_BuildValue("O&", |
| 600 | WinObj_WhichWindow, _rv); |
| 601 | return _res; |
| 602 | } |
| 603 | |
| 604 | static PyObject *DlgObj_GetDialogDefaultItem(_self, _args) |
| 605 | DialogObject *_self; |
| 606 | PyObject *_args; |
| 607 | { |
| 608 | PyObject *_res = NULL; |
| 609 | SInt16 _rv; |
| 610 | if (!PyArg_ParseTuple(_args, "")) |
| 611 | return NULL; |
| 612 | _rv = GetDialogDefaultItem(_self->ob_itself); |
| 613 | _res = Py_BuildValue("h", |
| 614 | _rv); |
| 615 | return _res; |
| 616 | } |
| 617 | |
| 618 | static PyObject *DlgObj_GetDialogCancelItem(_self, _args) |
| 619 | DialogObject *_self; |
| 620 | PyObject *_args; |
| 621 | { |
| 622 | PyObject *_res = NULL; |
| 623 | SInt16 _rv; |
| 624 | if (!PyArg_ParseTuple(_args, "")) |
| 625 | return NULL; |
| 626 | _rv = GetDialogCancelItem(_self->ob_itself); |
| 627 | _res = Py_BuildValue("h", |
| 628 | _rv); |
| 629 | return _res; |
| 630 | } |
| 631 | |
| 632 | static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args) |
| 633 | DialogObject *_self; |
| 634 | PyObject *_args; |
| 635 | { |
| 636 | PyObject *_res = NULL; |
| 637 | SInt16 _rv; |
| 638 | if (!PyArg_ParseTuple(_args, "")) |
| 639 | return NULL; |
| 640 | _rv = GetDialogKeyboardFocusItem(_self->ob_itself); |
| 641 | _res = Py_BuildValue("h", |
| 642 | _rv); |
| 643 | return _res; |
| 644 | } |
| 645 | |
| 646 | static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args) |
| 647 | DialogObject *_self; |
| 648 | PyObject *_args; |
| 649 | { |
| 650 | PyObject *_res = NULL; |
| 651 | if (!PyArg_ParseTuple(_args, "")) |
| 652 | return NULL; |
| 653 | SetGrafPortOfDialog(_self->ob_itself); |
| 654 | Py_INCREF(Py_None); |
| 655 | _res = Py_None; |
| 656 | return _res; |
| 657 | } |
| 658 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 659 | static PyMethodDef DlgObj_methods[] = { |
| 660 | {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, |
| 661 | "() -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 662 | {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1, |
Jack Jansen | 2b72417 | 1996-04-10 14:48:19 +0000 | [diff] [blame] | 663 | "(RgnHandle updateRgn) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 664 | {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 665 | "(DialogItemIndex itemNo) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 666 | {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 667 | "(DialogItemIndex itemNo) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 668 | {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 669 | "(Point thePt) -> (DialogItemIndexZeroBased _rv)"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 670 | {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 671 | "() -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 672 | {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 673 | "() -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 674 | {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 675 | "() -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 676 | {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 677 | "() -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 678 | {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1, |
| 679 | "(DialogItemIndex itemNo) -> (DialogItemType itemType, Handle item, Rect box)"}, |
| 680 | {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1, |
| 681 | "(DialogItemIndex itemNo, DialogItemType itemType, Handle item, Rect box) -> None"}, |
| 682 | {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1, |
| 683 | "(DialogItemIndex itemNo, SInt16 strtSel, SInt16 endSel) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 684 | {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1, |
| 685 | "(Handle theHandle, DITLMethod method) -> None"}, |
| 686 | {"CountDITL", (PyCFunction)DlgObj_CountDITL, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 687 | "() -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 688 | {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 689 | "(DialogItemIndex numberItems) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 690 | {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 691 | "() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 692 | {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 693 | "(DialogItemIndex newItem) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 694 | {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 695 | "(DialogItemIndex newItem) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 696 | {"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1, |
| 697 | "(Boolean tracks) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 698 | {"AutoSizeDialog", (PyCFunction)DlgObj_AutoSizeDialog, 1, |
| 699 | "() -> None"}, |
| 700 | {"GetDialogItemAsControl", (PyCFunction)DlgObj_GetDialogItemAsControl, 1, |
| 701 | "(SInt16 inItemNo) -> (ControlHandle outControl)"}, |
| 702 | {"MoveDialogItem", (PyCFunction)DlgObj_MoveDialogItem, 1, |
| 703 | "(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None"}, |
| 704 | {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 705 | "(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None"}, |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 706 | {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, |
| 707 | "() -> (DialogPtr _rv)"}, |
| 708 | {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, |
| 709 | "() -> (SInt16 _rv)"}, |
| 710 | {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1, |
| 711 | "() -> (SInt16 _rv)"}, |
| 712 | {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1, |
| 713 | "() -> (SInt16 _rv)"}, |
| 714 | {"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1, |
| 715 | "() -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 716 | {NULL, NULL, 0} |
| 717 | }; |
| 718 | |
| 719 | PyMethodChain DlgObj_chain = { DlgObj_methods, &WinObj_chain }; |
| 720 | |
| 721 | static PyObject *DlgObj_getattr(self, name) |
| 722 | DialogObject *self; |
| 723 | char *name; |
| 724 | { |
| 725 | return Py_FindMethodInChain(&DlgObj_chain, (PyObject *)self, name); |
| 726 | } |
| 727 | |
| 728 | #define DlgObj_setattr NULL |
| 729 | |
| 730 | PyTypeObject Dialog_Type = { |
| 731 | PyObject_HEAD_INIT(&PyType_Type) |
| 732 | 0, /*ob_size*/ |
| 733 | "Dialog", /*tp_name*/ |
| 734 | sizeof(DialogObject), /*tp_basicsize*/ |
| 735 | 0, /*tp_itemsize*/ |
| 736 | /* methods */ |
| 737 | (destructor) DlgObj_dealloc, /*tp_dealloc*/ |
| 738 | 0, /*tp_print*/ |
| 739 | (getattrfunc) DlgObj_getattr, /*tp_getattr*/ |
| 740 | (setattrfunc) DlgObj_setattr, /*tp_setattr*/ |
| 741 | }; |
| 742 | |
| 743 | /* --------------------- End object type Dialog --------------------- */ |
| 744 | |
| 745 | |
| 746 | static PyObject *Dlg_NewDialog(_self, _args) |
| 747 | PyObject *_self; |
| 748 | PyObject *_args; |
| 749 | { |
| 750 | PyObject *_res = NULL; |
| 751 | DialogPtr _rv; |
| 752 | Rect boundsRect; |
| 753 | Str255 title; |
| 754 | Boolean visible; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 755 | SInt16 procID; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 756 | WindowPtr behind; |
| 757 | Boolean goAwayFlag; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 758 | SInt32 refCon; |
| 759 | Handle items; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 760 | if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&", |
| 761 | PyMac_GetRect, &boundsRect, |
| 762 | PyMac_GetStr255, title, |
| 763 | &visible, |
| 764 | &procID, |
| 765 | WinObj_Convert, &behind, |
| 766 | &goAwayFlag, |
| 767 | &refCon, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 768 | ResObj_Convert, &items)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 769 | return NULL; |
| 770 | _rv = NewDialog((void *)0, |
| 771 | &boundsRect, |
| 772 | title, |
| 773 | visible, |
| 774 | procID, |
| 775 | behind, |
| 776 | goAwayFlag, |
| 777 | refCon, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 778 | items); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 779 | _res = Py_BuildValue("O&", |
| 780 | DlgObj_New, _rv); |
| 781 | return _res; |
| 782 | } |
| 783 | |
| 784 | static PyObject *Dlg_GetNewDialog(_self, _args) |
| 785 | PyObject *_self; |
| 786 | PyObject *_args; |
| 787 | { |
| 788 | PyObject *_res = NULL; |
| 789 | DialogPtr _rv; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 790 | SInt16 dialogID; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 791 | WindowPtr behind; |
| 792 | if (!PyArg_ParseTuple(_args, "hO&", |
| 793 | &dialogID, |
| 794 | WinObj_Convert, &behind)) |
| 795 | return NULL; |
| 796 | _rv = GetNewDialog(dialogID, |
| 797 | (void *)0, |
| 798 | behind); |
| 799 | _res = Py_BuildValue("O&", |
| 800 | DlgObj_New, _rv); |
| 801 | return _res; |
| 802 | } |
| 803 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 804 | static PyObject *Dlg_NewColorDialog(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 805 | PyObject *_self; |
| 806 | PyObject *_args; |
| 807 | { |
| 808 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 809 | DialogPtr _rv; |
| 810 | Rect boundsRect; |
| 811 | Str255 title; |
| 812 | Boolean visible; |
| 813 | SInt16 procID; |
| 814 | WindowPtr behind; |
| 815 | Boolean goAwayFlag; |
| 816 | SInt32 refCon; |
| 817 | Handle items; |
| 818 | if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&", |
| 819 | PyMac_GetRect, &boundsRect, |
| 820 | PyMac_GetStr255, title, |
| 821 | &visible, |
| 822 | &procID, |
| 823 | WinObj_Convert, &behind, |
| 824 | &goAwayFlag, |
| 825 | &refCon, |
| 826 | ResObj_Convert, &items)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 827 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 828 | _rv = NewColorDialog((void *)0, |
| 829 | &boundsRect, |
| 830 | title, |
| 831 | visible, |
| 832 | procID, |
| 833 | behind, |
| 834 | goAwayFlag, |
| 835 | refCon, |
| 836 | items); |
| 837 | _res = Py_BuildValue("O&", |
| 838 | DlgObj_New, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 839 | return _res; |
| 840 | } |
| 841 | |
| 842 | static PyObject *Dlg_ModalDialog(_self, _args) |
| 843 | PyObject *_self; |
| 844 | PyObject *_args; |
| 845 | { |
| 846 | PyObject *_res = NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 847 | PyObject* modalFilter; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 848 | DialogItemIndex itemHit; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 849 | if (!PyArg_ParseTuple(_args, "O", |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 850 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 851 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 852 | ModalDialog(NewModalFilterProc(Dlg_PassFilterProc(modalFilter)), |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 853 | &itemHit); |
| 854 | _res = Py_BuildValue("h", |
| 855 | itemHit); |
| 856 | return _res; |
| 857 | } |
| 858 | |
| 859 | static PyObject *Dlg_IsDialogEvent(_self, _args) |
| 860 | PyObject *_self; |
| 861 | PyObject *_args; |
| 862 | { |
| 863 | PyObject *_res = NULL; |
| 864 | Boolean _rv; |
| 865 | EventRecord theEvent; |
| 866 | if (!PyArg_ParseTuple(_args, "O&", |
| 867 | PyMac_GetEventRecord, &theEvent)) |
| 868 | return NULL; |
| 869 | _rv = IsDialogEvent(&theEvent); |
| 870 | _res = Py_BuildValue("b", |
| 871 | _rv); |
| 872 | return _res; |
| 873 | } |
| 874 | |
| 875 | static PyObject *Dlg_DialogSelect(_self, _args) |
| 876 | PyObject *_self; |
| 877 | PyObject *_args; |
| 878 | { |
| 879 | PyObject *_res = NULL; |
| 880 | Boolean _rv; |
| 881 | EventRecord theEvent; |
| 882 | DialogPtr theDialog; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 883 | DialogItemIndex itemHit; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 884 | if (!PyArg_ParseTuple(_args, "O&", |
| 885 | PyMac_GetEventRecord, &theEvent)) |
| 886 | return NULL; |
| 887 | _rv = DialogSelect(&theEvent, |
| 888 | &theDialog, |
| 889 | &itemHit); |
| 890 | _res = Py_BuildValue("bO&h", |
| 891 | _rv, |
| 892 | WinObj_WhichWindow, theDialog, |
| 893 | itemHit); |
| 894 | return _res; |
| 895 | } |
| 896 | |
| 897 | static PyObject *Dlg_Alert(_self, _args) |
| 898 | PyObject *_self; |
| 899 | PyObject *_args; |
| 900 | { |
| 901 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 902 | DialogItemIndex _rv; |
| 903 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 904 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 905 | if (!PyArg_ParseTuple(_args, "hO", |
| 906 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 907 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 908 | return NULL; |
| 909 | _rv = Alert(alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 910 | NewModalFilterProc(Dlg_PassFilterProc(modalFilter))); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 911 | _res = Py_BuildValue("h", |
| 912 | _rv); |
| 913 | return _res; |
| 914 | } |
| 915 | |
| 916 | static PyObject *Dlg_StopAlert(_self, _args) |
| 917 | PyObject *_self; |
| 918 | PyObject *_args; |
| 919 | { |
| 920 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 921 | DialogItemIndex _rv; |
| 922 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 923 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 924 | if (!PyArg_ParseTuple(_args, "hO", |
| 925 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 926 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 927 | return NULL; |
| 928 | _rv = StopAlert(alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 929 | NewModalFilterProc(Dlg_PassFilterProc(modalFilter))); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 930 | _res = Py_BuildValue("h", |
| 931 | _rv); |
| 932 | return _res; |
| 933 | } |
| 934 | |
| 935 | static PyObject *Dlg_NoteAlert(_self, _args) |
| 936 | PyObject *_self; |
| 937 | PyObject *_args; |
| 938 | { |
| 939 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 940 | DialogItemIndex _rv; |
| 941 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 942 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 943 | if (!PyArg_ParseTuple(_args, "hO", |
| 944 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 945 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 946 | return NULL; |
| 947 | _rv = NoteAlert(alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 948 | NewModalFilterProc(Dlg_PassFilterProc(modalFilter))); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 949 | _res = Py_BuildValue("h", |
| 950 | _rv); |
| 951 | return _res; |
| 952 | } |
| 953 | |
| 954 | static PyObject *Dlg_CautionAlert(_self, _args) |
| 955 | PyObject *_self; |
| 956 | PyObject *_args; |
| 957 | { |
| 958 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 959 | DialogItemIndex _rv; |
| 960 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 961 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 962 | if (!PyArg_ParseTuple(_args, "hO", |
| 963 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 964 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 965 | return NULL; |
| 966 | _rv = CautionAlert(alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 967 | NewModalFilterProc(Dlg_PassFilterProc(modalFilter))); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 968 | _res = Py_BuildValue("h", |
| 969 | _rv); |
| 970 | return _res; |
| 971 | } |
| 972 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 973 | static PyObject *Dlg_ParamText(_self, _args) |
| 974 | PyObject *_self; |
| 975 | PyObject *_args; |
| 976 | { |
| 977 | PyObject *_res = NULL; |
| 978 | Str255 param0; |
| 979 | Str255 param1; |
| 980 | Str255 param2; |
| 981 | Str255 param3; |
| 982 | if (!PyArg_ParseTuple(_args, "O&O&O&O&", |
| 983 | PyMac_GetStr255, param0, |
| 984 | PyMac_GetStr255, param1, |
| 985 | PyMac_GetStr255, param2, |
| 986 | PyMac_GetStr255, param3)) |
| 987 | return NULL; |
| 988 | ParamText(param0, |
| 989 | param1, |
| 990 | param2, |
| 991 | param3); |
| 992 | Py_INCREF(Py_None); |
| 993 | _res = Py_None; |
| 994 | return _res; |
| 995 | } |
| 996 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 997 | static PyObject *Dlg_GetDialogItemText(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 998 | PyObject *_self; |
| 999 | PyObject *_args; |
| 1000 | { |
| 1001 | PyObject *_res = NULL; |
| 1002 | Handle item; |
| 1003 | Str255 text; |
| 1004 | if (!PyArg_ParseTuple(_args, "O&", |
| 1005 | ResObj_Convert, &item)) |
| 1006 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1007 | GetDialogItemText(item, |
| 1008 | text); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1009 | _res = Py_BuildValue("O&", |
| 1010 | PyMac_BuildStr255, text); |
| 1011 | return _res; |
| 1012 | } |
| 1013 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1014 | static PyObject *Dlg_SetDialogItemText(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1015 | PyObject *_self; |
| 1016 | PyObject *_args; |
| 1017 | { |
| 1018 | PyObject *_res = NULL; |
| 1019 | Handle item; |
| 1020 | Str255 text; |
| 1021 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1022 | ResObj_Convert, &item, |
| 1023 | PyMac_GetStr255, text)) |
| 1024 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1025 | SetDialogItemText(item, |
| 1026 | text); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1027 | Py_INCREF(Py_None); |
| 1028 | _res = Py_None; |
| 1029 | return _res; |
| 1030 | } |
| 1031 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1032 | static PyObject *Dlg_GetAlertStage(_self, _args) |
| 1033 | PyObject *_self; |
| 1034 | PyObject *_args; |
| 1035 | { |
| 1036 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1037 | SInt16 _rv; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1038 | if (!PyArg_ParseTuple(_args, "")) |
| 1039 | return NULL; |
| 1040 | _rv = GetAlertStage(); |
| 1041 | _res = Py_BuildValue("h", |
| 1042 | _rv); |
| 1043 | return _res; |
| 1044 | } |
| 1045 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1046 | static PyObject *Dlg_SetDialogFont(_self, _args) |
| 1047 | PyObject *_self; |
| 1048 | PyObject *_args; |
| 1049 | { |
| 1050 | PyObject *_res = NULL; |
| 1051 | SInt16 value; |
| 1052 | if (!PyArg_ParseTuple(_args, "h", |
| 1053 | &value)) |
| 1054 | return NULL; |
| 1055 | SetDialogFont(value); |
| 1056 | Py_INCREF(Py_None); |
| 1057 | _res = Py_None; |
| 1058 | return _res; |
| 1059 | } |
| 1060 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1061 | static PyObject *Dlg_ResetAlertStage(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1062 | PyObject *_self; |
| 1063 | PyObject *_args; |
| 1064 | { |
| 1065 | PyObject *_res = NULL; |
| 1066 | if (!PyArg_ParseTuple(_args, "")) |
| 1067 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1068 | ResetAlertStage(); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1069 | Py_INCREF(Py_None); |
| 1070 | _res = Py_None; |
| 1071 | return _res; |
| 1072 | } |
| 1073 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1074 | static PyObject *Dlg_NewFeaturesDialog(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1075 | PyObject *_self; |
| 1076 | PyObject *_args; |
| 1077 | { |
| 1078 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1079 | DialogPtr _rv; |
| 1080 | Rect inBoundsRect; |
| 1081 | Str255 inTitle; |
| 1082 | Boolean inIsVisible; |
| 1083 | SInt16 inProcID; |
| 1084 | WindowPtr inBehind; |
| 1085 | Boolean inGoAwayFlag; |
| 1086 | SInt32 inRefCon; |
| 1087 | Handle inItemListHandle; |
| 1088 | UInt32 inFlags; |
| 1089 | if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&l", |
| 1090 | PyMac_GetRect, &inBoundsRect, |
| 1091 | PyMac_GetStr255, inTitle, |
| 1092 | &inIsVisible, |
| 1093 | &inProcID, |
| 1094 | WinObj_Convert, &inBehind, |
| 1095 | &inGoAwayFlag, |
| 1096 | &inRefCon, |
| 1097 | ResObj_Convert, &inItemListHandle, |
| 1098 | &inFlags)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1099 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1100 | _rv = NewFeaturesDialog((void *)0, |
| 1101 | &inBoundsRect, |
| 1102 | inTitle, |
| 1103 | inIsVisible, |
| 1104 | inProcID, |
| 1105 | inBehind, |
| 1106 | inGoAwayFlag, |
| 1107 | inRefCon, |
| 1108 | inItemListHandle, |
| 1109 | inFlags); |
| 1110 | _res = Py_BuildValue("O&", |
| 1111 | DlgObj_New, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1112 | return _res; |
| 1113 | } |
| 1114 | |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 1115 | static PyObject *Dlg_SetUserItemHandler(_self, _args) |
| 1116 | PyObject *_self; |
| 1117 | PyObject *_args; |
| 1118 | { |
| 1119 | PyObject *_res = NULL; |
| 1120 | |
| 1121 | PyObject *new = NULL; |
| 1122 | |
| 1123 | |
| 1124 | if (!PyArg_ParseTuple(_args, "|O", &new)) |
| 1125 | return NULL; |
| 1126 | |
| 1127 | if (Dlg_UserItemProc_callback && new && new != Py_None) { |
| 1128 | PyErr_SetString(Dlg_Error, "Another UserItemProc is already installed"); |
| 1129 | return NULL; |
| 1130 | } |
| 1131 | |
| 1132 | if (new == Py_None) { |
| 1133 | new = NULL; |
| 1134 | _res = Py_None; |
| 1135 | Py_INCREF(Py_None); |
| 1136 | } else { |
| 1137 | Py_INCREF(new); |
| 1138 | _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemProc(Dlg_UnivUserItemProc)); |
| 1139 | } |
| 1140 | |
| 1141 | Dlg_UserItemProc_callback = new; |
| 1142 | return _res; |
| 1143 | |
| 1144 | } |
| 1145 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1146 | static PyMethodDef Dlg_methods[] = { |
| 1147 | {"NewDialog", (PyCFunction)Dlg_NewDialog, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1148 | "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1149 | {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1150 | "(SInt16 dialogID, WindowPtr behind) -> (DialogPtr _rv)"}, |
| 1151 | {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1, |
| 1152 | "(Rect boundsRect, Str255 title, Boolean visible, SInt16 procID, WindowPtr behind, Boolean goAwayFlag, SInt32 refCon, Handle items) -> (DialogPtr _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1153 | {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1154 | "(PyObject* modalFilter) -> (DialogItemIndex itemHit)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1155 | {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1, |
| 1156 | "(EventRecord theEvent) -> (Boolean _rv)"}, |
| 1157 | {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1158 | "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1159 | {"Alert", (PyCFunction)Dlg_Alert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1160 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1161 | {"StopAlert", (PyCFunction)Dlg_StopAlert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1162 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1163 | {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1164 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1165 | {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1166 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
| 1167 | {"ParamText", (PyCFunction)Dlg_ParamText, 1, |
| 1168 | "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1169 | {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1170 | "(Handle item) -> (Str255 text)"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1171 | {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1172 | "(Handle item, Str255 text) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1173 | {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1174 | "() -> (SInt16 _rv)"}, |
| 1175 | {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1, |
| 1176 | "(SInt16 value) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1177 | {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1178 | "() -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1179 | {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1, |
| 1180 | "(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)"}, |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 1181 | {"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1, |
| 1182 | NULL}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1183 | {NULL, NULL, 0} |
| 1184 | }; |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | void initDlg() |
| 1190 | { |
| 1191 | PyObject *m; |
| 1192 | PyObject *d; |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | m = Py_InitModule("Dlg", Dlg_methods); |
| 1198 | d = PyModule_GetDict(m); |
| 1199 | Dlg_Error = PyMac_GetOSErrException(); |
| 1200 | if (Dlg_Error == NULL || |
| 1201 | PyDict_SetItemString(d, "Error", Dlg_Error) != 0) |
| 1202 | Py_FatalError("can't initialize Dlg.Error"); |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 1203 | Dialog_Type.ob_type = &PyType_Type; |
| 1204 | Py_INCREF(&Dialog_Type); |
| 1205 | if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0) |
| 1206 | Py_FatalError("can't initialize DialogType"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1207 | } |
| 1208 | |
| 1209 | /* ========================= End module Dlg ========================= */ |
| 1210 | |