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 | |
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 <Dialogs.h> |
| 12 | |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 13 | #if !ACCESSOR_CALLS_ARE_FUNCTIONS |
| 14 | #define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH) |
| 15 | #define SetPortDialogPort(dlg) SetPort(dlg) |
| 16 | #define GetDialogPort(dlg) ((CGrafPtr)(dlg)) |
| 17 | #define GetDialogFromWindow(win) ((DialogRef)(win)) |
| 18 | #endif |
| 19 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 20 | /* XXX Shouldn't this be a stack? */ |
| 21 | static PyObject *Dlg_FilterProc_callback = NULL; |
| 22 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 23 | static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, |
| 24 | EventRecord *event, |
| 25 | short *itemHit) |
| 26 | { |
| 27 | Boolean rv; |
| 28 | PyObject *args, *res; |
| 29 | PyObject *callback = Dlg_FilterProc_callback; |
| 30 | if (callback == NULL) |
| 31 | return 0; /* Default behavior */ |
| 32 | Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */ |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 33 | args = Py_BuildValue("O&O&", DlgObj_WhichDialog, dialog, PyMac_BuildEventRecord, event); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 34 | if (args == NULL) |
| 35 | res = NULL; |
| 36 | else { |
| 37 | res = PyEval_CallObject(callback, args); |
| 38 | Py_DECREF(args); |
| 39 | } |
| 40 | if (res == NULL) { |
Jack Jansen | deff89c | 1998-10-12 20:53:15 +0000 | [diff] [blame] | 41 | PySys_WriteStderr("Exception in Dialog Filter\n"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 42 | PyErr_Print(); |
| 43 | *itemHit = -1; /* Fake return item */ |
| 44 | return 1; /* We handled it */ |
| 45 | } |
| 46 | else { |
| 47 | Dlg_FilterProc_callback = callback; |
| 48 | if (PyInt_Check(res)) { |
| 49 | *itemHit = PyInt_AsLong(res); |
| 50 | rv = 1; |
| 51 | } |
| 52 | else |
| 53 | rv = PyObject_IsTrue(res); |
| 54 | } |
| 55 | Py_DECREF(res); |
| 56 | return rv; |
| 57 | } |
| 58 | |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 59 | static ModalFilterUPP |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 60 | Dlg_PassFilterProc(PyObject *callback) |
| 61 | { |
| 62 | PyObject *tmp = Dlg_FilterProc_callback; |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 63 | static ModalFilterUPP UnivFilterUpp = NULL; |
| 64 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 65 | Dlg_FilterProc_callback = NULL; |
| 66 | if (callback == Py_None) { |
| 67 | Py_XDECREF(tmp); |
| 68 | return NULL; |
| 69 | } |
| 70 | Py_INCREF(callback); |
| 71 | Dlg_FilterProc_callback = callback; |
| 72 | Py_XDECREF(tmp); |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 73 | if ( UnivFilterUpp == NULL ) |
| 74 | UnivFilterUpp = NewModalFilterUPP(&Dlg_UnivFilterProc); |
| 75 | return UnivFilterUpp; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 78 | static PyObject *Dlg_UserItemProc_callback = NULL; |
| 79 | |
| 80 | static pascal void Dlg_UnivUserItemProc(DialogPtr dialog, |
| 81 | short item) |
| 82 | { |
| 83 | PyObject *args, *res; |
| 84 | |
| 85 | if (Dlg_UserItemProc_callback == NULL) |
| 86 | return; /* Default behavior */ |
| 87 | Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */ |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 88 | args = Py_BuildValue("O&h", DlgObj_WhichDialog, dialog, item); |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 89 | if (args == NULL) |
| 90 | res = NULL; |
| 91 | else { |
| 92 | res = PyEval_CallObject(Dlg_UserItemProc_callback, args); |
| 93 | Py_DECREF(args); |
| 94 | } |
| 95 | if (res == NULL) { |
Jack Jansen | deff89c | 1998-10-12 20:53:15 +0000 | [diff] [blame] | 96 | PySys_WriteStderr("Exception in Dialog UserItem proc\n"); |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 97 | PyErr_Print(); |
| 98 | } |
| 99 | Py_XDECREF(res); |
| 100 | return; |
| 101 | } |
| 102 | |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 103 | #if 0 |
Jack Jansen | b8c4c7b | 2000-08-25 22:25:54 +0000 | [diff] [blame] | 104 | /* |
| 105 | ** Treating DialogObjects as WindowObjects is (I think) illegal under Carbon. |
| 106 | ** However, as they are still identical under MacOS9 Carbon this is a problem, even |
| 107 | ** if we neatly call GetDialogWindow() at the right places: there's one refcon field |
| 108 | ** and it points to the DialogObject, so WinObj_WhichWindow will smartly return the |
| 109 | ** dialog object, and therefore we still don't have a WindowObject. |
| 110 | ** I'll leave the chaining code in place for now, with this comment to warn the |
| 111 | ** unsuspecting victims (i.e. me, probably, in a few weeks:-) |
| 112 | */ |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 113 | extern PyMethodChain WinObj_chain; |
Jack Jansen | b8c4c7b | 2000-08-25 22:25:54 +0000 | [diff] [blame] | 114 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 115 | |
| 116 | static PyObject *Dlg_Error; |
| 117 | |
| 118 | /* ----------------------- Object type Dialog ----------------------- */ |
| 119 | |
| 120 | PyTypeObject Dialog_Type; |
| 121 | |
| 122 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 123 | |
| 124 | typedef struct DialogObject { |
| 125 | PyObject_HEAD |
| 126 | DialogPtr ob_itself; |
| 127 | } DialogObject; |
| 128 | |
| 129 | PyObject *DlgObj_New(itself) |
Guido van Rossum | 9784295 | 1995-02-19 15:59:49 +0000 | [diff] [blame] | 130 | DialogPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 131 | { |
| 132 | DialogObject *it; |
| 133 | if (itself == NULL) return Py_None; |
| 134 | it = PyObject_NEW(DialogObject, &Dialog_Type); |
| 135 | if (it == NULL) return NULL; |
| 136 | it->ob_itself = itself; |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 137 | SetWRefCon(GetDialogWindow(itself), (long)it); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 138 | return (PyObject *)it; |
| 139 | } |
| 140 | DlgObj_Convert(v, p_itself) |
| 141 | PyObject *v; |
| 142 | DialogPtr *p_itself; |
| 143 | { |
| 144 | if (v == Py_None) { *p_itself = NULL; return 1; } |
| 145 | if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v); |
| 146 | return 1; } |
| 147 | if (!DlgObj_Check(v)) |
| 148 | { |
| 149 | PyErr_SetString(PyExc_TypeError, "Dialog required"); |
| 150 | return 0; |
| 151 | } |
| 152 | *p_itself = ((DialogObject *)v)->ob_itself; |
| 153 | return 1; |
| 154 | } |
| 155 | |
| 156 | static void DlgObj_dealloc(self) |
| 157 | DialogObject *self; |
| 158 | { |
| 159 | DisposeDialog(self->ob_itself); |
| 160 | PyMem_DEL(self); |
| 161 | } |
| 162 | |
| 163 | static PyObject *DlgObj_DrawDialog(_self, _args) |
| 164 | DialogObject *_self; |
| 165 | PyObject *_args; |
| 166 | { |
| 167 | PyObject *_res = NULL; |
| 168 | if (!PyArg_ParseTuple(_args, "")) |
| 169 | return NULL; |
| 170 | DrawDialog(_self->ob_itself); |
| 171 | Py_INCREF(Py_None); |
| 172 | _res = Py_None; |
| 173 | return _res; |
| 174 | } |
| 175 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 176 | static PyObject *DlgObj_UpdateDialog(_self, _args) |
| 177 | DialogObject *_self; |
| 178 | PyObject *_args; |
| 179 | { |
| 180 | PyObject *_res = NULL; |
Jack Jansen | 2b72417 | 1996-04-10 14:48:19 +0000 | [diff] [blame] | 181 | RgnHandle updateRgn; |
| 182 | if (!PyArg_ParseTuple(_args, "O&", |
| 183 | ResObj_Convert, &updateRgn)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 184 | return NULL; |
| 185 | UpdateDialog(_self->ob_itself, |
Jack Jansen | 2b72417 | 1996-04-10 14:48:19 +0000 | [diff] [blame] | 186 | updateRgn); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 187 | Py_INCREF(Py_None); |
| 188 | _res = Py_None; |
| 189 | return _res; |
| 190 | } |
| 191 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 192 | static PyObject *DlgObj_HideDialogItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 193 | DialogObject *_self; |
| 194 | PyObject *_args; |
| 195 | { |
| 196 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 197 | DialogItemIndex itemNo; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 198 | if (!PyArg_ParseTuple(_args, "h", |
| 199 | &itemNo)) |
| 200 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 201 | HideDialogItem(_self->ob_itself, |
| 202 | itemNo); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 203 | Py_INCREF(Py_None); |
| 204 | _res = Py_None; |
| 205 | return _res; |
| 206 | } |
| 207 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 208 | static PyObject *DlgObj_ShowDialogItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 209 | DialogObject *_self; |
| 210 | PyObject *_args; |
| 211 | { |
| 212 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 213 | DialogItemIndex itemNo; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 214 | if (!PyArg_ParseTuple(_args, "h", |
| 215 | &itemNo)) |
| 216 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 217 | ShowDialogItem(_self->ob_itself, |
| 218 | itemNo); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 219 | Py_INCREF(Py_None); |
| 220 | _res = Py_None; |
| 221 | return _res; |
| 222 | } |
| 223 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 224 | static PyObject *DlgObj_FindDialogItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 225 | DialogObject *_self; |
| 226 | PyObject *_args; |
| 227 | { |
| 228 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 229 | DialogItemIndexZeroBased _rv; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 230 | Point thePt; |
| 231 | if (!PyArg_ParseTuple(_args, "O&", |
| 232 | PyMac_GetPoint, &thePt)) |
| 233 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 234 | _rv = FindDialogItem(_self->ob_itself, |
| 235 | thePt); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 236 | _res = Py_BuildValue("h", |
| 237 | _rv); |
| 238 | return _res; |
| 239 | } |
| 240 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 241 | static PyObject *DlgObj_DialogCut(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 242 | DialogObject *_self; |
| 243 | PyObject *_args; |
| 244 | { |
| 245 | PyObject *_res = NULL; |
| 246 | if (!PyArg_ParseTuple(_args, "")) |
| 247 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 248 | DialogCut(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 249 | Py_INCREF(Py_None); |
| 250 | _res = Py_None; |
| 251 | return _res; |
| 252 | } |
| 253 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 254 | static PyObject *DlgObj_DialogPaste(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 255 | DialogObject *_self; |
| 256 | PyObject *_args; |
| 257 | { |
| 258 | PyObject *_res = NULL; |
| 259 | if (!PyArg_ParseTuple(_args, "")) |
| 260 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 261 | DialogPaste(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 262 | Py_INCREF(Py_None); |
| 263 | _res = Py_None; |
| 264 | return _res; |
| 265 | } |
| 266 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 267 | static PyObject *DlgObj_DialogCopy(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 268 | DialogObject *_self; |
| 269 | PyObject *_args; |
| 270 | { |
| 271 | PyObject *_res = NULL; |
| 272 | if (!PyArg_ParseTuple(_args, "")) |
| 273 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 274 | DialogCopy(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 275 | Py_INCREF(Py_None); |
| 276 | _res = Py_None; |
| 277 | return _res; |
| 278 | } |
| 279 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 280 | static PyObject *DlgObj_DialogDelete(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 281 | DialogObject *_self; |
| 282 | PyObject *_args; |
| 283 | { |
| 284 | PyObject *_res = NULL; |
| 285 | if (!PyArg_ParseTuple(_args, "")) |
| 286 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 287 | DialogDelete(_self->ob_itself); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 288 | Py_INCREF(Py_None); |
| 289 | _res = Py_None; |
| 290 | return _res; |
| 291 | } |
| 292 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 293 | static PyObject *DlgObj_GetDialogItem(_self, _args) |
| 294 | DialogObject *_self; |
| 295 | PyObject *_args; |
| 296 | { |
| 297 | PyObject *_res = NULL; |
| 298 | DialogItemIndex itemNo; |
| 299 | DialogItemType itemType; |
| 300 | Handle item; |
| 301 | Rect box; |
| 302 | if (!PyArg_ParseTuple(_args, "h", |
| 303 | &itemNo)) |
| 304 | return NULL; |
| 305 | GetDialogItem(_self->ob_itself, |
| 306 | itemNo, |
| 307 | &itemType, |
| 308 | &item, |
| 309 | &box); |
| 310 | _res = Py_BuildValue("hO&O&", |
| 311 | itemType, |
| 312 | OptResObj_New, item, |
| 313 | PyMac_BuildRect, &box); |
| 314 | return _res; |
| 315 | } |
| 316 | |
| 317 | static PyObject *DlgObj_SetDialogItem(_self, _args) |
| 318 | DialogObject *_self; |
| 319 | PyObject *_args; |
| 320 | { |
| 321 | PyObject *_res = NULL; |
| 322 | DialogItemIndex itemNo; |
| 323 | DialogItemType itemType; |
| 324 | Handle item; |
| 325 | Rect box; |
| 326 | if (!PyArg_ParseTuple(_args, "hhO&O&", |
| 327 | &itemNo, |
| 328 | &itemType, |
| 329 | ResObj_Convert, &item, |
| 330 | PyMac_GetRect, &box)) |
| 331 | return NULL; |
| 332 | SetDialogItem(_self->ob_itself, |
| 333 | itemNo, |
| 334 | itemType, |
| 335 | item, |
| 336 | &box); |
| 337 | Py_INCREF(Py_None); |
| 338 | _res = Py_None; |
| 339 | return _res; |
| 340 | } |
| 341 | |
| 342 | static PyObject *DlgObj_SelectDialogItemText(_self, _args) |
| 343 | DialogObject *_self; |
| 344 | PyObject *_args; |
| 345 | { |
| 346 | PyObject *_res = NULL; |
| 347 | DialogItemIndex itemNo; |
| 348 | SInt16 strtSel; |
| 349 | SInt16 endSel; |
| 350 | if (!PyArg_ParseTuple(_args, "hhh", |
| 351 | &itemNo, |
| 352 | &strtSel, |
| 353 | &endSel)) |
| 354 | return NULL; |
| 355 | SelectDialogItemText(_self->ob_itself, |
| 356 | itemNo, |
| 357 | strtSel, |
| 358 | endSel); |
| 359 | Py_INCREF(Py_None); |
| 360 | _res = Py_None; |
| 361 | return _res; |
| 362 | } |
| 363 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 364 | static PyObject *DlgObj_AppendDITL(_self, _args) |
| 365 | DialogObject *_self; |
| 366 | PyObject *_args; |
| 367 | { |
| 368 | PyObject *_res = NULL; |
| 369 | Handle theHandle; |
| 370 | DITLMethod method; |
| 371 | if (!PyArg_ParseTuple(_args, "O&h", |
| 372 | ResObj_Convert, &theHandle, |
| 373 | &method)) |
| 374 | return NULL; |
| 375 | AppendDITL(_self->ob_itself, |
| 376 | theHandle, |
| 377 | method); |
| 378 | Py_INCREF(Py_None); |
| 379 | _res = Py_None; |
| 380 | return _res; |
| 381 | } |
| 382 | |
| 383 | static PyObject *DlgObj_CountDITL(_self, _args) |
| 384 | DialogObject *_self; |
| 385 | PyObject *_args; |
| 386 | { |
| 387 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 388 | DialogItemIndex _rv; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 389 | if (!PyArg_ParseTuple(_args, "")) |
| 390 | return NULL; |
| 391 | _rv = CountDITL(_self->ob_itself); |
| 392 | _res = Py_BuildValue("h", |
| 393 | _rv); |
| 394 | return _res; |
| 395 | } |
| 396 | |
| 397 | static PyObject *DlgObj_ShortenDITL(_self, _args) |
| 398 | DialogObject *_self; |
| 399 | PyObject *_args; |
| 400 | { |
| 401 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 402 | DialogItemIndex numberItems; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 403 | if (!PyArg_ParseTuple(_args, "h", |
| 404 | &numberItems)) |
| 405 | return NULL; |
| 406 | ShortenDITL(_self->ob_itself, |
| 407 | numberItems); |
| 408 | Py_INCREF(Py_None); |
| 409 | _res = Py_None; |
| 410 | return _res; |
| 411 | } |
| 412 | |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 413 | #if TARGET_API_MAC_CARBON |
| 414 | |
| 415 | static PyObject *DlgObj_InsertDialogItem(_self, _args) |
| 416 | DialogObject *_self; |
| 417 | PyObject *_args; |
| 418 | { |
| 419 | PyObject *_res = NULL; |
| 420 | OSStatus _err; |
| 421 | DialogItemIndex afterItem; |
| 422 | DialogItemType itemType; |
| 423 | Handle itemHandle; |
| 424 | Rect box; |
| 425 | if (!PyArg_ParseTuple(_args, "hhO&O&", |
| 426 | &afterItem, |
| 427 | &itemType, |
| 428 | ResObj_Convert, &itemHandle, |
| 429 | PyMac_GetRect, &box)) |
| 430 | return NULL; |
| 431 | _err = InsertDialogItem(_self->ob_itself, |
| 432 | afterItem, |
| 433 | itemType, |
| 434 | itemHandle, |
| 435 | &box); |
| 436 | if (_err != noErr) return PyMac_Error(_err); |
| 437 | Py_INCREF(Py_None); |
| 438 | _res = Py_None; |
| 439 | return _res; |
| 440 | } |
| 441 | #endif |
| 442 | |
| 443 | #if TARGET_API_MAC_CARBON |
| 444 | |
| 445 | static PyObject *DlgObj_RemoveDialogItems(_self, _args) |
| 446 | DialogObject *_self; |
| 447 | PyObject *_args; |
| 448 | { |
| 449 | PyObject *_res = NULL; |
| 450 | OSStatus _err; |
| 451 | DialogItemIndex itemNo; |
| 452 | DialogItemIndex amountToRemove; |
| 453 | Boolean disposeItemData; |
| 454 | if (!PyArg_ParseTuple(_args, "hhb", |
| 455 | &itemNo, |
| 456 | &amountToRemove, |
| 457 | &disposeItemData)) |
| 458 | return NULL; |
| 459 | _err = RemoveDialogItems(_self->ob_itself, |
| 460 | itemNo, |
| 461 | amountToRemove, |
| 462 | disposeItemData); |
| 463 | if (_err != noErr) return PyMac_Error(_err); |
| 464 | Py_INCREF(Py_None); |
| 465 | _res = Py_None; |
| 466 | return _res; |
| 467 | } |
| 468 | #endif |
| 469 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 470 | static PyObject *DlgObj_StdFilterProc(_self, _args) |
| 471 | DialogObject *_self; |
| 472 | PyObject *_args; |
| 473 | { |
| 474 | PyObject *_res = NULL; |
| 475 | Boolean _rv; |
| 476 | EventRecord event; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 477 | DialogItemIndex itemHit; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 478 | if (!PyArg_ParseTuple(_args, "")) |
| 479 | return NULL; |
| 480 | _rv = StdFilterProc(_self->ob_itself, |
| 481 | &event, |
| 482 | &itemHit); |
| 483 | _res = Py_BuildValue("bO&h", |
| 484 | _rv, |
| 485 | PyMac_BuildEventRecord, &event, |
| 486 | itemHit); |
| 487 | return _res; |
| 488 | } |
| 489 | |
| 490 | static PyObject *DlgObj_SetDialogDefaultItem(_self, _args) |
| 491 | DialogObject *_self; |
| 492 | PyObject *_args; |
| 493 | { |
| 494 | PyObject *_res = NULL; |
| 495 | OSErr _err; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 496 | DialogItemIndex newItem; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 497 | if (!PyArg_ParseTuple(_args, "h", |
| 498 | &newItem)) |
| 499 | return NULL; |
| 500 | _err = SetDialogDefaultItem(_self->ob_itself, |
| 501 | newItem); |
| 502 | if (_err != noErr) return PyMac_Error(_err); |
| 503 | Py_INCREF(Py_None); |
| 504 | _res = Py_None; |
| 505 | return _res; |
| 506 | } |
| 507 | |
| 508 | static PyObject *DlgObj_SetDialogCancelItem(_self, _args) |
| 509 | DialogObject *_self; |
| 510 | PyObject *_args; |
| 511 | { |
| 512 | PyObject *_res = NULL; |
| 513 | OSErr _err; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 514 | DialogItemIndex newItem; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 515 | if (!PyArg_ParseTuple(_args, "h", |
| 516 | &newItem)) |
| 517 | return NULL; |
| 518 | _err = SetDialogCancelItem(_self->ob_itself, |
| 519 | newItem); |
| 520 | if (_err != noErr) return PyMac_Error(_err); |
| 521 | Py_INCREF(Py_None); |
| 522 | _res = Py_None; |
| 523 | return _res; |
| 524 | } |
| 525 | |
| 526 | static PyObject *DlgObj_SetDialogTracksCursor(_self, _args) |
| 527 | DialogObject *_self; |
| 528 | PyObject *_args; |
| 529 | { |
| 530 | PyObject *_res = NULL; |
| 531 | OSErr _err; |
| 532 | Boolean tracks; |
| 533 | if (!PyArg_ParseTuple(_args, "b", |
| 534 | &tracks)) |
| 535 | return NULL; |
| 536 | _err = SetDialogTracksCursor(_self->ob_itself, |
| 537 | tracks); |
| 538 | if (_err != noErr) return PyMac_Error(_err); |
| 539 | Py_INCREF(Py_None); |
| 540 | _res = Py_None; |
| 541 | return _res; |
| 542 | } |
| 543 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 544 | static PyObject *DlgObj_AutoSizeDialog(_self, _args) |
| 545 | DialogObject *_self; |
| 546 | PyObject *_args; |
| 547 | { |
| 548 | PyObject *_res = NULL; |
| 549 | OSErr _err; |
| 550 | if (!PyArg_ParseTuple(_args, "")) |
| 551 | return NULL; |
| 552 | _err = AutoSizeDialog(_self->ob_itself); |
| 553 | if (_err != noErr) return PyMac_Error(_err); |
| 554 | Py_INCREF(Py_None); |
| 555 | _res = Py_None; |
| 556 | return _res; |
| 557 | } |
| 558 | |
| 559 | static PyObject *DlgObj_GetDialogItemAsControl(_self, _args) |
| 560 | DialogObject *_self; |
| 561 | PyObject *_args; |
| 562 | { |
| 563 | PyObject *_res = NULL; |
| 564 | OSErr _err; |
| 565 | SInt16 inItemNo; |
| 566 | ControlHandle outControl; |
| 567 | if (!PyArg_ParseTuple(_args, "h", |
| 568 | &inItemNo)) |
| 569 | return NULL; |
| 570 | _err = GetDialogItemAsControl(_self->ob_itself, |
| 571 | inItemNo, |
| 572 | &outControl); |
| 573 | if (_err != noErr) return PyMac_Error(_err); |
| 574 | _res = Py_BuildValue("O&", |
| 575 | CtlObj_New, outControl); |
| 576 | return _res; |
| 577 | } |
| 578 | |
| 579 | static PyObject *DlgObj_MoveDialogItem(_self, _args) |
| 580 | DialogObject *_self; |
| 581 | PyObject *_args; |
| 582 | { |
| 583 | PyObject *_res = NULL; |
| 584 | OSErr _err; |
| 585 | SInt16 inItemNo; |
| 586 | SInt16 inHoriz; |
| 587 | SInt16 inVert; |
| 588 | if (!PyArg_ParseTuple(_args, "hhh", |
| 589 | &inItemNo, |
| 590 | &inHoriz, |
| 591 | &inVert)) |
| 592 | return NULL; |
| 593 | _err = MoveDialogItem(_self->ob_itself, |
| 594 | inItemNo, |
| 595 | inHoriz, |
| 596 | inVert); |
| 597 | if (_err != noErr) return PyMac_Error(_err); |
| 598 | Py_INCREF(Py_None); |
| 599 | _res = Py_None; |
| 600 | return _res; |
| 601 | } |
| 602 | |
| 603 | static PyObject *DlgObj_SizeDialogItem(_self, _args) |
| 604 | DialogObject *_self; |
| 605 | PyObject *_args; |
| 606 | { |
| 607 | PyObject *_res = NULL; |
| 608 | OSErr _err; |
| 609 | SInt16 inItemNo; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 610 | SInt16 inWidth; |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 611 | SInt16 inHeight; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 612 | if (!PyArg_ParseTuple(_args, "hhh", |
| 613 | &inItemNo, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 614 | &inWidth, |
| 615 | &inHeight)) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 616 | return NULL; |
| 617 | _err = SizeDialogItem(_self->ob_itself, |
| 618 | inItemNo, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 619 | inWidth, |
| 620 | inHeight); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 621 | if (_err != noErr) return PyMac_Error(_err); |
| 622 | Py_INCREF(Py_None); |
| 623 | _res = Py_None; |
| 624 | return _res; |
| 625 | } |
| 626 | |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 627 | static PyObject *DlgObj_AppendDialogItemList(_self, _args) |
| 628 | DialogObject *_self; |
| 629 | PyObject *_args; |
| 630 | { |
| 631 | PyObject *_res = NULL; |
| 632 | OSErr _err; |
| 633 | SInt16 ditlID; |
| 634 | DITLMethod method; |
| 635 | if (!PyArg_ParseTuple(_args, "hh", |
| 636 | &ditlID, |
| 637 | &method)) |
| 638 | return NULL; |
| 639 | _err = AppendDialogItemList(_self->ob_itself, |
| 640 | ditlID, |
| 641 | method); |
| 642 | if (_err != noErr) return PyMac_Error(_err); |
| 643 | Py_INCREF(Py_None); |
| 644 | _res = Py_None; |
| 645 | return _res; |
| 646 | } |
| 647 | |
| 648 | static PyObject *DlgObj_SetDialogTimeout(_self, _args) |
| 649 | DialogObject *_self; |
| 650 | PyObject *_args; |
| 651 | { |
| 652 | PyObject *_res = NULL; |
| 653 | OSStatus _err; |
| 654 | SInt16 inButtonToPress; |
| 655 | UInt32 inSecondsToWait; |
| 656 | if (!PyArg_ParseTuple(_args, "hl", |
| 657 | &inButtonToPress, |
| 658 | &inSecondsToWait)) |
| 659 | return NULL; |
| 660 | _err = SetDialogTimeout(_self->ob_itself, |
| 661 | inButtonToPress, |
| 662 | inSecondsToWait); |
| 663 | if (_err != noErr) return PyMac_Error(_err); |
| 664 | Py_INCREF(Py_None); |
| 665 | _res = Py_None; |
| 666 | return _res; |
| 667 | } |
| 668 | |
| 669 | static PyObject *DlgObj_GetDialogTimeout(_self, _args) |
| 670 | DialogObject *_self; |
| 671 | PyObject *_args; |
| 672 | { |
| 673 | PyObject *_res = NULL; |
| 674 | OSStatus _err; |
| 675 | SInt16 outButtonToPress; |
| 676 | UInt32 outSecondsToWait; |
| 677 | UInt32 outSecondsRemaining; |
| 678 | if (!PyArg_ParseTuple(_args, "")) |
| 679 | return NULL; |
| 680 | _err = GetDialogTimeout(_self->ob_itself, |
| 681 | &outButtonToPress, |
| 682 | &outSecondsToWait, |
| 683 | &outSecondsRemaining); |
| 684 | if (_err != noErr) return PyMac_Error(_err); |
| 685 | _res = Py_BuildValue("hll", |
| 686 | outButtonToPress, |
| 687 | outSecondsToWait, |
| 688 | outSecondsRemaining); |
| 689 | return _res; |
| 690 | } |
| 691 | |
| 692 | static PyObject *DlgObj_SetModalDialogEventMask(_self, _args) |
| 693 | DialogObject *_self; |
| 694 | PyObject *_args; |
| 695 | { |
| 696 | PyObject *_res = NULL; |
| 697 | OSStatus _err; |
| 698 | EventMask inMask; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 699 | if (!PyArg_ParseTuple(_args, "H", |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 700 | &inMask)) |
| 701 | return NULL; |
| 702 | _err = SetModalDialogEventMask(_self->ob_itself, |
| 703 | inMask); |
| 704 | if (_err != noErr) return PyMac_Error(_err); |
| 705 | Py_INCREF(Py_None); |
| 706 | _res = Py_None; |
| 707 | return _res; |
| 708 | } |
| 709 | |
| 710 | static PyObject *DlgObj_GetModalDialogEventMask(_self, _args) |
| 711 | DialogObject *_self; |
| 712 | PyObject *_args; |
| 713 | { |
| 714 | PyObject *_res = NULL; |
| 715 | OSStatus _err; |
| 716 | EventMask outMask; |
| 717 | if (!PyArg_ParseTuple(_args, "")) |
| 718 | return NULL; |
| 719 | _err = GetModalDialogEventMask(_self->ob_itself, |
| 720 | &outMask); |
| 721 | if (_err != noErr) return PyMac_Error(_err); |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 722 | _res = Py_BuildValue("H", |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 723 | outMask); |
| 724 | return _res; |
| 725 | } |
| 726 | |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 727 | static PyObject *DlgObj_GetDialogWindow(_self, _args) |
| 728 | DialogObject *_self; |
| 729 | PyObject *_args; |
| 730 | { |
| 731 | PyObject *_res = NULL; |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 732 | WindowPtr _rv; |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 733 | if (!PyArg_ParseTuple(_args, "")) |
| 734 | return NULL; |
| 735 | _rv = GetDialogWindow(_self->ob_itself); |
| 736 | _res = Py_BuildValue("O&", |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 737 | WinObj_New, _rv); |
| 738 | return _res; |
| 739 | } |
| 740 | |
| 741 | static PyObject *DlgObj_GetDialogTextEditHandle(_self, _args) |
| 742 | DialogObject *_self; |
| 743 | PyObject *_args; |
| 744 | { |
| 745 | PyObject *_res = NULL; |
| 746 | TEHandle _rv; |
| 747 | if (!PyArg_ParseTuple(_args, "")) |
| 748 | return NULL; |
| 749 | _rv = GetDialogTextEditHandle(_self->ob_itself); |
| 750 | _res = Py_BuildValue("O&", |
| 751 | ResObj_New, _rv); |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 752 | return _res; |
| 753 | } |
| 754 | |
| 755 | static PyObject *DlgObj_GetDialogDefaultItem(_self, _args) |
| 756 | DialogObject *_self; |
| 757 | PyObject *_args; |
| 758 | { |
| 759 | PyObject *_res = NULL; |
| 760 | SInt16 _rv; |
| 761 | if (!PyArg_ParseTuple(_args, "")) |
| 762 | return NULL; |
| 763 | _rv = GetDialogDefaultItem(_self->ob_itself); |
| 764 | _res = Py_BuildValue("h", |
| 765 | _rv); |
| 766 | return _res; |
| 767 | } |
| 768 | |
| 769 | static PyObject *DlgObj_GetDialogCancelItem(_self, _args) |
| 770 | DialogObject *_self; |
| 771 | PyObject *_args; |
| 772 | { |
| 773 | PyObject *_res = NULL; |
| 774 | SInt16 _rv; |
| 775 | if (!PyArg_ParseTuple(_args, "")) |
| 776 | return NULL; |
| 777 | _rv = GetDialogCancelItem(_self->ob_itself); |
| 778 | _res = Py_BuildValue("h", |
| 779 | _rv); |
| 780 | return _res; |
| 781 | } |
| 782 | |
| 783 | static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args) |
| 784 | DialogObject *_self; |
| 785 | PyObject *_args; |
| 786 | { |
| 787 | PyObject *_res = NULL; |
| 788 | SInt16 _rv; |
| 789 | if (!PyArg_ParseTuple(_args, "")) |
| 790 | return NULL; |
| 791 | _rv = GetDialogKeyboardFocusItem(_self->ob_itself); |
| 792 | _res = Py_BuildValue("h", |
| 793 | _rv); |
| 794 | return _res; |
| 795 | } |
| 796 | |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 797 | static PyObject *DlgObj_SetPortDialogPort(_self, _args) |
| 798 | DialogObject *_self; |
| 799 | PyObject *_args; |
| 800 | { |
| 801 | PyObject *_res = NULL; |
| 802 | if (!PyArg_ParseTuple(_args, "")) |
| 803 | return NULL; |
| 804 | SetPortDialogPort(_self->ob_itself); |
| 805 | Py_INCREF(Py_None); |
| 806 | _res = Py_None; |
| 807 | return _res; |
| 808 | } |
| 809 | |
| 810 | static PyObject *DlgObj_GetDialogPort(_self, _args) |
| 811 | DialogObject *_self; |
| 812 | PyObject *_args; |
| 813 | { |
| 814 | PyObject *_res = NULL; |
| 815 | CGrafPtr _rv; |
| 816 | if (!PyArg_ParseTuple(_args, "")) |
| 817 | return NULL; |
| 818 | _rv = GetDialogPort(_self->ob_itself); |
| 819 | _res = Py_BuildValue("O&", |
| 820 | GrafObj_New, _rv); |
| 821 | return _res; |
| 822 | } |
| 823 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 824 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 825 | |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 826 | static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args) |
| 827 | DialogObject *_self; |
| 828 | PyObject *_args; |
| 829 | { |
| 830 | PyObject *_res = NULL; |
| 831 | if (!PyArg_ParseTuple(_args, "")) |
| 832 | return NULL; |
| 833 | SetGrafPortOfDialog(_self->ob_itself); |
| 834 | Py_INCREF(Py_None); |
| 835 | _res = Py_None; |
| 836 | return _res; |
| 837 | } |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 838 | #endif |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 839 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 840 | static PyMethodDef DlgObj_methods[] = { |
| 841 | {"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1, |
| 842 | "() -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 843 | {"UpdateDialog", (PyCFunction)DlgObj_UpdateDialog, 1, |
Jack Jansen | 2b72417 | 1996-04-10 14:48:19 +0000 | [diff] [blame] | 844 | "(RgnHandle updateRgn) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 845 | {"HideDialogItem", (PyCFunction)DlgObj_HideDialogItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 846 | "(DialogItemIndex itemNo) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 847 | {"ShowDialogItem", (PyCFunction)DlgObj_ShowDialogItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 848 | "(DialogItemIndex itemNo) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 849 | {"FindDialogItem", (PyCFunction)DlgObj_FindDialogItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 850 | "(Point thePt) -> (DialogItemIndexZeroBased _rv)"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 851 | {"DialogCut", (PyCFunction)DlgObj_DialogCut, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 852 | "() -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 853 | {"DialogPaste", (PyCFunction)DlgObj_DialogPaste, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 854 | "() -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 855 | {"DialogCopy", (PyCFunction)DlgObj_DialogCopy, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 856 | "() -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 857 | {"DialogDelete", (PyCFunction)DlgObj_DialogDelete, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 858 | "() -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 859 | {"GetDialogItem", (PyCFunction)DlgObj_GetDialogItem, 1, |
| 860 | "(DialogItemIndex itemNo) -> (DialogItemType itemType, Handle item, Rect box)"}, |
| 861 | {"SetDialogItem", (PyCFunction)DlgObj_SetDialogItem, 1, |
| 862 | "(DialogItemIndex itemNo, DialogItemType itemType, Handle item, Rect box) -> None"}, |
| 863 | {"SelectDialogItemText", (PyCFunction)DlgObj_SelectDialogItemText, 1, |
| 864 | "(DialogItemIndex itemNo, SInt16 strtSel, SInt16 endSel) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 865 | {"AppendDITL", (PyCFunction)DlgObj_AppendDITL, 1, |
| 866 | "(Handle theHandle, DITLMethod method) -> None"}, |
| 867 | {"CountDITL", (PyCFunction)DlgObj_CountDITL, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 868 | "() -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 869 | {"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 870 | "(DialogItemIndex numberItems) -> None"}, |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 871 | |
| 872 | #if TARGET_API_MAC_CARBON |
| 873 | {"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1, |
| 874 | "(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None"}, |
| 875 | #endif |
| 876 | |
| 877 | #if TARGET_API_MAC_CARBON |
| 878 | {"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1, |
| 879 | "(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None"}, |
| 880 | #endif |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 881 | {"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 882 | "() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 883 | {"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 884 | "(DialogItemIndex newItem) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 885 | {"SetDialogCancelItem", (PyCFunction)DlgObj_SetDialogCancelItem, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 886 | "(DialogItemIndex newItem) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 887 | {"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1, |
| 888 | "(Boolean tracks) -> None"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 889 | {"AutoSizeDialog", (PyCFunction)DlgObj_AutoSizeDialog, 1, |
| 890 | "() -> None"}, |
| 891 | {"GetDialogItemAsControl", (PyCFunction)DlgObj_GetDialogItemAsControl, 1, |
| 892 | "(SInt16 inItemNo) -> (ControlHandle outControl)"}, |
| 893 | {"MoveDialogItem", (PyCFunction)DlgObj_MoveDialogItem, 1, |
| 894 | "(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None"}, |
| 895 | {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1, |
Jack Jansen | 1c4e614 | 1998-04-21 15:23:55 +0000 | [diff] [blame] | 896 | "(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None"}, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 897 | {"AppendDialogItemList", (PyCFunction)DlgObj_AppendDialogItemList, 1, |
| 898 | "(SInt16 ditlID, DITLMethod method) -> None"}, |
| 899 | {"SetDialogTimeout", (PyCFunction)DlgObj_SetDialogTimeout, 1, |
| 900 | "(SInt16 inButtonToPress, UInt32 inSecondsToWait) -> None"}, |
| 901 | {"GetDialogTimeout", (PyCFunction)DlgObj_GetDialogTimeout, 1, |
| 902 | "() -> (SInt16 outButtonToPress, UInt32 outSecondsToWait, UInt32 outSecondsRemaining)"}, |
| 903 | {"SetModalDialogEventMask", (PyCFunction)DlgObj_SetModalDialogEventMask, 1, |
| 904 | "(EventMask inMask) -> None"}, |
| 905 | {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1, |
| 906 | "() -> (EventMask outMask)"}, |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 907 | {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 908 | "() -> (WindowPtr _rv)"}, |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 909 | {"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1, |
| 910 | "() -> (TEHandle _rv)"}, |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 911 | {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, |
| 912 | "() -> (SInt16 _rv)"}, |
| 913 | {"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1, |
| 914 | "() -> (SInt16 _rv)"}, |
| 915 | {"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1, |
| 916 | "() -> (SInt16 _rv)"}, |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 917 | {"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1, |
| 918 | "() -> None"}, |
| 919 | {"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1, |
| 920 | "() -> (CGrafPtr _rv)"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 921 | |
Jack Jansen | 74a1e63 | 2000-07-14 22:37:27 +0000 | [diff] [blame] | 922 | #if !TARGET_API_MAC_CARBON |
Jack Jansen | d96cb50 | 1996-09-23 15:48:46 +0000 | [diff] [blame] | 923 | {"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1, |
| 924 | "() -> None"}, |
Jack Jansen | e79dc76 | 2000-06-02 21:35:07 +0000 | [diff] [blame] | 925 | #endif |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 926 | {NULL, NULL, 0} |
| 927 | }; |
| 928 | |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 929 | PyMethodChain DlgObj_chain = { DlgObj_methods, NULL }; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 930 | |
| 931 | static PyObject *DlgObj_getattr(self, name) |
| 932 | DialogObject *self; |
| 933 | char *name; |
| 934 | { |
| 935 | return Py_FindMethodInChain(&DlgObj_chain, (PyObject *)self, name); |
| 936 | } |
| 937 | |
| 938 | #define DlgObj_setattr NULL |
| 939 | |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 940 | static int DlgObj_compare(self, other) |
| 941 | DialogObject *self, *other; |
| 942 | { |
| 943 | if ( self->ob_itself > other->ob_itself ) return 1; |
| 944 | if ( self->ob_itself < other->ob_itself ) return -1; |
| 945 | return 0; |
| 946 | } |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 947 | |
| 948 | #define DlgObj_repr NULL |
| 949 | |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 950 | static int DlgObj_hash(self) |
| 951 | DialogObject *self; |
| 952 | { |
| 953 | return (int)self->ob_itself; |
| 954 | } |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 955 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 956 | PyTypeObject Dialog_Type = { |
| 957 | PyObject_HEAD_INIT(&PyType_Type) |
| 958 | 0, /*ob_size*/ |
| 959 | "Dialog", /*tp_name*/ |
| 960 | sizeof(DialogObject), /*tp_basicsize*/ |
| 961 | 0, /*tp_itemsize*/ |
| 962 | /* methods */ |
| 963 | (destructor) DlgObj_dealloc, /*tp_dealloc*/ |
| 964 | 0, /*tp_print*/ |
| 965 | (getattrfunc) DlgObj_getattr, /*tp_getattr*/ |
| 966 | (setattrfunc) DlgObj_setattr, /*tp_setattr*/ |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 967 | (cmpfunc) DlgObj_compare, /*tp_compare*/ |
| 968 | (reprfunc) DlgObj_repr, /*tp_repr*/ |
| 969 | (PyNumberMethods *)0, /* tp_as_number */ |
| 970 | (PySequenceMethods *)0, /* tp_as_sequence */ |
| 971 | (PyMappingMethods *)0, /* tp_as_mapping */ |
| 972 | (hashfunc) DlgObj_hash, /*tp_hash*/ |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 973 | }; |
| 974 | |
| 975 | /* --------------------- End object type Dialog --------------------- */ |
| 976 | |
| 977 | |
| 978 | static PyObject *Dlg_NewDialog(_self, _args) |
| 979 | PyObject *_self; |
| 980 | PyObject *_args; |
| 981 | { |
| 982 | PyObject *_res = NULL; |
| 983 | DialogPtr _rv; |
| 984 | Rect boundsRect; |
| 985 | Str255 title; |
| 986 | Boolean visible; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 987 | SInt16 procID; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 988 | WindowPtr behind; |
| 989 | Boolean goAwayFlag; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 990 | SInt32 refCon; |
| 991 | Handle items; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 992 | if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&", |
| 993 | PyMac_GetRect, &boundsRect, |
| 994 | PyMac_GetStr255, title, |
| 995 | &visible, |
| 996 | &procID, |
| 997 | WinObj_Convert, &behind, |
| 998 | &goAwayFlag, |
| 999 | &refCon, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1000 | ResObj_Convert, &items)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1001 | return NULL; |
| 1002 | _rv = NewDialog((void *)0, |
| 1003 | &boundsRect, |
| 1004 | title, |
| 1005 | visible, |
| 1006 | procID, |
| 1007 | behind, |
| 1008 | goAwayFlag, |
| 1009 | refCon, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1010 | items); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1011 | _res = Py_BuildValue("O&", |
| 1012 | DlgObj_New, _rv); |
| 1013 | return _res; |
| 1014 | } |
| 1015 | |
| 1016 | static PyObject *Dlg_GetNewDialog(_self, _args) |
| 1017 | PyObject *_self; |
| 1018 | PyObject *_args; |
| 1019 | { |
| 1020 | PyObject *_res = NULL; |
| 1021 | DialogPtr _rv; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1022 | SInt16 dialogID; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1023 | WindowPtr behind; |
| 1024 | if (!PyArg_ParseTuple(_args, "hO&", |
| 1025 | &dialogID, |
| 1026 | WinObj_Convert, &behind)) |
| 1027 | return NULL; |
| 1028 | _rv = GetNewDialog(dialogID, |
| 1029 | (void *)0, |
| 1030 | behind); |
| 1031 | _res = Py_BuildValue("O&", |
| 1032 | DlgObj_New, _rv); |
| 1033 | return _res; |
| 1034 | } |
| 1035 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1036 | static PyObject *Dlg_NewColorDialog(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1037 | PyObject *_self; |
| 1038 | PyObject *_args; |
| 1039 | { |
| 1040 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1041 | DialogPtr _rv; |
| 1042 | Rect boundsRect; |
| 1043 | Str255 title; |
| 1044 | Boolean visible; |
| 1045 | SInt16 procID; |
| 1046 | WindowPtr behind; |
| 1047 | Boolean goAwayFlag; |
| 1048 | SInt32 refCon; |
| 1049 | Handle items; |
| 1050 | if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&", |
| 1051 | PyMac_GetRect, &boundsRect, |
| 1052 | PyMac_GetStr255, title, |
| 1053 | &visible, |
| 1054 | &procID, |
| 1055 | WinObj_Convert, &behind, |
| 1056 | &goAwayFlag, |
| 1057 | &refCon, |
| 1058 | ResObj_Convert, &items)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1059 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1060 | _rv = NewColorDialog((void *)0, |
| 1061 | &boundsRect, |
| 1062 | title, |
| 1063 | visible, |
| 1064 | procID, |
| 1065 | behind, |
| 1066 | goAwayFlag, |
| 1067 | refCon, |
| 1068 | items); |
| 1069 | _res = Py_BuildValue("O&", |
| 1070 | DlgObj_New, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1071 | return _res; |
| 1072 | } |
| 1073 | |
| 1074 | static PyObject *Dlg_ModalDialog(_self, _args) |
| 1075 | PyObject *_self; |
| 1076 | PyObject *_args; |
| 1077 | { |
| 1078 | PyObject *_res = NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1079 | PyObject* modalFilter; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1080 | DialogItemIndex itemHit; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1081 | if (!PyArg_ParseTuple(_args, "O", |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1082 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1083 | return NULL; |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 1084 | ModalDialog(Dlg_PassFilterProc(modalFilter), |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1085 | &itemHit); |
| 1086 | _res = Py_BuildValue("h", |
| 1087 | itemHit); |
| 1088 | return _res; |
| 1089 | } |
| 1090 | |
| 1091 | static PyObject *Dlg_IsDialogEvent(_self, _args) |
| 1092 | PyObject *_self; |
| 1093 | PyObject *_args; |
| 1094 | { |
| 1095 | PyObject *_res = NULL; |
| 1096 | Boolean _rv; |
| 1097 | EventRecord theEvent; |
| 1098 | if (!PyArg_ParseTuple(_args, "O&", |
| 1099 | PyMac_GetEventRecord, &theEvent)) |
| 1100 | return NULL; |
| 1101 | _rv = IsDialogEvent(&theEvent); |
| 1102 | _res = Py_BuildValue("b", |
| 1103 | _rv); |
| 1104 | return _res; |
| 1105 | } |
| 1106 | |
| 1107 | static PyObject *Dlg_DialogSelect(_self, _args) |
| 1108 | PyObject *_self; |
| 1109 | PyObject *_args; |
| 1110 | { |
| 1111 | PyObject *_res = NULL; |
| 1112 | Boolean _rv; |
| 1113 | EventRecord theEvent; |
| 1114 | DialogPtr theDialog; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1115 | DialogItemIndex itemHit; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1116 | if (!PyArg_ParseTuple(_args, "O&", |
| 1117 | PyMac_GetEventRecord, &theEvent)) |
| 1118 | return NULL; |
| 1119 | _rv = DialogSelect(&theEvent, |
| 1120 | &theDialog, |
| 1121 | &itemHit); |
| 1122 | _res = Py_BuildValue("bO&h", |
| 1123 | _rv, |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 1124 | DlgObj_WhichDialog, theDialog, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1125 | itemHit); |
| 1126 | return _res; |
| 1127 | } |
| 1128 | |
| 1129 | static PyObject *Dlg_Alert(_self, _args) |
| 1130 | PyObject *_self; |
| 1131 | PyObject *_args; |
| 1132 | { |
| 1133 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1134 | DialogItemIndex _rv; |
| 1135 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1136 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1137 | if (!PyArg_ParseTuple(_args, "hO", |
| 1138 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1139 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1140 | return NULL; |
| 1141 | _rv = Alert(alertID, |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 1142 | Dlg_PassFilterProc(modalFilter)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1143 | _res = Py_BuildValue("h", |
| 1144 | _rv); |
| 1145 | return _res; |
| 1146 | } |
| 1147 | |
| 1148 | static PyObject *Dlg_StopAlert(_self, _args) |
| 1149 | PyObject *_self; |
| 1150 | PyObject *_args; |
| 1151 | { |
| 1152 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1153 | DialogItemIndex _rv; |
| 1154 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1155 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1156 | if (!PyArg_ParseTuple(_args, "hO", |
| 1157 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1158 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1159 | return NULL; |
| 1160 | _rv = StopAlert(alertID, |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 1161 | Dlg_PassFilterProc(modalFilter)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1162 | _res = Py_BuildValue("h", |
| 1163 | _rv); |
| 1164 | return _res; |
| 1165 | } |
| 1166 | |
| 1167 | static PyObject *Dlg_NoteAlert(_self, _args) |
| 1168 | PyObject *_self; |
| 1169 | PyObject *_args; |
| 1170 | { |
| 1171 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1172 | DialogItemIndex _rv; |
| 1173 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1174 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1175 | if (!PyArg_ParseTuple(_args, "hO", |
| 1176 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1177 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1178 | return NULL; |
| 1179 | _rv = NoteAlert(alertID, |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 1180 | Dlg_PassFilterProc(modalFilter)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1181 | _res = Py_BuildValue("h", |
| 1182 | _rv); |
| 1183 | return _res; |
| 1184 | } |
| 1185 | |
| 1186 | static PyObject *Dlg_CautionAlert(_self, _args) |
| 1187 | PyObject *_self; |
| 1188 | PyObject *_args; |
| 1189 | { |
| 1190 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1191 | DialogItemIndex _rv; |
| 1192 | SInt16 alertID; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1193 | PyObject* modalFilter; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1194 | if (!PyArg_ParseTuple(_args, "hO", |
| 1195 | &alertID, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1196 | &modalFilter)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1197 | return NULL; |
| 1198 | _rv = CautionAlert(alertID, |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 1199 | Dlg_PassFilterProc(modalFilter)); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1200 | _res = Py_BuildValue("h", |
| 1201 | _rv); |
| 1202 | return _res; |
| 1203 | } |
| 1204 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1205 | static PyObject *Dlg_ParamText(_self, _args) |
| 1206 | PyObject *_self; |
| 1207 | PyObject *_args; |
| 1208 | { |
| 1209 | PyObject *_res = NULL; |
| 1210 | Str255 param0; |
| 1211 | Str255 param1; |
| 1212 | Str255 param2; |
| 1213 | Str255 param3; |
| 1214 | if (!PyArg_ParseTuple(_args, "O&O&O&O&", |
| 1215 | PyMac_GetStr255, param0, |
| 1216 | PyMac_GetStr255, param1, |
| 1217 | PyMac_GetStr255, param2, |
| 1218 | PyMac_GetStr255, param3)) |
| 1219 | return NULL; |
| 1220 | ParamText(param0, |
| 1221 | param1, |
| 1222 | param2, |
| 1223 | param3); |
| 1224 | Py_INCREF(Py_None); |
| 1225 | _res = Py_None; |
| 1226 | return _res; |
| 1227 | } |
| 1228 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1229 | static PyObject *Dlg_GetDialogItemText(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1230 | PyObject *_self; |
| 1231 | PyObject *_args; |
| 1232 | { |
| 1233 | PyObject *_res = NULL; |
| 1234 | Handle item; |
| 1235 | Str255 text; |
| 1236 | if (!PyArg_ParseTuple(_args, "O&", |
| 1237 | ResObj_Convert, &item)) |
| 1238 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1239 | GetDialogItemText(item, |
| 1240 | text); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1241 | _res = Py_BuildValue("O&", |
| 1242 | PyMac_BuildStr255, text); |
| 1243 | return _res; |
| 1244 | } |
| 1245 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1246 | static PyObject *Dlg_SetDialogItemText(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1247 | PyObject *_self; |
| 1248 | PyObject *_args; |
| 1249 | { |
| 1250 | PyObject *_res = NULL; |
| 1251 | Handle item; |
| 1252 | Str255 text; |
| 1253 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1254 | ResObj_Convert, &item, |
| 1255 | PyMac_GetStr255, text)) |
| 1256 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1257 | SetDialogItemText(item, |
| 1258 | text); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1259 | Py_INCREF(Py_None); |
| 1260 | _res = Py_None; |
| 1261 | return _res; |
| 1262 | } |
| 1263 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1264 | static PyObject *Dlg_GetAlertStage(_self, _args) |
| 1265 | PyObject *_self; |
| 1266 | PyObject *_args; |
| 1267 | { |
| 1268 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1269 | SInt16 _rv; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1270 | if (!PyArg_ParseTuple(_args, "")) |
| 1271 | return NULL; |
| 1272 | _rv = GetAlertStage(); |
| 1273 | _res = Py_BuildValue("h", |
| 1274 | _rv); |
| 1275 | return _res; |
| 1276 | } |
| 1277 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1278 | static PyObject *Dlg_SetDialogFont(_self, _args) |
| 1279 | PyObject *_self; |
| 1280 | PyObject *_args; |
| 1281 | { |
| 1282 | PyObject *_res = NULL; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1283 | SInt16 fontNum; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1284 | if (!PyArg_ParseTuple(_args, "h", |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1285 | &fontNum)) |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1286 | return NULL; |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1287 | SetDialogFont(fontNum); |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1288 | Py_INCREF(Py_None); |
| 1289 | _res = Py_None; |
| 1290 | return _res; |
| 1291 | } |
| 1292 | |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1293 | static PyObject *Dlg_ResetAlertStage(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1294 | PyObject *_self; |
| 1295 | PyObject *_args; |
| 1296 | { |
| 1297 | PyObject *_res = NULL; |
| 1298 | if (!PyArg_ParseTuple(_args, "")) |
| 1299 | return NULL; |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1300 | ResetAlertStage(); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1301 | Py_INCREF(Py_None); |
| 1302 | _res = Py_None; |
| 1303 | return _res; |
| 1304 | } |
| 1305 | |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1306 | #if TARGET_API_MAC_CARBON |
| 1307 | |
| 1308 | static PyObject *Dlg_GetParamText(_self, _args) |
| 1309 | PyObject *_self; |
| 1310 | PyObject *_args; |
| 1311 | { |
| 1312 | PyObject *_res = NULL; |
| 1313 | Str255 param0; |
| 1314 | Str255 param1; |
| 1315 | Str255 param2; |
| 1316 | Str255 param3; |
| 1317 | if (!PyArg_ParseTuple(_args, "O&O&O&O&", |
| 1318 | PyMac_GetStr255, param0, |
| 1319 | PyMac_GetStr255, param1, |
| 1320 | PyMac_GetStr255, param2, |
| 1321 | PyMac_GetStr255, param3)) |
| 1322 | return NULL; |
| 1323 | GetParamText(param0, |
| 1324 | param1, |
| 1325 | param2, |
| 1326 | param3); |
| 1327 | Py_INCREF(Py_None); |
| 1328 | _res = Py_None; |
| 1329 | return _res; |
| 1330 | } |
| 1331 | #endif |
| 1332 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1333 | static PyObject *Dlg_NewFeaturesDialog(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1334 | PyObject *_self; |
| 1335 | PyObject *_args; |
| 1336 | { |
| 1337 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1338 | DialogPtr _rv; |
| 1339 | Rect inBoundsRect; |
| 1340 | Str255 inTitle; |
| 1341 | Boolean inIsVisible; |
| 1342 | SInt16 inProcID; |
| 1343 | WindowPtr inBehind; |
| 1344 | Boolean inGoAwayFlag; |
| 1345 | SInt32 inRefCon; |
| 1346 | Handle inItemListHandle; |
| 1347 | UInt32 inFlags; |
| 1348 | if (!PyArg_ParseTuple(_args, "O&O&bhO&blO&l", |
| 1349 | PyMac_GetRect, &inBoundsRect, |
| 1350 | PyMac_GetStr255, inTitle, |
| 1351 | &inIsVisible, |
| 1352 | &inProcID, |
| 1353 | WinObj_Convert, &inBehind, |
| 1354 | &inGoAwayFlag, |
| 1355 | &inRefCon, |
| 1356 | ResObj_Convert, &inItemListHandle, |
| 1357 | &inFlags)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1358 | return NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1359 | _rv = NewFeaturesDialog((void *)0, |
| 1360 | &inBoundsRect, |
| 1361 | inTitle, |
| 1362 | inIsVisible, |
| 1363 | inProcID, |
| 1364 | inBehind, |
| 1365 | inGoAwayFlag, |
| 1366 | inRefCon, |
| 1367 | inItemListHandle, |
| 1368 | inFlags); |
| 1369 | _res = Py_BuildValue("O&", |
| 1370 | DlgObj_New, _rv); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1371 | return _res; |
| 1372 | } |
| 1373 | |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1374 | static PyObject *Dlg_GetDialogFromWindow(_self, _args) |
| 1375 | PyObject *_self; |
| 1376 | PyObject *_args; |
| 1377 | { |
| 1378 | PyObject *_res = NULL; |
| 1379 | DialogPtr _rv; |
| 1380 | WindowPtr window; |
| 1381 | if (!PyArg_ParseTuple(_args, "O&", |
| 1382 | WinObj_Convert, &window)) |
| 1383 | return NULL; |
| 1384 | _rv = GetDialogFromWindow(window); |
| 1385 | _res = Py_BuildValue("O&", |
| 1386 | DlgObj_New, _rv); |
| 1387 | return _res; |
| 1388 | } |
| 1389 | |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 1390 | static PyObject *Dlg_SetUserItemHandler(_self, _args) |
| 1391 | PyObject *_self; |
| 1392 | PyObject *_args; |
| 1393 | { |
| 1394 | PyObject *_res = NULL; |
| 1395 | |
| 1396 | PyObject *new = NULL; |
| 1397 | |
| 1398 | |
| 1399 | if (!PyArg_ParseTuple(_args, "|O", &new)) |
| 1400 | return NULL; |
| 1401 | |
| 1402 | if (Dlg_UserItemProc_callback && new && new != Py_None) { |
| 1403 | PyErr_SetString(Dlg_Error, "Another UserItemProc is already installed"); |
| 1404 | return NULL; |
| 1405 | } |
| 1406 | |
Jack Jansen | 599ce9c | 2001-02-20 22:27:43 +0000 | [diff] [blame^] | 1407 | if (new == NULL || new == Py_None) { |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 1408 | new = NULL; |
| 1409 | _res = Py_None; |
| 1410 | Py_INCREF(Py_None); |
| 1411 | } else { |
| 1412 | Py_INCREF(new); |
| 1413 | _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemProc(Dlg_UnivUserItemProc)); |
| 1414 | } |
| 1415 | |
| 1416 | Dlg_UserItemProc_callback = new; |
| 1417 | return _res; |
| 1418 | |
| 1419 | } |
| 1420 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1421 | static PyMethodDef Dlg_methods[] = { |
| 1422 | {"NewDialog", (PyCFunction)Dlg_NewDialog, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1423 | "(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] | 1424 | {"GetNewDialog", (PyCFunction)Dlg_GetNewDialog, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1425 | "(SInt16 dialogID, WindowPtr behind) -> (DialogPtr _rv)"}, |
| 1426 | {"NewColorDialog", (PyCFunction)Dlg_NewColorDialog, 1, |
| 1427 | "(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] | 1428 | {"ModalDialog", (PyCFunction)Dlg_ModalDialog, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1429 | "(PyObject* modalFilter) -> (DialogItemIndex itemHit)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1430 | {"IsDialogEvent", (PyCFunction)Dlg_IsDialogEvent, 1, |
| 1431 | "(EventRecord theEvent) -> (Boolean _rv)"}, |
| 1432 | {"DialogSelect", (PyCFunction)Dlg_DialogSelect, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1433 | "(EventRecord theEvent) -> (Boolean _rv, DialogPtr theDialog, DialogItemIndex itemHit)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1434 | {"Alert", (PyCFunction)Dlg_Alert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1435 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1436 | {"StopAlert", (PyCFunction)Dlg_StopAlert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1437 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1438 | {"NoteAlert", (PyCFunction)Dlg_NoteAlert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1439 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1440 | {"CautionAlert", (PyCFunction)Dlg_CautionAlert, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1441 | "(SInt16 alertID, PyObject* modalFilter) -> (DialogItemIndex _rv)"}, |
| 1442 | {"ParamText", (PyCFunction)Dlg_ParamText, 1, |
| 1443 | "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1444 | {"GetDialogItemText", (PyCFunction)Dlg_GetDialogItemText, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1445 | "(Handle item) -> (Str255 text)"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1446 | {"SetDialogItemText", (PyCFunction)Dlg_SetDialogItemText, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1447 | "(Handle item, Str255 text) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1448 | {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1449 | "() -> (SInt16 _rv)"}, |
| 1450 | {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1, |
Jack Jansen | a05ac60 | 1999-12-12 21:41:51 +0000 | [diff] [blame] | 1451 | "(SInt16 fontNum) -> None"}, |
Jack Jansen | ae8a68f | 1995-06-06 12:55:40 +0000 | [diff] [blame] | 1452 | {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1453 | "() -> None"}, |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1454 | |
| 1455 | #if TARGET_API_MAC_CARBON |
| 1456 | {"GetParamText", (PyCFunction)Dlg_GetParamText, 1, |
| 1457 | "(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"}, |
| 1458 | #endif |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 1459 | {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1, |
| 1460 | "(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)"}, |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1461 | {"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1, |
| 1462 | "(WindowPtr window) -> (DialogPtr _rv)"}, |
Jack Jansen | df901df | 1998-07-10 15:47:48 +0000 | [diff] [blame] | 1463 | {"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1, |
| 1464 | NULL}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1465 | {NULL, NULL, 0} |
| 1466 | }; |
| 1467 | |
| 1468 | |
| 1469 | |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1470 | /* Return the WindowPtr corresponding to a DialogObject */ |
| 1471 | |
| 1472 | WindowPtr |
| 1473 | DlgObj_ConvertToWindow(self) |
| 1474 | PyObject *self; |
| 1475 | { |
| 1476 | if ( DlgObj_Check(self) ) |
| 1477 | return GetDialogWindow(((DialogObject *)self)->ob_itself); |
| 1478 | return NULL; |
| 1479 | } |
Jack Jansen | 69e7f11 | 2001-02-06 16:14:54 +0000 | [diff] [blame] | 1480 | /* Return the object corresponding to the dialog, or None */ |
| 1481 | |
| 1482 | PyObject * |
| 1483 | DlgObj_WhichDialog(d) |
| 1484 | DialogPtr d; |
| 1485 | { |
| 1486 | PyObject *it; |
| 1487 | |
| 1488 | if (d == NULL) { |
| 1489 | it = Py_None; |
| 1490 | Py_INCREF(it); |
| 1491 | } else { |
| 1492 | WindowPtr w = GetDialogWindow(d); |
| 1493 | |
| 1494 | it = (PyObject *) GetWRefCon(w); |
| 1495 | if (it == NULL || ((DialogObject *)it)->ob_itself != d || !DlgObj_Check(it)) { |
| 1496 | #if 0 |
| 1497 | /* Should do this, but we don't have an ob_freeit for dialogs yet. */ |
| 1498 | it = WinObj_New(w); |
| 1499 | ((WindowObject *)it)->ob_freeit = NULL; |
| 1500 | #else |
| 1501 | it = Py_None; |
| 1502 | Py_INCREF(it); |
| 1503 | #endif |
| 1504 | } else { |
| 1505 | Py_INCREF(it); |
| 1506 | } |
| 1507 | } |
| 1508 | return it; |
| 1509 | } |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1510 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1511 | |
| 1512 | void initDlg() |
| 1513 | { |
| 1514 | PyObject *m; |
| 1515 | PyObject *d; |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | m = Py_InitModule("Dlg", Dlg_methods); |
| 1521 | d = PyModule_GetDict(m); |
| 1522 | Dlg_Error = PyMac_GetOSErrException(); |
| 1523 | if (Dlg_Error == NULL || |
| 1524 | PyDict_SetItemString(d, "Error", Dlg_Error) != 0) |
Jack Jansen | f7d5aa6 | 2000-12-10 23:43:49 +0000 | [diff] [blame] | 1525 | return; |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 1526 | Dialog_Type.ob_type = &PyType_Type; |
| 1527 | Py_INCREF(&Dialog_Type); |
| 1528 | if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0) |
| 1529 | Py_FatalError("can't initialize DialogType"); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1530 | } |
| 1531 | |
| 1532 | /* ========================= End module Dlg ========================= */ |
| 1533 | |