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