Changeset 391 for python/trunk/Mac/Modules/menu
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Mac/Modules/menu/_Menumodule.c
r2 r391 11 11 /* Macro to test whether a weak-loaded CFM function exists */ 12 12 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ 13 14 15 13 PyErr_SetString(PyExc_NotImplementedError, \ 14 "Not available in this shared library/OS version"); \ 15 return NULL; \ 16 16 }} while(0) 17 17 … … 36 36 PyObject *OptMenuObj_New(MenuRef itself) 37 37 { 38 39 40 41 42 38 if (itself == NULL) { 39 Py_INCREF(Py_None); 40 return Py_None; 41 } 42 return MenuObj_New(itself); 43 43 } 44 44 … … 46 46 int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) 47 47 { 48 49 50 51 52 48 if ( v == Py_None ) { 49 *p_itself = NULL; 50 return 1; 51 } 52 return MenuObj_Convert(v, p_itself); 53 53 } 54 54 … … 62 62 63 63 typedef struct MenuObject { 64 65 64 PyObject_HEAD 65 MenuHandle ob_itself; 66 66 } MenuObject; 67 67 68 68 PyObject *MenuObj_New(MenuHandle itself) 69 69 { 70 71 72 73 74 70 MenuObject *it; 71 it = PyObject_NEW(MenuObject, &Menu_Type); 72 if (it == NULL) return NULL; 73 it->ob_itself = itself; 74 return (PyObject *)it; 75 75 } 76 76 77 77 int MenuObj_Convert(PyObject *v, MenuHandle *p_itself) 78 78 { 79 80 81 82 83 84 85 79 if (!MenuObj_Check(v)) 80 { 81 PyErr_SetString(PyExc_TypeError, "Menu required"); 82 return 0; 83 } 84 *p_itself = ((MenuObject *)v)->ob_itself; 85 return 1; 86 86 } 87 87 88 88 static void MenuObj_dealloc(MenuObject *self) 89 89 { 90 91 90 /* Cleanup of self->ob_itself goes here */ 91 self->ob_type->tp_free((PyObject *)self); 92 92 } 93 93 94 94 static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args) 95 95 { 96 96 PyObject *_res = NULL; 97 97 #ifndef DisposeMenu 98 99 #endif 100 101 102 103 104 105 98 PyMac_PRECHECK(DisposeMenu); 99 #endif 100 if (!PyArg_ParseTuple(_args, "")) 101 return NULL; 102 DisposeMenu(_self->ob_itself); 103 Py_INCREF(Py_None); 104 _res = Py_None; 105 return _res; 106 106 } 107 107 108 108 static PyObject *MenuObj_CalcMenuSize(MenuObject *_self, PyObject *_args) 109 109 { 110 110 PyObject *_res = NULL; 111 111 #ifndef CalcMenuSize 112 113 #endif 114 115 116 117 118 119 112 PyMac_PRECHECK(CalcMenuSize); 113 #endif 114 if (!PyArg_ParseTuple(_args, "")) 115 return NULL; 116 CalcMenuSize(_self->ob_itself); 117 Py_INCREF(Py_None); 118 _res = Py_None; 119 return _res; 120 120 } 121 121 122 122 static PyObject *MenuObj_CountMenuItems(MenuObject *_self, PyObject *_args) 123 123 { 124 125 124 PyObject *_res = NULL; 125 UInt16 _rv; 126 126 #ifndef CountMenuItems 127 128 #endif 129 130 131 132 133 134 127 PyMac_PRECHECK(CountMenuItems); 128 #endif 129 if (!PyArg_ParseTuple(_args, "")) 130 return NULL; 131 _rv = CountMenuItems(_self->ob_itself); 132 _res = Py_BuildValue("H", 133 _rv); 134 return _res; 135 135 } 136 136 137 137 static PyObject *MenuObj_GetMenuFont(MenuObject *_self, PyObject *_args) 138 138 { 139 140 141 142 139 PyObject *_res = NULL; 140 OSStatus _err; 141 SInt16 outFontID; 142 UInt16 outFontSize; 143 143 #ifndef GetMenuFont 144 145 #endif 146 147 148 149 150 151 152 153 154 155 144 PyMac_PRECHECK(GetMenuFont); 145 #endif 146 if (!PyArg_ParseTuple(_args, "")) 147 return NULL; 148 _err = GetMenuFont(_self->ob_itself, 149 &outFontID, 150 &outFontSize); 151 if (_err != noErr) return PyMac_Error(_err); 152 _res = Py_BuildValue("hH", 153 outFontID, 154 outFontSize); 155 return _res; 156 156 } 157 157 158 158 static PyObject *MenuObj_SetMenuFont(MenuObject *_self, PyObject *_args) 159 159 { 160 161 162 163 160 PyObject *_res = NULL; 161 OSStatus _err; 162 SInt16 inFontID; 163 UInt16 inFontSize; 164 164 #ifndef SetMenuFont 165 166 #endif 167 168 169 170 171 172 173 174 175 176 177 165 PyMac_PRECHECK(SetMenuFont); 166 #endif 167 if (!PyArg_ParseTuple(_args, "hH", 168 &inFontID, 169 &inFontSize)) 170 return NULL; 171 _err = SetMenuFont(_self->ob_itself, 172 inFontID, 173 inFontSize); 174 if (_err != noErr) return PyMac_Error(_err); 175 Py_INCREF(Py_None); 176 _res = Py_None; 177 return _res; 178 178 } 179 179 180 180 static PyObject *MenuObj_GetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args) 181 181 { 182 183 182 PyObject *_res = NULL; 183 Boolean _rv; 184 184 #ifndef GetMenuExcludesMarkColumn 185 186 #endif 187 188 189 190 191 192 185 PyMac_PRECHECK(GetMenuExcludesMarkColumn); 186 #endif 187 if (!PyArg_ParseTuple(_args, "")) 188 return NULL; 189 _rv = GetMenuExcludesMarkColumn(_self->ob_itself); 190 _res = Py_BuildValue("b", 191 _rv); 192 return _res; 193 193 } 194 194 195 195 static PyObject *MenuObj_SetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args) 196 196 { 197 198 199 197 PyObject *_res = NULL; 198 OSStatus _err; 199 Boolean excludesMark; 200 200 #ifndef SetMenuExcludesMarkColumn 201 202 #endif 203 204 205 206 207 208 209 210 211 201 PyMac_PRECHECK(SetMenuExcludesMarkColumn); 202 #endif 203 if (!PyArg_ParseTuple(_args, "b", 204 &excludesMark)) 205 return NULL; 206 _err = SetMenuExcludesMarkColumn(_self->ob_itself, 207 excludesMark); 208 if (_err != noErr) return PyMac_Error(_err); 209 Py_INCREF(Py_None); 210 _res = Py_None; 211 return _res; 212 212 } 213 213 214 214 static PyObject *MenuObj_IsValidMenu(MenuObject *_self, PyObject *_args) 215 215 { 216 217 216 PyObject *_res = NULL; 217 Boolean _rv; 218 218 #ifndef IsValidMenu 219 220 #endif 221 222 223 224 225 226 219 PyMac_PRECHECK(IsValidMenu); 220 #endif 221 if (!PyArg_ParseTuple(_args, "")) 222 return NULL; 223 _rv = IsValidMenu(_self->ob_itself); 224 _res = Py_BuildValue("b", 225 _rv); 226 return _res; 227 227 } 228 228 229 229 static PyObject *MenuObj_GetMenuRetainCount(MenuObject *_self, PyObject *_args) 230 230 { 231 232 231 PyObject *_res = NULL; 232 ItemCount _rv; 233 233 #ifndef GetMenuRetainCount 234 235 #endif 236 237 238 239 240 241 234 PyMac_PRECHECK(GetMenuRetainCount); 235 #endif 236 if (!PyArg_ParseTuple(_args, "")) 237 return NULL; 238 _rv = GetMenuRetainCount(_self->ob_itself); 239 _res = Py_BuildValue("l", 240 _rv); 241 return _res; 242 242 } 243 243 244 244 static PyObject *MenuObj_RetainMenu(MenuObject *_self, PyObject *_args) 245 245 { 246 247 246 PyObject *_res = NULL; 247 OSStatus _err; 248 248 #ifndef RetainMenu 249 250 #endif 251 252 253 254 255 256 257 249 PyMac_PRECHECK(RetainMenu); 250 #endif 251 if (!PyArg_ParseTuple(_args, "")) 252 return NULL; 253 _err = RetainMenu(_self->ob_itself); 254 if (_err != noErr) return PyMac_Error(_err); 255 Py_INCREF(Py_None); 256 _res = Py_None; 257 return _res; 258 258 } 259 259 260 260 static PyObject *MenuObj_ReleaseMenu(MenuObject *_self, PyObject *_args) 261 261 { 262 263 262 PyObject *_res = NULL; 263 OSStatus _err; 264 264 #ifndef ReleaseMenu 265 266 #endif 267 268 269 270 271 272 273 265 PyMac_PRECHECK(ReleaseMenu); 266 #endif 267 if (!PyArg_ParseTuple(_args, "")) 268 return NULL; 269 _err = ReleaseMenu(_self->ob_itself); 270 if (_err != noErr) return PyMac_Error(_err); 271 Py_INCREF(Py_None); 272 _res = Py_None; 273 return _res; 274 274 } 275 275 276 276 static PyObject *MenuObj_DuplicateMenu(MenuObject *_self, PyObject *_args) 277 277 { 278 279 280 278 PyObject *_res = NULL; 279 OSStatus _err; 280 MenuHandle outMenu; 281 281 #ifndef DuplicateMenu 282 283 #endif 284 285 286 287 288 289 290 291 282 PyMac_PRECHECK(DuplicateMenu); 283 #endif 284 if (!PyArg_ParseTuple(_args, "")) 285 return NULL; 286 _err = DuplicateMenu(_self->ob_itself, 287 &outMenu); 288 if (_err != noErr) return PyMac_Error(_err); 289 _res = Py_BuildValue("O&", 290 MenuObj_New, outMenu); 291 return _res; 292 292 } 293 293 294 294 static PyObject *MenuObj_CopyMenuTitleAsCFString(MenuObject *_self, PyObject *_args) 295 295 { 296 297 298 296 PyObject *_res = NULL; 297 OSStatus _err; 298 CFStringRef outString; 299 299 #ifndef CopyMenuTitleAsCFString 300 301 #endif 302 303 304 305 306 307 308 309 300 PyMac_PRECHECK(CopyMenuTitleAsCFString); 301 #endif 302 if (!PyArg_ParseTuple(_args, "")) 303 return NULL; 304 _err = CopyMenuTitleAsCFString(_self->ob_itself, 305 &outString); 306 if (_err != noErr) return PyMac_Error(_err); 307 _res = Py_BuildValue("O&", 308 CFStringRefObj_New, outString); 309 return _res; 310 310 } 311 311 312 312 static PyObject *MenuObj_SetMenuTitleWithCFString(MenuObject *_self, PyObject *_args) 313 313 { 314 315 316 314 PyObject *_res = NULL; 315 OSStatus _err; 316 CFStringRef inString; 317 317 #ifndef SetMenuTitleWithCFString 318 319 #endif 320 321 322 323 324 325 326 327 328 318 PyMac_PRECHECK(SetMenuTitleWithCFString); 319 #endif 320 if (!PyArg_ParseTuple(_args, "O&", 321 CFStringRefObj_Convert, &inString)) 322 return NULL; 323 _err = SetMenuTitleWithCFString(_self->ob_itself, 324 inString); 325 if (_err != noErr) return PyMac_Error(_err); 326 Py_INCREF(Py_None); 327 _res = Py_None; 328 return _res; 329 329 } 330 330 331 331 static PyObject *MenuObj_InvalidateMenuSize(MenuObject *_self, PyObject *_args) 332 332 { 333 334 333 PyObject *_res = NULL; 334 OSStatus _err; 335 335 #ifndef InvalidateMenuSize 336 337 #endif 338 339 340 341 342 343 344 336 PyMac_PRECHECK(InvalidateMenuSize); 337 #endif 338 if (!PyArg_ParseTuple(_args, "")) 339 return NULL; 340 _err = InvalidateMenuSize(_self->ob_itself); 341 if (_err != noErr) return PyMac_Error(_err); 342 Py_INCREF(Py_None); 343 _res = Py_None; 344 return _res; 345 345 } 346 346 347 347 static PyObject *MenuObj_IsMenuSizeInvalid(MenuObject *_self, PyObject *_args) 348 348 { 349 350 349 PyObject *_res = NULL; 350 Boolean _rv; 351 351 #ifndef IsMenuSizeInvalid 352 353 #endif 354 355 356 357 358 359 352 PyMac_PRECHECK(IsMenuSizeInvalid); 353 #endif 354 if (!PyArg_ParseTuple(_args, "")) 355 return NULL; 356 _rv = IsMenuSizeInvalid(_self->ob_itself); 357 _res = Py_BuildValue("b", 358 _rv); 359 return _res; 360 360 } 361 361 362 362 static PyObject *MenuObj_MacAppendMenu(MenuObject *_self, PyObject *_args) 363 363 { 364 365 364 PyObject *_res = NULL; 365 Str255 data; 366 366 #ifndef MacAppendMenu 367 368 #endif 369 370 371 372 373 374 375 376 367 PyMac_PRECHECK(MacAppendMenu); 368 #endif 369 if (!PyArg_ParseTuple(_args, "O&", 370 PyMac_GetStr255, data)) 371 return NULL; 372 MacAppendMenu(_self->ob_itself, 373 data); 374 Py_INCREF(Py_None); 375 _res = Py_None; 376 return _res; 377 377 } 378 378 379 379 static PyObject *MenuObj_InsertResMenu(MenuObject *_self, PyObject *_args) 380 380 { 381 382 383 381 PyObject *_res = NULL; 382 ResType theType; 383 short afterItem; 384 384 #ifndef InsertResMenu 385 386 #endif 387 388 389 390 391 392 393 394 395 396 385 PyMac_PRECHECK(InsertResMenu); 386 #endif 387 if (!PyArg_ParseTuple(_args, "O&h", 388 PyMac_GetOSType, &theType, 389 &afterItem)) 390 return NULL; 391 InsertResMenu(_self->ob_itself, 392 theType, 393 afterItem); 394 Py_INCREF(Py_None); 395 _res = Py_None; 396 return _res; 397 397 } 398 398 399 399 static PyObject *MenuObj_AppendResMenu(MenuObject *_self, PyObject *_args) 400 400 { 401 402 401 PyObject *_res = NULL; 402 ResType theType; 403 403 #ifndef AppendResMenu 404 405 #endif 406 407 408 409 410 411 412 413 404 PyMac_PRECHECK(AppendResMenu); 405 #endif 406 if (!PyArg_ParseTuple(_args, "O&", 407 PyMac_GetOSType, &theType)) 408 return NULL; 409 AppendResMenu(_self->ob_itself, 410 theType); 411 Py_INCREF(Py_None); 412 _res = Py_None; 413 return _res; 414 414 } 415 415 416 416 static PyObject *MenuObj_MacInsertMenuItem(MenuObject *_self, PyObject *_args) 417 417 { 418 419 420 418 PyObject *_res = NULL; 419 Str255 itemString; 420 short afterItem; 421 421 #ifndef MacInsertMenuItem 422 423 #endif 424 425 426 427 428 429 430 431 432 433 422 PyMac_PRECHECK(MacInsertMenuItem); 423 #endif 424 if (!PyArg_ParseTuple(_args, "O&h", 425 PyMac_GetStr255, itemString, 426 &afterItem)) 427 return NULL; 428 MacInsertMenuItem(_self->ob_itself, 429 itemString, 430 afterItem); 431 Py_INCREF(Py_None); 432 _res = Py_None; 433 return _res; 434 434 } 435 435 436 436 static PyObject *MenuObj_DeleteMenuItem(MenuObject *_self, PyObject *_args) 437 437 { 438 439 438 PyObject *_res = NULL; 439 short item; 440 440 #ifndef DeleteMenuItem 441 442 #endif 443 444 445 446 447 448 449 450 441 PyMac_PRECHECK(DeleteMenuItem); 442 #endif 443 if (!PyArg_ParseTuple(_args, "h", 444 &item)) 445 return NULL; 446 DeleteMenuItem(_self->ob_itself, 447 item); 448 Py_INCREF(Py_None); 449 _res = Py_None; 450 return _res; 451 451 } 452 452 453 453 static PyObject *MenuObj_InsertFontResMenu(MenuObject *_self, PyObject *_args) 454 454 { 455 456 457 455 PyObject *_res = NULL; 456 short afterItem; 457 short scriptFilter; 458 458 #ifndef InsertFontResMenu 459 460 #endif 461 462 463 464 465 466 467 468 469 470 459 PyMac_PRECHECK(InsertFontResMenu); 460 #endif 461 if (!PyArg_ParseTuple(_args, "hh", 462 &afterItem, 463 &scriptFilter)) 464 return NULL; 465 InsertFontResMenu(_self->ob_itself, 466 afterItem, 467 scriptFilter); 468 Py_INCREF(Py_None); 469 _res = Py_None; 470 return _res; 471 471 } 472 472 473 473 static PyObject *MenuObj_InsertIntlResMenu(MenuObject *_self, PyObject *_args) 474 474 { 475 476 477 478 475 PyObject *_res = NULL; 476 ResType theType; 477 short afterItem; 478 short scriptFilter; 479 479 #ifndef InsertIntlResMenu 480 481 #endif 482 483 484 485 486 487 488 489 490 491 492 493 480 PyMac_PRECHECK(InsertIntlResMenu); 481 #endif 482 if (!PyArg_ParseTuple(_args, "O&hh", 483 PyMac_GetOSType, &theType, 484 &afterItem, 485 &scriptFilter)) 486 return NULL; 487 InsertIntlResMenu(_self->ob_itself, 488 theType, 489 afterItem, 490 scriptFilter); 491 Py_INCREF(Py_None); 492 _res = Py_None; 493 return _res; 494 494 } 495 495 496 496 static PyObject *MenuObj_AppendMenuItemText(MenuObject *_self, PyObject *_args) 497 497 { 498 499 500 498 PyObject *_res = NULL; 499 OSStatus _err; 500 Str255 inString; 501 501 #ifndef AppendMenuItemText 502 503 #endif 504 505 506 507 508 509 510 511 512 502 PyMac_PRECHECK(AppendMenuItemText); 503 #endif 504 if (!PyArg_ParseTuple(_args, "O&", 505 PyMac_GetStr255, inString)) 506 return NULL; 507 _err = AppendMenuItemText(_self->ob_itself, 508 inString); 509 if (_err != noErr) return PyMac_Error(_err); 510 Py_INCREF(Py_None); 511 _res = Py_None; 512 return _res; 513 513 } 514 514 515 515 static PyObject *MenuObj_InsertMenuItemText(MenuObject *_self, PyObject *_args) 516 516 { 517 518 519 520 517 PyObject *_res = NULL; 518 OSStatus _err; 519 Str255 inString; 520 MenuItemIndex afterItem; 521 521 #ifndef InsertMenuItemText 522 523 #endif 524 525 526 527 528 529 530 531 532 533 534 522 PyMac_PRECHECK(InsertMenuItemText); 523 #endif 524 if (!PyArg_ParseTuple(_args, "O&h", 525 PyMac_GetStr255, inString, 526 &afterItem)) 527 return NULL; 528 _err = InsertMenuItemText(_self->ob_itself, 529 inString, 530 afterItem); 531 if (_err != noErr) return PyMac_Error(_err); 532 Py_INCREF(Py_None); 533 _res = Py_None; 534 return _res; 535 535 } 536 536 537 537 static PyObject *MenuObj_CopyMenuItems(MenuObject *_self, PyObject *_args) 538 538 { 539 540 541 542 543 544 539 PyObject *_res = NULL; 540 OSStatus _err; 541 MenuItemIndex inFirstItem; 542 ItemCount inNumItems; 543 MenuHandle inDestMenu; 544 MenuItemIndex inInsertAfter; 545 545 #ifndef CopyMenuItems 546 547 #endif 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 546 PyMac_PRECHECK(CopyMenuItems); 547 #endif 548 if (!PyArg_ParseTuple(_args, "hlO&h", 549 &inFirstItem, 550 &inNumItems, 551 MenuObj_Convert, &inDestMenu, 552 &inInsertAfter)) 553 return NULL; 554 _err = CopyMenuItems(_self->ob_itself, 555 inFirstItem, 556 inNumItems, 557 inDestMenu, 558 inInsertAfter); 559 if (_err != noErr) return PyMac_Error(_err); 560 Py_INCREF(Py_None); 561 _res = Py_None; 562 return _res; 563 563 } 564 564 565 565 static PyObject *MenuObj_DeleteMenuItems(MenuObject *_self, PyObject *_args) 566 566 { 567 568 569 570 567 PyObject *_res = NULL; 568 OSStatus _err; 569 MenuItemIndex inFirstItem; 570 ItemCount inNumItems; 571 571 #ifndef DeleteMenuItems 572 573 #endif 574 575 576 577 578 579 580 581 582 583 584 572 PyMac_PRECHECK(DeleteMenuItems); 573 #endif 574 if (!PyArg_ParseTuple(_args, "hl", 575 &inFirstItem, 576 &inNumItems)) 577 return NULL; 578 _err = DeleteMenuItems(_self->ob_itself, 579 inFirstItem, 580 inNumItems); 581 if (_err != noErr) return PyMac_Error(_err); 582 Py_INCREF(Py_None); 583 _res = Py_None; 584 return _res; 585 585 } 586 586 587 587 static PyObject *MenuObj_AppendMenuItemTextWithCFString(MenuObject *_self, PyObject *_args) 588 588 { 589 590 591 592 593 594 589 PyObject *_res = NULL; 590 OSStatus _err; 591 CFStringRef inString; 592 MenuItemAttributes inAttributes; 593 MenuCommand inCommandID; 594 MenuItemIndex outNewItem; 595 595 #ifndef AppendMenuItemTextWithCFString 596 597 #endif 598 599 600 601 602 603 604 605 606 607 608 609 610 611 596 PyMac_PRECHECK(AppendMenuItemTextWithCFString); 597 #endif 598 if (!PyArg_ParseTuple(_args, "O&ll", 599 CFStringRefObj_Convert, &inString, 600 &inAttributes, 601 &inCommandID)) 602 return NULL; 603 _err = AppendMenuItemTextWithCFString(_self->ob_itself, 604 inString, 605 inAttributes, 606 inCommandID, 607 &outNewItem); 608 if (_err != noErr) return PyMac_Error(_err); 609 _res = Py_BuildValue("h", 610 outNewItem); 611 return _res; 612 612 } 613 613 614 614 static PyObject *MenuObj_InsertMenuItemTextWithCFString(MenuObject *_self, PyObject *_args) 615 615 { 616 617 618 619 620 621 616 PyObject *_res = NULL; 617 OSStatus _err; 618 CFStringRef inString; 619 MenuItemIndex inAfterItem; 620 MenuItemAttributes inAttributes; 621 MenuCommand inCommandID; 622 622 #ifndef InsertMenuItemTextWithCFString 623 624 #endif 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 623 PyMac_PRECHECK(InsertMenuItemTextWithCFString); 624 #endif 625 if (!PyArg_ParseTuple(_args, "O&hll", 626 CFStringRefObj_Convert, &inString, 627 &inAfterItem, 628 &inAttributes, 629 &inCommandID)) 630 return NULL; 631 _err = InsertMenuItemTextWithCFString(_self->ob_itself, 632 inString, 633 inAfterItem, 634 inAttributes, 635 inCommandID); 636 if (_err != noErr) return PyMac_Error(_err); 637 Py_INCREF(Py_None); 638 _res = Py_None; 639 return _res; 640 640 } 641 641 642 642 static PyObject *MenuObj_PopUpMenuSelect(MenuObject *_self, PyObject *_args) 643 643 { 644 645 646 647 648 644 PyObject *_res = NULL; 645 long _rv; 646 short top; 647 short left; 648 short popUpItem; 649 649 #ifndef PopUpMenuSelect 650 651 #endif 652 653 654 655 656 657 658 659 660 661 662 663 650 PyMac_PRECHECK(PopUpMenuSelect); 651 #endif 652 if (!PyArg_ParseTuple(_args, "hhh", 653 &top, 654 &left, 655 &popUpItem)) 656 return NULL; 657 _rv = PopUpMenuSelect(_self->ob_itself, 658 top, 659 left, 660 popUpItem); 661 _res = Py_BuildValue("l", 662 _rv); 663 return _res; 664 664 } 665 665 666 666 static PyObject *MenuObj_InvalidateMenuEnabling(MenuObject *_self, PyObject *_args) 667 667 { 668 669 668 PyObject *_res = NULL; 669 OSStatus _err; 670 670 #ifndef InvalidateMenuEnabling 671 672 #endif 673 674 675 676 677 678 679 671 PyMac_PRECHECK(InvalidateMenuEnabling); 672 #endif 673 if (!PyArg_ParseTuple(_args, "")) 674 return NULL; 675 _err = InvalidateMenuEnabling(_self->ob_itself); 676 if (_err != noErr) return PyMac_Error(_err); 677 Py_INCREF(Py_None); 678 _res = Py_None; 679 return _res; 680 680 } 681 681 682 682 static PyObject *MenuObj_IsMenuBarInvalid(MenuObject *_self, PyObject *_args) 683 683 { 684 685 684 PyObject *_res = NULL; 685 Boolean _rv; 686 686 #ifndef IsMenuBarInvalid 687 688 #endif 689 690 691 692 693 694 687 PyMac_PRECHECK(IsMenuBarInvalid); 688 #endif 689 if (!PyArg_ParseTuple(_args, "")) 690 return NULL; 691 _rv = IsMenuBarInvalid(_self->ob_itself); 692 _res = Py_BuildValue("b", 693 _rv); 694 return _res; 695 695 } 696 696 697 697 static PyObject *MenuObj_MacInsertMenu(MenuObject *_self, PyObject *_args) 698 698 { 699 700 699 PyObject *_res = NULL; 700 MenuID beforeID; 701 701 #ifndef MacInsertMenu 702 703 #endif 704 705 706 707 708 709 710 711 702 PyMac_PRECHECK(MacInsertMenu); 703 #endif 704 if (!PyArg_ParseTuple(_args, "h", 705 &beforeID)) 706 return NULL; 707 MacInsertMenu(_self->ob_itself, 708 beforeID); 709 Py_INCREF(Py_None); 710 _res = Py_None; 711 return _res; 712 712 } 713 713 714 714 static PyObject *MenuObj_SetRootMenu(MenuObject *_self, PyObject *_args) 715 715 { 716 717 716 PyObject *_res = NULL; 717 OSStatus _err; 718 718 #ifndef SetRootMenu 719 720 #endif 721 722 723 724 725 726 727 719 PyMac_PRECHECK(SetRootMenu); 720 #endif 721 if (!PyArg_ParseTuple(_args, "")) 722 return NULL; 723 _err = SetRootMenu(_self->ob_itself); 724 if (_err != noErr) return PyMac_Error(_err); 725 Py_INCREF(Py_None); 726 _res = Py_None; 727 return _res; 728 728 } 729 729 730 730 static PyObject *MenuObj_MacCheckMenuItem(MenuObject *_self, PyObject *_args) 731 731 { 732 733 734 732 PyObject *_res = NULL; 733 short item; 734 Boolean checked; 735 735 #ifndef MacCheckMenuItem 736 737 #endif 738 739 740 741 742 743 744 745 746 747 736 PyMac_PRECHECK(MacCheckMenuItem); 737 #endif 738 if (!PyArg_ParseTuple(_args, "hb", 739 &item, 740 &checked)) 741 return NULL; 742 MacCheckMenuItem(_self->ob_itself, 743 item, 744 checked); 745 Py_INCREF(Py_None); 746 _res = Py_None; 747 return _res; 748 748 } 749 749 750 750 static PyObject *MenuObj_SetMenuItemText(MenuObject *_self, PyObject *_args) 751 751 { 752 753 754 752 PyObject *_res = NULL; 753 short item; 754 Str255 itemString; 755 755 #ifndef SetMenuItemText 756 757 #endif 758 759 760 761 762 763 764 765 766 767 756 PyMac_PRECHECK(SetMenuItemText); 757 #endif 758 if (!PyArg_ParseTuple(_args, "hO&", 759 &item, 760 PyMac_GetStr255, itemString)) 761 return NULL; 762 SetMenuItemText(_self->ob_itself, 763 item, 764 itemString); 765 Py_INCREF(Py_None); 766 _res = Py_None; 767 return _res; 768 768 } 769 769 770 770 static PyObject *MenuObj_GetMenuItemText(MenuObject *_self, PyObject *_args) 771 771 { 772 773 774 772 PyObject *_res = NULL; 773 short item; 774 Str255 itemString; 775 775 #ifndef GetMenuItemText 776 777 #endif 778 779 780 781 782 783 784 785 786 776 PyMac_PRECHECK(GetMenuItemText); 777 #endif 778 if (!PyArg_ParseTuple(_args, "h", 779 &item)) 780 return NULL; 781 GetMenuItemText(_self->ob_itself, 782 item, 783 itemString); 784 _res = Py_BuildValue("O&", 785 PyMac_BuildStr255, itemString); 786 return _res; 787 787 } 788 788 789 789 static PyObject *MenuObj_SetItemMark(MenuObject *_self, PyObject *_args) 790 790 { 791 792 793 791 PyObject *_res = NULL; 792 short item; 793 CharParameter markChar; 794 794 #ifndef SetItemMark 795 796 #endif 797 798 799 800 801 802 803 804 805 806 795 PyMac_PRECHECK(SetItemMark); 796 #endif 797 if (!PyArg_ParseTuple(_args, "hh", 798 &item, 799 &markChar)) 800 return NULL; 801 SetItemMark(_self->ob_itself, 802 item, 803 markChar); 804 Py_INCREF(Py_None); 805 _res = Py_None; 806 return _res; 807 807 } 808 808 809 809 static PyObject *MenuObj_GetItemMark(MenuObject *_self, PyObject *_args) 810 810 { 811 812 813 811 PyObject *_res = NULL; 812 short item; 813 CharParameter markChar; 814 814 #ifndef GetItemMark 815 816 #endif 817 818 819 820 821 822 823 824 825 815 PyMac_PRECHECK(GetItemMark); 816 #endif 817 if (!PyArg_ParseTuple(_args, "h", 818 &item)) 819 return NULL; 820 GetItemMark(_self->ob_itself, 821 item, 822 &markChar); 823 _res = Py_BuildValue("h", 824 markChar); 825 return _res; 826 826 } 827 827 828 828 static PyObject *MenuObj_SetItemCmd(MenuObject *_self, PyObject *_args) 829 829 { 830 831 832 830 PyObject *_res = NULL; 831 short item; 832 CharParameter cmdChar; 833 833 #ifndef SetItemCmd 834 835 #endif 836 837 838 839 840 841 842 843 844 845 834 PyMac_PRECHECK(SetItemCmd); 835 #endif 836 if (!PyArg_ParseTuple(_args, "hh", 837 &item, 838 &cmdChar)) 839 return NULL; 840 SetItemCmd(_self->ob_itself, 841 item, 842 cmdChar); 843 Py_INCREF(Py_None); 844 _res = Py_None; 845 return _res; 846 846 } 847 847 848 848 static PyObject *MenuObj_GetItemCmd(MenuObject *_self, PyObject *_args) 849 849 { 850 851 852 850 PyObject *_res = NULL; 851 short item; 852 CharParameter cmdChar; 853 853 #ifndef GetItemCmd 854 855 #endif 856 857 858 859 860 861 862 863 864 854 PyMac_PRECHECK(GetItemCmd); 855 #endif 856 if (!PyArg_ParseTuple(_args, "h", 857 &item)) 858 return NULL; 859 GetItemCmd(_self->ob_itself, 860 item, 861 &cmdChar); 862 _res = Py_BuildValue("h", 863 cmdChar); 864 return _res; 865 865 } 866 866 867 867 static PyObject *MenuObj_SetItemIcon(MenuObject *_self, PyObject *_args) 868 868 { 869 870 871 869 PyObject *_res = NULL; 870 short item; 871 short iconIndex; 872 872 #ifndef SetItemIcon 873 874 #endif 875 876 877 878 879 880 881 882 883 884 873 PyMac_PRECHECK(SetItemIcon); 874 #endif 875 if (!PyArg_ParseTuple(_args, "hh", 876 &item, 877 &iconIndex)) 878 return NULL; 879 SetItemIcon(_self->ob_itself, 880 item, 881 iconIndex); 882 Py_INCREF(Py_None); 883 _res = Py_None; 884 return _res; 885 885 } 886 886 887 887 static PyObject *MenuObj_GetItemIcon(MenuObject *_self, PyObject *_args) 888 888 { 889 890 891 889 PyObject *_res = NULL; 890 short item; 891 short iconIndex; 892 892 #ifndef GetItemIcon 893 894 #endif 895 896 897 898 899 900 901 902 903 893 PyMac_PRECHECK(GetItemIcon); 894 #endif 895 if (!PyArg_ParseTuple(_args, "h", 896 &item)) 897 return NULL; 898 GetItemIcon(_self->ob_itself, 899 item, 900 &iconIndex); 901 _res = Py_BuildValue("h", 902 iconIndex); 903 return _res; 904 904 } 905 905 906 906 static PyObject *MenuObj_SetItemStyle(MenuObject *_self, PyObject *_args) 907 907 { 908 909 910 908 PyObject *_res = NULL; 909 short item; 910 StyleParameter chStyle; 911 911 #ifndef SetItemStyle 912 913 #endif 914 915 916 917 918 919 920 921 922 923 912 PyMac_PRECHECK(SetItemStyle); 913 #endif 914 if (!PyArg_ParseTuple(_args, "hh", 915 &item, 916 &chStyle)) 917 return NULL; 918 SetItemStyle(_self->ob_itself, 919 item, 920 chStyle); 921 Py_INCREF(Py_None); 922 _res = Py_None; 923 return _res; 924 924 } 925 925 926 926 static PyObject *MenuObj_GetItemStyle(MenuObject *_self, PyObject *_args) 927 927 { 928 929 930 928 PyObject *_res = NULL; 929 short item; 930 Style chStyle; 931 931 #ifndef GetItemStyle 932 933 #endif 934 935 936 937 938 939 940 941 942 932 PyMac_PRECHECK(GetItemStyle); 933 #endif 934 if (!PyArg_ParseTuple(_args, "h", 935 &item)) 936 return NULL; 937 GetItemStyle(_self->ob_itself, 938 item, 939 &chStyle); 940 _res = Py_BuildValue("b", 941 chStyle); 942 return _res; 943 943 } 944 944 945 945 static PyObject *MenuObj_SetMenuItemCommandID(MenuObject *_self, PyObject *_args) 946 946 { 947 948 949 950 947 PyObject *_res = NULL; 948 OSErr _err; 949 SInt16 inItem; 950 MenuCommand inCommandID; 951 951 #ifndef SetMenuItemCommandID 952 953 #endif 954 955 956 957 958 959 960 961 962 963 964 952 PyMac_PRECHECK(SetMenuItemCommandID); 953 #endif 954 if (!PyArg_ParseTuple(_args, "hl", 955 &inItem, 956 &inCommandID)) 957 return NULL; 958 _err = SetMenuItemCommandID(_self->ob_itself, 959 inItem, 960 inCommandID); 961 if (_err != noErr) return PyMac_Error(_err); 962 Py_INCREF(Py_None); 963 _res = Py_None; 964 return _res; 965 965 } 966 966 967 967 static PyObject *MenuObj_GetMenuItemCommandID(MenuObject *_self, PyObject *_args) 968 968 { 969 970 971 972 969 PyObject *_res = NULL; 970 OSErr _err; 971 SInt16 inItem; 972 MenuCommand outCommandID; 973 973 #ifndef GetMenuItemCommandID 974 975 #endif 976 977 978 979 980 981 982 983 984 985 974 PyMac_PRECHECK(GetMenuItemCommandID); 975 #endif 976 if (!PyArg_ParseTuple(_args, "h", 977 &inItem)) 978 return NULL; 979 _err = GetMenuItemCommandID(_self->ob_itself, 980 inItem, 981 &outCommandID); 982 if (_err != noErr) return PyMac_Error(_err); 983 _res = Py_BuildValue("l", 984 outCommandID); 985 return _res; 986 986 } 987 987 988 988 static PyObject *MenuObj_SetMenuItemModifiers(MenuObject *_self, PyObject *_args) 989 989 { 990 991 992 993 990 PyObject *_res = NULL; 991 OSErr _err; 992 SInt16 inItem; 993 UInt8 inModifiers; 994 994 #ifndef SetMenuItemModifiers 995 996 #endif 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 995 PyMac_PRECHECK(SetMenuItemModifiers); 996 #endif 997 if (!PyArg_ParseTuple(_args, "hb", 998 &inItem, 999 &inModifiers)) 1000 return NULL; 1001 _err = SetMenuItemModifiers(_self->ob_itself, 1002 inItem, 1003 inModifiers); 1004 if (_err != noErr) return PyMac_Error(_err); 1005 Py_INCREF(Py_None); 1006 _res = Py_None; 1007 return _res; 1008 1008 } 1009 1009 1010 1010 static PyObject *MenuObj_GetMenuItemModifiers(MenuObject *_self, PyObject *_args) 1011 1011 { 1012 1013 1014 1015 1012 PyObject *_res = NULL; 1013 OSErr _err; 1014 SInt16 inItem; 1015 UInt8 outModifiers; 1016 1016 #ifndef GetMenuItemModifiers 1017 1018 #endif 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1017 PyMac_PRECHECK(GetMenuItemModifiers); 1018 #endif 1019 if (!PyArg_ParseTuple(_args, "h", 1020 &inItem)) 1021 return NULL; 1022 _err = GetMenuItemModifiers(_self->ob_itself, 1023 inItem, 1024 &outModifiers); 1025 if (_err != noErr) return PyMac_Error(_err); 1026 _res = Py_BuildValue("b", 1027 outModifiers); 1028 return _res; 1029 1029 } 1030 1030 1031 1031 static PyObject *MenuObj_SetMenuItemIconHandle(MenuObject *_self, PyObject *_args) 1032 1032 { 1033 1034 1035 1036 1037 1033 PyObject *_res = NULL; 1034 OSErr _err; 1035 SInt16 inItem; 1036 UInt8 inIconType; 1037 Handle inIconHandle; 1038 1038 #ifndef SetMenuItemIconHandle 1039 1040 #endif 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1039 PyMac_PRECHECK(SetMenuItemIconHandle); 1040 #endif 1041 if (!PyArg_ParseTuple(_args, "hbO&", 1042 &inItem, 1043 &inIconType, 1044 ResObj_Convert, &inIconHandle)) 1045 return NULL; 1046 _err = SetMenuItemIconHandle(_self->ob_itself, 1047 inItem, 1048 inIconType, 1049 inIconHandle); 1050 if (_err != noErr) return PyMac_Error(_err); 1051 Py_INCREF(Py_None); 1052 _res = Py_None; 1053 return _res; 1054 1054 } 1055 1055 1056 1056 static PyObject *MenuObj_GetMenuItemIconHandle(MenuObject *_self, PyObject *_args) 1057 1057 { 1058 1059 1060 1061 1062 1058 PyObject *_res = NULL; 1059 OSErr _err; 1060 SInt16 inItem; 1061 UInt8 outIconType; 1062 Handle outIconHandle; 1063 1063 #ifndef GetMenuItemIconHandle 1064 1065 #endif 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1064 PyMac_PRECHECK(GetMenuItemIconHandle); 1065 #endif 1066 if (!PyArg_ParseTuple(_args, "h", 1067 &inItem)) 1068 return NULL; 1069 _err = GetMenuItemIconHandle(_self->ob_itself, 1070 inItem, 1071 &outIconType, 1072 &outIconHandle); 1073 if (_err != noErr) return PyMac_Error(_err); 1074 _res = Py_BuildValue("bO&", 1075 outIconType, 1076 ResObj_New, outIconHandle); 1077 return _res; 1078 1078 } 1079 1079 1080 1080 static PyObject *MenuObj_SetMenuItemTextEncoding(MenuObject *_self, PyObject *_args) 1081 1081 { 1082 1083 1084 1085 1082 PyObject *_res = NULL; 1083 OSErr _err; 1084 SInt16 inItem; 1085 TextEncoding inScriptID; 1086 1086 #ifndef SetMenuItemTextEncoding 1087 1088 #endif 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1087 PyMac_PRECHECK(SetMenuItemTextEncoding); 1088 #endif 1089 if (!PyArg_ParseTuple(_args, "hl", 1090 &inItem, 1091 &inScriptID)) 1092 return NULL; 1093 _err = SetMenuItemTextEncoding(_self->ob_itself, 1094 inItem, 1095 inScriptID); 1096 if (_err != noErr) return PyMac_Error(_err); 1097 Py_INCREF(Py_None); 1098 _res = Py_None; 1099 return _res; 1100 1100 } 1101 1101 1102 1102 static PyObject *MenuObj_GetMenuItemTextEncoding(MenuObject *_self, PyObject *_args) 1103 1103 { 1104 1105 1106 1107 1104 PyObject *_res = NULL; 1105 OSErr _err; 1106 SInt16 inItem; 1107 TextEncoding outScriptID; 1108 1108 #ifndef GetMenuItemTextEncoding 1109 1110 #endif 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1109 PyMac_PRECHECK(GetMenuItemTextEncoding); 1110 #endif 1111 if (!PyArg_ParseTuple(_args, "h", 1112 &inItem)) 1113 return NULL; 1114 _err = GetMenuItemTextEncoding(_self->ob_itself, 1115 inItem, 1116 &outScriptID); 1117 if (_err != noErr) return PyMac_Error(_err); 1118 _res = Py_BuildValue("l", 1119 outScriptID); 1120 return _res; 1121 1121 } 1122 1122 1123 1123 static PyObject *MenuObj_SetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args) 1124 1124 { 1125 1126 1127 1128 1125 PyObject *_res = NULL; 1126 OSErr _err; 1127 SInt16 inItem; 1128 MenuID inHierID; 1129 1129 #ifndef SetMenuItemHierarchicalID 1130 1131 #endif 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1130 PyMac_PRECHECK(SetMenuItemHierarchicalID); 1131 #endif 1132 if (!PyArg_ParseTuple(_args, "hh", 1133 &inItem, 1134 &inHierID)) 1135 return NULL; 1136 _err = SetMenuItemHierarchicalID(_self->ob_itself, 1137 inItem, 1138 inHierID); 1139 if (_err != noErr) return PyMac_Error(_err); 1140 Py_INCREF(Py_None); 1141 _res = Py_None; 1142 return _res; 1143 1143 } 1144 1144 1145 1145 static PyObject *MenuObj_GetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args) 1146 1146 { 1147 1148 1149 1150 1147 PyObject *_res = NULL; 1148 OSErr _err; 1149 SInt16 inItem; 1150 MenuID outHierID; 1151 1151 #ifndef GetMenuItemHierarchicalID 1152 1153 #endif 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1152 PyMac_PRECHECK(GetMenuItemHierarchicalID); 1153 #endif 1154 if (!PyArg_ParseTuple(_args, "h", 1155 &inItem)) 1156 return NULL; 1157 _err = GetMenuItemHierarchicalID(_self->ob_itself, 1158 inItem, 1159 &outHierID); 1160 if (_err != noErr) return PyMac_Error(_err); 1161 _res = Py_BuildValue("h", 1162 outHierID); 1163 return _res; 1164 1164 } 1165 1165 1166 1166 static PyObject *MenuObj_SetMenuItemFontID(MenuObject *_self, PyObject *_args) 1167 1167 { 1168 1169 1170 1171 1168 PyObject *_res = NULL; 1169 OSErr _err; 1170 SInt16 inItem; 1171 SInt16 inFontID; 1172 1172 #ifndef SetMenuItemFontID 1173 1174 #endif 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1173 PyMac_PRECHECK(SetMenuItemFontID); 1174 #endif 1175 if (!PyArg_ParseTuple(_args, "hh", 1176 &inItem, 1177 &inFontID)) 1178 return NULL; 1179 _err = SetMenuItemFontID(_self->ob_itself, 1180 inItem, 1181 inFontID); 1182 if (_err != noErr) return PyMac_Error(_err); 1183 Py_INCREF(Py_None); 1184 _res = Py_None; 1185 return _res; 1186 1186 } 1187 1187 1188 1188 static PyObject *MenuObj_GetMenuItemFontID(MenuObject *_self, PyObject *_args) 1189 1189 { 1190 1191 1192 1193 1190 PyObject *_res = NULL; 1191 OSErr _err; 1192 SInt16 inItem; 1193 SInt16 outFontID; 1194 1194 #ifndef GetMenuItemFontID 1195 1196 #endif 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1195 PyMac_PRECHECK(GetMenuItemFontID); 1196 #endif 1197 if (!PyArg_ParseTuple(_args, "h", 1198 &inItem)) 1199 return NULL; 1200 _err = GetMenuItemFontID(_self->ob_itself, 1201 inItem, 1202 &outFontID); 1203 if (_err != noErr) return PyMac_Error(_err); 1204 _res = Py_BuildValue("h", 1205 outFontID); 1206 return _res; 1207 1207 } 1208 1208 1209 1209 static PyObject *MenuObj_SetMenuItemRefCon(MenuObject *_self, PyObject *_args) 1210 1210 { 1211 1212 1213 1214 1211 PyObject *_res = NULL; 1212 OSErr _err; 1213 SInt16 inItem; 1214 UInt32 inRefCon; 1215 1215 #ifndef SetMenuItemRefCon 1216 1217 #endif 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1216 PyMac_PRECHECK(SetMenuItemRefCon); 1217 #endif 1218 if (!PyArg_ParseTuple(_args, "hl", 1219 &inItem, 1220 &inRefCon)) 1221 return NULL; 1222 _err = SetMenuItemRefCon(_self->ob_itself, 1223 inItem, 1224 inRefCon); 1225 if (_err != noErr) return PyMac_Error(_err); 1226 Py_INCREF(Py_None); 1227 _res = Py_None; 1228 return _res; 1229 1229 } 1230 1230 1231 1231 static PyObject *MenuObj_GetMenuItemRefCon(MenuObject *_self, PyObject *_args) 1232 1232 { 1233 1234 1235 1236 1233 PyObject *_res = NULL; 1234 OSErr _err; 1235 SInt16 inItem; 1236 UInt32 outRefCon; 1237 1237 #ifndef GetMenuItemRefCon 1238 1239 #endif 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1238 PyMac_PRECHECK(GetMenuItemRefCon); 1239 #endif 1240 if (!PyArg_ParseTuple(_args, "h", 1241 &inItem)) 1242 return NULL; 1243 _err = GetMenuItemRefCon(_self->ob_itself, 1244 inItem, 1245 &outRefCon); 1246 if (_err != noErr) return PyMac_Error(_err); 1247 _res = Py_BuildValue("l", 1248 outRefCon); 1249 return _res; 1250 1250 } 1251 1251 1252 1252 static PyObject *MenuObj_SetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args) 1253 1253 { 1254 1255 1256 1257 1254 PyObject *_res = NULL; 1255 OSErr _err; 1256 SInt16 inItem; 1257 SInt16 inGlyph; 1258 1258 #ifndef SetMenuItemKeyGlyph 1259 1260 #endif 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1259 PyMac_PRECHECK(SetMenuItemKeyGlyph); 1260 #endif 1261 if (!PyArg_ParseTuple(_args, "hh", 1262 &inItem, 1263 &inGlyph)) 1264 return NULL; 1265 _err = SetMenuItemKeyGlyph(_self->ob_itself, 1266 inItem, 1267 inGlyph); 1268 if (_err != noErr) return PyMac_Error(_err); 1269 Py_INCREF(Py_None); 1270 _res = Py_None; 1271 return _res; 1272 1272 } 1273 1273 1274 1274 static PyObject *MenuObj_GetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args) 1275 1275 { 1276 1277 1278 1279 1276 PyObject *_res = NULL; 1277 OSErr _err; 1278 SInt16 inItem; 1279 SInt16 outGlyph; 1280 1280 #ifndef GetMenuItemKeyGlyph 1281 1282 #endif 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1281 PyMac_PRECHECK(GetMenuItemKeyGlyph); 1282 #endif 1283 if (!PyArg_ParseTuple(_args, "h", 1284 &inItem)) 1285 return NULL; 1286 _err = GetMenuItemKeyGlyph(_self->ob_itself, 1287 inItem, 1288 &outGlyph); 1289 if (_err != noErr) return PyMac_Error(_err); 1290 _res = Py_BuildValue("h", 1291 outGlyph); 1292 return _res; 1293 1293 } 1294 1294 1295 1295 static PyObject *MenuObj_MacEnableMenuItem(MenuObject *_self, PyObject *_args) 1296 1296 { 1297 1298 1297 PyObject *_res = NULL; 1298 MenuItemIndex item; 1299 1299 #ifndef MacEnableMenuItem 1300 1301 #endif 1302 1303 1304 1305 1306 1307 1308 1309 1300 PyMac_PRECHECK(MacEnableMenuItem); 1301 #endif 1302 if (!PyArg_ParseTuple(_args, "h", 1303 &item)) 1304 return NULL; 1305 MacEnableMenuItem(_self->ob_itself, 1306 item); 1307 Py_INCREF(Py_None); 1308 _res = Py_None; 1309 return _res; 1310 1310 } 1311 1311 1312 1312 static PyObject *MenuObj_DisableMenuItem(MenuObject *_self, PyObject *_args) 1313 1313 { 1314 1315 1314 PyObject *_res = NULL; 1315 MenuItemIndex item; 1316 1316 #ifndef DisableMenuItem 1317 1318 #endif 1319 1320 1321 1322 1323 1324 1325 1326 1317 PyMac_PRECHECK(DisableMenuItem); 1318 #endif 1319 if (!PyArg_ParseTuple(_args, "h", 1320 &item)) 1321 return NULL; 1322 DisableMenuItem(_self->ob_itself, 1323 item); 1324 Py_INCREF(Py_None); 1325 _res = Py_None; 1326 return _res; 1327 1327 } 1328 1328 1329 1329 static PyObject *MenuObj_IsMenuItemEnabled(MenuObject *_self, PyObject *_args) 1330 1330 { 1331 1332 1333 1331 PyObject *_res = NULL; 1332 Boolean _rv; 1333 MenuItemIndex item; 1334 1334 #ifndef IsMenuItemEnabled 1335 1336 #endif 1337 1338 1339 1340 1341 1342 1343 1344 1335 PyMac_PRECHECK(IsMenuItemEnabled); 1336 #endif 1337 if (!PyArg_ParseTuple(_args, "h", 1338 &item)) 1339 return NULL; 1340 _rv = IsMenuItemEnabled(_self->ob_itself, 1341 item); 1342 _res = Py_BuildValue("b", 1343 _rv); 1344 return _res; 1345 1345 } 1346 1346 1347 1347 static PyObject *MenuObj_EnableMenuItemIcon(MenuObject *_self, PyObject *_args) 1348 1348 { 1349 1350 1349 PyObject *_res = NULL; 1350 MenuItemIndex item; 1351 1351 #ifndef EnableMenuItemIcon 1352 1353 #endif 1354 1355 1356 1357 1358 1359 1360 1361 1352 PyMac_PRECHECK(EnableMenuItemIcon); 1353 #endif 1354 if (!PyArg_ParseTuple(_args, "h", 1355 &item)) 1356 return NULL; 1357 EnableMenuItemIcon(_self->ob_itself, 1358 item); 1359 Py_INCREF(Py_None); 1360 _res = Py_None; 1361 return _res; 1362 1362 } 1363 1363 1364 1364 static PyObject *MenuObj_DisableMenuItemIcon(MenuObject *_self, PyObject *_args) 1365 1365 { 1366 1367 1366 PyObject *_res = NULL; 1367 MenuItemIndex item; 1368 1368 #ifndef DisableMenuItemIcon 1369 1370 #endif 1371 1372 1373 1374 1375 1376 1377 1378 1369 PyMac_PRECHECK(DisableMenuItemIcon); 1370 #endif 1371 if (!PyArg_ParseTuple(_args, "h", 1372 &item)) 1373 return NULL; 1374 DisableMenuItemIcon(_self->ob_itself, 1375 item); 1376 Py_INCREF(Py_None); 1377 _res = Py_None; 1378 return _res; 1379 1379 } 1380 1380 1381 1381 static PyObject *MenuObj_IsMenuItemIconEnabled(MenuObject *_self, PyObject *_args) 1382 1382 { 1383 1384 1385 1383 PyObject *_res = NULL; 1384 Boolean _rv; 1385 MenuItemIndex item; 1386 1386 #ifndef IsMenuItemIconEnabled 1387 1388 #endif 1389 1390 1391 1392 1393 1394 1395 1396 1387 PyMac_PRECHECK(IsMenuItemIconEnabled); 1388 #endif 1389 if (!PyArg_ParseTuple(_args, "h", 1390 &item)) 1391 return NULL; 1392 _rv = IsMenuItemIconEnabled(_self->ob_itself, 1393 item); 1394 _res = Py_BuildValue("b", 1395 _rv); 1396 return _res; 1397 1397 } 1398 1398 1399 1399 static PyObject *MenuObj_SetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args) 1400 1400 { 1401 1402 1403 1404 1401 PyObject *_res = NULL; 1402 OSStatus _err; 1403 MenuItemIndex inItem; 1404 MenuHandle inHierMenu; 1405 1405 #ifndef SetMenuItemHierarchicalMenu 1406 1407 #endif 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1406 PyMac_PRECHECK(SetMenuItemHierarchicalMenu); 1407 #endif 1408 if (!PyArg_ParseTuple(_args, "hO&", 1409 &inItem, 1410 MenuObj_Convert, &inHierMenu)) 1411 return NULL; 1412 _err = SetMenuItemHierarchicalMenu(_self->ob_itself, 1413 inItem, 1414 inHierMenu); 1415 if (_err != noErr) return PyMac_Error(_err); 1416 Py_INCREF(Py_None); 1417 _res = Py_None; 1418 return _res; 1419 1419 } 1420 1420 1421 1421 static PyObject *MenuObj_GetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args) 1422 1422 { 1423 1424 1425 1426 1423 PyObject *_res = NULL; 1424 OSStatus _err; 1425 MenuItemIndex inItem; 1426 MenuHandle outHierMenu; 1427 1427 #ifndef GetMenuItemHierarchicalMenu 1428 1429 #endif 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1428 PyMac_PRECHECK(GetMenuItemHierarchicalMenu); 1429 #endif 1430 if (!PyArg_ParseTuple(_args, "h", 1431 &inItem)) 1432 return NULL; 1433 _err = GetMenuItemHierarchicalMenu(_self->ob_itself, 1434 inItem, 1435 &outHierMenu); 1436 if (_err != noErr) return PyMac_Error(_err); 1437 _res = Py_BuildValue("O&", 1438 OptMenuObj_New, outHierMenu); 1439 return _res; 1440 1440 } 1441 1441 1442 1442 static PyObject *MenuObj_CopyMenuItemTextAsCFString(MenuObject *_self, PyObject *_args) 1443 1443 { 1444 1445 1446 1447 1444 PyObject *_res = NULL; 1445 OSStatus _err; 1446 MenuItemIndex inItem; 1447 CFStringRef outString; 1448 1448 #ifndef CopyMenuItemTextAsCFString 1449 1450 #endif 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1449 PyMac_PRECHECK(CopyMenuItemTextAsCFString); 1450 #endif 1451 if (!PyArg_ParseTuple(_args, "h", 1452 &inItem)) 1453 return NULL; 1454 _err = CopyMenuItemTextAsCFString(_self->ob_itself, 1455 inItem, 1456 &outString); 1457 if (_err != noErr) return PyMac_Error(_err); 1458 _res = Py_BuildValue("O&", 1459 CFStringRefObj_New, outString); 1460 return _res; 1461 1461 } 1462 1462 1463 1463 static PyObject *MenuObj_SetMenuItemTextWithCFString(MenuObject *_self, PyObject *_args) 1464 1464 { 1465 1466 1467 1468 1465 PyObject *_res = NULL; 1466 OSStatus _err; 1467 MenuItemIndex inItem; 1468 CFStringRef inString; 1469 1469 #ifndef SetMenuItemTextWithCFString 1470 1471 #endif 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1470 PyMac_PRECHECK(SetMenuItemTextWithCFString); 1471 #endif 1472 if (!PyArg_ParseTuple(_args, "hO&", 1473 &inItem, 1474 CFStringRefObj_Convert, &inString)) 1475 return NULL; 1476 _err = SetMenuItemTextWithCFString(_self->ob_itself, 1477 inItem, 1478 inString); 1479 if (_err != noErr) return PyMac_Error(_err); 1480 Py_INCREF(Py_None); 1481 _res = Py_None; 1482 return _res; 1483 1483 } 1484 1484 1485 1485 static PyObject *MenuObj_GetMenuItemIndent(MenuObject *_self, PyObject *_args) 1486 1486 { 1487 1488 1489 1490 1487 PyObject *_res = NULL; 1488 OSStatus _err; 1489 MenuItemIndex inItem; 1490 UInt32 outIndent; 1491 1491 #ifndef GetMenuItemIndent 1492 1493 #endif 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1492 PyMac_PRECHECK(GetMenuItemIndent); 1493 #endif 1494 if (!PyArg_ParseTuple(_args, "h", 1495 &inItem)) 1496 return NULL; 1497 _err = GetMenuItemIndent(_self->ob_itself, 1498 inItem, 1499 &outIndent); 1500 if (_err != noErr) return PyMac_Error(_err); 1501 _res = Py_BuildValue("l", 1502 outIndent); 1503 return _res; 1504 1504 } 1505 1505 1506 1506 static PyObject *MenuObj_SetMenuItemIndent(MenuObject *_self, PyObject *_args) 1507 1507 { 1508 1509 1510 1511 1508 PyObject *_res = NULL; 1509 OSStatus _err; 1510 MenuItemIndex inItem; 1511 UInt32 inIndent; 1512 1512 #ifndef SetMenuItemIndent 1513 1514 #endif 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1513 PyMac_PRECHECK(SetMenuItemIndent); 1514 #endif 1515 if (!PyArg_ParseTuple(_args, "hl", 1516 &inItem, 1517 &inIndent)) 1518 return NULL; 1519 _err = SetMenuItemIndent(_self->ob_itself, 1520 inItem, 1521 inIndent); 1522 if (_err != noErr) return PyMac_Error(_err); 1523 Py_INCREF(Py_None); 1524 _res = Py_None; 1525 return _res; 1526 1526 } 1527 1527 1528 1528 static PyObject *MenuObj_GetMenuItemCommandKey(MenuObject *_self, PyObject *_args) 1529 1529 { 1530 1531 1532 1533 1534 1530 PyObject *_res = NULL; 1531 OSStatus _err; 1532 MenuItemIndex inItem; 1533 Boolean inGetVirtualKey; 1534 UInt16 outKey; 1535 1535 #ifndef GetMenuItemCommandKey 1536 1537 #endif 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1536 PyMac_PRECHECK(GetMenuItemCommandKey); 1537 #endif 1538 if (!PyArg_ParseTuple(_args, "hb", 1539 &inItem, 1540 &inGetVirtualKey)) 1541 return NULL; 1542 _err = GetMenuItemCommandKey(_self->ob_itself, 1543 inItem, 1544 inGetVirtualKey, 1545 &outKey); 1546 if (_err != noErr) return PyMac_Error(_err); 1547 _res = Py_BuildValue("H", 1548 outKey); 1549 return _res; 1550 1550 } 1551 1551 1552 1552 static PyObject *MenuObj_SetMenuItemCommandKey(MenuObject *_self, PyObject *_args) 1553 1553 { 1554 1555 1556 1557 1558 1554 PyObject *_res = NULL; 1555 OSStatus _err; 1556 MenuItemIndex inItem; 1557 Boolean inSetVirtualKey; 1558 UInt16 inKey; 1559 1559 #ifndef SetMenuItemCommandKey 1560 1561 #endif 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1560 PyMac_PRECHECK(SetMenuItemCommandKey); 1561 #endif 1562 if (!PyArg_ParseTuple(_args, "hbH", 1563 &inItem, 1564 &inSetVirtualKey, 1565 &inKey)) 1566 return NULL; 1567 _err = SetMenuItemCommandKey(_self->ob_itself, 1568 inItem, 1569 inSetVirtualKey, 1570 inKey); 1571 if (_err != noErr) return PyMac_Error(_err); 1572 Py_INCREF(Py_None); 1573 _res = Py_None; 1574 return _res; 1575 1575 } 1576 1576 1577 1577 static PyObject *MenuObj_GetMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args) 1578 1578 { 1579 1580 1581 1582 1583 1584 1579 PyObject *_res = NULL; 1580 OSStatus _err; 1581 MenuItemIndex item; 1582 OSType propertyCreator; 1583 OSType propertyTag; 1584 UInt32 attributes; 1585 1585 #ifndef GetMenuItemPropertyAttributes 1586 1587 #endif 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1586 PyMac_PRECHECK(GetMenuItemPropertyAttributes); 1587 #endif 1588 if (!PyArg_ParseTuple(_args, "hO&O&", 1589 &item, 1590 PyMac_GetOSType, &propertyCreator, 1591 PyMac_GetOSType, &propertyTag)) 1592 return NULL; 1593 _err = GetMenuItemPropertyAttributes(_self->ob_itself, 1594 item, 1595 propertyCreator, 1596 propertyTag, 1597 &attributes); 1598 if (_err != noErr) return PyMac_Error(_err); 1599 _res = Py_BuildValue("l", 1600 attributes); 1601 return _res; 1602 1602 } 1603 1603 1604 1604 static PyObject *MenuObj_ChangeMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args) 1605 1605 { 1606 1607 1608 1609 1610 1611 1612 1606 PyObject *_res = NULL; 1607 OSStatus _err; 1608 MenuItemIndex item; 1609 OSType propertyCreator; 1610 OSType propertyTag; 1611 UInt32 attributesToSet; 1612 UInt32 attributesToClear; 1613 1613 #ifndef ChangeMenuItemPropertyAttributes 1614 1615 #endif 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1614 PyMac_PRECHECK(ChangeMenuItemPropertyAttributes); 1615 #endif 1616 if (!PyArg_ParseTuple(_args, "hO&O&ll", 1617 &item, 1618 PyMac_GetOSType, &propertyCreator, 1619 PyMac_GetOSType, &propertyTag, 1620 &attributesToSet, 1621 &attributesToClear)) 1622 return NULL; 1623 _err = ChangeMenuItemPropertyAttributes(_self->ob_itself, 1624 item, 1625 propertyCreator, 1626 propertyTag, 1627 attributesToSet, 1628 attributesToClear); 1629 if (_err != noErr) return PyMac_Error(_err); 1630 Py_INCREF(Py_None); 1631 _res = Py_None; 1632 return _res; 1633 1633 } 1634 1634 1635 1635 static PyObject *MenuObj_GetMenuAttributes(MenuObject *_self, PyObject *_args) 1636 1636 { 1637 1638 1639 1637 PyObject *_res = NULL; 1638 OSStatus _err; 1639 MenuAttributes outAttributes; 1640 1640 #ifndef GetMenuAttributes 1641 1642 #endif 1643 1644 1645 1646 1647 1648 1649 1650 1641 PyMac_PRECHECK(GetMenuAttributes); 1642 #endif 1643 if (!PyArg_ParseTuple(_args, "")) 1644 return NULL; 1645 _err = GetMenuAttributes(_self->ob_itself, 1646 &outAttributes); 1647 if (_err != noErr) return PyMac_Error(_err); 1648 _res = Py_BuildValue("l", 1649 outAttributes); 1650 return _res; 1651 1651 } 1652 1652 1653 1653 static PyObject *MenuObj_ChangeMenuAttributes(MenuObject *_self, PyObject *_args) 1654 1654 { 1655 1656 1657 1658 1655 PyObject *_res = NULL; 1656 OSStatus _err; 1657 MenuAttributes setTheseAttributes; 1658 MenuAttributes clearTheseAttributes; 1659 1659 #ifndef ChangeMenuAttributes 1660 1661 #endif 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1660 PyMac_PRECHECK(ChangeMenuAttributes); 1661 #endif 1662 if (!PyArg_ParseTuple(_args, "ll", 1663 &setTheseAttributes, 1664 &clearTheseAttributes)) 1665 return NULL; 1666 _err = ChangeMenuAttributes(_self->ob_itself, 1667 setTheseAttributes, 1668 clearTheseAttributes); 1669 if (_err != noErr) return PyMac_Error(_err); 1670 Py_INCREF(Py_None); 1671 _res = Py_None; 1672 return _res; 1673 1673 } 1674 1674 1675 1675 static PyObject *MenuObj_GetMenuItemAttributes(MenuObject *_self, PyObject *_args) 1676 1676 { 1677 1678 1679 1680 1677 PyObject *_res = NULL; 1678 OSStatus _err; 1679 MenuItemIndex item; 1680 MenuItemAttributes outAttributes; 1681 1681 #ifndef GetMenuItemAttributes 1682 1683 #endif 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1682 PyMac_PRECHECK(GetMenuItemAttributes); 1683 #endif 1684 if (!PyArg_ParseTuple(_args, "h", 1685 &item)) 1686 return NULL; 1687 _err = GetMenuItemAttributes(_self->ob_itself, 1688 item, 1689 &outAttributes); 1690 if (_err != noErr) return PyMac_Error(_err); 1691 _res = Py_BuildValue("l", 1692 outAttributes); 1693 return _res; 1694 1694 } 1695 1695 1696 1696 static PyObject *MenuObj_ChangeMenuItemAttributes(MenuObject *_self, PyObject *_args) 1697 1697 { 1698 1699 1700 1701 1702 1698 PyObject *_res = NULL; 1699 OSStatus _err; 1700 MenuItemIndex item; 1701 MenuItemAttributes setTheseAttributes; 1702 MenuItemAttributes clearTheseAttributes; 1703 1703 #ifndef ChangeMenuItemAttributes 1704 1705 #endif 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1704 PyMac_PRECHECK(ChangeMenuItemAttributes); 1705 #endif 1706 if (!PyArg_ParseTuple(_args, "hll", 1707 &item, 1708 &setTheseAttributes, 1709 &clearTheseAttributes)) 1710 return NULL; 1711 _err = ChangeMenuItemAttributes(_self->ob_itself, 1712 item, 1713 setTheseAttributes, 1714 clearTheseAttributes); 1715 if (_err != noErr) return PyMac_Error(_err); 1716 Py_INCREF(Py_None); 1717 _res = Py_None; 1718 return _res; 1719 1719 } 1720 1720 1721 1721 static PyObject *MenuObj_DisableAllMenuItems(MenuObject *_self, PyObject *_args) 1722 1722 { 1723 1723 PyObject *_res = NULL; 1724 1724 #ifndef DisableAllMenuItems 1725 1726 #endif 1727 1728 1729 1730 1731 1732 1725 PyMac_PRECHECK(DisableAllMenuItems); 1726 #endif 1727 if (!PyArg_ParseTuple(_args, "")) 1728 return NULL; 1729 DisableAllMenuItems(_self->ob_itself); 1730 Py_INCREF(Py_None); 1731 _res = Py_None; 1732 return _res; 1733 1733 } 1734 1734 1735 1735 static PyObject *MenuObj_EnableAllMenuItems(MenuObject *_self, PyObject *_args) 1736 1736 { 1737 1737 PyObject *_res = NULL; 1738 1738 #ifndef EnableAllMenuItems 1739 1740 #endif 1741 1742 1743 1744 1745 1746 1739 PyMac_PRECHECK(EnableAllMenuItems); 1740 #endif 1741 if (!PyArg_ParseTuple(_args, "")) 1742 return NULL; 1743 EnableAllMenuItems(_self->ob_itself); 1744 Py_INCREF(Py_None); 1745 _res = Py_None; 1746 return _res; 1747 1747 } 1748 1748 1749 1749 static PyObject *MenuObj_MenuHasEnabledItems(MenuObject *_self, PyObject *_args) 1750 1750 { 1751 1752 1751 PyObject *_res = NULL; 1752 Boolean _rv; 1753 1753 #ifndef MenuHasEnabledItems 1754 1755 #endif 1756 1757 1758 1759 1760 1761 1754 PyMac_PRECHECK(MenuHasEnabledItems); 1755 #endif 1756 if (!PyArg_ParseTuple(_args, "")) 1757 return NULL; 1758 _rv = MenuHasEnabledItems(_self->ob_itself); 1759 _res = Py_BuildValue("b", 1760 _rv); 1761 return _res; 1762 1762 } 1763 1763 1764 1764 static PyObject *MenuObj_GetMenuType(MenuObject *_self, PyObject *_args) 1765 1765 { 1766 1767 1768 1766 PyObject *_res = NULL; 1767 OSStatus _err; 1768 UInt16 outType; 1769 1769 #ifndef GetMenuType 1770 1771 #endif 1772 1773 1774 1775 1776 1777 1778 1779 1770 PyMac_PRECHECK(GetMenuType); 1771 #endif 1772 if (!PyArg_ParseTuple(_args, "")) 1773 return NULL; 1774 _err = GetMenuType(_self->ob_itself, 1775 &outType); 1776 if (_err != noErr) return PyMac_Error(_err); 1777 _res = Py_BuildValue("H", 1778 outType); 1779 return _res; 1780 1780 } 1781 1781 1782 1782 static PyObject *MenuObj_CountMenuItemsWithCommandID(MenuObject *_self, PyObject *_args) 1783 1783 { 1784 1785 1786 1784 PyObject *_res = NULL; 1785 ItemCount _rv; 1786 MenuCommand inCommandID; 1787 1787 #ifndef CountMenuItemsWithCommandID 1788 1789 #endif 1790 1791 1792 1793 1794 1795 1796 1797 1788 PyMac_PRECHECK(CountMenuItemsWithCommandID); 1789 #endif 1790 if (!PyArg_ParseTuple(_args, "l", 1791 &inCommandID)) 1792 return NULL; 1793 _rv = CountMenuItemsWithCommandID(_self->ob_itself, 1794 inCommandID); 1795 _res = Py_BuildValue("l", 1796 _rv); 1797 return _res; 1798 1798 } 1799 1799 1800 1800 static PyObject *MenuObj_GetIndMenuItemWithCommandID(MenuObject *_self, PyObject *_args) 1801 1801 { 1802 1803 1804 1805 1806 1807 1802 PyObject *_res = NULL; 1803 OSStatus _err; 1804 MenuCommand inCommandID; 1805 UInt32 inItemIndex; 1806 MenuHandle outMenu; 1807 MenuItemIndex outIndex; 1808 1808 #ifndef GetIndMenuItemWithCommandID 1809 1810 #endif 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1809 PyMac_PRECHECK(GetIndMenuItemWithCommandID); 1810 #endif 1811 if (!PyArg_ParseTuple(_args, "ll", 1812 &inCommandID, 1813 &inItemIndex)) 1814 return NULL; 1815 _err = GetIndMenuItemWithCommandID(_self->ob_itself, 1816 inCommandID, 1817 inItemIndex, 1818 &outMenu, 1819 &outIndex); 1820 if (_err != noErr) return PyMac_Error(_err); 1821 _res = Py_BuildValue("O&h", 1822 MenuObj_New, outMenu, 1823 outIndex); 1824 return _res; 1825 1825 } 1826 1826 1827 1827 static PyObject *MenuObj_EnableMenuCommand(MenuObject *_self, PyObject *_args) 1828 1828 { 1829 1830 1829 PyObject *_res = NULL; 1830 MenuCommand inCommandID; 1831 1831 #ifndef EnableMenuCommand 1832 1833 #endif 1834 1835 1836 1837 1838 1839 1840 1841 1832 PyMac_PRECHECK(EnableMenuCommand); 1833 #endif 1834 if (!PyArg_ParseTuple(_args, "l", 1835 &inCommandID)) 1836 return NULL; 1837 EnableMenuCommand(_self->ob_itself, 1838 inCommandID); 1839 Py_INCREF(Py_None); 1840 _res = Py_None; 1841 return _res; 1842 1842 } 1843 1843 1844 1844 static PyObject *MenuObj_DisableMenuCommand(MenuObject *_self, PyObject *_args) 1845 1845 { 1846 1847 1846 PyObject *_res = NULL; 1847 MenuCommand inCommandID; 1848 1848 #ifndef DisableMenuCommand 1849 1850 #endif 1851 1852 1853 1854 1855 1856 1857 1858 1849 PyMac_PRECHECK(DisableMenuCommand); 1850 #endif 1851 if (!PyArg_ParseTuple(_args, "l", 1852 &inCommandID)) 1853 return NULL; 1854 DisableMenuCommand(_self->ob_itself, 1855 inCommandID); 1856 Py_INCREF(Py_None); 1857 _res = Py_None; 1858 return _res; 1859 1859 } 1860 1860 1861 1861 static PyObject *MenuObj_IsMenuCommandEnabled(MenuObject *_self, PyObject *_args) 1862 1862 { 1863 1864 1865 1863 PyObject *_res = NULL; 1864 Boolean _rv; 1865 MenuCommand inCommandID; 1866 1866 #ifndef IsMenuCommandEnabled 1867 1868 #endif 1869 1870 1871 1872 1873 1874 1875 1876 1867 PyMac_PRECHECK(IsMenuCommandEnabled); 1868 #endif 1869 if (!PyArg_ParseTuple(_args, "l", 1870 &inCommandID)) 1871 return NULL; 1872 _rv = IsMenuCommandEnabled(_self->ob_itself, 1873 inCommandID); 1874 _res = Py_BuildValue("b", 1875 _rv); 1876 return _res; 1877 1877 } 1878 1878 1879 1879 static PyObject *MenuObj_SetMenuCommandMark(MenuObject *_self, PyObject *_args) 1880 1880 { 1881 1882 1883 1884 1881 PyObject *_res = NULL; 1882 OSStatus _err; 1883 MenuCommand inCommandID; 1884 UniChar inMark; 1885 1885 #ifndef SetMenuCommandMark 1886 1887 #endif 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1886 PyMac_PRECHECK(SetMenuCommandMark); 1887 #endif 1888 if (!PyArg_ParseTuple(_args, "lh", 1889 &inCommandID, 1890 &inMark)) 1891 return NULL; 1892 _err = SetMenuCommandMark(_self->ob_itself, 1893 inCommandID, 1894 inMark); 1895 if (_err != noErr) return PyMac_Error(_err); 1896 Py_INCREF(Py_None); 1897 _res = Py_None; 1898 return _res; 1899 1899 } 1900 1900 1901 1901 static PyObject *MenuObj_GetMenuCommandMark(MenuObject *_self, PyObject *_args) 1902 1902 { 1903 1904 1905 1906 1903 PyObject *_res = NULL; 1904 OSStatus _err; 1905 MenuCommand inCommandID; 1906 UniChar outMark; 1907 1907 #ifndef GetMenuCommandMark 1908 1909 #endif 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1908 PyMac_PRECHECK(GetMenuCommandMark); 1909 #endif 1910 if (!PyArg_ParseTuple(_args, "l", 1911 &inCommandID)) 1912 return NULL; 1913 _err = GetMenuCommandMark(_self->ob_itself, 1914 inCommandID, 1915 &outMark); 1916 if (_err != noErr) return PyMac_Error(_err); 1917 _res = Py_BuildValue("h", 1918 outMark); 1919 return _res; 1920 1920 } 1921 1921 1922 1922 static PyObject *MenuObj_GetMenuCommandPropertySize(MenuObject *_self, PyObject *_args) 1923 1923 { 1924 1925 1926 1927 1928 1929 1924 PyObject *_res = NULL; 1925 OSStatus _err; 1926 MenuCommand inCommandID; 1927 OSType inPropertyCreator; 1928 OSType inPropertyTag; 1929 ByteCount outSize; 1930 1930 #ifndef GetMenuCommandPropertySize 1931 1932 #endif 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1931 PyMac_PRECHECK(GetMenuCommandPropertySize); 1932 #endif 1933 if (!PyArg_ParseTuple(_args, "lO&O&", 1934 &inCommandID, 1935 PyMac_GetOSType, &inPropertyCreator, 1936 PyMac_GetOSType, &inPropertyTag)) 1937 return NULL; 1938 _err = GetMenuCommandPropertySize(_self->ob_itself, 1939 inCommandID, 1940 inPropertyCreator, 1941 inPropertyTag, 1942 &outSize); 1943 if (_err != noErr) return PyMac_Error(_err); 1944 _res = Py_BuildValue("l", 1945 outSize); 1946 return _res; 1947 1947 } 1948 1948 1949 1949 static PyObject *MenuObj_RemoveMenuCommandProperty(MenuObject *_self, PyObject *_args) 1950 1950 { 1951 1952 1953 1954 1955 1951 PyObject *_res = NULL; 1952 OSStatus _err; 1953 MenuCommand inCommandID; 1954 OSType inPropertyCreator; 1955 OSType inPropertyTag; 1956 1956 #ifndef RemoveMenuCommandProperty 1957 1958 #endif 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1957 PyMac_PRECHECK(RemoveMenuCommandProperty); 1958 #endif 1959 if (!PyArg_ParseTuple(_args, "lO&O&", 1960 &inCommandID, 1961 PyMac_GetOSType, &inPropertyCreator, 1962 PyMac_GetOSType, &inPropertyTag)) 1963 return NULL; 1964 _err = RemoveMenuCommandProperty(_self->ob_itself, 1965 inCommandID, 1966 inPropertyCreator, 1967 inPropertyTag); 1968 if (_err != noErr) return PyMac_Error(_err); 1969 Py_INCREF(Py_None); 1970 _res = Py_None; 1971 return _res; 1972 1972 } 1973 1973 1974 1974 static PyObject *MenuObj_IsMenuItemInvalid(MenuObject *_self, PyObject *_args) 1975 1975 { 1976 1977 1978 1976 PyObject *_res = NULL; 1977 Boolean _rv; 1978 MenuItemIndex inItem; 1979 1979 #ifndef IsMenuItemInvalid 1980 1981 #endif 1982 1983 1984 1985 1986 1987 1988 1989 1980 PyMac_PRECHECK(IsMenuItemInvalid); 1981 #endif 1982 if (!PyArg_ParseTuple(_args, "h", 1983 &inItem)) 1984 return NULL; 1985 _rv = IsMenuItemInvalid(_self->ob_itself, 1986 inItem); 1987 _res = Py_BuildValue("b", 1988 _rv); 1989 return _res; 1990 1990 } 1991 1991 1992 1992 static PyObject *MenuObj_InvalidateMenuItems(MenuObject *_self, PyObject *_args) 1993 1993 { 1994 1995 1996 1997 1994 PyObject *_res = NULL; 1995 OSStatus _err; 1996 MenuItemIndex inFirstItem; 1997 ItemCount inNumItems; 1998 1998 #ifndef InvalidateMenuItems 1999 2000 #endif 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 1999 PyMac_PRECHECK(InvalidateMenuItems); 2000 #endif 2001 if (!PyArg_ParseTuple(_args, "hl", 2002 &inFirstItem, 2003 &inNumItems)) 2004 return NULL; 2005 _err = InvalidateMenuItems(_self->ob_itself, 2006 inFirstItem, 2007 inNumItems); 2008 if (_err != noErr) return PyMac_Error(_err); 2009 Py_INCREF(Py_None); 2010 _res = Py_None; 2011 return _res; 2012 2012 } 2013 2013 2014 2014 static PyObject *MenuObj_UpdateInvalidMenuItems(MenuObject *_self, PyObject *_args) 2015 2015 { 2016 2017 2016 PyObject *_res = NULL; 2017 OSStatus _err; 2018 2018 #ifndef UpdateInvalidMenuItems 2019 2020 #endif 2021 2022 2023 2024 2025 2026 2027 2019 PyMac_PRECHECK(UpdateInvalidMenuItems); 2020 #endif 2021 if (!PyArg_ParseTuple(_args, "")) 2022 return NULL; 2023 _err = UpdateInvalidMenuItems(_self->ob_itself); 2024 if (_err != noErr) return PyMac_Error(_err); 2025 Py_INCREF(Py_None); 2026 _res = Py_None; 2027 return _res; 2028 2028 } 2029 2029 2030 2030 static PyObject *MenuObj_CreateStandardFontMenu(MenuObject *_self, PyObject *_args) 2031 2031 { 2032 2033 2034 2035 2036 2037 2032 PyObject *_res = NULL; 2033 OSStatus _err; 2034 MenuItemIndex afterItem; 2035 MenuID firstHierMenuID; 2036 OptionBits options; 2037 ItemCount outHierMenuCount; 2038 2038 #ifndef CreateStandardFontMenu 2039 2040 #endif 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2039 PyMac_PRECHECK(CreateStandardFontMenu); 2040 #endif 2041 if (!PyArg_ParseTuple(_args, "hhl", 2042 &afterItem, 2043 &firstHierMenuID, 2044 &options)) 2045 return NULL; 2046 _err = CreateStandardFontMenu(_self->ob_itself, 2047 afterItem, 2048 firstHierMenuID, 2049 options, 2050 &outHierMenuCount); 2051 if (_err != noErr) return PyMac_Error(_err); 2052 _res = Py_BuildValue("l", 2053 outHierMenuCount); 2054 return _res; 2055 2055 } 2056 2056 2057 2057 static PyObject *MenuObj_UpdateStandardFontMenu(MenuObject *_self, PyObject *_args) 2058 2058 { 2059 2060 2061 2059 PyObject *_res = NULL; 2060 OSStatus _err; 2061 ItemCount outHierMenuCount; 2062 2062 #ifndef UpdateStandardFontMenu 2063 2064 #endif 2065 2066 2067 2068 2069 2070 2071 2072 2063 PyMac_PRECHECK(UpdateStandardFontMenu); 2064 #endif 2065 if (!PyArg_ParseTuple(_args, "")) 2066 return NULL; 2067 _err = UpdateStandardFontMenu(_self->ob_itself, 2068 &outHierMenuCount); 2069 if (_err != noErr) return PyMac_Error(_err); 2070 _res = Py_BuildValue("l", 2071 outHierMenuCount); 2072 return _res; 2073 2073 } 2074 2074 2075 2075 static PyObject *MenuObj_GetFontFamilyFromMenuSelection(MenuObject *_self, PyObject *_args) 2076 2076 { 2077 2078 2079 2080 2081 2077 PyObject *_res = NULL; 2078 OSStatus _err; 2079 MenuItemIndex item; 2080 FMFontFamily outFontFamily; 2081 FMFontStyle outStyle; 2082 2082 #ifndef GetFontFamilyFromMenuSelection 2083 2084 #endif 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2083 PyMac_PRECHECK(GetFontFamilyFromMenuSelection); 2084 #endif 2085 if (!PyArg_ParseTuple(_args, "h", 2086 &item)) 2087 return NULL; 2088 _err = GetFontFamilyFromMenuSelection(_self->ob_itself, 2089 item, 2090 &outFontFamily, 2091 &outStyle); 2092 if (_err != noErr) return PyMac_Error(_err); 2093 _res = Py_BuildValue("hh", 2094 outFontFamily, 2095 outStyle); 2096 return _res; 2097 2097 } 2098 2098 2099 2099 static PyObject *MenuObj_GetMenuID(MenuObject *_self, PyObject *_args) 2100 2100 { 2101 2102 2101 PyObject *_res = NULL; 2102 MenuID _rv; 2103 2103 #ifndef GetMenuID 2104 2105 #endif 2106 2107 2108 2109 2110 2111 2104 PyMac_PRECHECK(GetMenuID); 2105 #endif 2106 if (!PyArg_ParseTuple(_args, "")) 2107 return NULL; 2108 _rv = GetMenuID(_self->ob_itself); 2109 _res = Py_BuildValue("h", 2110 _rv); 2111 return _res; 2112 2112 } 2113 2113 2114 2114 static PyObject *MenuObj_GetMenuWidth(MenuObject *_self, PyObject *_args) 2115 2115 { 2116 2117 2116 PyObject *_res = NULL; 2117 SInt16 _rv; 2118 2118 #ifndef GetMenuWidth 2119 2120 #endif 2121 2122 2123 2124 2125 2126 2119 PyMac_PRECHECK(GetMenuWidth); 2120 #endif 2121 if (!PyArg_ParseTuple(_args, "")) 2122 return NULL; 2123 _rv = GetMenuWidth(_self->ob_itself); 2124 _res = Py_BuildValue("h", 2125 _rv); 2126 return _res; 2127 2127 } 2128 2128 2129 2129 static PyObject *MenuObj_GetMenuHeight(MenuObject *_self, PyObject *_args) 2130 2130 { 2131 2132 2131 PyObject *_res = NULL; 2132 SInt16 _rv; 2133 2133 #ifndef GetMenuHeight 2134 2135 #endif 2136 2137 2138 2139 2140 2141 2134 PyMac_PRECHECK(GetMenuHeight); 2135 #endif 2136 if (!PyArg_ParseTuple(_args, "")) 2137 return NULL; 2138 _rv = GetMenuHeight(_self->ob_itself); 2139 _res = Py_BuildValue("h", 2140 _rv); 2141 return _res; 2142 2142 } 2143 2143 2144 2144 static PyObject *MenuObj_SetMenuID(MenuObject *_self, PyObject *_args) 2145 2145 { 2146 2147 2146 PyObject *_res = NULL; 2147 MenuID menuID; 2148 2148 #ifndef SetMenuID 2149 2150 #endif 2151 2152 2153 2154 2155 2156 2157 2158 2149 PyMac_PRECHECK(SetMenuID); 2150 #endif 2151 if (!PyArg_ParseTuple(_args, "h", 2152 &menuID)) 2153 return NULL; 2154 SetMenuID(_self->ob_itself, 2155 menuID); 2156 Py_INCREF(Py_None); 2157 _res = Py_None; 2158 return _res; 2159 2159 } 2160 2160 2161 2161 static PyObject *MenuObj_SetMenuWidth(MenuObject *_self, PyObject *_args) 2162 2162 { 2163 2164 2163 PyObject *_res = NULL; 2164 SInt16 width; 2165 2165 #ifndef SetMenuWidth 2166 2167 #endif 2168 2169 2170 2171 2172 2173 2174 2175 2166 PyMac_PRECHECK(SetMenuWidth); 2167 #endif 2168 if (!PyArg_ParseTuple(_args, "h", 2169 &width)) 2170 return NULL; 2171 SetMenuWidth(_self->ob_itself, 2172 width); 2173 Py_INCREF(Py_None); 2174 _res = Py_None; 2175 return _res; 2176 2176 } 2177 2177 2178 2178 static PyObject *MenuObj_SetMenuHeight(MenuObject *_self, PyObject *_args) 2179 2179 { 2180 2181 2180 PyObject *_res = NULL; 2181 SInt16 height; 2182 2182 #ifndef SetMenuHeight 2183 2184 #endif 2185 2186 2187 2188 2189 2190 2191 2192 2183 PyMac_PRECHECK(SetMenuHeight); 2184 #endif 2185 if (!PyArg_ParseTuple(_args, "h", 2186 &height)) 2187 return NULL; 2188 SetMenuHeight(_self->ob_itself, 2189 height); 2190 Py_INCREF(Py_None); 2191 _res = Py_None; 2192 return _res; 2193 2193 } 2194 2194 2195 2195 static PyObject *MenuObj_as_Resource(MenuObject *_self, PyObject *_args) 2196 2196 { 2197 2198 2197 PyObject *_res = NULL; 2198 Handle _rv; 2199 2199 #ifndef as_Resource 2200 2201 #endif 2202 2203 2204 2205 2206 2207 2200 PyMac_PRECHECK(as_Resource); 2201 #endif 2202 if (!PyArg_ParseTuple(_args, "")) 2203 return NULL; 2204 _rv = as_Resource(_self->ob_itself); 2205 _res = Py_BuildValue("O&", 2206 ResObj_New, _rv); 2207 return _res; 2208 2208 } 2209 2209 2210 2210 static PyObject *MenuObj_AppendMenu(MenuObject *_self, PyObject *_args) 2211 2211 { 2212 2213 2212 PyObject *_res = NULL; 2213 Str255 data; 2214 2214 #ifndef AppendMenu 2215 2216 #endif 2217 2218 2219 2220 2221 2222 2223 2224 2215 PyMac_PRECHECK(AppendMenu); 2216 #endif 2217 if (!PyArg_ParseTuple(_args, "O&", 2218 PyMac_GetStr255, data)) 2219 return NULL; 2220 AppendMenu(_self->ob_itself, 2221 data); 2222 Py_INCREF(Py_None); 2223 _res = Py_None; 2224 return _res; 2225 2225 } 2226 2226 2227 2227 static PyObject *MenuObj_InsertMenu(MenuObject *_self, PyObject *_args) 2228 2228 { 2229 2230 2229 PyObject *_res = NULL; 2230 short beforeID; 2231 2231 #ifndef InsertMenu 2232 2233 #endif 2234 2235 2236 2237 2238 2239 2240 2241 2232 PyMac_PRECHECK(InsertMenu); 2233 #endif 2234 if (!PyArg_ParseTuple(_args, "h", 2235 &beforeID)) 2236 return NULL; 2237 InsertMenu(_self->ob_itself, 2238 beforeID); 2239 Py_INCREF(Py_None); 2240 _res = Py_None; 2241 return _res; 2242 2242 } 2243 2243 2244 2244 static PyObject *MenuObj_InsertMenuItem(MenuObject *_self, PyObject *_args) 2245 2245 { 2246 2247 2248 2246 PyObject *_res = NULL; 2247 Str255 itemString; 2248 short afterItem; 2249 2249 #ifndef InsertMenuItem 2250 2251 #endif 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2250 PyMac_PRECHECK(InsertMenuItem); 2251 #endif 2252 if (!PyArg_ParseTuple(_args, "O&h", 2253 PyMac_GetStr255, itemString, 2254 &afterItem)) 2255 return NULL; 2256 InsertMenuItem(_self->ob_itself, 2257 itemString, 2258 afterItem); 2259 Py_INCREF(Py_None); 2260 _res = Py_None; 2261 return _res; 2262 2262 } 2263 2263 2264 2264 static PyObject *MenuObj_EnableMenuItem(MenuObject *_self, PyObject *_args) 2265 2265 { 2266 2267 2266 PyObject *_res = NULL; 2267 UInt16 item; 2268 2268 #ifndef EnableMenuItem 2269 2270 #endif 2271 2272 2273 2274 2275 2276 2277 2278 2269 PyMac_PRECHECK(EnableMenuItem); 2270 #endif 2271 if (!PyArg_ParseTuple(_args, "H", 2272 &item)) 2273 return NULL; 2274 EnableMenuItem(_self->ob_itself, 2275 item); 2276 Py_INCREF(Py_None); 2277 _res = Py_None; 2278 return _res; 2279 2279 } 2280 2280 2281 2281 static PyObject *MenuObj_CheckMenuItem(MenuObject *_self, PyObject *_args) 2282 2282 { 2283 2284 2285 2283 PyObject *_res = NULL; 2284 short item; 2285 Boolean checked; 2286 2286 #ifndef CheckMenuItem 2287 2288 #endif 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2287 PyMac_PRECHECK(CheckMenuItem); 2288 #endif 2289 if (!PyArg_ParseTuple(_args, "hb", 2290 &item, 2291 &checked)) 2292 return NULL; 2293 CheckMenuItem(_self->ob_itself, 2294 item, 2295 checked); 2296 Py_INCREF(Py_None); 2297 _res = Py_None; 2298 return _res; 2299 2299 } 2300 2300 2301 2301 static PyMethodDef MenuObj_methods[] = { 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2302 {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1, 2303 PyDoc_STR("() -> None")}, 2304 {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, 2305 PyDoc_STR("() -> None")}, 2306 {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1, 2307 PyDoc_STR("() -> (UInt16 _rv)")}, 2308 {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1, 2309 PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")}, 2310 {"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1, 2311 PyDoc_STR("(SInt16 inFontID, UInt16 inFontSize) -> None")}, 2312 {"GetMenuExcludesMarkColumn", (PyCFunction)MenuObj_GetMenuExcludesMarkColumn, 1, 2313 PyDoc_STR("() -> (Boolean _rv)")}, 2314 {"SetMenuExcludesMarkColumn", (PyCFunction)MenuObj_SetMenuExcludesMarkColumn, 1, 2315 PyDoc_STR("(Boolean excludesMark) -> None")}, 2316 {"IsValidMenu", (PyCFunction)MenuObj_IsValidMenu, 1, 2317 PyDoc_STR("() -> (Boolean _rv)")}, 2318 {"GetMenuRetainCount", (PyCFunction)MenuObj_GetMenuRetainCount, 1, 2319 PyDoc_STR("() -> (ItemCount _rv)")}, 2320 {"RetainMenu", (PyCFunction)MenuObj_RetainMenu, 1, 2321 PyDoc_STR("() -> None")}, 2322 {"ReleaseMenu", (PyCFunction)MenuObj_ReleaseMenu, 1, 2323 PyDoc_STR("() -> None")}, 2324 {"DuplicateMenu", (PyCFunction)MenuObj_DuplicateMenu, 1, 2325 PyDoc_STR("() -> (MenuHandle outMenu)")}, 2326 {"CopyMenuTitleAsCFString", (PyCFunction)MenuObj_CopyMenuTitleAsCFString, 1, 2327 PyDoc_STR("() -> (CFStringRef outString)")}, 2328 {"SetMenuTitleWithCFString", (PyCFunction)MenuObj_SetMenuTitleWithCFString, 1, 2329 PyDoc_STR("(CFStringRef inString) -> None")}, 2330 {"InvalidateMenuSize", (PyCFunction)MenuObj_InvalidateMenuSize, 1, 2331 PyDoc_STR("() -> None")}, 2332 {"IsMenuSizeInvalid", (PyCFunction)MenuObj_IsMenuSizeInvalid, 1, 2333 PyDoc_STR("() -> (Boolean _rv)")}, 2334 {"MacAppendMenu", (PyCFunction)MenuObj_MacAppendMenu, 1, 2335 PyDoc_STR("(Str255 data) -> None")}, 2336 {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1, 2337 PyDoc_STR("(ResType theType, short afterItem) -> None")}, 2338 {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1, 2339 PyDoc_STR("(ResType theType) -> None")}, 2340 {"MacInsertMenuItem", (PyCFunction)MenuObj_MacInsertMenuItem, 1, 2341 PyDoc_STR("(Str255 itemString, short afterItem) -> None")}, 2342 {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1, 2343 PyDoc_STR("(short item) -> None")}, 2344 {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1, 2345 PyDoc_STR("(short afterItem, short scriptFilter) -> None")}, 2346 {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1, 2347 PyDoc_STR("(ResType theType, short afterItem, short scriptFilter) -> None")}, 2348 {"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1, 2349 PyDoc_STR("(Str255 inString) -> None")}, 2350 {"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1, 2351 PyDoc_STR("(Str255 inString, MenuItemIndex afterItem) -> None")}, 2352 {"CopyMenuItems", (PyCFunction)MenuObj_CopyMenuItems, 1, 2353 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems, MenuHandle inDestMenu, MenuItemIndex inInsertAfter) -> None")}, 2354 {"DeleteMenuItems", (PyCFunction)MenuObj_DeleteMenuItems, 1, 2355 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")}, 2356 {"AppendMenuItemTextWithCFString", (PyCFunction)MenuObj_AppendMenuItemTextWithCFString, 1, 2357 PyDoc_STR("(CFStringRef inString, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> (MenuItemIndex outNewItem)")}, 2358 {"InsertMenuItemTextWithCFString", (PyCFunction)MenuObj_InsertMenuItemTextWithCFString, 1, 2359 PyDoc_STR("(CFStringRef inString, MenuItemIndex inAfterItem, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> None")}, 2360 {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1, 2361 PyDoc_STR("(short top, short left, short popUpItem) -> (long _rv)")}, 2362 {"InvalidateMenuEnabling", (PyCFunction)MenuObj_InvalidateMenuEnabling, 1, 2363 PyDoc_STR("() -> None")}, 2364 {"IsMenuBarInvalid", (PyCFunction)MenuObj_IsMenuBarInvalid, 1, 2365 PyDoc_STR("() -> (Boolean _rv)")}, 2366 {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1, 2367 PyDoc_STR("(MenuID beforeID) -> None")}, 2368 {"SetRootMenu", (PyCFunction)MenuObj_SetRootMenu, 1, 2369 PyDoc_STR("() -> None")}, 2370 {"MacCheckMenuItem", (PyCFunction)MenuObj_MacCheckMenuItem, 1, 2371 PyDoc_STR("(short item, Boolean checked) -> None")}, 2372 {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1, 2373 PyDoc_STR("(short item, Str255 itemString) -> None")}, 2374 {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1, 2375 PyDoc_STR("(short item) -> (Str255 itemString)")}, 2376 {"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1, 2377 PyDoc_STR("(short item, CharParameter markChar) -> None")}, 2378 {"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1, 2379 PyDoc_STR("(short item) -> (CharParameter markChar)")}, 2380 {"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1, 2381 PyDoc_STR("(short item, CharParameter cmdChar) -> None")}, 2382 {"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1, 2383 PyDoc_STR("(short item) -> (CharParameter cmdChar)")}, 2384 {"SetItemIcon", (PyCFunction)MenuObj_SetItemIcon, 1, 2385 PyDoc_STR("(short item, short iconIndex) -> None")}, 2386 {"GetItemIcon", (PyCFunction)MenuObj_GetItemIcon, 1, 2387 PyDoc_STR("(short item) -> (short iconIndex)")}, 2388 {"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1, 2389 PyDoc_STR("(short item, StyleParameter chStyle) -> None")}, 2390 {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1, 2391 PyDoc_STR("(short item) -> (Style chStyle)")}, 2392 {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1, 2393 PyDoc_STR("(SInt16 inItem, MenuCommand inCommandID) -> None")}, 2394 {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1, 2395 PyDoc_STR("(SInt16 inItem) -> (MenuCommand outCommandID)")}, 2396 {"SetMenuItemModifiers", (PyCFunction)MenuObj_SetMenuItemModifiers, 1, 2397 PyDoc_STR("(SInt16 inItem, UInt8 inModifiers) -> None")}, 2398 {"GetMenuItemModifiers", (PyCFunction)MenuObj_GetMenuItemModifiers, 1, 2399 PyDoc_STR("(SInt16 inItem) -> (UInt8 outModifiers)")}, 2400 {"SetMenuItemIconHandle", (PyCFunction)MenuObj_SetMenuItemIconHandle, 1, 2401 PyDoc_STR("(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None")}, 2402 {"GetMenuItemIconHandle", (PyCFunction)MenuObj_GetMenuItemIconHandle, 1, 2403 PyDoc_STR("(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)")}, 2404 {"SetMenuItemTextEncoding", (PyCFunction)MenuObj_SetMenuItemTextEncoding, 1, 2405 PyDoc_STR("(SInt16 inItem, TextEncoding inScriptID) -> None")}, 2406 {"GetMenuItemTextEncoding", (PyCFunction)MenuObj_GetMenuItemTextEncoding, 1, 2407 PyDoc_STR("(SInt16 inItem) -> (TextEncoding outScriptID)")}, 2408 {"SetMenuItemHierarchicalID", (PyCFunction)MenuObj_SetMenuItemHierarchicalID, 1, 2409 PyDoc_STR("(SInt16 inItem, MenuID inHierID) -> None")}, 2410 {"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1, 2411 PyDoc_STR("(SInt16 inItem) -> (MenuID outHierID)")}, 2412 {"SetMenuItemFontID", (PyCFunction)MenuObj_SetMenuItemFontID, 1, 2413 PyDoc_STR("(SInt16 inItem, SInt16 inFontID) -> None")}, 2414 {"GetMenuItemFontID", (PyCFunction)MenuObj_GetMenuItemFontID, 1, 2415 PyDoc_STR("(SInt16 inItem) -> (SInt16 outFontID)")}, 2416 {"SetMenuItemRefCon", (PyCFunction)MenuObj_SetMenuItemRefCon, 1, 2417 PyDoc_STR("(SInt16 inItem, UInt32 inRefCon) -> None")}, 2418 {"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1, 2419 PyDoc_STR("(SInt16 inItem) -> (UInt32 outRefCon)")}, 2420 {"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1, 2421 PyDoc_STR("(SInt16 inItem, SInt16 inGlyph) -> None")}, 2422 {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1, 2423 PyDoc_STR("(SInt16 inItem) -> (SInt16 outGlyph)")}, 2424 {"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1, 2425 PyDoc_STR("(MenuItemIndex item) -> None")}, 2426 {"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1, 2427 PyDoc_STR("(MenuItemIndex item) -> None")}, 2428 {"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1, 2429 PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")}, 2430 {"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1, 2431 PyDoc_STR("(MenuItemIndex item) -> None")}, 2432 {"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1, 2433 PyDoc_STR("(MenuItemIndex item) -> None")}, 2434 {"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1, 2435 PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")}, 2436 {"SetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_SetMenuItemHierarchicalMenu, 1, 2437 PyDoc_STR("(MenuItemIndex inItem, MenuHandle inHierMenu) -> None")}, 2438 {"GetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_GetMenuItemHierarchicalMenu, 1, 2439 PyDoc_STR("(MenuItemIndex inItem) -> (MenuHandle outHierMenu)")}, 2440 {"CopyMenuItemTextAsCFString", (PyCFunction)MenuObj_CopyMenuItemTextAsCFString, 1, 2441 PyDoc_STR("(MenuItemIndex inItem) -> (CFStringRef outString)")}, 2442 {"SetMenuItemTextWithCFString", (PyCFunction)MenuObj_SetMenuItemTextWithCFString, 1, 2443 PyDoc_STR("(MenuItemIndex inItem, CFStringRef inString) -> None")}, 2444 {"GetMenuItemIndent", (PyCFunction)MenuObj_GetMenuItemIndent, 1, 2445 PyDoc_STR("(MenuItemIndex inItem) -> (UInt32 outIndent)")}, 2446 {"SetMenuItemIndent", (PyCFunction)MenuObj_SetMenuItemIndent, 1, 2447 PyDoc_STR("(MenuItemIndex inItem, UInt32 inIndent) -> None")}, 2448 {"GetMenuItemCommandKey", (PyCFunction)MenuObj_GetMenuItemCommandKey, 1, 2449 PyDoc_STR("(MenuItemIndex inItem, Boolean inGetVirtualKey) -> (UInt16 outKey)")}, 2450 {"SetMenuItemCommandKey", (PyCFunction)MenuObj_SetMenuItemCommandKey, 1, 2451 PyDoc_STR("(MenuItemIndex inItem, Boolean inSetVirtualKey, UInt16 inKey) -> None")}, 2452 {"GetMenuItemPropertyAttributes", (PyCFunction)MenuObj_GetMenuItemPropertyAttributes, 1, 2453 PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")}, 2454 {"ChangeMenuItemPropertyAttributes", (PyCFunction)MenuObj_ChangeMenuItemPropertyAttributes, 1, 2455 PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")}, 2456 {"GetMenuAttributes", (PyCFunction)MenuObj_GetMenuAttributes, 1, 2457 PyDoc_STR("() -> (MenuAttributes outAttributes)")}, 2458 {"ChangeMenuAttributes", (PyCFunction)MenuObj_ChangeMenuAttributes, 1, 2459 PyDoc_STR("(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None")}, 2460 {"GetMenuItemAttributes", (PyCFunction)MenuObj_GetMenuItemAttributes, 1, 2461 PyDoc_STR("(MenuItemIndex item) -> (MenuItemAttributes outAttributes)")}, 2462 {"ChangeMenuItemAttributes", (PyCFunction)MenuObj_ChangeMenuItemAttributes, 1, 2463 PyDoc_STR("(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None")}, 2464 {"DisableAllMenuItems", (PyCFunction)MenuObj_DisableAllMenuItems, 1, 2465 PyDoc_STR("() -> None")}, 2466 {"EnableAllMenuItems", (PyCFunction)MenuObj_EnableAllMenuItems, 1, 2467 PyDoc_STR("() -> None")}, 2468 {"MenuHasEnabledItems", (PyCFunction)MenuObj_MenuHasEnabledItems, 1, 2469 PyDoc_STR("() -> (Boolean _rv)")}, 2470 {"GetMenuType", (PyCFunction)MenuObj_GetMenuType, 1, 2471 PyDoc_STR("() -> (UInt16 outType)")}, 2472 {"CountMenuItemsWithCommandID", (PyCFunction)MenuObj_CountMenuItemsWithCommandID, 1, 2473 PyDoc_STR("(MenuCommand inCommandID) -> (ItemCount _rv)")}, 2474 {"GetIndMenuItemWithCommandID", (PyCFunction)MenuObj_GetIndMenuItemWithCommandID, 1, 2475 PyDoc_STR("(MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")}, 2476 {"EnableMenuCommand", (PyCFunction)MenuObj_EnableMenuCommand, 1, 2477 PyDoc_STR("(MenuCommand inCommandID) -> None")}, 2478 {"DisableMenuCommand", (PyCFunction)MenuObj_DisableMenuCommand, 1, 2479 PyDoc_STR("(MenuCommand inCommandID) -> None")}, 2480 {"IsMenuCommandEnabled", (PyCFunction)MenuObj_IsMenuCommandEnabled, 1, 2481 PyDoc_STR("(MenuCommand inCommandID) -> (Boolean _rv)")}, 2482 {"SetMenuCommandMark", (PyCFunction)MenuObj_SetMenuCommandMark, 1, 2483 PyDoc_STR("(MenuCommand inCommandID, UniChar inMark) -> None")}, 2484 {"GetMenuCommandMark", (PyCFunction)MenuObj_GetMenuCommandMark, 1, 2485 PyDoc_STR("(MenuCommand inCommandID) -> (UniChar outMark)")}, 2486 {"GetMenuCommandPropertySize", (PyCFunction)MenuObj_GetMenuCommandPropertySize, 1, 2487 PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")}, 2488 {"RemoveMenuCommandProperty", (PyCFunction)MenuObj_RemoveMenuCommandProperty, 1, 2489 PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, 2490 {"IsMenuItemInvalid", (PyCFunction)MenuObj_IsMenuItemInvalid, 1, 2491 PyDoc_STR("(MenuItemIndex inItem) -> (Boolean _rv)")}, 2492 {"InvalidateMenuItems", (PyCFunction)MenuObj_InvalidateMenuItems, 1, 2493 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")}, 2494 {"UpdateInvalidMenuItems", (PyCFunction)MenuObj_UpdateInvalidMenuItems, 1, 2495 PyDoc_STR("() -> None")}, 2496 {"CreateStandardFontMenu", (PyCFunction)MenuObj_CreateStandardFontMenu, 1, 2497 PyDoc_STR("(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)")}, 2498 {"UpdateStandardFontMenu", (PyCFunction)MenuObj_UpdateStandardFontMenu, 1, 2499 PyDoc_STR("() -> (ItemCount outHierMenuCount)")}, 2500 {"GetFontFamilyFromMenuSelection", (PyCFunction)MenuObj_GetFontFamilyFromMenuSelection, 1, 2501 PyDoc_STR("(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)")}, 2502 {"GetMenuID", (PyCFunction)MenuObj_GetMenuID, 1, 2503 PyDoc_STR("() -> (MenuID _rv)")}, 2504 {"GetMenuWidth", (PyCFunction)MenuObj_GetMenuWidth, 1, 2505 PyDoc_STR("() -> (SInt16 _rv)")}, 2506 {"GetMenuHeight", (PyCFunction)MenuObj_GetMenuHeight, 1, 2507 PyDoc_STR("() -> (SInt16 _rv)")}, 2508 {"SetMenuID", (PyCFunction)MenuObj_SetMenuID, 1, 2509 PyDoc_STR("(MenuID menuID) -> None")}, 2510 {"SetMenuWidth", (PyCFunction)MenuObj_SetMenuWidth, 1, 2511 PyDoc_STR("(SInt16 width) -> None")}, 2512 {"SetMenuHeight", (PyCFunction)MenuObj_SetMenuHeight, 1, 2513 PyDoc_STR("(SInt16 height) -> None")}, 2514 {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1, 2515 PyDoc_STR("() -> (Handle _rv)")}, 2516 {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1, 2517 PyDoc_STR("(Str255 data) -> None")}, 2518 {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1, 2519 PyDoc_STR("(short beforeID) -> None")}, 2520 {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1, 2521 PyDoc_STR("(Str255 itemString, short afterItem) -> None")}, 2522 {"EnableMenuItem", (PyCFunction)MenuObj_EnableMenuItem, 1, 2523 PyDoc_STR("(UInt16 item) -> None")}, 2524 {"CheckMenuItem", (PyCFunction)MenuObj_CheckMenuItem, 1, 2525 PyDoc_STR("(short item, Boolean checked) -> None")}, 2526 {NULL, NULL, 0} 2527 2527 }; 2528 2528 … … 2541 2541 static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) 2542 2542 { 2543 2544 2545 2546 2547 2548 2549 2550 2543 PyObject *_self; 2544 MenuHandle itself; 2545 char *kw[] = {"itself", 0}; 2546 2547 if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, MenuObj_Convert, &itself)) return NULL; 2548 if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; 2549 ((MenuObject *)_self)->ob_itself = itself; 2550 return _self; 2551 2551 } 2552 2552 … … 2555 2555 2556 2556 PyTypeObject Menu_Type = { 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2557 PyObject_HEAD_INIT(NULL) 2558 0, /*ob_size*/ 2559 "_Menu.Menu", /*tp_name*/ 2560 sizeof(MenuObject), /*tp_basicsize*/ 2561 0, /*tp_itemsize*/ 2562 /* methods */ 2563 (destructor) MenuObj_dealloc, /*tp_dealloc*/ 2564 0, /*tp_print*/ 2565 (getattrfunc)0, /*tp_getattr*/ 2566 (setattrfunc)0, /*tp_setattr*/ 2567 (cmpfunc) MenuObj_compare, /*tp_compare*/ 2568 (reprfunc) MenuObj_repr, /*tp_repr*/ 2569 (PyNumberMethods *)0, /* tp_as_number */ 2570 (PySequenceMethods *)0, /* tp_as_sequence */ 2571 (PyMappingMethods *)0, /* tp_as_mapping */ 2572 (hashfunc) MenuObj_hash, /*tp_hash*/ 2573 0, /*tp_call*/ 2574 0, /*tp_str*/ 2575 PyObject_GenericGetAttr, /*tp_getattro*/ 2576 PyObject_GenericSetAttr, /*tp_setattro */ 2577 0, /*tp_as_buffer*/ 2578 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ 2579 0, /*tp_doc*/ 2580 0, /*tp_traverse*/ 2581 0, /*tp_clear*/ 2582 0, /*tp_richcompare*/ 2583 0, /*tp_weaklistoffset*/ 2584 0, /*tp_iter*/ 2585 0, /*tp_iternext*/ 2586 MenuObj_methods, /* tp_methods */ 2587 0, /*tp_members*/ 2588 MenuObj_getsetlist, /*tp_getset*/ 2589 0, /*tp_base*/ 2590 0, /*tp_dict*/ 2591 0, /*tp_descr_get*/ 2592 0, /*tp_descr_set*/ 2593 0, /*tp_dictoffset*/ 2594 MenuObj_tp_init, /* tp_init */ 2595 MenuObj_tp_alloc, /* tp_alloc */ 2596 MenuObj_tp_new, /* tp_new */ 2597 MenuObj_tp_free, /* tp_free */ 2598 2598 }; 2599 2599 … … 2603 2603 static PyObject *Menu_NewMenu(PyObject *_self, PyObject *_args) 2604 2604 { 2605 2606 2607 2608 2605 PyObject *_res = NULL; 2606 MenuHandle _rv; 2607 MenuID menuID; 2608 Str255 menuTitle; 2609 2609 #ifndef NewMenu 2610 2611 #endif 2612 2613 2614 2615 2616 2617 2618 2619 2620 2610 PyMac_PRECHECK(NewMenu); 2611 #endif 2612 if (!PyArg_ParseTuple(_args, "hO&", 2613 &menuID, 2614 PyMac_GetStr255, menuTitle)) 2615 return NULL; 2616 _rv = NewMenu(menuID, 2617 menuTitle); 2618 _res = Py_BuildValue("O&", 2619 MenuObj_New, _rv); 2620 return _res; 2621 2621 } 2622 2622 2623 2623 static PyObject *Menu_MacGetMenu(PyObject *_self, PyObject *_args) 2624 2624 { 2625 2626 2627 2625 PyObject *_res = NULL; 2626 MenuHandle _rv; 2627 short resourceID; 2628 2628 #ifndef MacGetMenu 2629 2630 #endif 2631 2632 2633 2634 2635 2636 2637 2629 PyMac_PRECHECK(MacGetMenu); 2630 #endif 2631 if (!PyArg_ParseTuple(_args, "h", 2632 &resourceID)) 2633 return NULL; 2634 _rv = MacGetMenu(resourceID); 2635 _res = Py_BuildValue("O&", 2636 MenuObj_New, _rv); 2637 return _res; 2638 2638 } 2639 2639 2640 2640 static PyObject *Menu_CreateNewMenu(PyObject *_self, PyObject *_args) 2641 2641 { 2642 2643 2644 2645 2646 2642 PyObject *_res = NULL; 2643 OSStatus _err; 2644 MenuID inMenuID; 2645 MenuAttributes inMenuAttributes; 2646 MenuHandle outMenuRef; 2647 2647 #ifndef CreateNewMenu 2648 2649 #endif 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2648 PyMac_PRECHECK(CreateNewMenu); 2649 #endif 2650 if (!PyArg_ParseTuple(_args, "hl", 2651 &inMenuID, 2652 &inMenuAttributes)) 2653 return NULL; 2654 _err = CreateNewMenu(inMenuID, 2655 inMenuAttributes, 2656 &outMenuRef); 2657 if (_err != noErr) return PyMac_Error(_err); 2658 _res = Py_BuildValue("O&", 2659 MenuObj_New, outMenuRef); 2660 return _res; 2661 2661 } 2662 2662 2663 2663 static PyObject *Menu_MenuKey(PyObject *_self, PyObject *_args) 2664 2664 { 2665 2666 2667 2665 PyObject *_res = NULL; 2666 long _rv; 2667 CharParameter ch; 2668 2668 #ifndef MenuKey 2669 2670 #endif 2671 2672 2673 2674 2675 2676 2677 2669 PyMac_PRECHECK(MenuKey); 2670 #endif 2671 if (!PyArg_ParseTuple(_args, "h", 2672 &ch)) 2673 return NULL; 2674 _rv = MenuKey(ch); 2675 _res = Py_BuildValue("l", 2676 _rv); 2677 return _res; 2678 2678 } 2679 2679 2680 2680 static PyObject *Menu_MenuSelect(PyObject *_self, PyObject *_args) 2681 2681 { 2682 2683 2684 2682 PyObject *_res = NULL; 2683 long _rv; 2684 Point startPt; 2685 2685 #ifndef MenuSelect 2686 2687 #endif 2688 2689 2690 2691 2692 2693 2694 2686 PyMac_PRECHECK(MenuSelect); 2687 #endif 2688 if (!PyArg_ParseTuple(_args, "O&", 2689 PyMac_GetPoint, &startPt)) 2690 return NULL; 2691 _rv = MenuSelect(startPt); 2692 _res = Py_BuildValue("l", 2693 _rv); 2694 return _res; 2695 2695 } 2696 2696 2697 2697 static PyObject *Menu_MenuChoice(PyObject *_self, PyObject *_args) 2698 2698 { 2699 2700 2699 PyObject *_res = NULL; 2700 long _rv; 2701 2701 #ifndef MenuChoice 2702 2703 #endif 2704 2705 2706 2707 2708 2709 2702 PyMac_PRECHECK(MenuChoice); 2703 #endif 2704 if (!PyArg_ParseTuple(_args, "")) 2705 return NULL; 2706 _rv = MenuChoice(); 2707 _res = Py_BuildValue("l", 2708 _rv); 2709 return _res; 2710 2710 } 2711 2711 2712 2712 static PyObject *Menu_MenuEvent(PyObject *_self, PyObject *_args) 2713 2713 { 2714 2715 2716 2714 PyObject *_res = NULL; 2715 UInt32 _rv; 2716 EventRecord inEvent; 2717 2717 #ifndef MenuEvent 2718 2719 #endif 2720 2721 2722 2723 2724 2725 2726 2718 PyMac_PRECHECK(MenuEvent); 2719 #endif 2720 if (!PyArg_ParseTuple(_args, "O&", 2721 PyMac_GetEventRecord, &inEvent)) 2722 return NULL; 2723 _rv = MenuEvent(&inEvent); 2724 _res = Py_BuildValue("l", 2725 _rv); 2726 return _res; 2727 2727 } 2728 2728 2729 2729 static PyObject *Menu_GetMBarHeight(PyObject *_self, PyObject *_args) 2730 2730 { 2731 2732 2731 PyObject *_res = NULL; 2732 short _rv; 2733 2733 #ifndef GetMBarHeight 2734 2735 #endif 2736 2737 2738 2739 2740 2741 2734 PyMac_PRECHECK(GetMBarHeight); 2735 #endif 2736 if (!PyArg_ParseTuple(_args, "")) 2737 return NULL; 2738 _rv = GetMBarHeight(); 2739 _res = Py_BuildValue("h", 2740 _rv); 2741 return _res; 2742 2742 } 2743 2743 2744 2744 static PyObject *Menu_MacDrawMenuBar(PyObject *_self, PyObject *_args) 2745 2745 { 2746 2746 PyObject *_res = NULL; 2747 2747 #ifndef MacDrawMenuBar 2748 2749 #endif 2750 2751 2752 2753 2754 2755 2748 PyMac_PRECHECK(MacDrawMenuBar); 2749 #endif 2750 if (!PyArg_ParseTuple(_args, "")) 2751 return NULL; 2752 MacDrawMenuBar(); 2753 Py_INCREF(Py_None); 2754 _res = Py_None; 2755 return _res; 2756 2756 } 2757 2757 2758 2758 static PyObject *Menu_InvalMenuBar(PyObject *_self, PyObject *_args) 2759 2759 { 2760 2760 PyObject *_res = NULL; 2761 2761 #ifndef InvalMenuBar 2762 2763 #endif 2764 2765 2766 2767 2768 2769 2762 PyMac_PRECHECK(InvalMenuBar); 2763 #endif 2764 if (!PyArg_ParseTuple(_args, "")) 2765 return NULL; 2766 InvalMenuBar(); 2767 Py_INCREF(Py_None); 2768 _res = Py_None; 2769 return _res; 2770 2770 } 2771 2771 2772 2772 static PyObject *Menu_HiliteMenu(PyObject *_self, PyObject *_args) 2773 2773 { 2774 2775 2774 PyObject *_res = NULL; 2775 MenuID menuID; 2776 2776 #ifndef HiliteMenu 2777 2778 #endif 2779 2780 2781 2782 2783 2784 2785 2777 PyMac_PRECHECK(HiliteMenu); 2778 #endif 2779 if (!PyArg_ParseTuple(_args, "h", 2780 &menuID)) 2781 return NULL; 2782 HiliteMenu(menuID); 2783 Py_INCREF(Py_None); 2784 _res = Py_None; 2785 return _res; 2786 2786 } 2787 2787 2788 2788 static PyObject *Menu_GetNewMBar(PyObject *_self, PyObject *_args) 2789 2789 { 2790 2791 2792 2790 PyObject *_res = NULL; 2791 MenuBarHandle _rv; 2792 short menuBarID; 2793 2793 #ifndef GetNewMBar 2794 2795 #endif 2796 2797 2798 2799 2800 2801 2802 2794 PyMac_PRECHECK(GetNewMBar); 2795 #endif 2796 if (!PyArg_ParseTuple(_args, "h", 2797 &menuBarID)) 2798 return NULL; 2799 _rv = GetNewMBar(menuBarID); 2800 _res = Py_BuildValue("O&", 2801 ResObj_New, _rv); 2802 return _res; 2803 2803 } 2804 2804 2805 2805 static PyObject *Menu_GetMenuBar(PyObject *_self, PyObject *_args) 2806 2806 { 2807 2808 2807 PyObject *_res = NULL; 2808 MenuBarHandle _rv; 2809 2809 #ifndef GetMenuBar 2810 2811 #endif 2812 2813 2814 2815 2816 2817 2810 PyMac_PRECHECK(GetMenuBar); 2811 #endif 2812 if (!PyArg_ParseTuple(_args, "")) 2813 return NULL; 2814 _rv = GetMenuBar(); 2815 _res = Py_BuildValue("O&", 2816 ResObj_New, _rv); 2817 return _res; 2818 2818 } 2819 2819 2820 2820 static PyObject *Menu_SetMenuBar(PyObject *_self, PyObject *_args) 2821 2821 { 2822 2823 2822 PyObject *_res = NULL; 2823 MenuBarHandle mbar; 2824 2824 #ifndef SetMenuBar 2825 2826 #endif 2827 2828 2829 2830 2831 2832 2833 2825 PyMac_PRECHECK(SetMenuBar); 2826 #endif 2827 if (!PyArg_ParseTuple(_args, "O&", 2828 ResObj_Convert, &mbar)) 2829 return NULL; 2830 SetMenuBar(mbar); 2831 Py_INCREF(Py_None); 2832 _res = Py_None; 2833 return _res; 2834 2834 } 2835 2835 2836 2836 static PyObject *Menu_DuplicateMenuBar(PyObject *_self, PyObject *_args) 2837 2837 { 2838 2839 2840 2841 2838 PyObject *_res = NULL; 2839 OSStatus _err; 2840 MenuBarHandle inMbar; 2841 MenuBarHandle outMbar; 2842 2842 #ifndef DuplicateMenuBar 2843 2844 #endif 2845 2846 2847 2848 2849 2850 2851 2852 2853 2843 PyMac_PRECHECK(DuplicateMenuBar); 2844 #endif 2845 if (!PyArg_ParseTuple(_args, "O&", 2846 ResObj_Convert, &inMbar)) 2847 return NULL; 2848 _err = DuplicateMenuBar(inMbar, 2849 &outMbar); 2850 if (_err != noErr) return PyMac_Error(_err); 2851 _res = Py_BuildValue("O&", 2852 ResObj_New, outMbar); 2853 return _res; 2854 2854 } 2855 2855 2856 2856 static PyObject *Menu_DisposeMenuBar(PyObject *_self, PyObject *_args) 2857 2857 { 2858 2859 2860 2858 PyObject *_res = NULL; 2859 OSStatus _err; 2860 MenuBarHandle inMbar; 2861 2861 #ifndef DisposeMenuBar 2862 2863 #endif 2864 2865 2866 2867 2868 2869 2870 2871 2862 PyMac_PRECHECK(DisposeMenuBar); 2863 #endif 2864 if (!PyArg_ParseTuple(_args, "O&", 2865 ResObj_Convert, &inMbar)) 2866 return NULL; 2867 _err = DisposeMenuBar(inMbar); 2868 if (_err != noErr) return PyMac_Error(_err); 2869 Py_INCREF(Py_None); 2870 _res = Py_None; 2871 return _res; 2872 2872 } 2873 2873 2874 2874 static PyObject *Menu_GetMenuHandle(PyObject *_self, PyObject *_args) 2875 2875 { 2876 2877 2878 2876 PyObject *_res = NULL; 2877 MenuHandle _rv; 2878 MenuID menuID; 2879 2879 #ifndef GetMenuHandle 2880 2881 #endif 2882 2883 2884 2885 2886 2887 2888 2880 PyMac_PRECHECK(GetMenuHandle); 2881 #endif 2882 if (!PyArg_ParseTuple(_args, "h", 2883 &menuID)) 2884 return NULL; 2885 _rv = GetMenuHandle(menuID); 2886 _res = Py_BuildValue("O&", 2887 MenuObj_New, _rv); 2888 return _res; 2889 2889 } 2890 2890 2891 2891 static PyObject *Menu_MacDeleteMenu(PyObject *_self, PyObject *_args) 2892 2892 { 2893 2894 2893 PyObject *_res = NULL; 2894 MenuID menuID; 2895 2895 #ifndef MacDeleteMenu 2896 2897 #endif 2898 2899 2900 2901 2902 2903 2904 2896 PyMac_PRECHECK(MacDeleteMenu); 2897 #endif 2898 if (!PyArg_ParseTuple(_args, "h", 2899 &menuID)) 2900 return NULL; 2901 MacDeleteMenu(menuID); 2902 Py_INCREF(Py_None); 2903 _res = Py_None; 2904 return _res; 2905 2905 } 2906 2906 2907 2907 static PyObject *Menu_ClearMenuBar(PyObject *_self, PyObject *_args) 2908 2908 { 2909 2909 PyObject *_res = NULL; 2910 2910 #ifndef ClearMenuBar 2911 2912 #endif 2913 2914 2915 2916 2917 2918 2911 PyMac_PRECHECK(ClearMenuBar); 2912 #endif 2913 if (!PyArg_ParseTuple(_args, "")) 2914 return NULL; 2915 ClearMenuBar(); 2916 Py_INCREF(Py_None); 2917 _res = Py_None; 2918 return _res; 2919 2919 } 2920 2920 2921 2921 static PyObject *Menu_SetMenuFlashCount(PyObject *_self, PyObject *_args) 2922 2922 { 2923 2924 2923 PyObject *_res = NULL; 2924 short count; 2925 2925 #ifndef SetMenuFlashCount 2926 2927 #endif 2928 2929 2930 2931 2932 2933 2934 2926 PyMac_PRECHECK(SetMenuFlashCount); 2927 #endif 2928 if (!PyArg_ParseTuple(_args, "h", 2929 &count)) 2930 return NULL; 2931 SetMenuFlashCount(count); 2932 Py_INCREF(Py_None); 2933 _res = Py_None; 2934 return _res; 2935 2935 } 2936 2936 2937 2937 static PyObject *Menu_FlashMenuBar(PyObject *_self, PyObject *_args) 2938 2938 { 2939 2940 2939 PyObject *_res = NULL; 2940 MenuID menuID; 2941 2941 #ifndef FlashMenuBar 2942 2943 #endif 2944 2945 2946 2947 2948 2949 2950 2942 PyMac_PRECHECK(FlashMenuBar); 2943 #endif 2944 if (!PyArg_ParseTuple(_args, "h", 2945 &menuID)) 2946 return NULL; 2947 FlashMenuBar(menuID); 2948 Py_INCREF(Py_None); 2949 _res = Py_None; 2950 return _res; 2951 2951 } 2952 2952 2953 2953 static PyObject *Menu_IsMenuBarVisible(PyObject *_self, PyObject *_args) 2954 2954 { 2955 2956 2955 PyObject *_res = NULL; 2956 Boolean _rv; 2957 2957 #ifndef IsMenuBarVisible 2958 2959 #endif 2960 2961 2962 2963 2964 2965 2958 PyMac_PRECHECK(IsMenuBarVisible); 2959 #endif 2960 if (!PyArg_ParseTuple(_args, "")) 2961 return NULL; 2962 _rv = IsMenuBarVisible(); 2963 _res = Py_BuildValue("b", 2964 _rv); 2965 return _res; 2966 2966 } 2967 2967 2968 2968 static PyObject *Menu_ShowMenuBar(PyObject *_self, PyObject *_args) 2969 2969 { 2970 2970 PyObject *_res = NULL; 2971 2971 #ifndef ShowMenuBar 2972 2973 #endif 2974 2975 2976 2977 2978 2979 2972 PyMac_PRECHECK(ShowMenuBar); 2973 #endif 2974 if (!PyArg_ParseTuple(_args, "")) 2975 return NULL; 2976 ShowMenuBar(); 2977 Py_INCREF(Py_None); 2978 _res = Py_None; 2979 return _res; 2980 2980 } 2981 2981 2982 2982 static PyObject *Menu_HideMenuBar(PyObject *_self, PyObject *_args) 2983 2983 { 2984 2984 PyObject *_res = NULL; 2985 2985 #ifndef HideMenuBar 2986 2987 #endif 2988 2989 2990 2991 2992 2993 2986 PyMac_PRECHECK(HideMenuBar); 2987 #endif 2988 if (!PyArg_ParseTuple(_args, "")) 2989 return NULL; 2990 HideMenuBar(); 2991 Py_INCREF(Py_None); 2992 _res = Py_None; 2993 return _res; 2994 2994 } 2995 2995 2996 2996 static PyObject *Menu_AcquireRootMenu(PyObject *_self, PyObject *_args) 2997 2997 { 2998 2999 2998 PyObject *_res = NULL; 2999 MenuHandle _rv; 3000 3000 #ifndef AcquireRootMenu 3001 3002 #endif 3003 3004 3005 3006 3007 3008 3001 PyMac_PRECHECK(AcquireRootMenu); 3002 #endif 3003 if (!PyArg_ParseTuple(_args, "")) 3004 return NULL; 3005 _rv = AcquireRootMenu(); 3006 _res = Py_BuildValue("O&", 3007 MenuObj_New, _rv); 3008 return _res; 3009 3009 } 3010 3010 3011 3011 static PyObject *Menu_DeleteMCEntries(PyObject *_self, PyObject *_args) 3012 3012 { 3013 3014 3015 3013 PyObject *_res = NULL; 3014 MenuID menuID; 3015 short menuItem; 3016 3016 #ifndef DeleteMCEntries 3017 3018 #endif 3019 3020 3021 3022 3023 3024 3025 3026 3027 3017 PyMac_PRECHECK(DeleteMCEntries); 3018 #endif 3019 if (!PyArg_ParseTuple(_args, "hh", 3020 &menuID, 3021 &menuItem)) 3022 return NULL; 3023 DeleteMCEntries(menuID, 3024 menuItem); 3025 Py_INCREF(Py_None); 3026 _res = Py_None; 3027 return _res; 3028 3028 } 3029 3029 3030 3030 static PyObject *Menu_InitContextualMenus(PyObject *_self, PyObject *_args) 3031 3031 { 3032 3033 3032 PyObject *_res = NULL; 3033 OSStatus _err; 3034 3034 #ifndef InitContextualMenus 3035 3036 #endif 3037 3038 3039 3040 3041 3042 3043 3035 PyMac_PRECHECK(InitContextualMenus); 3036 #endif 3037 if (!PyArg_ParseTuple(_args, "")) 3038 return NULL; 3039 _err = InitContextualMenus(); 3040 if (_err != noErr) return PyMac_Error(_err); 3041 Py_INCREF(Py_None); 3042 _res = Py_None; 3043 return _res; 3044 3044 } 3045 3045 3046 3046 static PyObject *Menu_IsShowContextualMenuClick(PyObject *_self, PyObject *_args) 3047 3047 { 3048 3049 3050 3048 PyObject *_res = NULL; 3049 Boolean _rv; 3050 EventRecord inEvent; 3051 3051 #ifndef IsShowContextualMenuClick 3052 3053 #endif 3054 3055 3056 3057 3058 3059 3060 3052 PyMac_PRECHECK(IsShowContextualMenuClick); 3053 #endif 3054 if (!PyArg_ParseTuple(_args, "O&", 3055 PyMac_GetEventRecord, &inEvent)) 3056 return NULL; 3057 _rv = IsShowContextualMenuClick(&inEvent); 3058 _res = Py_BuildValue("b", 3059 _rv); 3060 return _res; 3061 3061 } 3062 3062 3063 3063 static PyObject *Menu_LMGetTheMenu(PyObject *_self, PyObject *_args) 3064 3064 { 3065 3066 3065 PyObject *_res = NULL; 3066 SInt16 _rv; 3067 3067 #ifndef LMGetTheMenu 3068 3069 #endif 3070 3071 3072 3073 3074 3075 3068 PyMac_PRECHECK(LMGetTheMenu); 3069 #endif 3070 if (!PyArg_ParseTuple(_args, "")) 3071 return NULL; 3072 _rv = LMGetTheMenu(); 3073 _res = Py_BuildValue("h", 3074 _rv); 3075 return _res; 3076 3076 } 3077 3077 3078 3078 static PyObject *Menu_as_Menu(PyObject *_self, PyObject *_args) 3079 3079 { 3080 3081 3082 3080 PyObject *_res = NULL; 3081 MenuHandle _rv; 3082 Handle h; 3083 3083 #ifndef as_Menu 3084 3085 #endif 3086 3087 3088 3089 3090 3091 3092 3084 PyMac_PRECHECK(as_Menu); 3085 #endif 3086 if (!PyArg_ParseTuple(_args, "O&", 3087 ResObj_Convert, &h)) 3088 return NULL; 3089 _rv = as_Menu(h); 3090 _res = Py_BuildValue("O&", 3091 MenuObj_New, _rv); 3092 return _res; 3093 3093 } 3094 3094 3095 3095 static PyObject *Menu_GetMenu(PyObject *_self, PyObject *_args) 3096 3096 { 3097 3098 3099 3097 PyObject *_res = NULL; 3098 MenuHandle _rv; 3099 short resourceID; 3100 3100 #ifndef GetMenu 3101 3102 #endif 3103 3104 3105 3106 3107 3108 3109 3101 PyMac_PRECHECK(GetMenu); 3102 #endif 3103 if (!PyArg_ParseTuple(_args, "h", 3104 &resourceID)) 3105 return NULL; 3106 _rv = GetMenu(resourceID); 3107 _res = Py_BuildValue("O&", 3108 MenuObj_New, _rv); 3109 return _res; 3110 3110 } 3111 3111 3112 3112 static PyObject *Menu_DeleteMenu(PyObject *_self, PyObject *_args) 3113 3113 { 3114 3115 3114 PyObject *_res = NULL; 3115 short menuID; 3116 3116 #ifndef DeleteMenu 3117 3118 #endif 3119 3120 3121 3122 3123 3124 3125 3117 PyMac_PRECHECK(DeleteMenu); 3118 #endif 3119 if (!PyArg_ParseTuple(_args, "h", 3120 &menuID)) 3121 return NULL; 3122 DeleteMenu(menuID); 3123 Py_INCREF(Py_None); 3124 _res = Py_None; 3125 return _res; 3126 3126 } 3127 3127 3128 3128 static PyObject *Menu_DrawMenuBar(PyObject *_self, PyObject *_args) 3129 3129 { 3130 3130 PyObject *_res = NULL; 3131 3131 #ifndef DrawMenuBar 3132 3133 #endif 3134 3135 3136 3137 3138 3139 3132 PyMac_PRECHECK(DrawMenuBar); 3133 #endif 3134 if (!PyArg_ParseTuple(_args, "")) 3135 return NULL; 3136 DrawMenuBar(); 3137 Py_INCREF(Py_None); 3138 _res = Py_None; 3139 return _res; 3140 3140 } 3141 3141 3142 3142 static PyObject *Menu_CountMenuItemsWithCommandID(PyObject *_self, PyObject *_args) 3143 3143 { 3144 3145 3146 3147 3144 PyObject *_res = NULL; 3145 ItemCount _rv; 3146 MenuHandle inMenu; 3147 MenuCommand inCommandID; 3148 3148 #ifndef CountMenuItemsWithCommandID 3149 3150 #endif 3151 3152 3153 3154 3155 3156 3157 3158 3159 3149 PyMac_PRECHECK(CountMenuItemsWithCommandID); 3150 #endif 3151 if (!PyArg_ParseTuple(_args, "O&l", 3152 OptMenuObj_Convert, &inMenu, 3153 &inCommandID)) 3154 return NULL; 3155 _rv = CountMenuItemsWithCommandID(inMenu, 3156 inCommandID); 3157 _res = Py_BuildValue("l", 3158 _rv); 3159 return _res; 3160 3160 } 3161 3161 3162 3162 static PyObject *Menu_GetIndMenuItemWithCommandID(PyObject *_self, PyObject *_args) 3163 3163 { 3164 3165 3166 3167 3168 3169 3170 3164 PyObject *_res = NULL; 3165 OSStatus _err; 3166 MenuHandle inMenu; 3167 MenuCommand inCommandID; 3168 UInt32 inItemIndex; 3169 MenuHandle outMenu; 3170 MenuItemIndex outIndex; 3171 3171 #ifndef GetIndMenuItemWithCommandID 3172 3173 #endif 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3172 PyMac_PRECHECK(GetIndMenuItemWithCommandID); 3173 #endif 3174 if (!PyArg_ParseTuple(_args, "O&ll", 3175 OptMenuObj_Convert, &inMenu, 3176 &inCommandID, 3177 &inItemIndex)) 3178 return NULL; 3179 _err = GetIndMenuItemWithCommandID(inMenu, 3180 inCommandID, 3181 inItemIndex, 3182 &outMenu, 3183 &outIndex); 3184 if (_err != noErr) return PyMac_Error(_err); 3185 _res = Py_BuildValue("O&h", 3186 MenuObj_New, outMenu, 3187 outIndex); 3188 return _res; 3189 3189 } 3190 3190 3191 3191 static PyObject *Menu_EnableMenuCommand(PyObject *_self, PyObject *_args) 3192 3192 { 3193 3194 3195 3193 PyObject *_res = NULL; 3194 MenuHandle inMenu; 3195 MenuCommand inCommandID; 3196 3196 #ifndef EnableMenuCommand 3197 3198 #endif 3199 3200 3201 3202 3203 3204 3205 3206 3207 3197 PyMac_PRECHECK(EnableMenuCommand); 3198 #endif 3199 if (!PyArg_ParseTuple(_args, "O&l", 3200 OptMenuObj_Convert, &inMenu, 3201 &inCommandID)) 3202 return NULL; 3203 EnableMenuCommand(inMenu, 3204 inCommandID); 3205 Py_INCREF(Py_None); 3206 _res = Py_None; 3207 return _res; 3208 3208 } 3209 3209 3210 3210 static PyObject *Menu_DisableMenuCommand(PyObject *_self, PyObject *_args) 3211 3211 { 3212 3213 3214 3212 PyObject *_res = NULL; 3213 MenuHandle inMenu; 3214 MenuCommand inCommandID; 3215 3215 #ifndef DisableMenuCommand 3216 3217 #endif 3218 3219 3220 3221 3222 3223 3224 3225 3226 3216 PyMac_PRECHECK(DisableMenuCommand); 3217 #endif 3218 if (!PyArg_ParseTuple(_args, "O&l", 3219 OptMenuObj_Convert, &inMenu, 3220 &inCommandID)) 3221 return NULL; 3222 DisableMenuCommand(inMenu, 3223 inCommandID); 3224 Py_INCREF(Py_None); 3225 _res = Py_None; 3226 return _res; 3227 3227 } 3228 3228 3229 3229 static PyObject *Menu_IsMenuCommandEnabled(PyObject *_self, PyObject *_args) 3230 3230 { 3231 3232 3233 3234 3231 PyObject *_res = NULL; 3232 Boolean _rv; 3233 MenuHandle inMenu; 3234 MenuCommand inCommandID; 3235 3235 #ifndef IsMenuCommandEnabled 3236 3237 #endif 3238 3239 3240 3241 3242 3243 3244 3245 3246 3236 PyMac_PRECHECK(IsMenuCommandEnabled); 3237 #endif 3238 if (!PyArg_ParseTuple(_args, "O&l", 3239 OptMenuObj_Convert, &inMenu, 3240 &inCommandID)) 3241 return NULL; 3242 _rv = IsMenuCommandEnabled(inMenu, 3243 inCommandID); 3244 _res = Py_BuildValue("b", 3245 _rv); 3246 return _res; 3247 3247 } 3248 3248 3249 3249 static PyObject *Menu_SetMenuCommandMark(PyObject *_self, PyObject *_args) 3250 3250 { 3251 3252 3253 3254 3255 3251 PyObject *_res = NULL; 3252 OSStatus _err; 3253 MenuHandle inMenu; 3254 MenuCommand inCommandID; 3255 UniChar inMark; 3256 3256 #ifndef SetMenuCommandMark 3257 3258 #endif 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3257 PyMac_PRECHECK(SetMenuCommandMark); 3258 #endif 3259 if (!PyArg_ParseTuple(_args, "O&lh", 3260 OptMenuObj_Convert, &inMenu, 3261 &inCommandID, 3262 &inMark)) 3263 return NULL; 3264 _err = SetMenuCommandMark(inMenu, 3265 inCommandID, 3266 inMark); 3267 if (_err != noErr) return PyMac_Error(_err); 3268 Py_INCREF(Py_None); 3269 _res = Py_None; 3270 return _res; 3271 3271 } 3272 3272 3273 3273 static PyObject *Menu_GetMenuCommandMark(PyObject *_self, PyObject *_args) 3274 3274 { 3275 3276 3277 3278 3279 3275 PyObject *_res = NULL; 3276 OSStatus _err; 3277 MenuHandle inMenu; 3278 MenuCommand inCommandID; 3279 UniChar outMark; 3280 3280 #ifndef GetMenuCommandMark 3281 3282 #endif 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3281 PyMac_PRECHECK(GetMenuCommandMark); 3282 #endif 3283 if (!PyArg_ParseTuple(_args, "O&l", 3284 OptMenuObj_Convert, &inMenu, 3285 &inCommandID)) 3286 return NULL; 3287 _err = GetMenuCommandMark(inMenu, 3288 inCommandID, 3289 &outMark); 3290 if (_err != noErr) return PyMac_Error(_err); 3291 _res = Py_BuildValue("h", 3292 outMark); 3293 return _res; 3294 3294 } 3295 3295 3296 3296 static PyObject *Menu_GetMenuCommandPropertySize(PyObject *_self, PyObject *_args) 3297 3297 { 3298 3299 3300 3301 3302 3303 3304 3298 PyObject *_res = NULL; 3299 OSStatus _err; 3300 MenuHandle inMenu; 3301 MenuCommand inCommandID; 3302 OSType inPropertyCreator; 3303 OSType inPropertyTag; 3304 ByteCount outSize; 3305 3305 #ifndef GetMenuCommandPropertySize 3306 3307 #endif 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3306 PyMac_PRECHECK(GetMenuCommandPropertySize); 3307 #endif 3308 if (!PyArg_ParseTuple(_args, "O&lO&O&", 3309 OptMenuObj_Convert, &inMenu, 3310 &inCommandID, 3311 PyMac_GetOSType, &inPropertyCreator, 3312 PyMac_GetOSType, &inPropertyTag)) 3313 return NULL; 3314 _err = GetMenuCommandPropertySize(inMenu, 3315 inCommandID, 3316 inPropertyCreator, 3317 inPropertyTag, 3318 &outSize); 3319 if (_err != noErr) return PyMac_Error(_err); 3320 _res = Py_BuildValue("l", 3321 outSize); 3322 return _res; 3323 3323 } 3324 3324 3325 3325 static PyObject *Menu_RemoveMenuCommandProperty(PyObject *_self, PyObject *_args) 3326 3326 { 3327 3328 3329 3330 3331 3332 3327 PyObject *_res = NULL; 3328 OSStatus _err; 3329 MenuHandle inMenu; 3330 MenuCommand inCommandID; 3331 OSType inPropertyCreator; 3332 OSType inPropertyTag; 3333 3333 #ifndef RemoveMenuCommandProperty 3334 3335 #endif 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3334 PyMac_PRECHECK(RemoveMenuCommandProperty); 3335 #endif 3336 if (!PyArg_ParseTuple(_args, "O&lO&O&", 3337 OptMenuObj_Convert, &inMenu, 3338 &inCommandID, 3339 PyMac_GetOSType, &inPropertyCreator, 3340 PyMac_GetOSType, &inPropertyTag)) 3341 return NULL; 3342 _err = RemoveMenuCommandProperty(inMenu, 3343 inCommandID, 3344 inPropertyCreator, 3345 inPropertyTag); 3346 if (_err != noErr) return PyMac_Error(_err); 3347 Py_INCREF(Py_None); 3348 _res = Py_None; 3349 return _res; 3350 3350 } 3351 3351 #endif /* __LP64__ */ … … 3353 3353 static PyMethodDef Menu_methods[] = { 3354 3354 #ifndef __LP64__ 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3355 {"NewMenu", (PyCFunction)Menu_NewMenu, 1, 3356 PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")}, 3357 {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1, 3358 PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")}, 3359 {"CreateNewMenu", (PyCFunction)Menu_CreateNewMenu, 1, 3360 PyDoc_STR("(MenuID inMenuID, MenuAttributes inMenuAttributes) -> (MenuHandle outMenuRef)")}, 3361 {"MenuKey", (PyCFunction)Menu_MenuKey, 1, 3362 PyDoc_STR("(CharParameter ch) -> (long _rv)")}, 3363 {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1, 3364 PyDoc_STR("(Point startPt) -> (long _rv)")}, 3365 {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1, 3366 PyDoc_STR("() -> (long _rv)")}, 3367 {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1, 3368 PyDoc_STR("(EventRecord inEvent) -> (UInt32 _rv)")}, 3369 {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1, 3370 PyDoc_STR("() -> (short _rv)")}, 3371 {"MacDrawMenuBar", (PyCFunction)Menu_MacDrawMenuBar, 1, 3372 PyDoc_STR("() -> None")}, 3373 {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1, 3374 PyDoc_STR("() -> None")}, 3375 {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1, 3376 PyDoc_STR("(MenuID menuID) -> None")}, 3377 {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1, 3378 PyDoc_STR("(short menuBarID) -> (MenuBarHandle _rv)")}, 3379 {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1, 3380 PyDoc_STR("() -> (MenuBarHandle _rv)")}, 3381 {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1, 3382 PyDoc_STR("(MenuBarHandle mbar) -> None")}, 3383 {"DuplicateMenuBar", (PyCFunction)Menu_DuplicateMenuBar, 1, 3384 PyDoc_STR("(MenuBarHandle inMbar) -> (MenuBarHandle outMbar)")}, 3385 {"DisposeMenuBar", (PyCFunction)Menu_DisposeMenuBar, 1, 3386 PyDoc_STR("(MenuBarHandle inMbar) -> None")}, 3387 {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1, 3388 PyDoc_STR("(MenuID menuID) -> (MenuHandle _rv)")}, 3389 {"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1, 3390 PyDoc_STR("(MenuID menuID) -> None")}, 3391 {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1, 3392 PyDoc_STR("() -> None")}, 3393 {"SetMenuFlashCount", (PyCFunction)Menu_SetMenuFlashCount, 1, 3394 PyDoc_STR("(short count) -> None")}, 3395 {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1, 3396 PyDoc_STR("(MenuID menuID) -> None")}, 3397 {"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1, 3398 PyDoc_STR("() -> (Boolean _rv)")}, 3399 {"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1, 3400 PyDoc_STR("() -> None")}, 3401 {"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1, 3402 PyDoc_STR("() -> None")}, 3403 {"AcquireRootMenu", (PyCFunction)Menu_AcquireRootMenu, 1, 3404 PyDoc_STR("() -> (MenuHandle _rv)")}, 3405 {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1, 3406 PyDoc_STR("(MenuID menuID, short menuItem) -> None")}, 3407 {"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1, 3408 PyDoc_STR("() -> None")}, 3409 {"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1, 3410 PyDoc_STR("(EventRecord inEvent) -> (Boolean _rv)")}, 3411 {"LMGetTheMenu", (PyCFunction)Menu_LMGetTheMenu, 1, 3412 PyDoc_STR("() -> (SInt16 _rv)")}, 3413 {"as_Menu", (PyCFunction)Menu_as_Menu, 1, 3414 PyDoc_STR("(Handle h) -> (MenuHandle _rv)")}, 3415 {"GetMenu", (PyCFunction)Menu_GetMenu, 1, 3416 PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")}, 3417 {"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1, 3418 PyDoc_STR("(short menuID) -> None")}, 3419 {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1, 3420 PyDoc_STR("() -> None")}, 3421 {"CountMenuItemsWithCommandID", (PyCFunction)Menu_CountMenuItemsWithCommandID, 1, 3422 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)")}, 3423 {"GetIndMenuItemWithCommandID", (PyCFunction)Menu_GetIndMenuItemWithCommandID, 1, 3424 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")}, 3425 {"EnableMenuCommand", (PyCFunction)Menu_EnableMenuCommand, 1, 3426 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")}, 3427 {"DisableMenuCommand", (PyCFunction)Menu_DisableMenuCommand, 1, 3428 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")}, 3429 {"IsMenuCommandEnabled", (PyCFunction)Menu_IsMenuCommandEnabled, 1, 3430 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)")}, 3431 {"SetMenuCommandMark", (PyCFunction)Menu_SetMenuCommandMark, 1, 3432 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None")}, 3433 {"GetMenuCommandMark", (PyCFunction)Menu_GetMenuCommandMark, 1, 3434 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)")}, 3435 {"GetMenuCommandPropertySize", (PyCFunction)Menu_GetMenuCommandPropertySize, 1, 3436 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")}, 3437 {"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1, 3438 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, 3439 3439 #endif /* __LP64__ */ 3440 3440 {NULL, NULL, 0} 3441 3441 }; 3442 3442 … … 3446 3446 void init_Menu(void) 3447 3447 { 3448 3448 PyObject *m; 3449 3449 #ifndef __LP64__ 3450 3451 3452 3453 3454 3455 3450 PyObject *d; 3451 3452 3453 3454 PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); 3455 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); 3456 3456 #endif /* __LP64__ */ 3457 3457 3458 3458 3459 3459 m = Py_InitModule("_Menu", Menu_methods); 3460 3460 #ifndef __LP64__ 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3461 d = PyModule_GetDict(m); 3462 Menu_Error = PyMac_GetOSErrException(); 3463 if (Menu_Error == NULL || 3464 PyDict_SetItemString(d, "Error", Menu_Error) != 0) 3465 return; 3466 Menu_Type.ob_type = &PyType_Type; 3467 if (PyType_Ready(&Menu_Type) < 0) return; 3468 Py_INCREF(&Menu_Type); 3469 PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type); 3470 /* Backward-compatible name */ 3471 Py_INCREF(&Menu_Type); 3472 PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type); 3473 3473 #endif /* __LP64__ */ 3474 3474 }
Note:
See TracChangeset
for help on using the changeset viewer.