Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* ========================== Module Menu =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #define SystemSevenOrLater 1 |
| 9 | |
| 10 | #include "macglue.h" |
| 11 | #include <Memory.h> |
| 12 | #include <Dialogs.h> |
| 13 | #include <Menus.h> |
| 14 | #include <Controls.h> |
| 15 | |
| 16 | extern PyObject *ResObj_New(Handle); |
| 17 | extern int ResObj_Convert(PyObject *, Handle *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 18 | extern PyObject *OptResObj_New(Handle); |
| 19 | extern int OptResObj_Convert(PyObject *, Handle *); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 20 | |
| 21 | extern PyObject *WinObj_New(WindowPtr); |
| 22 | extern int WinObj_Convert(PyObject *, WindowPtr *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 23 | extern PyTypeObject Window_Type; |
| 24 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 25 | |
| 26 | extern PyObject *DlgObj_New(DialogPtr); |
| 27 | extern int DlgObj_Convert(PyObject *, DialogPtr *); |
| 28 | extern PyTypeObject Dialog_Type; |
| 29 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 30 | |
| 31 | extern PyObject *MenuObj_New(MenuHandle); |
| 32 | extern int MenuObj_Convert(PyObject *, MenuHandle *); |
| 33 | |
| 34 | extern PyObject *CtlObj_New(ControlHandle); |
| 35 | extern int CtlObj_Convert(PyObject *, ControlHandle *); |
| 36 | |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 37 | extern PyObject *GrafObj_New(GrafPtr); |
| 38 | extern int GrafObj_Convert(PyObject *, GrafPtr *); |
| 39 | |
| 40 | extern PyObject *BMObj_New(BitMapPtr); |
| 41 | extern int BMObj_Convert(PyObject *, BitMapPtr *); |
| 42 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 43 | extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
Guido van Rossum | 86c3af7 | 1995-03-19 22:42:51 +0000 | [diff] [blame] | 45 | #include <Devices.h> /* Defines OpenDeskAcc in universal headers */ |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 46 | #include <Menus.h> |
| 47 | |
| 48 | #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ |
| 49 | |
| 50 | static PyObject *Menu_Error; |
| 51 | |
| 52 | /* ------------------------ Object type Menu ------------------------ */ |
| 53 | |
| 54 | PyTypeObject Menu_Type; |
| 55 | |
| 56 | #define MenuObj_Check(x) ((x)->ob_type == &Menu_Type) |
| 57 | |
| 58 | typedef struct MenuObject { |
| 59 | PyObject_HEAD |
| 60 | MenuHandle ob_itself; |
| 61 | } MenuObject; |
| 62 | |
| 63 | PyObject *MenuObj_New(itself) |
Guido van Rossum | 227a423 | 1995-03-10 14:42:57 +0000 | [diff] [blame] | 64 | MenuHandle itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 65 | { |
| 66 | MenuObject *it; |
| 67 | it = PyObject_NEW(MenuObject, &Menu_Type); |
| 68 | if (it == NULL) return NULL; |
| 69 | it->ob_itself = itself; |
| 70 | return (PyObject *)it; |
| 71 | } |
| 72 | MenuObj_Convert(v, p_itself) |
| 73 | PyObject *v; |
| 74 | MenuHandle *p_itself; |
| 75 | { |
| 76 | if (!MenuObj_Check(v)) |
| 77 | { |
| 78 | PyErr_SetString(PyExc_TypeError, "Menu required"); |
| 79 | return 0; |
| 80 | } |
| 81 | *p_itself = ((MenuObject *)v)->ob_itself; |
| 82 | return 1; |
| 83 | } |
| 84 | |
| 85 | static void MenuObj_dealloc(self) |
| 86 | MenuObject *self; |
| 87 | { |
| 88 | /* Cleanup of self->ob_itself goes here */ |
| 89 | PyMem_DEL(self); |
| 90 | } |
| 91 | |
| 92 | static PyObject *MenuObj_DisposeMenu(_self, _args) |
| 93 | MenuObject *_self; |
| 94 | PyObject *_args; |
| 95 | { |
| 96 | PyObject *_res = NULL; |
| 97 | if (!PyArg_ParseTuple(_args, "")) |
| 98 | return NULL; |
| 99 | DisposeMenu(_self->ob_itself); |
| 100 | Py_INCREF(Py_None); |
| 101 | _res = Py_None; |
| 102 | return _res; |
| 103 | } |
| 104 | |
| 105 | static PyObject *MenuObj_AppendMenu(_self, _args) |
| 106 | MenuObject *_self; |
| 107 | PyObject *_args; |
| 108 | { |
| 109 | PyObject *_res = NULL; |
| 110 | Str255 data; |
| 111 | if (!PyArg_ParseTuple(_args, "O&", |
| 112 | PyMac_GetStr255, data)) |
| 113 | return NULL; |
| 114 | AppendMenu(_self->ob_itself, |
| 115 | data); |
| 116 | Py_INCREF(Py_None); |
| 117 | _res = Py_None; |
| 118 | return _res; |
| 119 | } |
| 120 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 121 | static PyObject *MenuObj_AppendResMenu(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 122 | MenuObject *_self; |
| 123 | PyObject *_args; |
| 124 | { |
| 125 | PyObject *_res = NULL; |
| 126 | ResType theType; |
| 127 | if (!PyArg_ParseTuple(_args, "O&", |
| 128 | PyMac_GetOSType, &theType)) |
| 129 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 130 | AppendResMenu(_self->ob_itself, |
| 131 | theType); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 132 | Py_INCREF(Py_None); |
| 133 | _res = Py_None; |
| 134 | return _res; |
| 135 | } |
| 136 | |
| 137 | static PyObject *MenuObj_InsertResMenu(_self, _args) |
| 138 | MenuObject *_self; |
| 139 | PyObject *_args; |
| 140 | { |
| 141 | PyObject *_res = NULL; |
| 142 | ResType theType; |
| 143 | short afterItem; |
| 144 | if (!PyArg_ParseTuple(_args, "O&h", |
| 145 | PyMac_GetOSType, &theType, |
| 146 | &afterItem)) |
| 147 | return NULL; |
| 148 | InsertResMenu(_self->ob_itself, |
| 149 | theType, |
| 150 | afterItem); |
| 151 | Py_INCREF(Py_None); |
| 152 | _res = Py_None; |
| 153 | return _res; |
| 154 | } |
| 155 | |
| 156 | static PyObject *MenuObj_InsertMenu(_self, _args) |
| 157 | MenuObject *_self; |
| 158 | PyObject *_args; |
| 159 | { |
| 160 | PyObject *_res = NULL; |
| 161 | short beforeID; |
| 162 | if (!PyArg_ParseTuple(_args, "h", |
| 163 | &beforeID)) |
| 164 | return NULL; |
| 165 | InsertMenu(_self->ob_itself, |
| 166 | beforeID); |
| 167 | Py_INCREF(Py_None); |
| 168 | _res = Py_None; |
| 169 | return _res; |
| 170 | } |
| 171 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 172 | static PyObject *MenuObj_InsertMenuItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 173 | MenuObject *_self; |
| 174 | PyObject *_args; |
| 175 | { |
| 176 | PyObject *_res = NULL; |
| 177 | Str255 itemString; |
| 178 | short afterItem; |
| 179 | if (!PyArg_ParseTuple(_args, "O&h", |
| 180 | PyMac_GetStr255, itemString, |
| 181 | &afterItem)) |
| 182 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 183 | InsertMenuItem(_self->ob_itself, |
| 184 | itemString, |
| 185 | afterItem); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 186 | Py_INCREF(Py_None); |
| 187 | _res = Py_None; |
| 188 | return _res; |
| 189 | } |
| 190 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 191 | static PyObject *MenuObj_DeleteMenuItem(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 192 | MenuObject *_self; |
| 193 | PyObject *_args; |
| 194 | { |
| 195 | PyObject *_res = NULL; |
| 196 | short item; |
| 197 | if (!PyArg_ParseTuple(_args, "h", |
| 198 | &item)) |
| 199 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 200 | DeleteMenuItem(_self->ob_itself, |
| 201 | item); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 202 | Py_INCREF(Py_None); |
| 203 | _res = Py_None; |
| 204 | return _res; |
| 205 | } |
| 206 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 207 | static PyObject *MenuObj_SetMenuItemText(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 208 | MenuObject *_self; |
| 209 | PyObject *_args; |
| 210 | { |
| 211 | PyObject *_res = NULL; |
| 212 | short item; |
| 213 | Str255 itemString; |
| 214 | if (!PyArg_ParseTuple(_args, "hO&", |
| 215 | &item, |
| 216 | PyMac_GetStr255, itemString)) |
| 217 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 218 | SetMenuItemText(_self->ob_itself, |
| 219 | item, |
| 220 | itemString); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 221 | Py_INCREF(Py_None); |
| 222 | _res = Py_None; |
| 223 | return _res; |
| 224 | } |
| 225 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 226 | static PyObject *MenuObj_GetMenuItemText(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 227 | MenuObject *_self; |
| 228 | PyObject *_args; |
| 229 | { |
| 230 | PyObject *_res = NULL; |
| 231 | short item; |
| 232 | Str255 itemString; |
| 233 | if (!PyArg_ParseTuple(_args, "h", |
| 234 | &item)) |
| 235 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 236 | GetMenuItemText(_self->ob_itself, |
| 237 | item, |
| 238 | itemString); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 239 | _res = Py_BuildValue("O&", |
| 240 | PyMac_BuildStr255, itemString); |
| 241 | return _res; |
| 242 | } |
| 243 | |
| 244 | static PyObject *MenuObj_DisableItem(_self, _args) |
| 245 | MenuObject *_self; |
| 246 | PyObject *_args; |
| 247 | { |
| 248 | PyObject *_res = NULL; |
| 249 | short item; |
| 250 | if (!PyArg_ParseTuple(_args, "h", |
| 251 | &item)) |
| 252 | return NULL; |
| 253 | DisableItem(_self->ob_itself, |
| 254 | item); |
| 255 | Py_INCREF(Py_None); |
| 256 | _res = Py_None; |
| 257 | return _res; |
| 258 | } |
| 259 | |
| 260 | static PyObject *MenuObj_EnableItem(_self, _args) |
| 261 | MenuObject *_self; |
| 262 | PyObject *_args; |
| 263 | { |
| 264 | PyObject *_res = NULL; |
| 265 | short item; |
| 266 | if (!PyArg_ParseTuple(_args, "h", |
| 267 | &item)) |
| 268 | return NULL; |
| 269 | EnableItem(_self->ob_itself, |
| 270 | item); |
| 271 | Py_INCREF(Py_None); |
| 272 | _res = Py_None; |
| 273 | return _res; |
| 274 | } |
| 275 | |
| 276 | static PyObject *MenuObj_CheckItem(_self, _args) |
| 277 | MenuObject *_self; |
| 278 | PyObject *_args; |
| 279 | { |
| 280 | PyObject *_res = NULL; |
| 281 | short item; |
| 282 | Boolean checked; |
| 283 | if (!PyArg_ParseTuple(_args, "hb", |
| 284 | &item, |
| 285 | &checked)) |
| 286 | return NULL; |
| 287 | CheckItem(_self->ob_itself, |
| 288 | item, |
| 289 | checked); |
| 290 | Py_INCREF(Py_None); |
| 291 | _res = Py_None; |
| 292 | return _res; |
| 293 | } |
| 294 | |
| 295 | static PyObject *MenuObj_SetItemMark(_self, _args) |
| 296 | MenuObject *_self; |
| 297 | PyObject *_args; |
| 298 | { |
| 299 | PyObject *_res = NULL; |
| 300 | short item; |
| 301 | short markChar; |
| 302 | if (!PyArg_ParseTuple(_args, "hh", |
| 303 | &item, |
| 304 | &markChar)) |
| 305 | return NULL; |
| 306 | SetItemMark(_self->ob_itself, |
| 307 | item, |
| 308 | markChar); |
| 309 | Py_INCREF(Py_None); |
| 310 | _res = Py_None; |
| 311 | return _res; |
| 312 | } |
| 313 | |
| 314 | static PyObject *MenuObj_GetItemMark(_self, _args) |
| 315 | MenuObject *_self; |
| 316 | PyObject *_args; |
| 317 | { |
| 318 | PyObject *_res = NULL; |
| 319 | short item; |
| 320 | short markChar; |
| 321 | if (!PyArg_ParseTuple(_args, "h", |
| 322 | &item)) |
| 323 | return NULL; |
| 324 | GetItemMark(_self->ob_itself, |
| 325 | item, |
| 326 | &markChar); |
| 327 | _res = Py_BuildValue("h", |
| 328 | markChar); |
| 329 | return _res; |
| 330 | } |
| 331 | |
| 332 | static PyObject *MenuObj_SetItemIcon(_self, _args) |
| 333 | MenuObject *_self; |
| 334 | PyObject *_args; |
| 335 | { |
| 336 | PyObject *_res = NULL; |
| 337 | short item; |
| 338 | short iconIndex; |
| 339 | if (!PyArg_ParseTuple(_args, "hh", |
| 340 | &item, |
| 341 | &iconIndex)) |
| 342 | return NULL; |
| 343 | SetItemIcon(_self->ob_itself, |
| 344 | item, |
| 345 | iconIndex); |
| 346 | Py_INCREF(Py_None); |
| 347 | _res = Py_None; |
| 348 | return _res; |
| 349 | } |
| 350 | |
| 351 | static PyObject *MenuObj_GetItemIcon(_self, _args) |
| 352 | MenuObject *_self; |
| 353 | PyObject *_args; |
| 354 | { |
| 355 | PyObject *_res = NULL; |
| 356 | short item; |
| 357 | short iconIndex; |
| 358 | if (!PyArg_ParseTuple(_args, "h", |
| 359 | &item)) |
| 360 | return NULL; |
| 361 | GetItemIcon(_self->ob_itself, |
| 362 | item, |
| 363 | &iconIndex); |
| 364 | _res = Py_BuildValue("h", |
| 365 | iconIndex); |
| 366 | return _res; |
| 367 | } |
| 368 | |
| 369 | static PyObject *MenuObj_SetItemStyle(_self, _args) |
| 370 | MenuObject *_self; |
| 371 | PyObject *_args; |
| 372 | { |
| 373 | PyObject *_res = NULL; |
| 374 | short item; |
| 375 | short chStyle; |
| 376 | if (!PyArg_ParseTuple(_args, "hh", |
| 377 | &item, |
| 378 | &chStyle)) |
| 379 | return NULL; |
| 380 | SetItemStyle(_self->ob_itself, |
| 381 | item, |
| 382 | chStyle); |
| 383 | Py_INCREF(Py_None); |
| 384 | _res = Py_None; |
| 385 | return _res; |
| 386 | } |
| 387 | |
| 388 | static PyObject *MenuObj_GetItemStyle(_self, _args) |
| 389 | MenuObject *_self; |
| 390 | PyObject *_args; |
| 391 | { |
| 392 | PyObject *_res = NULL; |
| 393 | short item; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 394 | Style chStyle; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 395 | if (!PyArg_ParseTuple(_args, "h", |
| 396 | &item)) |
| 397 | return NULL; |
| 398 | GetItemStyle(_self->ob_itself, |
| 399 | item, |
| 400 | &chStyle); |
| 401 | _res = Py_BuildValue("b", |
| 402 | chStyle); |
| 403 | return _res; |
| 404 | } |
| 405 | |
| 406 | static PyObject *MenuObj_CalcMenuSize(_self, _args) |
| 407 | MenuObject *_self; |
| 408 | PyObject *_args; |
| 409 | { |
| 410 | PyObject *_res = NULL; |
| 411 | if (!PyArg_ParseTuple(_args, "")) |
| 412 | return NULL; |
| 413 | CalcMenuSize(_self->ob_itself); |
| 414 | Py_INCREF(Py_None); |
| 415 | _res = Py_None; |
| 416 | return _res; |
| 417 | } |
| 418 | |
| 419 | static PyObject *MenuObj_CountMItems(_self, _args) |
| 420 | MenuObject *_self; |
| 421 | PyObject *_args; |
| 422 | { |
| 423 | PyObject *_res = NULL; |
| 424 | short _rv; |
| 425 | if (!PyArg_ParseTuple(_args, "")) |
| 426 | return NULL; |
| 427 | _rv = CountMItems(_self->ob_itself); |
| 428 | _res = Py_BuildValue("h", |
| 429 | _rv); |
| 430 | return _res; |
| 431 | } |
| 432 | |
| 433 | static PyObject *MenuObj_GetItemCmd(_self, _args) |
| 434 | MenuObject *_self; |
| 435 | PyObject *_args; |
| 436 | { |
| 437 | PyObject *_res = NULL; |
| 438 | short item; |
| 439 | short cmdChar; |
| 440 | if (!PyArg_ParseTuple(_args, "h", |
| 441 | &item)) |
| 442 | return NULL; |
| 443 | GetItemCmd(_self->ob_itself, |
| 444 | item, |
| 445 | &cmdChar); |
| 446 | _res = Py_BuildValue("h", |
| 447 | cmdChar); |
| 448 | return _res; |
| 449 | } |
| 450 | |
| 451 | static PyObject *MenuObj_SetItemCmd(_self, _args) |
| 452 | MenuObject *_self; |
| 453 | PyObject *_args; |
| 454 | { |
| 455 | PyObject *_res = NULL; |
| 456 | short item; |
| 457 | short cmdChar; |
| 458 | if (!PyArg_ParseTuple(_args, "hh", |
| 459 | &item, |
| 460 | &cmdChar)) |
| 461 | return NULL; |
| 462 | SetItemCmd(_self->ob_itself, |
| 463 | item, |
| 464 | cmdChar); |
| 465 | Py_INCREF(Py_None); |
| 466 | _res = Py_None; |
| 467 | return _res; |
| 468 | } |
| 469 | |
| 470 | static PyObject *MenuObj_PopUpMenuSelect(_self, _args) |
| 471 | MenuObject *_self; |
| 472 | PyObject *_args; |
| 473 | { |
| 474 | PyObject *_res = NULL; |
| 475 | long _rv; |
| 476 | short top; |
| 477 | short left; |
| 478 | short popUpItem; |
| 479 | if (!PyArg_ParseTuple(_args, "hhh", |
| 480 | &top, |
| 481 | &left, |
| 482 | &popUpItem)) |
| 483 | return NULL; |
| 484 | _rv = PopUpMenuSelect(_self->ob_itself, |
| 485 | top, |
| 486 | left, |
| 487 | popUpItem); |
| 488 | _res = Py_BuildValue("l", |
| 489 | _rv); |
| 490 | return _res; |
| 491 | } |
| 492 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 493 | static PyObject *MenuObj_InsertFontResMenu(_self, _args) |
| 494 | MenuObject *_self; |
| 495 | PyObject *_args; |
| 496 | { |
| 497 | PyObject *_res = NULL; |
| 498 | short afterItem; |
| 499 | short scriptFilter; |
| 500 | if (!PyArg_ParseTuple(_args, "hh", |
| 501 | &afterItem, |
| 502 | &scriptFilter)) |
| 503 | return NULL; |
| 504 | InsertFontResMenu(_self->ob_itself, |
| 505 | afterItem, |
| 506 | scriptFilter); |
| 507 | Py_INCREF(Py_None); |
| 508 | _res = Py_None; |
| 509 | return _res; |
| 510 | } |
| 511 | |
| 512 | static PyObject *MenuObj_InsertIntlResMenu(_self, _args) |
| 513 | MenuObject *_self; |
| 514 | PyObject *_args; |
| 515 | { |
| 516 | PyObject *_res = NULL; |
| 517 | ResType theType; |
| 518 | short afterItem; |
| 519 | short scriptFilter; |
| 520 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 521 | PyMac_GetOSType, &theType, |
| 522 | &afterItem, |
| 523 | &scriptFilter)) |
| 524 | return NULL; |
| 525 | InsertIntlResMenu(_self->ob_itself, |
| 526 | theType, |
| 527 | afterItem, |
| 528 | scriptFilter); |
| 529 | Py_INCREF(Py_None); |
| 530 | _res = Py_None; |
| 531 | return _res; |
| 532 | } |
| 533 | |
Jack Jansen | a177228 | 1995-06-18 20:17:27 +0000 | [diff] [blame] | 534 | static PyObject *MenuObj_as_Resource(_self, _args) |
| 535 | MenuObject *_self; |
| 536 | PyObject *_args; |
| 537 | { |
| 538 | PyObject *_res = NULL; |
| 539 | |
| 540 | return ResObj_New((Handle)_self->ob_itself); |
| 541 | |
| 542 | } |
| 543 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 544 | static PyMethodDef MenuObj_methods[] = { |
| 545 | {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1, |
| 546 | "() -> None"}, |
| 547 | {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1, |
| 548 | "(Str255 data) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 549 | {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 550 | "(ResType theType) -> None"}, |
| 551 | {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1, |
| 552 | "(ResType theType, short afterItem) -> None"}, |
| 553 | {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1, |
| 554 | "(short beforeID) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 555 | {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 556 | "(Str255 itemString, short afterItem) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 557 | {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 558 | "(short item) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 559 | {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 560 | "(short item, Str255 itemString) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 561 | {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 562 | "(short item) -> (Str255 itemString)"}, |
| 563 | {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1, |
| 564 | "(short item) -> None"}, |
| 565 | {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1, |
| 566 | "(short item) -> None"}, |
| 567 | {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1, |
| 568 | "(short item, Boolean checked) -> None"}, |
| 569 | {"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1, |
| 570 | "(short item, short markChar) -> None"}, |
| 571 | {"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1, |
| 572 | "(short item) -> (short markChar)"}, |
| 573 | {"SetItemIcon", (PyCFunction)MenuObj_SetItemIcon, 1, |
| 574 | "(short item, short iconIndex) -> None"}, |
| 575 | {"GetItemIcon", (PyCFunction)MenuObj_GetItemIcon, 1, |
| 576 | "(short item) -> (short iconIndex)"}, |
| 577 | {"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1, |
| 578 | "(short item, short chStyle) -> None"}, |
| 579 | {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 580 | "(short item) -> (Style chStyle)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 581 | {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, |
| 582 | "() -> None"}, |
| 583 | {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1, |
| 584 | "() -> (short _rv)"}, |
| 585 | {"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1, |
| 586 | "(short item) -> (short cmdChar)"}, |
| 587 | {"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1, |
| 588 | "(short item, short cmdChar) -> None"}, |
| 589 | {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1, |
| 590 | "(short top, short left, short popUpItem) -> (long _rv)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 591 | {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1, |
| 592 | "(short afterItem, short scriptFilter) -> None"}, |
| 593 | {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1, |
| 594 | "(ResType theType, short afterItem, short scriptFilter) -> None"}, |
Jack Jansen | a177228 | 1995-06-18 20:17:27 +0000 | [diff] [blame] | 595 | {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1, |
| 596 | "Return this Menu as a Resource"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 597 | {NULL, NULL, 0} |
| 598 | }; |
| 599 | |
| 600 | PyMethodChain MenuObj_chain = { MenuObj_methods, NULL }; |
| 601 | |
| 602 | static PyObject *MenuObj_getattr(self, name) |
| 603 | MenuObject *self; |
| 604 | char *name; |
| 605 | { |
| 606 | return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name); |
| 607 | } |
| 608 | |
| 609 | #define MenuObj_setattr NULL |
| 610 | |
| 611 | PyTypeObject Menu_Type = { |
| 612 | PyObject_HEAD_INIT(&PyType_Type) |
| 613 | 0, /*ob_size*/ |
| 614 | "Menu", /*tp_name*/ |
| 615 | sizeof(MenuObject), /*tp_basicsize*/ |
| 616 | 0, /*tp_itemsize*/ |
| 617 | /* methods */ |
| 618 | (destructor) MenuObj_dealloc, /*tp_dealloc*/ |
| 619 | 0, /*tp_print*/ |
| 620 | (getattrfunc) MenuObj_getattr, /*tp_getattr*/ |
| 621 | (setattrfunc) MenuObj_setattr, /*tp_setattr*/ |
| 622 | }; |
| 623 | |
| 624 | /* ---------------------- End object type Menu ---------------------- */ |
| 625 | |
| 626 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 627 | static PyObject *Menu_GetMBarHeight(_self, _args) |
| 628 | PyObject *_self; |
| 629 | PyObject *_args; |
| 630 | { |
| 631 | PyObject *_res = NULL; |
| 632 | short _rv; |
| 633 | if (!PyArg_ParseTuple(_args, "")) |
| 634 | return NULL; |
| 635 | _rv = GetMBarHeight(); |
| 636 | _res = Py_BuildValue("h", |
| 637 | _rv); |
| 638 | return _res; |
| 639 | } |
| 640 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 641 | static PyObject *Menu_InitMenus(_self, _args) |
| 642 | PyObject *_self; |
| 643 | PyObject *_args; |
| 644 | { |
| 645 | PyObject *_res = NULL; |
| 646 | if (!PyArg_ParseTuple(_args, "")) |
| 647 | return NULL; |
| 648 | InitMenus(); |
| 649 | Py_INCREF(Py_None); |
| 650 | _res = Py_None; |
| 651 | return _res; |
| 652 | } |
| 653 | |
| 654 | static PyObject *Menu_NewMenu(_self, _args) |
| 655 | PyObject *_self; |
| 656 | PyObject *_args; |
| 657 | { |
| 658 | PyObject *_res = NULL; |
| 659 | MenuHandle _rv; |
| 660 | short menuID; |
| 661 | Str255 menuTitle; |
| 662 | if (!PyArg_ParseTuple(_args, "hO&", |
| 663 | &menuID, |
| 664 | PyMac_GetStr255, menuTitle)) |
| 665 | return NULL; |
| 666 | _rv = NewMenu(menuID, |
| 667 | menuTitle); |
| 668 | _res = Py_BuildValue("O&", |
| 669 | MenuObj_New, _rv); |
| 670 | return _res; |
| 671 | } |
| 672 | |
| 673 | static PyObject *Menu_GetMenu(_self, _args) |
| 674 | PyObject *_self; |
| 675 | PyObject *_args; |
| 676 | { |
| 677 | PyObject *_res = NULL; |
| 678 | MenuHandle _rv; |
| 679 | short resourceID; |
| 680 | if (!PyArg_ParseTuple(_args, "h", |
| 681 | &resourceID)) |
| 682 | return NULL; |
| 683 | _rv = GetMenu(resourceID); |
| 684 | _res = Py_BuildValue("O&", |
| 685 | MenuObj_New, _rv); |
| 686 | return _res; |
| 687 | } |
| 688 | |
| 689 | static PyObject *Menu_DrawMenuBar(_self, _args) |
| 690 | PyObject *_self; |
| 691 | PyObject *_args; |
| 692 | { |
| 693 | PyObject *_res = NULL; |
| 694 | if (!PyArg_ParseTuple(_args, "")) |
| 695 | return NULL; |
| 696 | DrawMenuBar(); |
| 697 | Py_INCREF(Py_None); |
| 698 | _res = Py_None; |
| 699 | return _res; |
| 700 | } |
| 701 | |
| 702 | static PyObject *Menu_InvalMenuBar(_self, _args) |
| 703 | PyObject *_self; |
| 704 | PyObject *_args; |
| 705 | { |
| 706 | PyObject *_res = NULL; |
| 707 | if (!PyArg_ParseTuple(_args, "")) |
| 708 | return NULL; |
| 709 | InvalMenuBar(); |
| 710 | Py_INCREF(Py_None); |
| 711 | _res = Py_None; |
| 712 | return _res; |
| 713 | } |
| 714 | |
| 715 | static PyObject *Menu_DeleteMenu(_self, _args) |
| 716 | PyObject *_self; |
| 717 | PyObject *_args; |
| 718 | { |
| 719 | PyObject *_res = NULL; |
| 720 | short menuID; |
| 721 | if (!PyArg_ParseTuple(_args, "h", |
| 722 | &menuID)) |
| 723 | return NULL; |
| 724 | DeleteMenu(menuID); |
| 725 | Py_INCREF(Py_None); |
| 726 | _res = Py_None; |
| 727 | return _res; |
| 728 | } |
| 729 | |
| 730 | static PyObject *Menu_ClearMenuBar(_self, _args) |
| 731 | PyObject *_self; |
| 732 | PyObject *_args; |
| 733 | { |
| 734 | PyObject *_res = NULL; |
| 735 | if (!PyArg_ParseTuple(_args, "")) |
| 736 | return NULL; |
| 737 | ClearMenuBar(); |
| 738 | Py_INCREF(Py_None); |
| 739 | _res = Py_None; |
| 740 | return _res; |
| 741 | } |
| 742 | |
| 743 | static PyObject *Menu_GetNewMBar(_self, _args) |
| 744 | PyObject *_self; |
| 745 | PyObject *_args; |
| 746 | { |
| 747 | PyObject *_res = NULL; |
| 748 | Handle _rv; |
| 749 | short menuBarID; |
| 750 | if (!PyArg_ParseTuple(_args, "h", |
| 751 | &menuBarID)) |
| 752 | return NULL; |
| 753 | _rv = GetNewMBar(menuBarID); |
| 754 | _res = Py_BuildValue("O&", |
| 755 | ResObj_New, _rv); |
| 756 | return _res; |
| 757 | } |
| 758 | |
| 759 | static PyObject *Menu_GetMenuBar(_self, _args) |
| 760 | PyObject *_self; |
| 761 | PyObject *_args; |
| 762 | { |
| 763 | PyObject *_res = NULL; |
| 764 | Handle _rv; |
| 765 | if (!PyArg_ParseTuple(_args, "")) |
| 766 | return NULL; |
| 767 | _rv = GetMenuBar(); |
| 768 | _res = Py_BuildValue("O&", |
| 769 | ResObj_New, _rv); |
| 770 | return _res; |
| 771 | } |
| 772 | |
| 773 | static PyObject *Menu_SetMenuBar(_self, _args) |
| 774 | PyObject *_self; |
| 775 | PyObject *_args; |
| 776 | { |
| 777 | PyObject *_res = NULL; |
| 778 | Handle menuList; |
| 779 | if (!PyArg_ParseTuple(_args, "O&", |
| 780 | ResObj_Convert, &menuList)) |
| 781 | return NULL; |
| 782 | SetMenuBar(menuList); |
| 783 | Py_INCREF(Py_None); |
| 784 | _res = Py_None; |
| 785 | return _res; |
| 786 | } |
| 787 | |
| 788 | static PyObject *Menu_MenuKey(_self, _args) |
| 789 | PyObject *_self; |
| 790 | PyObject *_args; |
| 791 | { |
| 792 | PyObject *_res = NULL; |
| 793 | long _rv; |
| 794 | short ch; |
| 795 | if (!PyArg_ParseTuple(_args, "h", |
| 796 | &ch)) |
| 797 | return NULL; |
| 798 | _rv = MenuKey(ch); |
| 799 | _res = Py_BuildValue("l", |
| 800 | _rv); |
| 801 | return _res; |
| 802 | } |
| 803 | |
| 804 | static PyObject *Menu_HiliteMenu(_self, _args) |
| 805 | PyObject *_self; |
| 806 | PyObject *_args; |
| 807 | { |
| 808 | PyObject *_res = NULL; |
| 809 | short menuID; |
| 810 | if (!PyArg_ParseTuple(_args, "h", |
| 811 | &menuID)) |
| 812 | return NULL; |
| 813 | HiliteMenu(menuID); |
| 814 | Py_INCREF(Py_None); |
| 815 | _res = Py_None; |
| 816 | return _res; |
| 817 | } |
| 818 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 819 | static PyObject *Menu_GetMenuHandle(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 820 | PyObject *_self; |
| 821 | PyObject *_args; |
| 822 | { |
| 823 | PyObject *_res = NULL; |
| 824 | MenuHandle _rv; |
| 825 | short menuID; |
| 826 | if (!PyArg_ParseTuple(_args, "h", |
| 827 | &menuID)) |
| 828 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 829 | _rv = GetMenuHandle(menuID); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 830 | _res = Py_BuildValue("O&", |
| 831 | MenuObj_New, _rv); |
| 832 | return _res; |
| 833 | } |
| 834 | |
| 835 | static PyObject *Menu_FlashMenuBar(_self, _args) |
| 836 | PyObject *_self; |
| 837 | PyObject *_args; |
| 838 | { |
| 839 | PyObject *_res = NULL; |
| 840 | short menuID; |
| 841 | if (!PyArg_ParseTuple(_args, "h", |
| 842 | &menuID)) |
| 843 | return NULL; |
| 844 | FlashMenuBar(menuID); |
| 845 | Py_INCREF(Py_None); |
| 846 | _res = Py_None; |
| 847 | return _res; |
| 848 | } |
| 849 | |
| 850 | static PyObject *Menu_SetMenuFlash(_self, _args) |
| 851 | PyObject *_self; |
| 852 | PyObject *_args; |
| 853 | { |
| 854 | PyObject *_res = NULL; |
| 855 | short count; |
| 856 | if (!PyArg_ParseTuple(_args, "h", |
| 857 | &count)) |
| 858 | return NULL; |
| 859 | SetMenuFlash(count); |
| 860 | Py_INCREF(Py_None); |
| 861 | _res = Py_None; |
| 862 | return _res; |
| 863 | } |
| 864 | |
| 865 | static PyObject *Menu_MenuSelect(_self, _args) |
| 866 | PyObject *_self; |
| 867 | PyObject *_args; |
| 868 | { |
| 869 | PyObject *_res = NULL; |
| 870 | long _rv; |
| 871 | Point startPt; |
| 872 | if (!PyArg_ParseTuple(_args, "O&", |
| 873 | PyMac_GetPoint, &startPt)) |
| 874 | return NULL; |
| 875 | _rv = MenuSelect(startPt); |
| 876 | _res = Py_BuildValue("l", |
| 877 | _rv); |
| 878 | return _res; |
| 879 | } |
| 880 | |
| 881 | static PyObject *Menu_InitProcMenu(_self, _args) |
| 882 | PyObject *_self; |
| 883 | PyObject *_args; |
| 884 | { |
| 885 | PyObject *_res = NULL; |
| 886 | short resID; |
| 887 | if (!PyArg_ParseTuple(_args, "h", |
| 888 | &resID)) |
| 889 | return NULL; |
| 890 | InitProcMenu(resID); |
| 891 | Py_INCREF(Py_None); |
| 892 | _res = Py_None; |
| 893 | return _res; |
| 894 | } |
| 895 | |
| 896 | static PyObject *Menu_MenuChoice(_self, _args) |
| 897 | PyObject *_self; |
| 898 | PyObject *_args; |
| 899 | { |
| 900 | PyObject *_res = NULL; |
| 901 | long _rv; |
| 902 | if (!PyArg_ParseTuple(_args, "")) |
| 903 | return NULL; |
| 904 | _rv = MenuChoice(); |
| 905 | _res = Py_BuildValue("l", |
| 906 | _rv); |
| 907 | return _res; |
| 908 | } |
| 909 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 910 | static PyObject *Menu_DeleteMCEntries(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 911 | PyObject *_self; |
| 912 | PyObject *_args; |
| 913 | { |
| 914 | PyObject *_res = NULL; |
| 915 | short menuID; |
| 916 | short menuItem; |
| 917 | if (!PyArg_ParseTuple(_args, "hh", |
| 918 | &menuID, |
| 919 | &menuItem)) |
| 920 | return NULL; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 921 | DeleteMCEntries(menuID, |
| 922 | menuItem); |
| 923 | Py_INCREF(Py_None); |
| 924 | _res = Py_None; |
| 925 | return _res; |
| 926 | } |
| 927 | |
| 928 | static PyObject *Menu_SystemEdit(_self, _args) |
| 929 | PyObject *_self; |
| 930 | PyObject *_args; |
| 931 | { |
| 932 | PyObject *_res = NULL; |
| 933 | Boolean _rv; |
| 934 | short editCmd; |
| 935 | if (!PyArg_ParseTuple(_args, "h", |
| 936 | &editCmd)) |
| 937 | return NULL; |
| 938 | _rv = SystemEdit(editCmd); |
| 939 | _res = Py_BuildValue("b", |
| 940 | _rv); |
| 941 | return _res; |
| 942 | } |
| 943 | |
| 944 | static PyObject *Menu_SystemMenu(_self, _args) |
| 945 | PyObject *_self; |
| 946 | PyObject *_args; |
| 947 | { |
| 948 | PyObject *_res = NULL; |
| 949 | long menuResult; |
| 950 | if (!PyArg_ParseTuple(_args, "l", |
| 951 | &menuResult)) |
| 952 | return NULL; |
| 953 | SystemMenu(menuResult); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 954 | Py_INCREF(Py_None); |
| 955 | _res = Py_None; |
| 956 | return _res; |
| 957 | } |
| 958 | |
Guido van Rossum | 86c3af7 | 1995-03-19 22:42:51 +0000 | [diff] [blame] | 959 | static PyObject *Menu_OpenDeskAcc(_self, _args) |
| 960 | PyObject *_self; |
| 961 | PyObject *_args; |
| 962 | { |
| 963 | PyObject *_res = NULL; |
| 964 | Str255 name; |
| 965 | if (!PyArg_ParseTuple(_args, "O&", |
| 966 | PyMac_GetStr255, name)) |
| 967 | return NULL; |
| 968 | OpenDeskAcc(name); |
| 969 | Py_INCREF(Py_None); |
| 970 | _res = Py_None; |
| 971 | return _res; |
| 972 | } |
| 973 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 974 | static PyMethodDef Menu_methods[] = { |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 975 | {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1, |
| 976 | "() -> (short _rv)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 977 | {"InitMenus", (PyCFunction)Menu_InitMenus, 1, |
| 978 | "() -> None"}, |
| 979 | {"NewMenu", (PyCFunction)Menu_NewMenu, 1, |
| 980 | "(short menuID, Str255 menuTitle) -> (MenuHandle _rv)"}, |
| 981 | {"GetMenu", (PyCFunction)Menu_GetMenu, 1, |
| 982 | "(short resourceID) -> (MenuHandle _rv)"}, |
| 983 | {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1, |
| 984 | "() -> None"}, |
| 985 | {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1, |
| 986 | "() -> None"}, |
| 987 | {"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1, |
| 988 | "(short menuID) -> None"}, |
| 989 | {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1, |
| 990 | "() -> None"}, |
| 991 | {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1, |
| 992 | "(short menuBarID) -> (Handle _rv)"}, |
| 993 | {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1, |
| 994 | "() -> (Handle _rv)"}, |
| 995 | {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1, |
| 996 | "(Handle menuList) -> None"}, |
| 997 | {"MenuKey", (PyCFunction)Menu_MenuKey, 1, |
| 998 | "(short ch) -> (long _rv)"}, |
| 999 | {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1, |
| 1000 | "(short menuID) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 1001 | {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1002 | "(short menuID) -> (MenuHandle _rv)"}, |
| 1003 | {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1, |
| 1004 | "(short menuID) -> None"}, |
| 1005 | {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1, |
| 1006 | "(short count) -> None"}, |
| 1007 | {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1, |
| 1008 | "(Point startPt) -> (long _rv)"}, |
| 1009 | {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1, |
| 1010 | "(short resID) -> None"}, |
| 1011 | {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1, |
| 1012 | "() -> (long _rv)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 1013 | {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1014 | "(short menuID, short menuItem) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 1015 | {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1, |
| 1016 | "(short editCmd) -> (Boolean _rv)"}, |
| 1017 | {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1, |
| 1018 | "(long menuResult) -> None"}, |
Guido van Rossum | 86c3af7 | 1995-03-19 22:42:51 +0000 | [diff] [blame] | 1019 | {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1, |
| 1020 | "(Str255 name) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1021 | {NULL, NULL, 0} |
| 1022 | }; |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | void initMenu() |
| 1028 | { |
| 1029 | PyObject *m; |
| 1030 | PyObject *d; |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | m = Py_InitModule("Menu", Menu_methods); |
| 1036 | d = PyModule_GetDict(m); |
| 1037 | Menu_Error = PyMac_GetOSErrException(); |
| 1038 | if (Menu_Error == NULL || |
| 1039 | PyDict_SetItemString(d, "Error", Menu_Error) != 0) |
| 1040 | Py_FatalError("can't initialize Menu.Error"); |
| 1041 | } |
| 1042 | |
| 1043 | /* ======================== End module Menu ========================= */ |
| 1044 | |