This commit was manufactured by cvs2svn to create tag 'r221'.
[python/dscho.git] / Mac / Modules / menu / _Menumodule.c
blobf46eb83098e469ca0941120704d6024d89b98af0
2 /* ========================== Module _Menu ========================== */
4 #include "Python.h"
8 #ifdef _WIN32
9 #include "pywintoolbox.h"
10 #else
11 #include "macglue.h"
12 #include "pymactoolbox.h"
13 #endif
15 /* Macro to test whether a weak-loaded CFM function exists */
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
23 #ifdef WITHOUT_FRAMEWORKS
24 #include <Devices.h> /* Defines OpenDeskAcc in universal headers */
25 #include <Menus.h>
26 #else
27 #include <Carbon/Carbon.h>
28 #endif
31 #ifdef USE_TOOLBOX_OBJECT_GLUE
33 extern PyObject *_MenuObj_New(MenuHandle);
34 extern int _MenuObj_Convert(PyObject *, MenuHandle *);
36 #define MenuObj_New _MenuObj_New
37 #define MenuObj_Convert _MenuObj_Convert
38 #endif
40 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
41 #define GetMenuID(menu) ((*(menu))->menuID)
42 #define GetMenuWidth(menu) ((*(menu))->menuWidth)
43 #define GetMenuHeight(menu) ((*(menu))->menuHeight)
45 #define SetMenuID(menu, id) ((*(menu))->menuID = (id))
46 #define SetMenuWidth(menu, width) ((*(menu))->menuWidth = (width))
47 #define SetMenuHeight(menu, height) ((*(menu))->menuHeight = (height))
48 #endif
50 #define as_Menu(h) ((MenuHandle)h)
51 #define as_Resource(h) ((Handle)h)
54 /* Alternative version of MenuObj_New, which returns None for NULL argument */
55 PyObject *OptMenuObj_New(MenuRef itself)
57 if (itself == NULL) {
58 Py_INCREF(Py_None);
59 return Py_None;
61 return MenuObj_New(itself);
64 /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */
65 int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself)
67 PyObject *tmp;
69 if ( v == Py_None ) {
70 *p_itself = NULL;
71 return 1;
73 return MenuObj_Convert(v, p_itself);
76 static PyObject *Menu_Error;
78 /* ------------------------ Object type Menu ------------------------ */
80 PyTypeObject Menu_Type;
82 #define MenuObj_Check(x) ((x)->ob_type == &Menu_Type)
84 typedef struct MenuObject {
85 PyObject_HEAD
86 MenuHandle ob_itself;
87 } MenuObject;
89 PyObject *MenuObj_New(MenuHandle itself)
91 MenuObject *it;
92 it = PyObject_NEW(MenuObject, &Menu_Type);
93 if (it == NULL) return NULL;
94 it->ob_itself = itself;
95 return (PyObject *)it;
97 int MenuObj_Convert(PyObject *v, MenuHandle *p_itself)
99 if (!MenuObj_Check(v))
101 PyErr_SetString(PyExc_TypeError, "Menu required");
102 return 0;
104 *p_itself = ((MenuObject *)v)->ob_itself;
105 return 1;
108 static void MenuObj_dealloc(MenuObject *self)
110 /* Cleanup of self->ob_itself goes here */
111 PyMem_DEL(self);
114 static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args)
116 PyObject *_res = NULL;
117 #ifndef DisposeMenu
118 PyMac_PRECHECK(DisposeMenu);
119 #endif
120 if (!PyArg_ParseTuple(_args, ""))
121 return NULL;
122 DisposeMenu(_self->ob_itself);
123 Py_INCREF(Py_None);
124 _res = Py_None;
125 return _res;
128 static PyObject *MenuObj_CalcMenuSize(MenuObject *_self, PyObject *_args)
130 PyObject *_res = NULL;
131 #ifndef CalcMenuSize
132 PyMac_PRECHECK(CalcMenuSize);
133 #endif
134 if (!PyArg_ParseTuple(_args, ""))
135 return NULL;
136 CalcMenuSize(_self->ob_itself);
137 Py_INCREF(Py_None);
138 _res = Py_None;
139 return _res;
142 #if !TARGET_API_MAC_CARBON
144 static PyObject *MenuObj_CountMItems(MenuObject *_self, PyObject *_args)
146 PyObject *_res = NULL;
147 short _rv;
148 #ifndef CountMItems
149 PyMac_PRECHECK(CountMItems);
150 #endif
151 if (!PyArg_ParseTuple(_args, ""))
152 return NULL;
153 _rv = CountMItems(_self->ob_itself);
154 _res = Py_BuildValue("h",
155 _rv);
156 return _res;
158 #endif
160 static PyObject *MenuObj_CountMenuItems(MenuObject *_self, PyObject *_args)
162 PyObject *_res = NULL;
163 short _rv;
164 #ifndef CountMenuItems
165 PyMac_PRECHECK(CountMenuItems);
166 #endif
167 if (!PyArg_ParseTuple(_args, ""))
168 return NULL;
169 _rv = CountMenuItems(_self->ob_itself);
170 _res = Py_BuildValue("h",
171 _rv);
172 return _res;
175 static PyObject *MenuObj_GetMenuFont(MenuObject *_self, PyObject *_args)
177 PyObject *_res = NULL;
178 OSStatus _err;
179 SInt16 outFontID;
180 UInt16 outFontSize;
181 #ifndef GetMenuFont
182 PyMac_PRECHECK(GetMenuFont);
183 #endif
184 if (!PyArg_ParseTuple(_args, ""))
185 return NULL;
186 _err = GetMenuFont(_self->ob_itself,
187 &outFontID,
188 &outFontSize);
189 if (_err != noErr) return PyMac_Error(_err);
190 _res = Py_BuildValue("hH",
191 outFontID,
192 outFontSize);
193 return _res;
196 static PyObject *MenuObj_SetMenuFont(MenuObject *_self, PyObject *_args)
198 PyObject *_res = NULL;
199 OSStatus _err;
200 SInt16 inFontID;
201 UInt16 inFontSize;
202 #ifndef SetMenuFont
203 PyMac_PRECHECK(SetMenuFont);
204 #endif
205 if (!PyArg_ParseTuple(_args, "hH",
206 &inFontID,
207 &inFontSize))
208 return NULL;
209 _err = SetMenuFont(_self->ob_itself,
210 inFontID,
211 inFontSize);
212 if (_err != noErr) return PyMac_Error(_err);
213 Py_INCREF(Py_None);
214 _res = Py_None;
215 return _res;
218 static PyObject *MenuObj_GetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
220 PyObject *_res = NULL;
221 Boolean _rv;
222 #ifndef GetMenuExcludesMarkColumn
223 PyMac_PRECHECK(GetMenuExcludesMarkColumn);
224 #endif
225 if (!PyArg_ParseTuple(_args, ""))
226 return NULL;
227 _rv = GetMenuExcludesMarkColumn(_self->ob_itself);
228 _res = Py_BuildValue("b",
229 _rv);
230 return _res;
233 static PyObject *MenuObj_SetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
235 PyObject *_res = NULL;
236 OSStatus _err;
237 Boolean excludesMark;
238 #ifndef SetMenuExcludesMarkColumn
239 PyMac_PRECHECK(SetMenuExcludesMarkColumn);
240 #endif
241 if (!PyArg_ParseTuple(_args, "b",
242 &excludesMark))
243 return NULL;
244 _err = SetMenuExcludesMarkColumn(_self->ob_itself,
245 excludesMark);
246 if (_err != noErr) return PyMac_Error(_err);
247 Py_INCREF(Py_None);
248 _res = Py_None;
249 return _res;
252 #if TARGET_API_MAC_CARBON
254 static PyObject *MenuObj_IsValidMenu(MenuObject *_self, PyObject *_args)
256 PyObject *_res = NULL;
257 Boolean _rv;
258 #ifndef IsValidMenu
259 PyMac_PRECHECK(IsValidMenu);
260 #endif
261 if (!PyArg_ParseTuple(_args, ""))
262 return NULL;
263 _rv = IsValidMenu(_self->ob_itself);
264 _res = Py_BuildValue("b",
265 _rv);
266 return _res;
268 #endif
270 #if TARGET_API_MAC_CARBON
272 static PyObject *MenuObj_GetMenuRetainCount(MenuObject *_self, PyObject *_args)
274 PyObject *_res = NULL;
275 ItemCount _rv;
276 #ifndef GetMenuRetainCount
277 PyMac_PRECHECK(GetMenuRetainCount);
278 #endif
279 if (!PyArg_ParseTuple(_args, ""))
280 return NULL;
281 _rv = GetMenuRetainCount(_self->ob_itself);
282 _res = Py_BuildValue("l",
283 _rv);
284 return _res;
286 #endif
288 #if TARGET_API_MAC_CARBON
290 static PyObject *MenuObj_RetainMenu(MenuObject *_self, PyObject *_args)
292 PyObject *_res = NULL;
293 OSStatus _err;
294 #ifndef RetainMenu
295 PyMac_PRECHECK(RetainMenu);
296 #endif
297 if (!PyArg_ParseTuple(_args, ""))
298 return NULL;
299 _err = RetainMenu(_self->ob_itself);
300 if (_err != noErr) return PyMac_Error(_err);
301 Py_INCREF(Py_None);
302 _res = Py_None;
303 return _res;
305 #endif
307 #if TARGET_API_MAC_CARBON
309 static PyObject *MenuObj_ReleaseMenu(MenuObject *_self, PyObject *_args)
311 PyObject *_res = NULL;
312 OSStatus _err;
313 #ifndef ReleaseMenu
314 PyMac_PRECHECK(ReleaseMenu);
315 #endif
316 if (!PyArg_ParseTuple(_args, ""))
317 return NULL;
318 _err = ReleaseMenu(_self->ob_itself);
319 if (_err != noErr) return PyMac_Error(_err);
320 Py_INCREF(Py_None);
321 _res = Py_None;
322 return _res;
324 #endif
326 #if TARGET_API_MAC_CARBON
328 static PyObject *MenuObj_DuplicateMenu(MenuObject *_self, PyObject *_args)
330 PyObject *_res = NULL;
331 OSStatus _err;
332 MenuHandle outMenu;
333 #ifndef DuplicateMenu
334 PyMac_PRECHECK(DuplicateMenu);
335 #endif
336 if (!PyArg_ParseTuple(_args, ""))
337 return NULL;
338 _err = DuplicateMenu(_self->ob_itself,
339 &outMenu);
340 if (_err != noErr) return PyMac_Error(_err);
341 _res = Py_BuildValue("O&",
342 MenuObj_New, outMenu);
343 return _res;
345 #endif
347 #if TARGET_API_MAC_CARBON
349 static PyObject *MenuObj_CopyMenuTitleAsCFString(MenuObject *_self, PyObject *_args)
351 PyObject *_res = NULL;
352 OSStatus _err;
353 CFStringRef outString;
354 #ifndef CopyMenuTitleAsCFString
355 PyMac_PRECHECK(CopyMenuTitleAsCFString);
356 #endif
357 if (!PyArg_ParseTuple(_args, ""))
358 return NULL;
359 _err = CopyMenuTitleAsCFString(_self->ob_itself,
360 &outString);
361 if (_err != noErr) return PyMac_Error(_err);
362 _res = Py_BuildValue("O&",
363 CFStringRefObj_New, outString);
364 return _res;
366 #endif
368 #if TARGET_API_MAC_CARBON
370 static PyObject *MenuObj_SetMenuTitleWithCFString(MenuObject *_self, PyObject *_args)
372 PyObject *_res = NULL;
373 OSStatus _err;
374 CFStringRef inString;
375 #ifndef SetMenuTitleWithCFString
376 PyMac_PRECHECK(SetMenuTitleWithCFString);
377 #endif
378 if (!PyArg_ParseTuple(_args, "O&",
379 CFStringRefObj_Convert, &inString))
380 return NULL;
381 _err = SetMenuTitleWithCFString(_self->ob_itself,
382 inString);
383 if (_err != noErr) return PyMac_Error(_err);
384 Py_INCREF(Py_None);
385 _res = Py_None;
386 return _res;
388 #endif
390 #if TARGET_API_MAC_CARBON
392 static PyObject *MenuObj_InvalidateMenuSize(MenuObject *_self, PyObject *_args)
394 PyObject *_res = NULL;
395 OSStatus _err;
396 #ifndef InvalidateMenuSize
397 PyMac_PRECHECK(InvalidateMenuSize);
398 #endif
399 if (!PyArg_ParseTuple(_args, ""))
400 return NULL;
401 _err = InvalidateMenuSize(_self->ob_itself);
402 if (_err != noErr) return PyMac_Error(_err);
403 Py_INCREF(Py_None);
404 _res = Py_None;
405 return _res;
407 #endif
409 #if TARGET_API_MAC_CARBON
411 static PyObject *MenuObj_IsMenuSizeInvalid(MenuObject *_self, PyObject *_args)
413 PyObject *_res = NULL;
414 Boolean _rv;
415 #ifndef IsMenuSizeInvalid
416 PyMac_PRECHECK(IsMenuSizeInvalid);
417 #endif
418 if (!PyArg_ParseTuple(_args, ""))
419 return NULL;
420 _rv = IsMenuSizeInvalid(_self->ob_itself);
421 _res = Py_BuildValue("b",
422 _rv);
423 return _res;
425 #endif
427 static PyObject *MenuObj_MacAppendMenu(MenuObject *_self, PyObject *_args)
429 PyObject *_res = NULL;
430 Str255 data;
431 #ifndef MacAppendMenu
432 PyMac_PRECHECK(MacAppendMenu);
433 #endif
434 if (!PyArg_ParseTuple(_args, "O&",
435 PyMac_GetStr255, data))
436 return NULL;
437 MacAppendMenu(_self->ob_itself,
438 data);
439 Py_INCREF(Py_None);
440 _res = Py_None;
441 return _res;
444 static PyObject *MenuObj_InsertResMenu(MenuObject *_self, PyObject *_args)
446 PyObject *_res = NULL;
447 ResType theType;
448 short afterItem;
449 #ifndef InsertResMenu
450 PyMac_PRECHECK(InsertResMenu);
451 #endif
452 if (!PyArg_ParseTuple(_args, "O&h",
453 PyMac_GetOSType, &theType,
454 &afterItem))
455 return NULL;
456 InsertResMenu(_self->ob_itself,
457 theType,
458 afterItem);
459 Py_INCREF(Py_None);
460 _res = Py_None;
461 return _res;
464 static PyObject *MenuObj_AppendResMenu(MenuObject *_self, PyObject *_args)
466 PyObject *_res = NULL;
467 ResType theType;
468 #ifndef AppendResMenu
469 PyMac_PRECHECK(AppendResMenu);
470 #endif
471 if (!PyArg_ParseTuple(_args, "O&",
472 PyMac_GetOSType, &theType))
473 return NULL;
474 AppendResMenu(_self->ob_itself,
475 theType);
476 Py_INCREF(Py_None);
477 _res = Py_None;
478 return _res;
481 static PyObject *MenuObj_MacInsertMenuItem(MenuObject *_self, PyObject *_args)
483 PyObject *_res = NULL;
484 Str255 itemString;
485 short afterItem;
486 #ifndef MacInsertMenuItem
487 PyMac_PRECHECK(MacInsertMenuItem);
488 #endif
489 if (!PyArg_ParseTuple(_args, "O&h",
490 PyMac_GetStr255, itemString,
491 &afterItem))
492 return NULL;
493 MacInsertMenuItem(_self->ob_itself,
494 itemString,
495 afterItem);
496 Py_INCREF(Py_None);
497 _res = Py_None;
498 return _res;
501 static PyObject *MenuObj_DeleteMenuItem(MenuObject *_self, PyObject *_args)
503 PyObject *_res = NULL;
504 short item;
505 #ifndef DeleteMenuItem
506 PyMac_PRECHECK(DeleteMenuItem);
507 #endif
508 if (!PyArg_ParseTuple(_args, "h",
509 &item))
510 return NULL;
511 DeleteMenuItem(_self->ob_itself,
512 item);
513 Py_INCREF(Py_None);
514 _res = Py_None;
515 return _res;
518 static PyObject *MenuObj_InsertFontResMenu(MenuObject *_self, PyObject *_args)
520 PyObject *_res = NULL;
521 short afterItem;
522 short scriptFilter;
523 #ifndef InsertFontResMenu
524 PyMac_PRECHECK(InsertFontResMenu);
525 #endif
526 if (!PyArg_ParseTuple(_args, "hh",
527 &afterItem,
528 &scriptFilter))
529 return NULL;
530 InsertFontResMenu(_self->ob_itself,
531 afterItem,
532 scriptFilter);
533 Py_INCREF(Py_None);
534 _res = Py_None;
535 return _res;
538 static PyObject *MenuObj_InsertIntlResMenu(MenuObject *_self, PyObject *_args)
540 PyObject *_res = NULL;
541 ResType theType;
542 short afterItem;
543 short scriptFilter;
544 #ifndef InsertIntlResMenu
545 PyMac_PRECHECK(InsertIntlResMenu);
546 #endif
547 if (!PyArg_ParseTuple(_args, "O&hh",
548 PyMac_GetOSType, &theType,
549 &afterItem,
550 &scriptFilter))
551 return NULL;
552 InsertIntlResMenu(_self->ob_itself,
553 theType,
554 afterItem,
555 scriptFilter);
556 Py_INCREF(Py_None);
557 _res = Py_None;
558 return _res;
561 static PyObject *MenuObj_AppendMenuItemText(MenuObject *_self, PyObject *_args)
563 PyObject *_res = NULL;
564 OSStatus _err;
565 Str255 inString;
566 #ifndef AppendMenuItemText
567 PyMac_PRECHECK(AppendMenuItemText);
568 #endif
569 if (!PyArg_ParseTuple(_args, "O&",
570 PyMac_GetStr255, inString))
571 return NULL;
572 _err = AppendMenuItemText(_self->ob_itself,
573 inString);
574 if (_err != noErr) return PyMac_Error(_err);
575 Py_INCREF(Py_None);
576 _res = Py_None;
577 return _res;
580 static PyObject *MenuObj_InsertMenuItemText(MenuObject *_self, PyObject *_args)
582 PyObject *_res = NULL;
583 OSStatus _err;
584 Str255 inString;
585 MenuItemIndex afterItem;
586 #ifndef InsertMenuItemText
587 PyMac_PRECHECK(InsertMenuItemText);
588 #endif
589 if (!PyArg_ParseTuple(_args, "O&h",
590 PyMac_GetStr255, inString,
591 &afterItem))
592 return NULL;
593 _err = InsertMenuItemText(_self->ob_itself,
594 inString,
595 afterItem);
596 if (_err != noErr) return PyMac_Error(_err);
597 Py_INCREF(Py_None);
598 _res = Py_None;
599 return _res;
602 #if TARGET_API_MAC_CARBON
604 static PyObject *MenuObj_CopyMenuItems(MenuObject *_self, PyObject *_args)
606 PyObject *_res = NULL;
607 OSStatus _err;
608 MenuItemIndex inFirstItem;
609 ItemCount inNumItems;
610 MenuHandle inDestMenu;
611 MenuItemIndex inInsertAfter;
612 #ifndef CopyMenuItems
613 PyMac_PRECHECK(CopyMenuItems);
614 #endif
615 if (!PyArg_ParseTuple(_args, "hlO&h",
616 &inFirstItem,
617 &inNumItems,
618 MenuObj_Convert, &inDestMenu,
619 &inInsertAfter))
620 return NULL;
621 _err = CopyMenuItems(_self->ob_itself,
622 inFirstItem,
623 inNumItems,
624 inDestMenu,
625 inInsertAfter);
626 if (_err != noErr) return PyMac_Error(_err);
627 Py_INCREF(Py_None);
628 _res = Py_None;
629 return _res;
631 #endif
633 #if TARGET_API_MAC_CARBON
635 static PyObject *MenuObj_DeleteMenuItems(MenuObject *_self, PyObject *_args)
637 PyObject *_res = NULL;
638 OSStatus _err;
639 MenuItemIndex inFirstItem;
640 ItemCount inNumItems;
641 #ifndef DeleteMenuItems
642 PyMac_PRECHECK(DeleteMenuItems);
643 #endif
644 if (!PyArg_ParseTuple(_args, "hl",
645 &inFirstItem,
646 &inNumItems))
647 return NULL;
648 _err = DeleteMenuItems(_self->ob_itself,
649 inFirstItem,
650 inNumItems);
651 if (_err != noErr) return PyMac_Error(_err);
652 Py_INCREF(Py_None);
653 _res = Py_None;
654 return _res;
656 #endif
658 #if TARGET_API_MAC_CARBON
660 static PyObject *MenuObj_AppendMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
662 PyObject *_res = NULL;
663 OSStatus _err;
664 CFStringRef inString;
665 MenuItemAttributes inAttributes;
666 MenuCommand inCommandID;
667 MenuItemIndex outNewItem;
668 #ifndef AppendMenuItemTextWithCFString
669 PyMac_PRECHECK(AppendMenuItemTextWithCFString);
670 #endif
671 if (!PyArg_ParseTuple(_args, "O&ll",
672 CFStringRefObj_Convert, &inString,
673 &inAttributes,
674 &inCommandID))
675 return NULL;
676 _err = AppendMenuItemTextWithCFString(_self->ob_itself,
677 inString,
678 inAttributes,
679 inCommandID,
680 &outNewItem);
681 if (_err != noErr) return PyMac_Error(_err);
682 _res = Py_BuildValue("h",
683 outNewItem);
684 return _res;
686 #endif
688 #if TARGET_API_MAC_CARBON
690 static PyObject *MenuObj_InsertMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
692 PyObject *_res = NULL;
693 OSStatus _err;
694 CFStringRef inString;
695 MenuItemIndex inAfterItem;
696 MenuItemAttributes inAttributes;
697 MenuCommand inCommandID;
698 #ifndef InsertMenuItemTextWithCFString
699 PyMac_PRECHECK(InsertMenuItemTextWithCFString);
700 #endif
701 if (!PyArg_ParseTuple(_args, "O&hll",
702 CFStringRefObj_Convert, &inString,
703 &inAfterItem,
704 &inAttributes,
705 &inCommandID))
706 return NULL;
707 _err = InsertMenuItemTextWithCFString(_self->ob_itself,
708 inString,
709 inAfterItem,
710 inAttributes,
711 inCommandID);
712 if (_err != noErr) return PyMac_Error(_err);
713 Py_INCREF(Py_None);
714 _res = Py_None;
715 return _res;
717 #endif
719 static PyObject *MenuObj_PopUpMenuSelect(MenuObject *_self, PyObject *_args)
721 PyObject *_res = NULL;
722 long _rv;
723 short top;
724 short left;
725 short popUpItem;
726 #ifndef PopUpMenuSelect
727 PyMac_PRECHECK(PopUpMenuSelect);
728 #endif
729 if (!PyArg_ParseTuple(_args, "hhh",
730 &top,
731 &left,
732 &popUpItem))
733 return NULL;
734 _rv = PopUpMenuSelect(_self->ob_itself,
735 top,
736 left,
737 popUpItem);
738 _res = Py_BuildValue("l",
739 _rv);
740 return _res;
743 #if TARGET_API_MAC_CARBON
745 static PyObject *MenuObj_InvalidateMenuEnabling(MenuObject *_self, PyObject *_args)
747 PyObject *_res = NULL;
748 OSStatus _err;
749 #ifndef InvalidateMenuEnabling
750 PyMac_PRECHECK(InvalidateMenuEnabling);
751 #endif
752 if (!PyArg_ParseTuple(_args, ""))
753 return NULL;
754 _err = InvalidateMenuEnabling(_self->ob_itself);
755 if (_err != noErr) return PyMac_Error(_err);
756 Py_INCREF(Py_None);
757 _res = Py_None;
758 return _res;
760 #endif
762 #if TARGET_API_MAC_CARBON
764 static PyObject *MenuObj_IsMenuBarInvalid(MenuObject *_self, PyObject *_args)
766 PyObject *_res = NULL;
767 Boolean _rv;
768 #ifndef IsMenuBarInvalid
769 PyMac_PRECHECK(IsMenuBarInvalid);
770 #endif
771 if (!PyArg_ParseTuple(_args, ""))
772 return NULL;
773 _rv = IsMenuBarInvalid(_self->ob_itself);
774 _res = Py_BuildValue("b",
775 _rv);
776 return _res;
778 #endif
780 static PyObject *MenuObj_MacInsertMenu(MenuObject *_self, PyObject *_args)
782 PyObject *_res = NULL;
783 MenuID beforeID;
784 #ifndef MacInsertMenu
785 PyMac_PRECHECK(MacInsertMenu);
786 #endif
787 if (!PyArg_ParseTuple(_args, "h",
788 &beforeID))
789 return NULL;
790 MacInsertMenu(_self->ob_itself,
791 beforeID);
792 Py_INCREF(Py_None);
793 _res = Py_None;
794 return _res;
797 #if TARGET_API_MAC_CARBON
799 static PyObject *MenuObj_SetRootMenu(MenuObject *_self, PyObject *_args)
801 PyObject *_res = NULL;
802 OSStatus _err;
803 #ifndef SetRootMenu
804 PyMac_PRECHECK(SetRootMenu);
805 #endif
806 if (!PyArg_ParseTuple(_args, ""))
807 return NULL;
808 _err = SetRootMenu(_self->ob_itself);
809 if (_err != noErr) return PyMac_Error(_err);
810 Py_INCREF(Py_None);
811 _res = Py_None;
812 return _res;
814 #endif
816 #if !TARGET_API_MAC_CARBON
818 static PyObject *MenuObj_CheckItem(MenuObject *_self, PyObject *_args)
820 PyObject *_res = NULL;
821 short item;
822 Boolean checked;
823 #ifndef CheckItem
824 PyMac_PRECHECK(CheckItem);
825 #endif
826 if (!PyArg_ParseTuple(_args, "hb",
827 &item,
828 &checked))
829 return NULL;
830 CheckItem(_self->ob_itself,
831 item,
832 checked);
833 Py_INCREF(Py_None);
834 _res = Py_None;
835 return _res;
837 #endif
839 static PyObject *MenuObj_MacCheckMenuItem(MenuObject *_self, PyObject *_args)
841 PyObject *_res = NULL;
842 short item;
843 Boolean checked;
844 #ifndef MacCheckMenuItem
845 PyMac_PRECHECK(MacCheckMenuItem);
846 #endif
847 if (!PyArg_ParseTuple(_args, "hb",
848 &item,
849 &checked))
850 return NULL;
851 MacCheckMenuItem(_self->ob_itself,
852 item,
853 checked);
854 Py_INCREF(Py_None);
855 _res = Py_None;
856 return _res;
859 static PyObject *MenuObj_SetMenuItemText(MenuObject *_self, PyObject *_args)
861 PyObject *_res = NULL;
862 short item;
863 Str255 itemString;
864 #ifndef SetMenuItemText
865 PyMac_PRECHECK(SetMenuItemText);
866 #endif
867 if (!PyArg_ParseTuple(_args, "hO&",
868 &item,
869 PyMac_GetStr255, itemString))
870 return NULL;
871 SetMenuItemText(_self->ob_itself,
872 item,
873 itemString);
874 Py_INCREF(Py_None);
875 _res = Py_None;
876 return _res;
879 static PyObject *MenuObj_GetMenuItemText(MenuObject *_self, PyObject *_args)
881 PyObject *_res = NULL;
882 short item;
883 Str255 itemString;
884 #ifndef GetMenuItemText
885 PyMac_PRECHECK(GetMenuItemText);
886 #endif
887 if (!PyArg_ParseTuple(_args, "h",
888 &item))
889 return NULL;
890 GetMenuItemText(_self->ob_itself,
891 item,
892 itemString);
893 _res = Py_BuildValue("O&",
894 PyMac_BuildStr255, itemString);
895 return _res;
898 static PyObject *MenuObj_SetItemMark(MenuObject *_self, PyObject *_args)
900 PyObject *_res = NULL;
901 short item;
902 CharParameter markChar;
903 #ifndef SetItemMark
904 PyMac_PRECHECK(SetItemMark);
905 #endif
906 if (!PyArg_ParseTuple(_args, "hh",
907 &item,
908 &markChar))
909 return NULL;
910 SetItemMark(_self->ob_itself,
911 item,
912 markChar);
913 Py_INCREF(Py_None);
914 _res = Py_None;
915 return _res;
918 static PyObject *MenuObj_GetItemMark(MenuObject *_self, PyObject *_args)
920 PyObject *_res = NULL;
921 short item;
922 CharParameter markChar;
923 #ifndef GetItemMark
924 PyMac_PRECHECK(GetItemMark);
925 #endif
926 if (!PyArg_ParseTuple(_args, "h",
927 &item))
928 return NULL;
929 GetItemMark(_self->ob_itself,
930 item,
931 &markChar);
932 _res = Py_BuildValue("h",
933 markChar);
934 return _res;
937 static PyObject *MenuObj_SetItemCmd(MenuObject *_self, PyObject *_args)
939 PyObject *_res = NULL;
940 short item;
941 CharParameter cmdChar;
942 #ifndef SetItemCmd
943 PyMac_PRECHECK(SetItemCmd);
944 #endif
945 if (!PyArg_ParseTuple(_args, "hh",
946 &item,
947 &cmdChar))
948 return NULL;
949 SetItemCmd(_self->ob_itself,
950 item,
951 cmdChar);
952 Py_INCREF(Py_None);
953 _res = Py_None;
954 return _res;
957 static PyObject *MenuObj_GetItemCmd(MenuObject *_self, PyObject *_args)
959 PyObject *_res = NULL;
960 short item;
961 CharParameter cmdChar;
962 #ifndef GetItemCmd
963 PyMac_PRECHECK(GetItemCmd);
964 #endif
965 if (!PyArg_ParseTuple(_args, "h",
966 &item))
967 return NULL;
968 GetItemCmd(_self->ob_itself,
969 item,
970 &cmdChar);
971 _res = Py_BuildValue("h",
972 cmdChar);
973 return _res;
976 static PyObject *MenuObj_SetItemIcon(MenuObject *_self, PyObject *_args)
978 PyObject *_res = NULL;
979 short item;
980 short iconIndex;
981 #ifndef SetItemIcon
982 PyMac_PRECHECK(SetItemIcon);
983 #endif
984 if (!PyArg_ParseTuple(_args, "hh",
985 &item,
986 &iconIndex))
987 return NULL;
988 SetItemIcon(_self->ob_itself,
989 item,
990 iconIndex);
991 Py_INCREF(Py_None);
992 _res = Py_None;
993 return _res;
996 static PyObject *MenuObj_GetItemIcon(MenuObject *_self, PyObject *_args)
998 PyObject *_res = NULL;
999 short item;
1000 short iconIndex;
1001 #ifndef GetItemIcon
1002 PyMac_PRECHECK(GetItemIcon);
1003 #endif
1004 if (!PyArg_ParseTuple(_args, "h",
1005 &item))
1006 return NULL;
1007 GetItemIcon(_self->ob_itself,
1008 item,
1009 &iconIndex);
1010 _res = Py_BuildValue("h",
1011 iconIndex);
1012 return _res;
1015 static PyObject *MenuObj_SetItemStyle(MenuObject *_self, PyObject *_args)
1017 PyObject *_res = NULL;
1018 short item;
1019 StyleParameter chStyle;
1020 #ifndef SetItemStyle
1021 PyMac_PRECHECK(SetItemStyle);
1022 #endif
1023 if (!PyArg_ParseTuple(_args, "hh",
1024 &item,
1025 &chStyle))
1026 return NULL;
1027 SetItemStyle(_self->ob_itself,
1028 item,
1029 chStyle);
1030 Py_INCREF(Py_None);
1031 _res = Py_None;
1032 return _res;
1035 static PyObject *MenuObj_GetItemStyle(MenuObject *_self, PyObject *_args)
1037 PyObject *_res = NULL;
1038 short item;
1039 Style chStyle;
1040 #ifndef GetItemStyle
1041 PyMac_PRECHECK(GetItemStyle);
1042 #endif
1043 if (!PyArg_ParseTuple(_args, "h",
1044 &item))
1045 return NULL;
1046 GetItemStyle(_self->ob_itself,
1047 item,
1048 &chStyle);
1049 _res = Py_BuildValue("b",
1050 chStyle);
1051 return _res;
1054 #if !TARGET_API_MAC_CARBON
1056 static PyObject *MenuObj_DisableItem(MenuObject *_self, PyObject *_args)
1058 PyObject *_res = NULL;
1059 short item;
1060 #ifndef DisableItem
1061 PyMac_PRECHECK(DisableItem);
1062 #endif
1063 if (!PyArg_ParseTuple(_args, "h",
1064 &item))
1065 return NULL;
1066 DisableItem(_self->ob_itself,
1067 item);
1068 Py_INCREF(Py_None);
1069 _res = Py_None;
1070 return _res;
1072 #endif
1074 #if !TARGET_API_MAC_CARBON
1076 static PyObject *MenuObj_EnableItem(MenuObject *_self, PyObject *_args)
1078 PyObject *_res = NULL;
1079 short item;
1080 #ifndef EnableItem
1081 PyMac_PRECHECK(EnableItem);
1082 #endif
1083 if (!PyArg_ParseTuple(_args, "h",
1084 &item))
1085 return NULL;
1086 EnableItem(_self->ob_itself,
1087 item);
1088 Py_INCREF(Py_None);
1089 _res = Py_None;
1090 return _res;
1092 #endif
1094 static PyObject *MenuObj_SetMenuItemCommandID(MenuObject *_self, PyObject *_args)
1096 PyObject *_res = NULL;
1097 OSErr _err;
1098 SInt16 inItem;
1099 MenuCommand inCommandID;
1100 #ifndef SetMenuItemCommandID
1101 PyMac_PRECHECK(SetMenuItemCommandID);
1102 #endif
1103 if (!PyArg_ParseTuple(_args, "hl",
1104 &inItem,
1105 &inCommandID))
1106 return NULL;
1107 _err = SetMenuItemCommandID(_self->ob_itself,
1108 inItem,
1109 inCommandID);
1110 if (_err != noErr) return PyMac_Error(_err);
1111 Py_INCREF(Py_None);
1112 _res = Py_None;
1113 return _res;
1116 static PyObject *MenuObj_GetMenuItemCommandID(MenuObject *_self, PyObject *_args)
1118 PyObject *_res = NULL;
1119 OSErr _err;
1120 SInt16 inItem;
1121 MenuCommand outCommandID;
1122 #ifndef GetMenuItemCommandID
1123 PyMac_PRECHECK(GetMenuItemCommandID);
1124 #endif
1125 if (!PyArg_ParseTuple(_args, "h",
1126 &inItem))
1127 return NULL;
1128 _err = GetMenuItemCommandID(_self->ob_itself,
1129 inItem,
1130 &outCommandID);
1131 if (_err != noErr) return PyMac_Error(_err);
1132 _res = Py_BuildValue("l",
1133 outCommandID);
1134 return _res;
1137 static PyObject *MenuObj_SetMenuItemModifiers(MenuObject *_self, PyObject *_args)
1139 PyObject *_res = NULL;
1140 OSErr _err;
1141 SInt16 inItem;
1142 UInt8 inModifiers;
1143 #ifndef SetMenuItemModifiers
1144 PyMac_PRECHECK(SetMenuItemModifiers);
1145 #endif
1146 if (!PyArg_ParseTuple(_args, "hb",
1147 &inItem,
1148 &inModifiers))
1149 return NULL;
1150 _err = SetMenuItemModifiers(_self->ob_itself,
1151 inItem,
1152 inModifiers);
1153 if (_err != noErr) return PyMac_Error(_err);
1154 Py_INCREF(Py_None);
1155 _res = Py_None;
1156 return _res;
1159 static PyObject *MenuObj_GetMenuItemModifiers(MenuObject *_self, PyObject *_args)
1161 PyObject *_res = NULL;
1162 OSErr _err;
1163 SInt16 inItem;
1164 UInt8 outModifiers;
1165 #ifndef GetMenuItemModifiers
1166 PyMac_PRECHECK(GetMenuItemModifiers);
1167 #endif
1168 if (!PyArg_ParseTuple(_args, "h",
1169 &inItem))
1170 return NULL;
1171 _err = GetMenuItemModifiers(_self->ob_itself,
1172 inItem,
1173 &outModifiers);
1174 if (_err != noErr) return PyMac_Error(_err);
1175 _res = Py_BuildValue("b",
1176 outModifiers);
1177 return _res;
1180 static PyObject *MenuObj_SetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
1182 PyObject *_res = NULL;
1183 OSErr _err;
1184 SInt16 inItem;
1185 UInt8 inIconType;
1186 Handle inIconHandle;
1187 #ifndef SetMenuItemIconHandle
1188 PyMac_PRECHECK(SetMenuItemIconHandle);
1189 #endif
1190 if (!PyArg_ParseTuple(_args, "hbO&",
1191 &inItem,
1192 &inIconType,
1193 ResObj_Convert, &inIconHandle))
1194 return NULL;
1195 _err = SetMenuItemIconHandle(_self->ob_itself,
1196 inItem,
1197 inIconType,
1198 inIconHandle);
1199 if (_err != noErr) return PyMac_Error(_err);
1200 Py_INCREF(Py_None);
1201 _res = Py_None;
1202 return _res;
1205 static PyObject *MenuObj_GetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
1207 PyObject *_res = NULL;
1208 OSErr _err;
1209 SInt16 inItem;
1210 UInt8 outIconType;
1211 Handle outIconHandle;
1212 #ifndef GetMenuItemIconHandle
1213 PyMac_PRECHECK(GetMenuItemIconHandle);
1214 #endif
1215 if (!PyArg_ParseTuple(_args, "h",
1216 &inItem))
1217 return NULL;
1218 _err = GetMenuItemIconHandle(_self->ob_itself,
1219 inItem,
1220 &outIconType,
1221 &outIconHandle);
1222 if (_err != noErr) return PyMac_Error(_err);
1223 _res = Py_BuildValue("bO&",
1224 outIconType,
1225 ResObj_New, outIconHandle);
1226 return _res;
1229 static PyObject *MenuObj_SetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
1231 PyObject *_res = NULL;
1232 OSErr _err;
1233 SInt16 inItem;
1234 TextEncoding inScriptID;
1235 #ifndef SetMenuItemTextEncoding
1236 PyMac_PRECHECK(SetMenuItemTextEncoding);
1237 #endif
1238 if (!PyArg_ParseTuple(_args, "hl",
1239 &inItem,
1240 &inScriptID))
1241 return NULL;
1242 _err = SetMenuItemTextEncoding(_self->ob_itself,
1243 inItem,
1244 inScriptID);
1245 if (_err != noErr) return PyMac_Error(_err);
1246 Py_INCREF(Py_None);
1247 _res = Py_None;
1248 return _res;
1251 static PyObject *MenuObj_GetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
1253 PyObject *_res = NULL;
1254 OSErr _err;
1255 SInt16 inItem;
1256 TextEncoding outScriptID;
1257 #ifndef GetMenuItemTextEncoding
1258 PyMac_PRECHECK(GetMenuItemTextEncoding);
1259 #endif
1260 if (!PyArg_ParseTuple(_args, "h",
1261 &inItem))
1262 return NULL;
1263 _err = GetMenuItemTextEncoding(_self->ob_itself,
1264 inItem,
1265 &outScriptID);
1266 if (_err != noErr) return PyMac_Error(_err);
1267 _res = Py_BuildValue("l",
1268 outScriptID);
1269 return _res;
1272 static PyObject *MenuObj_SetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
1274 PyObject *_res = NULL;
1275 OSErr _err;
1276 SInt16 inItem;
1277 MenuID inHierID;
1278 #ifndef SetMenuItemHierarchicalID
1279 PyMac_PRECHECK(SetMenuItemHierarchicalID);
1280 #endif
1281 if (!PyArg_ParseTuple(_args, "hh",
1282 &inItem,
1283 &inHierID))
1284 return NULL;
1285 _err = SetMenuItemHierarchicalID(_self->ob_itself,
1286 inItem,
1287 inHierID);
1288 if (_err != noErr) return PyMac_Error(_err);
1289 Py_INCREF(Py_None);
1290 _res = Py_None;
1291 return _res;
1294 static PyObject *MenuObj_GetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
1296 PyObject *_res = NULL;
1297 OSErr _err;
1298 SInt16 inItem;
1299 MenuID outHierID;
1300 #ifndef GetMenuItemHierarchicalID
1301 PyMac_PRECHECK(GetMenuItemHierarchicalID);
1302 #endif
1303 if (!PyArg_ParseTuple(_args, "h",
1304 &inItem))
1305 return NULL;
1306 _err = GetMenuItemHierarchicalID(_self->ob_itself,
1307 inItem,
1308 &outHierID);
1309 if (_err != noErr) return PyMac_Error(_err);
1310 _res = Py_BuildValue("h",
1311 outHierID);
1312 return _res;
1315 static PyObject *MenuObj_SetMenuItemFontID(MenuObject *_self, PyObject *_args)
1317 PyObject *_res = NULL;
1318 OSErr _err;
1319 SInt16 inItem;
1320 SInt16 inFontID;
1321 #ifndef SetMenuItemFontID
1322 PyMac_PRECHECK(SetMenuItemFontID);
1323 #endif
1324 if (!PyArg_ParseTuple(_args, "hh",
1325 &inItem,
1326 &inFontID))
1327 return NULL;
1328 _err = SetMenuItemFontID(_self->ob_itself,
1329 inItem,
1330 inFontID);
1331 if (_err != noErr) return PyMac_Error(_err);
1332 Py_INCREF(Py_None);
1333 _res = Py_None;
1334 return _res;
1337 static PyObject *MenuObj_GetMenuItemFontID(MenuObject *_self, PyObject *_args)
1339 PyObject *_res = NULL;
1340 OSErr _err;
1341 SInt16 inItem;
1342 SInt16 outFontID;
1343 #ifndef GetMenuItemFontID
1344 PyMac_PRECHECK(GetMenuItemFontID);
1345 #endif
1346 if (!PyArg_ParseTuple(_args, "h",
1347 &inItem))
1348 return NULL;
1349 _err = GetMenuItemFontID(_self->ob_itself,
1350 inItem,
1351 &outFontID);
1352 if (_err != noErr) return PyMac_Error(_err);
1353 _res = Py_BuildValue("h",
1354 outFontID);
1355 return _res;
1358 static PyObject *MenuObj_SetMenuItemRefCon(MenuObject *_self, PyObject *_args)
1360 PyObject *_res = NULL;
1361 OSErr _err;
1362 SInt16 inItem;
1363 UInt32 inRefCon;
1364 #ifndef SetMenuItemRefCon
1365 PyMac_PRECHECK(SetMenuItemRefCon);
1366 #endif
1367 if (!PyArg_ParseTuple(_args, "hl",
1368 &inItem,
1369 &inRefCon))
1370 return NULL;
1371 _err = SetMenuItemRefCon(_self->ob_itself,
1372 inItem,
1373 inRefCon);
1374 if (_err != noErr) return PyMac_Error(_err);
1375 Py_INCREF(Py_None);
1376 _res = Py_None;
1377 return _res;
1380 static PyObject *MenuObj_GetMenuItemRefCon(MenuObject *_self, PyObject *_args)
1382 PyObject *_res = NULL;
1383 OSErr _err;
1384 SInt16 inItem;
1385 UInt32 outRefCon;
1386 #ifndef GetMenuItemRefCon
1387 PyMac_PRECHECK(GetMenuItemRefCon);
1388 #endif
1389 if (!PyArg_ParseTuple(_args, "h",
1390 &inItem))
1391 return NULL;
1392 _err = GetMenuItemRefCon(_self->ob_itself,
1393 inItem,
1394 &outRefCon);
1395 if (_err != noErr) return PyMac_Error(_err);
1396 _res = Py_BuildValue("l",
1397 outRefCon);
1398 return _res;
1401 #if !TARGET_API_MAC_CARBON
1403 static PyObject *MenuObj_SetMenuItemRefCon2(MenuObject *_self, PyObject *_args)
1405 PyObject *_res = NULL;
1406 OSErr _err;
1407 SInt16 inItem;
1408 UInt32 inRefCon2;
1409 #ifndef SetMenuItemRefCon2
1410 PyMac_PRECHECK(SetMenuItemRefCon2);
1411 #endif
1412 if (!PyArg_ParseTuple(_args, "hl",
1413 &inItem,
1414 &inRefCon2))
1415 return NULL;
1416 _err = SetMenuItemRefCon2(_self->ob_itself,
1417 inItem,
1418 inRefCon2);
1419 if (_err != noErr) return PyMac_Error(_err);
1420 Py_INCREF(Py_None);
1421 _res = Py_None;
1422 return _res;
1424 #endif
1426 #if !TARGET_API_MAC_CARBON
1428 static PyObject *MenuObj_GetMenuItemRefCon2(MenuObject *_self, PyObject *_args)
1430 PyObject *_res = NULL;
1431 OSErr _err;
1432 SInt16 inItem;
1433 UInt32 outRefCon2;
1434 #ifndef GetMenuItemRefCon2
1435 PyMac_PRECHECK(GetMenuItemRefCon2);
1436 #endif
1437 if (!PyArg_ParseTuple(_args, "h",
1438 &inItem))
1439 return NULL;
1440 _err = GetMenuItemRefCon2(_self->ob_itself,
1441 inItem,
1442 &outRefCon2);
1443 if (_err != noErr) return PyMac_Error(_err);
1444 _res = Py_BuildValue("l",
1445 outRefCon2);
1446 return _res;
1448 #endif
1450 static PyObject *MenuObj_SetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
1452 PyObject *_res = NULL;
1453 OSErr _err;
1454 SInt16 inItem;
1455 SInt16 inGlyph;
1456 #ifndef SetMenuItemKeyGlyph
1457 PyMac_PRECHECK(SetMenuItemKeyGlyph);
1458 #endif
1459 if (!PyArg_ParseTuple(_args, "hh",
1460 &inItem,
1461 &inGlyph))
1462 return NULL;
1463 _err = SetMenuItemKeyGlyph(_self->ob_itself,
1464 inItem,
1465 inGlyph);
1466 if (_err != noErr) return PyMac_Error(_err);
1467 Py_INCREF(Py_None);
1468 _res = Py_None;
1469 return _res;
1472 static PyObject *MenuObj_GetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
1474 PyObject *_res = NULL;
1475 OSErr _err;
1476 SInt16 inItem;
1477 SInt16 outGlyph;
1478 #ifndef GetMenuItemKeyGlyph
1479 PyMac_PRECHECK(GetMenuItemKeyGlyph);
1480 #endif
1481 if (!PyArg_ParseTuple(_args, "h",
1482 &inItem))
1483 return NULL;
1484 _err = GetMenuItemKeyGlyph(_self->ob_itself,
1485 inItem,
1486 &outGlyph);
1487 if (_err != noErr) return PyMac_Error(_err);
1488 _res = Py_BuildValue("h",
1489 outGlyph);
1490 return _res;
1493 static PyObject *MenuObj_MacEnableMenuItem(MenuObject *_self, PyObject *_args)
1495 PyObject *_res = NULL;
1496 MenuItemIndex item;
1497 #ifndef MacEnableMenuItem
1498 PyMac_PRECHECK(MacEnableMenuItem);
1499 #endif
1500 if (!PyArg_ParseTuple(_args, "h",
1501 &item))
1502 return NULL;
1503 MacEnableMenuItem(_self->ob_itself,
1504 item);
1505 Py_INCREF(Py_None);
1506 _res = Py_None;
1507 return _res;
1510 static PyObject *MenuObj_DisableMenuItem(MenuObject *_self, PyObject *_args)
1512 PyObject *_res = NULL;
1513 MenuItemIndex item;
1514 #ifndef DisableMenuItem
1515 PyMac_PRECHECK(DisableMenuItem);
1516 #endif
1517 if (!PyArg_ParseTuple(_args, "h",
1518 &item))
1519 return NULL;
1520 DisableMenuItem(_self->ob_itself,
1521 item);
1522 Py_INCREF(Py_None);
1523 _res = Py_None;
1524 return _res;
1527 static PyObject *MenuObj_IsMenuItemEnabled(MenuObject *_self, PyObject *_args)
1529 PyObject *_res = NULL;
1530 Boolean _rv;
1531 MenuItemIndex item;
1532 #ifndef IsMenuItemEnabled
1533 PyMac_PRECHECK(IsMenuItemEnabled);
1534 #endif
1535 if (!PyArg_ParseTuple(_args, "h",
1536 &item))
1537 return NULL;
1538 _rv = IsMenuItemEnabled(_self->ob_itself,
1539 item);
1540 _res = Py_BuildValue("b",
1541 _rv);
1542 return _res;
1545 static PyObject *MenuObj_EnableMenuItemIcon(MenuObject *_self, PyObject *_args)
1547 PyObject *_res = NULL;
1548 MenuItemIndex item;
1549 #ifndef EnableMenuItemIcon
1550 PyMac_PRECHECK(EnableMenuItemIcon);
1551 #endif
1552 if (!PyArg_ParseTuple(_args, "h",
1553 &item))
1554 return NULL;
1555 EnableMenuItemIcon(_self->ob_itself,
1556 item);
1557 Py_INCREF(Py_None);
1558 _res = Py_None;
1559 return _res;
1562 static PyObject *MenuObj_DisableMenuItemIcon(MenuObject *_self, PyObject *_args)
1564 PyObject *_res = NULL;
1565 MenuItemIndex item;
1566 #ifndef DisableMenuItemIcon
1567 PyMac_PRECHECK(DisableMenuItemIcon);
1568 #endif
1569 if (!PyArg_ParseTuple(_args, "h",
1570 &item))
1571 return NULL;
1572 DisableMenuItemIcon(_self->ob_itself,
1573 item);
1574 Py_INCREF(Py_None);
1575 _res = Py_None;
1576 return _res;
1579 static PyObject *MenuObj_IsMenuItemIconEnabled(MenuObject *_self, PyObject *_args)
1581 PyObject *_res = NULL;
1582 Boolean _rv;
1583 MenuItemIndex item;
1584 #ifndef IsMenuItemIconEnabled
1585 PyMac_PRECHECK(IsMenuItemIconEnabled);
1586 #endif
1587 if (!PyArg_ParseTuple(_args, "h",
1588 &item))
1589 return NULL;
1590 _rv = IsMenuItemIconEnabled(_self->ob_itself,
1591 item);
1592 _res = Py_BuildValue("b",
1593 _rv);
1594 return _res;
1597 #if TARGET_API_MAC_CARBON
1599 static PyObject *MenuObj_SetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args)
1601 PyObject *_res = NULL;
1602 OSStatus _err;
1603 MenuItemIndex inItem;
1604 MenuHandle inHierMenu;
1605 #ifndef SetMenuItemHierarchicalMenu
1606 PyMac_PRECHECK(SetMenuItemHierarchicalMenu);
1607 #endif
1608 if (!PyArg_ParseTuple(_args, "hO&",
1609 &inItem,
1610 MenuObj_Convert, &inHierMenu))
1611 return NULL;
1612 _err = SetMenuItemHierarchicalMenu(_self->ob_itself,
1613 inItem,
1614 inHierMenu);
1615 if (_err != noErr) return PyMac_Error(_err);
1616 Py_INCREF(Py_None);
1617 _res = Py_None;
1618 return _res;
1620 #endif
1622 #if TARGET_API_MAC_CARBON
1624 static PyObject *MenuObj_GetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args)
1626 PyObject *_res = NULL;
1627 OSStatus _err;
1628 MenuItemIndex inItem;
1629 MenuHandle outHierMenu;
1630 #ifndef GetMenuItemHierarchicalMenu
1631 PyMac_PRECHECK(GetMenuItemHierarchicalMenu);
1632 #endif
1633 if (!PyArg_ParseTuple(_args, "h",
1634 &inItem))
1635 return NULL;
1636 _err = GetMenuItemHierarchicalMenu(_self->ob_itself,
1637 inItem,
1638 &outHierMenu);
1639 if (_err != noErr) return PyMac_Error(_err);
1640 _res = Py_BuildValue("O&",
1641 OptMenuObj_New, outHierMenu);
1642 return _res;
1644 #endif
1646 #if TARGET_API_MAC_CARBON
1648 static PyObject *MenuObj_CopyMenuItemTextAsCFString(MenuObject *_self, PyObject *_args)
1650 PyObject *_res = NULL;
1651 OSStatus _err;
1652 MenuItemIndex inItem;
1653 CFStringRef outString;
1654 #ifndef CopyMenuItemTextAsCFString
1655 PyMac_PRECHECK(CopyMenuItemTextAsCFString);
1656 #endif
1657 if (!PyArg_ParseTuple(_args, "h",
1658 &inItem))
1659 return NULL;
1660 _err = CopyMenuItemTextAsCFString(_self->ob_itself,
1661 inItem,
1662 &outString);
1663 if (_err != noErr) return PyMac_Error(_err);
1664 _res = Py_BuildValue("O&",
1665 CFStringRefObj_New, outString);
1666 return _res;
1668 #endif
1670 #if TARGET_API_MAC_CARBON
1672 static PyObject *MenuObj_SetMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
1674 PyObject *_res = NULL;
1675 OSStatus _err;
1676 MenuItemIndex inItem;
1677 CFStringRef inString;
1678 #ifndef SetMenuItemTextWithCFString
1679 PyMac_PRECHECK(SetMenuItemTextWithCFString);
1680 #endif
1681 if (!PyArg_ParseTuple(_args, "hO&",
1682 &inItem,
1683 CFStringRefObj_Convert, &inString))
1684 return NULL;
1685 _err = SetMenuItemTextWithCFString(_self->ob_itself,
1686 inItem,
1687 inString);
1688 if (_err != noErr) return PyMac_Error(_err);
1689 Py_INCREF(Py_None);
1690 _res = Py_None;
1691 return _res;
1693 #endif
1695 #if TARGET_API_MAC_CARBON
1697 static PyObject *MenuObj_GetMenuItemIndent(MenuObject *_self, PyObject *_args)
1699 PyObject *_res = NULL;
1700 OSStatus _err;
1701 MenuItemIndex inItem;
1702 UInt32 outIndent;
1703 #ifndef GetMenuItemIndent
1704 PyMac_PRECHECK(GetMenuItemIndent);
1705 #endif
1706 if (!PyArg_ParseTuple(_args, "h",
1707 &inItem))
1708 return NULL;
1709 _err = GetMenuItemIndent(_self->ob_itself,
1710 inItem,
1711 &outIndent);
1712 if (_err != noErr) return PyMac_Error(_err);
1713 _res = Py_BuildValue("l",
1714 outIndent);
1715 return _res;
1717 #endif
1719 #if TARGET_API_MAC_CARBON
1721 static PyObject *MenuObj_SetMenuItemIndent(MenuObject *_self, PyObject *_args)
1723 PyObject *_res = NULL;
1724 OSStatus _err;
1725 MenuItemIndex inItem;
1726 UInt32 inIndent;
1727 #ifndef SetMenuItemIndent
1728 PyMac_PRECHECK(SetMenuItemIndent);
1729 #endif
1730 if (!PyArg_ParseTuple(_args, "hl",
1731 &inItem,
1732 &inIndent))
1733 return NULL;
1734 _err = SetMenuItemIndent(_self->ob_itself,
1735 inItem,
1736 inIndent);
1737 if (_err != noErr) return PyMac_Error(_err);
1738 Py_INCREF(Py_None);
1739 _res = Py_None;
1740 return _res;
1742 #endif
1744 #if TARGET_API_MAC_CARBON
1746 static PyObject *MenuObj_GetMenuItemCommandKey(MenuObject *_self, PyObject *_args)
1748 PyObject *_res = NULL;
1749 OSStatus _err;
1750 MenuItemIndex inItem;
1751 Boolean inGetVirtualKey;
1752 UInt16 outKey;
1753 #ifndef GetMenuItemCommandKey
1754 PyMac_PRECHECK(GetMenuItemCommandKey);
1755 #endif
1756 if (!PyArg_ParseTuple(_args, "hb",
1757 &inItem,
1758 &inGetVirtualKey))
1759 return NULL;
1760 _err = GetMenuItemCommandKey(_self->ob_itself,
1761 inItem,
1762 inGetVirtualKey,
1763 &outKey);
1764 if (_err != noErr) return PyMac_Error(_err);
1765 _res = Py_BuildValue("H",
1766 outKey);
1767 return _res;
1769 #endif
1771 #if TARGET_API_MAC_CARBON
1773 static PyObject *MenuObj_SetMenuItemCommandKey(MenuObject *_self, PyObject *_args)
1775 PyObject *_res = NULL;
1776 OSStatus _err;
1777 MenuItemIndex inItem;
1778 Boolean inSetVirtualKey;
1779 UInt16 inKey;
1780 #ifndef SetMenuItemCommandKey
1781 PyMac_PRECHECK(SetMenuItemCommandKey);
1782 #endif
1783 if (!PyArg_ParseTuple(_args, "hbH",
1784 &inItem,
1785 &inSetVirtualKey,
1786 &inKey))
1787 return NULL;
1788 _err = SetMenuItemCommandKey(_self->ob_itself,
1789 inItem,
1790 inSetVirtualKey,
1791 inKey);
1792 if (_err != noErr) return PyMac_Error(_err);
1793 Py_INCREF(Py_None);
1794 _res = Py_None;
1795 return _res;
1797 #endif
1799 #if TARGET_API_MAC_CARBON
1801 static PyObject *MenuObj_GetMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
1803 PyObject *_res = NULL;
1804 OSStatus _err;
1805 MenuItemIndex item;
1806 OSType propertyCreator;
1807 OSType propertyTag;
1808 UInt32 attributes;
1809 #ifndef GetMenuItemPropertyAttributes
1810 PyMac_PRECHECK(GetMenuItemPropertyAttributes);
1811 #endif
1812 if (!PyArg_ParseTuple(_args, "hO&O&",
1813 &item,
1814 PyMac_GetOSType, &propertyCreator,
1815 PyMac_GetOSType, &propertyTag))
1816 return NULL;
1817 _err = GetMenuItemPropertyAttributes(_self->ob_itself,
1818 item,
1819 propertyCreator,
1820 propertyTag,
1821 &attributes);
1822 if (_err != noErr) return PyMac_Error(_err);
1823 _res = Py_BuildValue("l",
1824 attributes);
1825 return _res;
1827 #endif
1829 #if TARGET_API_MAC_CARBON
1831 static PyObject *MenuObj_ChangeMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
1833 PyObject *_res = NULL;
1834 OSStatus _err;
1835 MenuItemIndex item;
1836 OSType propertyCreator;
1837 OSType propertyTag;
1838 UInt32 attributesToSet;
1839 UInt32 attributesToClear;
1840 #ifndef ChangeMenuItemPropertyAttributes
1841 PyMac_PRECHECK(ChangeMenuItemPropertyAttributes);
1842 #endif
1843 if (!PyArg_ParseTuple(_args, "hO&O&ll",
1844 &item,
1845 PyMac_GetOSType, &propertyCreator,
1846 PyMac_GetOSType, &propertyTag,
1847 &attributesToSet,
1848 &attributesToClear))
1849 return NULL;
1850 _err = ChangeMenuItemPropertyAttributes(_self->ob_itself,
1851 item,
1852 propertyCreator,
1853 propertyTag,
1854 attributesToSet,
1855 attributesToClear);
1856 if (_err != noErr) return PyMac_Error(_err);
1857 Py_INCREF(Py_None);
1858 _res = Py_None;
1859 return _res;
1861 #endif
1863 #if TARGET_API_MAC_CARBON
1865 static PyObject *MenuObj_GetMenuAttributes(MenuObject *_self, PyObject *_args)
1867 PyObject *_res = NULL;
1868 OSStatus _err;
1869 MenuAttributes outAttributes;
1870 #ifndef GetMenuAttributes
1871 PyMac_PRECHECK(GetMenuAttributes);
1872 #endif
1873 if (!PyArg_ParseTuple(_args, ""))
1874 return NULL;
1875 _err = GetMenuAttributes(_self->ob_itself,
1876 &outAttributes);
1877 if (_err != noErr) return PyMac_Error(_err);
1878 _res = Py_BuildValue("l",
1879 outAttributes);
1880 return _res;
1882 #endif
1884 #if TARGET_API_MAC_CARBON
1886 static PyObject *MenuObj_ChangeMenuAttributes(MenuObject *_self, PyObject *_args)
1888 PyObject *_res = NULL;
1889 OSStatus _err;
1890 MenuAttributes setTheseAttributes;
1891 MenuAttributes clearTheseAttributes;
1892 #ifndef ChangeMenuAttributes
1893 PyMac_PRECHECK(ChangeMenuAttributes);
1894 #endif
1895 if (!PyArg_ParseTuple(_args, "ll",
1896 &setTheseAttributes,
1897 &clearTheseAttributes))
1898 return NULL;
1899 _err = ChangeMenuAttributes(_self->ob_itself,
1900 setTheseAttributes,
1901 clearTheseAttributes);
1902 if (_err != noErr) return PyMac_Error(_err);
1903 Py_INCREF(Py_None);
1904 _res = Py_None;
1905 return _res;
1907 #endif
1909 #if TARGET_API_MAC_CARBON
1911 static PyObject *MenuObj_GetMenuItemAttributes(MenuObject *_self, PyObject *_args)
1913 PyObject *_res = NULL;
1914 OSStatus _err;
1915 MenuItemIndex item;
1916 MenuItemAttributes outAttributes;
1917 #ifndef GetMenuItemAttributes
1918 PyMac_PRECHECK(GetMenuItemAttributes);
1919 #endif
1920 if (!PyArg_ParseTuple(_args, "h",
1921 &item))
1922 return NULL;
1923 _err = GetMenuItemAttributes(_self->ob_itself,
1924 item,
1925 &outAttributes);
1926 if (_err != noErr) return PyMac_Error(_err);
1927 _res = Py_BuildValue("l",
1928 outAttributes);
1929 return _res;
1931 #endif
1933 #if TARGET_API_MAC_CARBON
1935 static PyObject *MenuObj_ChangeMenuItemAttributes(MenuObject *_self, PyObject *_args)
1937 PyObject *_res = NULL;
1938 OSStatus _err;
1939 MenuItemIndex item;
1940 MenuItemAttributes setTheseAttributes;
1941 MenuItemAttributes clearTheseAttributes;
1942 #ifndef ChangeMenuItemAttributes
1943 PyMac_PRECHECK(ChangeMenuItemAttributes);
1944 #endif
1945 if (!PyArg_ParseTuple(_args, "hll",
1946 &item,
1947 &setTheseAttributes,
1948 &clearTheseAttributes))
1949 return NULL;
1950 _err = ChangeMenuItemAttributes(_self->ob_itself,
1951 item,
1952 setTheseAttributes,
1953 clearTheseAttributes);
1954 if (_err != noErr) return PyMac_Error(_err);
1955 Py_INCREF(Py_None);
1956 _res = Py_None;
1957 return _res;
1959 #endif
1961 #if TARGET_API_MAC_CARBON
1963 static PyObject *MenuObj_DisableAllMenuItems(MenuObject *_self, PyObject *_args)
1965 PyObject *_res = NULL;
1966 #ifndef DisableAllMenuItems
1967 PyMac_PRECHECK(DisableAllMenuItems);
1968 #endif
1969 if (!PyArg_ParseTuple(_args, ""))
1970 return NULL;
1971 DisableAllMenuItems(_self->ob_itself);
1972 Py_INCREF(Py_None);
1973 _res = Py_None;
1974 return _res;
1976 #endif
1978 #if TARGET_API_MAC_CARBON
1980 static PyObject *MenuObj_EnableAllMenuItems(MenuObject *_self, PyObject *_args)
1982 PyObject *_res = NULL;
1983 #ifndef EnableAllMenuItems
1984 PyMac_PRECHECK(EnableAllMenuItems);
1985 #endif
1986 if (!PyArg_ParseTuple(_args, ""))
1987 return NULL;
1988 EnableAllMenuItems(_self->ob_itself);
1989 Py_INCREF(Py_None);
1990 _res = Py_None;
1991 return _res;
1993 #endif
1995 #if TARGET_API_MAC_CARBON
1997 static PyObject *MenuObj_MenuHasEnabledItems(MenuObject *_self, PyObject *_args)
1999 PyObject *_res = NULL;
2000 Boolean _rv;
2001 #ifndef MenuHasEnabledItems
2002 PyMac_PRECHECK(MenuHasEnabledItems);
2003 #endif
2004 if (!PyArg_ParseTuple(_args, ""))
2005 return NULL;
2006 _rv = MenuHasEnabledItems(_self->ob_itself);
2007 _res = Py_BuildValue("b",
2008 _rv);
2009 return _res;
2011 #endif
2013 #if TARGET_API_MAC_CARBON
2015 static PyObject *MenuObj_GetMenuType(MenuObject *_self, PyObject *_args)
2017 PyObject *_res = NULL;
2018 OSStatus _err;
2019 UInt16 outType;
2020 #ifndef GetMenuType
2021 PyMac_PRECHECK(GetMenuType);
2022 #endif
2023 if (!PyArg_ParseTuple(_args, ""))
2024 return NULL;
2025 _err = GetMenuType(_self->ob_itself,
2026 &outType);
2027 if (_err != noErr) return PyMac_Error(_err);
2028 _res = Py_BuildValue("H",
2029 outType);
2030 return _res;
2032 #endif
2034 #if TARGET_API_MAC_CARBON
2036 static PyObject *MenuObj_CountMenuItemsWithCommandID(MenuObject *_self, PyObject *_args)
2038 PyObject *_res = NULL;
2039 ItemCount _rv;
2040 MenuCommand inCommandID;
2041 #ifndef CountMenuItemsWithCommandID
2042 PyMac_PRECHECK(CountMenuItemsWithCommandID);
2043 #endif
2044 if (!PyArg_ParseTuple(_args, "l",
2045 &inCommandID))
2046 return NULL;
2047 _rv = CountMenuItemsWithCommandID(_self->ob_itself,
2048 inCommandID);
2049 _res = Py_BuildValue("l",
2050 _rv);
2051 return _res;
2053 #endif
2055 #if TARGET_API_MAC_CARBON
2057 static PyObject *MenuObj_GetIndMenuItemWithCommandID(MenuObject *_self, PyObject *_args)
2059 PyObject *_res = NULL;
2060 OSStatus _err;
2061 MenuCommand inCommandID;
2062 UInt32 inItemIndex;
2063 MenuHandle outMenu;
2064 MenuItemIndex outIndex;
2065 #ifndef GetIndMenuItemWithCommandID
2066 PyMac_PRECHECK(GetIndMenuItemWithCommandID);
2067 #endif
2068 if (!PyArg_ParseTuple(_args, "ll",
2069 &inCommandID,
2070 &inItemIndex))
2071 return NULL;
2072 _err = GetIndMenuItemWithCommandID(_self->ob_itself,
2073 inCommandID,
2074 inItemIndex,
2075 &outMenu,
2076 &outIndex);
2077 if (_err != noErr) return PyMac_Error(_err);
2078 _res = Py_BuildValue("O&h",
2079 MenuObj_New, outMenu,
2080 outIndex);
2081 return _res;
2083 #endif
2085 #if TARGET_API_MAC_CARBON
2087 static PyObject *MenuObj_EnableMenuCommand(MenuObject *_self, PyObject *_args)
2089 PyObject *_res = NULL;
2090 MenuCommand inCommandID;
2091 #ifndef EnableMenuCommand
2092 PyMac_PRECHECK(EnableMenuCommand);
2093 #endif
2094 if (!PyArg_ParseTuple(_args, "l",
2095 &inCommandID))
2096 return NULL;
2097 EnableMenuCommand(_self->ob_itself,
2098 inCommandID);
2099 Py_INCREF(Py_None);
2100 _res = Py_None;
2101 return _res;
2103 #endif
2105 #if TARGET_API_MAC_CARBON
2107 static PyObject *MenuObj_DisableMenuCommand(MenuObject *_self, PyObject *_args)
2109 PyObject *_res = NULL;
2110 MenuCommand inCommandID;
2111 #ifndef DisableMenuCommand
2112 PyMac_PRECHECK(DisableMenuCommand);
2113 #endif
2114 if (!PyArg_ParseTuple(_args, "l",
2115 &inCommandID))
2116 return NULL;
2117 DisableMenuCommand(_self->ob_itself,
2118 inCommandID);
2119 Py_INCREF(Py_None);
2120 _res = Py_None;
2121 return _res;
2123 #endif
2125 #if TARGET_API_MAC_CARBON
2127 static PyObject *MenuObj_IsMenuCommandEnabled(MenuObject *_self, PyObject *_args)
2129 PyObject *_res = NULL;
2130 Boolean _rv;
2131 MenuCommand inCommandID;
2132 #ifndef IsMenuCommandEnabled
2133 PyMac_PRECHECK(IsMenuCommandEnabled);
2134 #endif
2135 if (!PyArg_ParseTuple(_args, "l",
2136 &inCommandID))
2137 return NULL;
2138 _rv = IsMenuCommandEnabled(_self->ob_itself,
2139 inCommandID);
2140 _res = Py_BuildValue("b",
2141 _rv);
2142 return _res;
2144 #endif
2146 #if TARGET_API_MAC_CARBON
2148 static PyObject *MenuObj_SetMenuCommandMark(MenuObject *_self, PyObject *_args)
2150 PyObject *_res = NULL;
2151 OSStatus _err;
2152 MenuCommand inCommandID;
2153 UniChar inMark;
2154 #ifndef SetMenuCommandMark
2155 PyMac_PRECHECK(SetMenuCommandMark);
2156 #endif
2157 if (!PyArg_ParseTuple(_args, "lh",
2158 &inCommandID,
2159 &inMark))
2160 return NULL;
2161 _err = SetMenuCommandMark(_self->ob_itself,
2162 inCommandID,
2163 inMark);
2164 if (_err != noErr) return PyMac_Error(_err);
2165 Py_INCREF(Py_None);
2166 _res = Py_None;
2167 return _res;
2169 #endif
2171 #if TARGET_API_MAC_CARBON
2173 static PyObject *MenuObj_GetMenuCommandMark(MenuObject *_self, PyObject *_args)
2175 PyObject *_res = NULL;
2176 OSStatus _err;
2177 MenuCommand inCommandID;
2178 UniChar outMark;
2179 #ifndef GetMenuCommandMark
2180 PyMac_PRECHECK(GetMenuCommandMark);
2181 #endif
2182 if (!PyArg_ParseTuple(_args, "l",
2183 &inCommandID))
2184 return NULL;
2185 _err = GetMenuCommandMark(_self->ob_itself,
2186 inCommandID,
2187 &outMark);
2188 if (_err != noErr) return PyMac_Error(_err);
2189 _res = Py_BuildValue("h",
2190 outMark);
2191 return _res;
2193 #endif
2195 #if TARGET_API_MAC_CARBON
2197 static PyObject *MenuObj_GetMenuCommandPropertySize(MenuObject *_self, PyObject *_args)
2199 PyObject *_res = NULL;
2200 OSStatus _err;
2201 MenuCommand inCommandID;
2202 OSType inPropertyCreator;
2203 OSType inPropertyTag;
2204 ByteCount outSize;
2205 #ifndef GetMenuCommandPropertySize
2206 PyMac_PRECHECK(GetMenuCommandPropertySize);
2207 #endif
2208 if (!PyArg_ParseTuple(_args, "lO&O&",
2209 &inCommandID,
2210 PyMac_GetOSType, &inPropertyCreator,
2211 PyMac_GetOSType, &inPropertyTag))
2212 return NULL;
2213 _err = GetMenuCommandPropertySize(_self->ob_itself,
2214 inCommandID,
2215 inPropertyCreator,
2216 inPropertyTag,
2217 &outSize);
2218 if (_err != noErr) return PyMac_Error(_err);
2219 _res = Py_BuildValue("l",
2220 outSize);
2221 return _res;
2223 #endif
2225 #if TARGET_API_MAC_CARBON
2227 static PyObject *MenuObj_RemoveMenuCommandProperty(MenuObject *_self, PyObject *_args)
2229 PyObject *_res = NULL;
2230 OSStatus _err;
2231 MenuCommand inCommandID;
2232 OSType inPropertyCreator;
2233 OSType inPropertyTag;
2234 #ifndef RemoveMenuCommandProperty
2235 PyMac_PRECHECK(RemoveMenuCommandProperty);
2236 #endif
2237 if (!PyArg_ParseTuple(_args, "lO&O&",
2238 &inCommandID,
2239 PyMac_GetOSType, &inPropertyCreator,
2240 PyMac_GetOSType, &inPropertyTag))
2241 return NULL;
2242 _err = RemoveMenuCommandProperty(_self->ob_itself,
2243 inCommandID,
2244 inPropertyCreator,
2245 inPropertyTag);
2246 if (_err != noErr) return PyMac_Error(_err);
2247 Py_INCREF(Py_None);
2248 _res = Py_None;
2249 return _res;
2251 #endif
2253 #if TARGET_API_MAC_CARBON
2255 static PyObject *MenuObj_IsMenuItemInvalid(MenuObject *_self, PyObject *_args)
2257 PyObject *_res = NULL;
2258 Boolean _rv;
2259 MenuItemIndex item;
2260 #ifndef IsMenuItemInvalid
2261 PyMac_PRECHECK(IsMenuItemInvalid);
2262 #endif
2263 if (!PyArg_ParseTuple(_args, "h",
2264 &item))
2265 return NULL;
2266 _rv = IsMenuItemInvalid(_self->ob_itself,
2267 item);
2268 _res = Py_BuildValue("b",
2269 _rv);
2270 return _res;
2272 #endif
2274 #if TARGET_API_MAC_CARBON
2276 static PyObject *MenuObj_InvalidateMenuItems(MenuObject *_self, PyObject *_args)
2278 PyObject *_res = NULL;
2279 OSStatus _err;
2280 MenuItemIndex firstItem;
2281 ItemCount numItems;
2282 #ifndef InvalidateMenuItems
2283 PyMac_PRECHECK(InvalidateMenuItems);
2284 #endif
2285 if (!PyArg_ParseTuple(_args, "hl",
2286 &firstItem,
2287 &numItems))
2288 return NULL;
2289 _err = InvalidateMenuItems(_self->ob_itself,
2290 firstItem,
2291 numItems);
2292 if (_err != noErr) return PyMac_Error(_err);
2293 Py_INCREF(Py_None);
2294 _res = Py_None;
2295 return _res;
2297 #endif
2299 #if TARGET_API_MAC_CARBON
2301 static PyObject *MenuObj_UpdateInvalidMenuItems(MenuObject *_self, PyObject *_args)
2303 PyObject *_res = NULL;
2304 OSStatus _err;
2305 #ifndef UpdateInvalidMenuItems
2306 PyMac_PRECHECK(UpdateInvalidMenuItems);
2307 #endif
2308 if (!PyArg_ParseTuple(_args, ""))
2309 return NULL;
2310 _err = UpdateInvalidMenuItems(_self->ob_itself);
2311 if (_err != noErr) return PyMac_Error(_err);
2312 Py_INCREF(Py_None);
2313 _res = Py_None;
2314 return _res;
2316 #endif
2318 #if TARGET_API_MAC_CARBON
2320 static PyObject *MenuObj_CreateStandardFontMenu(MenuObject *_self, PyObject *_args)
2322 PyObject *_res = NULL;
2323 OSStatus _err;
2324 MenuItemIndex afterItem;
2325 MenuID firstHierMenuID;
2326 OptionBits options;
2327 ItemCount outHierMenuCount;
2328 #ifndef CreateStandardFontMenu
2329 PyMac_PRECHECK(CreateStandardFontMenu);
2330 #endif
2331 if (!PyArg_ParseTuple(_args, "hhl",
2332 &afterItem,
2333 &firstHierMenuID,
2334 &options))
2335 return NULL;
2336 _err = CreateStandardFontMenu(_self->ob_itself,
2337 afterItem,
2338 firstHierMenuID,
2339 options,
2340 &outHierMenuCount);
2341 if (_err != noErr) return PyMac_Error(_err);
2342 _res = Py_BuildValue("l",
2343 outHierMenuCount);
2344 return _res;
2346 #endif
2348 #if TARGET_API_MAC_CARBON
2350 static PyObject *MenuObj_UpdateStandardFontMenu(MenuObject *_self, PyObject *_args)
2352 PyObject *_res = NULL;
2353 OSStatus _err;
2354 ItemCount outHierMenuCount;
2355 #ifndef UpdateStandardFontMenu
2356 PyMac_PRECHECK(UpdateStandardFontMenu);
2357 #endif
2358 if (!PyArg_ParseTuple(_args, ""))
2359 return NULL;
2360 _err = UpdateStandardFontMenu(_self->ob_itself,
2361 &outHierMenuCount);
2362 if (_err != noErr) return PyMac_Error(_err);
2363 _res = Py_BuildValue("l",
2364 outHierMenuCount);
2365 return _res;
2367 #endif
2369 #if TARGET_API_MAC_CARBON
2371 static PyObject *MenuObj_GetFontFamilyFromMenuSelection(MenuObject *_self, PyObject *_args)
2373 PyObject *_res = NULL;
2374 OSStatus _err;
2375 MenuItemIndex item;
2376 FMFontFamily outFontFamily;
2377 FMFontStyle outStyle;
2378 #ifndef GetFontFamilyFromMenuSelection
2379 PyMac_PRECHECK(GetFontFamilyFromMenuSelection);
2380 #endif
2381 if (!PyArg_ParseTuple(_args, "h",
2382 &item))
2383 return NULL;
2384 _err = GetFontFamilyFromMenuSelection(_self->ob_itself,
2385 item,
2386 &outFontFamily,
2387 &outStyle);
2388 if (_err != noErr) return PyMac_Error(_err);
2389 _res = Py_BuildValue("hh",
2390 outFontFamily,
2391 outStyle);
2392 return _res;
2394 #endif
2396 static PyObject *MenuObj_GetMenuID(MenuObject *_self, PyObject *_args)
2398 PyObject *_res = NULL;
2399 MenuID _rv;
2400 #ifndef GetMenuID
2401 PyMac_PRECHECK(GetMenuID);
2402 #endif
2403 if (!PyArg_ParseTuple(_args, ""))
2404 return NULL;
2405 _rv = GetMenuID(_self->ob_itself);
2406 _res = Py_BuildValue("h",
2407 _rv);
2408 return _res;
2411 static PyObject *MenuObj_GetMenuWidth(MenuObject *_self, PyObject *_args)
2413 PyObject *_res = NULL;
2414 SInt16 _rv;
2415 #ifndef GetMenuWidth
2416 PyMac_PRECHECK(GetMenuWidth);
2417 #endif
2418 if (!PyArg_ParseTuple(_args, ""))
2419 return NULL;
2420 _rv = GetMenuWidth(_self->ob_itself);
2421 _res = Py_BuildValue("h",
2422 _rv);
2423 return _res;
2426 static PyObject *MenuObj_GetMenuHeight(MenuObject *_self, PyObject *_args)
2428 PyObject *_res = NULL;
2429 SInt16 _rv;
2430 #ifndef GetMenuHeight
2431 PyMac_PRECHECK(GetMenuHeight);
2432 #endif
2433 if (!PyArg_ParseTuple(_args, ""))
2434 return NULL;
2435 _rv = GetMenuHeight(_self->ob_itself);
2436 _res = Py_BuildValue("h",
2437 _rv);
2438 return _res;
2441 static PyObject *MenuObj_SetMenuID(MenuObject *_self, PyObject *_args)
2443 PyObject *_res = NULL;
2444 MenuID menuID;
2445 #ifndef SetMenuID
2446 PyMac_PRECHECK(SetMenuID);
2447 #endif
2448 if (!PyArg_ParseTuple(_args, "h",
2449 &menuID))
2450 return NULL;
2451 SetMenuID(_self->ob_itself,
2452 menuID);
2453 Py_INCREF(Py_None);
2454 _res = Py_None;
2455 return _res;
2458 static PyObject *MenuObj_SetMenuWidth(MenuObject *_self, PyObject *_args)
2460 PyObject *_res = NULL;
2461 SInt16 width;
2462 #ifndef SetMenuWidth
2463 PyMac_PRECHECK(SetMenuWidth);
2464 #endif
2465 if (!PyArg_ParseTuple(_args, "h",
2466 &width))
2467 return NULL;
2468 SetMenuWidth(_self->ob_itself,
2469 width);
2470 Py_INCREF(Py_None);
2471 _res = Py_None;
2472 return _res;
2475 static PyObject *MenuObj_SetMenuHeight(MenuObject *_self, PyObject *_args)
2477 PyObject *_res = NULL;
2478 SInt16 height;
2479 #ifndef SetMenuHeight
2480 PyMac_PRECHECK(SetMenuHeight);
2481 #endif
2482 if (!PyArg_ParseTuple(_args, "h",
2483 &height))
2484 return NULL;
2485 SetMenuHeight(_self->ob_itself,
2486 height);
2487 Py_INCREF(Py_None);
2488 _res = Py_None;
2489 return _res;
2492 static PyObject *MenuObj_as_Resource(MenuObject *_self, PyObject *_args)
2494 PyObject *_res = NULL;
2495 Handle _rv;
2496 #ifndef as_Resource
2497 PyMac_PRECHECK(as_Resource);
2498 #endif
2499 if (!PyArg_ParseTuple(_args, ""))
2500 return NULL;
2501 _rv = as_Resource(_self->ob_itself);
2502 _res = Py_BuildValue("O&",
2503 ResObj_New, _rv);
2504 return _res;
2507 static PyObject *MenuObj_AppendMenu(MenuObject *_self, PyObject *_args)
2509 PyObject *_res = NULL;
2510 Str255 data;
2511 #ifndef AppendMenu
2512 PyMac_PRECHECK(AppendMenu);
2513 #endif
2514 if (!PyArg_ParseTuple(_args, "O&",
2515 PyMac_GetStr255, data))
2516 return NULL;
2517 AppendMenu(_self->ob_itself,
2518 data);
2519 Py_INCREF(Py_None);
2520 _res = Py_None;
2521 return _res;
2524 static PyObject *MenuObj_InsertMenu(MenuObject *_self, PyObject *_args)
2526 PyObject *_res = NULL;
2527 short beforeID;
2528 #ifndef InsertMenu
2529 PyMac_PRECHECK(InsertMenu);
2530 #endif
2531 if (!PyArg_ParseTuple(_args, "h",
2532 &beforeID))
2533 return NULL;
2534 InsertMenu(_self->ob_itself,
2535 beforeID);
2536 Py_INCREF(Py_None);
2537 _res = Py_None;
2538 return _res;
2541 static PyObject *MenuObj_InsertMenuItem(MenuObject *_self, PyObject *_args)
2543 PyObject *_res = NULL;
2544 Str255 itemString;
2545 short afterItem;
2546 #ifndef InsertMenuItem
2547 PyMac_PRECHECK(InsertMenuItem);
2548 #endif
2549 if (!PyArg_ParseTuple(_args, "O&h",
2550 PyMac_GetStr255, itemString,
2551 &afterItem))
2552 return NULL;
2553 InsertMenuItem(_self->ob_itself,
2554 itemString,
2555 afterItem);
2556 Py_INCREF(Py_None);
2557 _res = Py_None;
2558 return _res;
2561 static PyObject *MenuObj_EnableMenuItem(MenuObject *_self, PyObject *_args)
2563 PyObject *_res = NULL;
2564 UInt16 item;
2565 #ifndef EnableMenuItem
2566 PyMac_PRECHECK(EnableMenuItem);
2567 #endif
2568 if (!PyArg_ParseTuple(_args, "H",
2569 &item))
2570 return NULL;
2571 EnableMenuItem(_self->ob_itself,
2572 item);
2573 Py_INCREF(Py_None);
2574 _res = Py_None;
2575 return _res;
2578 static PyObject *MenuObj_CheckMenuItem(MenuObject *_self, PyObject *_args)
2580 PyObject *_res = NULL;
2581 short item;
2582 Boolean checked;
2583 #ifndef CheckMenuItem
2584 PyMac_PRECHECK(CheckMenuItem);
2585 #endif
2586 if (!PyArg_ParseTuple(_args, "hb",
2587 &item,
2588 &checked))
2589 return NULL;
2590 CheckMenuItem(_self->ob_itself,
2591 item,
2592 checked);
2593 Py_INCREF(Py_None);
2594 _res = Py_None;
2595 return _res;
2598 static PyMethodDef MenuObj_methods[] = {
2599 {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
2600 "() -> None"},
2601 {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
2602 "() -> None"},
2604 #if !TARGET_API_MAC_CARBON
2605 {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
2606 "() -> (short _rv)"},
2607 #endif
2608 {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1,
2609 "() -> (short _rv)"},
2610 {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1,
2611 "() -> (SInt16 outFontID, UInt16 outFontSize)"},
2612 {"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1,
2613 "(SInt16 inFontID, UInt16 inFontSize) -> None"},
2614 {"GetMenuExcludesMarkColumn", (PyCFunction)MenuObj_GetMenuExcludesMarkColumn, 1,
2615 "() -> (Boolean _rv)"},
2616 {"SetMenuExcludesMarkColumn", (PyCFunction)MenuObj_SetMenuExcludesMarkColumn, 1,
2617 "(Boolean excludesMark) -> None"},
2619 #if TARGET_API_MAC_CARBON
2620 {"IsValidMenu", (PyCFunction)MenuObj_IsValidMenu, 1,
2621 "() -> (Boolean _rv)"},
2622 #endif
2624 #if TARGET_API_MAC_CARBON
2625 {"GetMenuRetainCount", (PyCFunction)MenuObj_GetMenuRetainCount, 1,
2626 "() -> (ItemCount _rv)"},
2627 #endif
2629 #if TARGET_API_MAC_CARBON
2630 {"RetainMenu", (PyCFunction)MenuObj_RetainMenu, 1,
2631 "() -> None"},
2632 #endif
2634 #if TARGET_API_MAC_CARBON
2635 {"ReleaseMenu", (PyCFunction)MenuObj_ReleaseMenu, 1,
2636 "() -> None"},
2637 #endif
2639 #if TARGET_API_MAC_CARBON
2640 {"DuplicateMenu", (PyCFunction)MenuObj_DuplicateMenu, 1,
2641 "() -> (MenuHandle outMenu)"},
2642 #endif
2644 #if TARGET_API_MAC_CARBON
2645 {"CopyMenuTitleAsCFString", (PyCFunction)MenuObj_CopyMenuTitleAsCFString, 1,
2646 "() -> (CFStringRef outString)"},
2647 #endif
2649 #if TARGET_API_MAC_CARBON
2650 {"SetMenuTitleWithCFString", (PyCFunction)MenuObj_SetMenuTitleWithCFString, 1,
2651 "(CFStringRef inString) -> None"},
2652 #endif
2654 #if TARGET_API_MAC_CARBON
2655 {"InvalidateMenuSize", (PyCFunction)MenuObj_InvalidateMenuSize, 1,
2656 "() -> None"},
2657 #endif
2659 #if TARGET_API_MAC_CARBON
2660 {"IsMenuSizeInvalid", (PyCFunction)MenuObj_IsMenuSizeInvalid, 1,
2661 "() -> (Boolean _rv)"},
2662 #endif
2663 {"MacAppendMenu", (PyCFunction)MenuObj_MacAppendMenu, 1,
2664 "(Str255 data) -> None"},
2665 {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
2666 "(ResType theType, short afterItem) -> None"},
2667 {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
2668 "(ResType theType) -> None"},
2669 {"MacInsertMenuItem", (PyCFunction)MenuObj_MacInsertMenuItem, 1,
2670 "(Str255 itemString, short afterItem) -> None"},
2671 {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
2672 "(short item) -> None"},
2673 {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
2674 "(short afterItem, short scriptFilter) -> None"},
2675 {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
2676 "(ResType theType, short afterItem, short scriptFilter) -> None"},
2677 {"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1,
2678 "(Str255 inString) -> None"},
2679 {"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1,
2680 "(Str255 inString, MenuItemIndex afterItem) -> None"},
2682 #if TARGET_API_MAC_CARBON
2683 {"CopyMenuItems", (PyCFunction)MenuObj_CopyMenuItems, 1,
2684 "(MenuItemIndex inFirstItem, ItemCount inNumItems, MenuHandle inDestMenu, MenuItemIndex inInsertAfter) -> None"},
2685 #endif
2687 #if TARGET_API_MAC_CARBON
2688 {"DeleteMenuItems", (PyCFunction)MenuObj_DeleteMenuItems, 1,
2689 "(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None"},
2690 #endif
2692 #if TARGET_API_MAC_CARBON
2693 {"AppendMenuItemTextWithCFString", (PyCFunction)MenuObj_AppendMenuItemTextWithCFString, 1,
2694 "(CFStringRef inString, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> (MenuItemIndex outNewItem)"},
2695 #endif
2697 #if TARGET_API_MAC_CARBON
2698 {"InsertMenuItemTextWithCFString", (PyCFunction)MenuObj_InsertMenuItemTextWithCFString, 1,
2699 "(CFStringRef inString, MenuItemIndex inAfterItem, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> None"},
2700 #endif
2701 {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
2702 "(short top, short left, short popUpItem) -> (long _rv)"},
2704 #if TARGET_API_MAC_CARBON
2705 {"InvalidateMenuEnabling", (PyCFunction)MenuObj_InvalidateMenuEnabling, 1,
2706 "() -> None"},
2707 #endif
2709 #if TARGET_API_MAC_CARBON
2710 {"IsMenuBarInvalid", (PyCFunction)MenuObj_IsMenuBarInvalid, 1,
2711 "() -> (Boolean _rv)"},
2712 #endif
2713 {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1,
2714 "(MenuID beforeID) -> None"},
2716 #if TARGET_API_MAC_CARBON
2717 {"SetRootMenu", (PyCFunction)MenuObj_SetRootMenu, 1,
2718 "() -> None"},
2719 #endif
2721 #if !TARGET_API_MAC_CARBON
2722 {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1,
2723 "(short item, Boolean checked) -> None"},
2724 #endif
2725 {"MacCheckMenuItem", (PyCFunction)MenuObj_MacCheckMenuItem, 1,
2726 "(short item, Boolean checked) -> None"},
2727 {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
2728 "(short item, Str255 itemString) -> None"},
2729 {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
2730 "(short item) -> (Str255 itemString)"},
2731 {"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1,
2732 "(short item, CharParameter markChar) -> None"},
2733 {"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1,
2734 "(short item) -> (CharParameter markChar)"},
2735 {"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1,
2736 "(short item, CharParameter cmdChar) -> None"},
2737 {"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1,
2738 "(short item) -> (CharParameter cmdChar)"},
2739 {"SetItemIcon", (PyCFunction)MenuObj_SetItemIcon, 1,
2740 "(short item, short iconIndex) -> None"},
2741 {"GetItemIcon", (PyCFunction)MenuObj_GetItemIcon, 1,
2742 "(short item) -> (short iconIndex)"},
2743 {"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1,
2744 "(short item, StyleParameter chStyle) -> None"},
2745 {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
2746 "(short item) -> (Style chStyle)"},
2748 #if !TARGET_API_MAC_CARBON
2749 {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1,
2750 "(short item) -> None"},
2751 #endif
2753 #if !TARGET_API_MAC_CARBON
2754 {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1,
2755 "(short item) -> None"},
2756 #endif
2757 {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
2758 "(SInt16 inItem, MenuCommand inCommandID) -> None"},
2759 {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
2760 "(SInt16 inItem) -> (MenuCommand outCommandID)"},
2761 {"SetMenuItemModifiers", (PyCFunction)MenuObj_SetMenuItemModifiers, 1,
2762 "(SInt16 inItem, UInt8 inModifiers) -> None"},
2763 {"GetMenuItemModifiers", (PyCFunction)MenuObj_GetMenuItemModifiers, 1,
2764 "(SInt16 inItem) -> (UInt8 outModifiers)"},
2765 {"SetMenuItemIconHandle", (PyCFunction)MenuObj_SetMenuItemIconHandle, 1,
2766 "(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None"},
2767 {"GetMenuItemIconHandle", (PyCFunction)MenuObj_GetMenuItemIconHandle, 1,
2768 "(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)"},
2769 {"SetMenuItemTextEncoding", (PyCFunction)MenuObj_SetMenuItemTextEncoding, 1,
2770 "(SInt16 inItem, TextEncoding inScriptID) -> None"},
2771 {"GetMenuItemTextEncoding", (PyCFunction)MenuObj_GetMenuItemTextEncoding, 1,
2772 "(SInt16 inItem) -> (TextEncoding outScriptID)"},
2773 {"SetMenuItemHierarchicalID", (PyCFunction)MenuObj_SetMenuItemHierarchicalID, 1,
2774 "(SInt16 inItem, MenuID inHierID) -> None"},
2775 {"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1,
2776 "(SInt16 inItem) -> (MenuID outHierID)"},
2777 {"SetMenuItemFontID", (PyCFunction)MenuObj_SetMenuItemFontID, 1,
2778 "(SInt16 inItem, SInt16 inFontID) -> None"},
2779 {"GetMenuItemFontID", (PyCFunction)MenuObj_GetMenuItemFontID, 1,
2780 "(SInt16 inItem) -> (SInt16 outFontID)"},
2781 {"SetMenuItemRefCon", (PyCFunction)MenuObj_SetMenuItemRefCon, 1,
2782 "(SInt16 inItem, UInt32 inRefCon) -> None"},
2783 {"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1,
2784 "(SInt16 inItem) -> (UInt32 outRefCon)"},
2786 #if !TARGET_API_MAC_CARBON
2787 {"SetMenuItemRefCon2", (PyCFunction)MenuObj_SetMenuItemRefCon2, 1,
2788 "(SInt16 inItem, UInt32 inRefCon2) -> None"},
2789 #endif
2791 #if !TARGET_API_MAC_CARBON
2792 {"GetMenuItemRefCon2", (PyCFunction)MenuObj_GetMenuItemRefCon2, 1,
2793 "(SInt16 inItem) -> (UInt32 outRefCon2)"},
2794 #endif
2795 {"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1,
2796 "(SInt16 inItem, SInt16 inGlyph) -> None"},
2797 {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
2798 "(SInt16 inItem) -> (SInt16 outGlyph)"},
2799 {"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1,
2800 "(MenuItemIndex item) -> None"},
2801 {"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1,
2802 "(MenuItemIndex item) -> None"},
2803 {"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1,
2804 "(MenuItemIndex item) -> (Boolean _rv)"},
2805 {"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1,
2806 "(MenuItemIndex item) -> None"},
2807 {"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1,
2808 "(MenuItemIndex item) -> None"},
2809 {"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1,
2810 "(MenuItemIndex item) -> (Boolean _rv)"},
2812 #if TARGET_API_MAC_CARBON
2813 {"SetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_SetMenuItemHierarchicalMenu, 1,
2814 "(MenuItemIndex inItem, MenuHandle inHierMenu) -> None"},
2815 #endif
2817 #if TARGET_API_MAC_CARBON
2818 {"GetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_GetMenuItemHierarchicalMenu, 1,
2819 "(MenuItemIndex inItem) -> (MenuHandle outHierMenu)"},
2820 #endif
2822 #if TARGET_API_MAC_CARBON
2823 {"CopyMenuItemTextAsCFString", (PyCFunction)MenuObj_CopyMenuItemTextAsCFString, 1,
2824 "(MenuItemIndex inItem) -> (CFStringRef outString)"},
2825 #endif
2827 #if TARGET_API_MAC_CARBON
2828 {"SetMenuItemTextWithCFString", (PyCFunction)MenuObj_SetMenuItemTextWithCFString, 1,
2829 "(MenuItemIndex inItem, CFStringRef inString) -> None"},
2830 #endif
2832 #if TARGET_API_MAC_CARBON
2833 {"GetMenuItemIndent", (PyCFunction)MenuObj_GetMenuItemIndent, 1,
2834 "(MenuItemIndex inItem) -> (UInt32 outIndent)"},
2835 #endif
2837 #if TARGET_API_MAC_CARBON
2838 {"SetMenuItemIndent", (PyCFunction)MenuObj_SetMenuItemIndent, 1,
2839 "(MenuItemIndex inItem, UInt32 inIndent) -> None"},
2840 #endif
2842 #if TARGET_API_MAC_CARBON
2843 {"GetMenuItemCommandKey", (PyCFunction)MenuObj_GetMenuItemCommandKey, 1,
2844 "(MenuItemIndex inItem, Boolean inGetVirtualKey) -> (UInt16 outKey)"},
2845 #endif
2847 #if TARGET_API_MAC_CARBON
2848 {"SetMenuItemCommandKey", (PyCFunction)MenuObj_SetMenuItemCommandKey, 1,
2849 "(MenuItemIndex inItem, Boolean inSetVirtualKey, UInt16 inKey) -> None"},
2850 #endif
2852 #if TARGET_API_MAC_CARBON
2853 {"GetMenuItemPropertyAttributes", (PyCFunction)MenuObj_GetMenuItemPropertyAttributes, 1,
2854 "(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
2855 #endif
2857 #if TARGET_API_MAC_CARBON
2858 {"ChangeMenuItemPropertyAttributes", (PyCFunction)MenuObj_ChangeMenuItemPropertyAttributes, 1,
2859 "(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
2860 #endif
2862 #if TARGET_API_MAC_CARBON
2863 {"GetMenuAttributes", (PyCFunction)MenuObj_GetMenuAttributes, 1,
2864 "() -> (MenuAttributes outAttributes)"},
2865 #endif
2867 #if TARGET_API_MAC_CARBON
2868 {"ChangeMenuAttributes", (PyCFunction)MenuObj_ChangeMenuAttributes, 1,
2869 "(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None"},
2870 #endif
2872 #if TARGET_API_MAC_CARBON
2873 {"GetMenuItemAttributes", (PyCFunction)MenuObj_GetMenuItemAttributes, 1,
2874 "(MenuItemIndex item) -> (MenuItemAttributes outAttributes)"},
2875 #endif
2877 #if TARGET_API_MAC_CARBON
2878 {"ChangeMenuItemAttributes", (PyCFunction)MenuObj_ChangeMenuItemAttributes, 1,
2879 "(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None"},
2880 #endif
2882 #if TARGET_API_MAC_CARBON
2883 {"DisableAllMenuItems", (PyCFunction)MenuObj_DisableAllMenuItems, 1,
2884 "() -> None"},
2885 #endif
2887 #if TARGET_API_MAC_CARBON
2888 {"EnableAllMenuItems", (PyCFunction)MenuObj_EnableAllMenuItems, 1,
2889 "() -> None"},
2890 #endif
2892 #if TARGET_API_MAC_CARBON
2893 {"MenuHasEnabledItems", (PyCFunction)MenuObj_MenuHasEnabledItems, 1,
2894 "() -> (Boolean _rv)"},
2895 #endif
2897 #if TARGET_API_MAC_CARBON
2898 {"GetMenuType", (PyCFunction)MenuObj_GetMenuType, 1,
2899 "() -> (UInt16 outType)"},
2900 #endif
2902 #if TARGET_API_MAC_CARBON
2903 {"CountMenuItemsWithCommandID", (PyCFunction)MenuObj_CountMenuItemsWithCommandID, 1,
2904 "(MenuCommand inCommandID) -> (ItemCount _rv)"},
2905 #endif
2907 #if TARGET_API_MAC_CARBON
2908 {"GetIndMenuItemWithCommandID", (PyCFunction)MenuObj_GetIndMenuItemWithCommandID, 1,
2909 "(MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)"},
2910 #endif
2912 #if TARGET_API_MAC_CARBON
2913 {"EnableMenuCommand", (PyCFunction)MenuObj_EnableMenuCommand, 1,
2914 "(MenuCommand inCommandID) -> None"},
2915 #endif
2917 #if TARGET_API_MAC_CARBON
2918 {"DisableMenuCommand", (PyCFunction)MenuObj_DisableMenuCommand, 1,
2919 "(MenuCommand inCommandID) -> None"},
2920 #endif
2922 #if TARGET_API_MAC_CARBON
2923 {"IsMenuCommandEnabled", (PyCFunction)MenuObj_IsMenuCommandEnabled, 1,
2924 "(MenuCommand inCommandID) -> (Boolean _rv)"},
2925 #endif
2927 #if TARGET_API_MAC_CARBON
2928 {"SetMenuCommandMark", (PyCFunction)MenuObj_SetMenuCommandMark, 1,
2929 "(MenuCommand inCommandID, UniChar inMark) -> None"},
2930 #endif
2932 #if TARGET_API_MAC_CARBON
2933 {"GetMenuCommandMark", (PyCFunction)MenuObj_GetMenuCommandMark, 1,
2934 "(MenuCommand inCommandID) -> (UniChar outMark)"},
2935 #endif
2937 #if TARGET_API_MAC_CARBON
2938 {"GetMenuCommandPropertySize", (PyCFunction)MenuObj_GetMenuCommandPropertySize, 1,
2939 "(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)"},
2940 #endif
2942 #if TARGET_API_MAC_CARBON
2943 {"RemoveMenuCommandProperty", (PyCFunction)MenuObj_RemoveMenuCommandProperty, 1,
2944 "(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None"},
2945 #endif
2947 #if TARGET_API_MAC_CARBON
2948 {"IsMenuItemInvalid", (PyCFunction)MenuObj_IsMenuItemInvalid, 1,
2949 "(MenuItemIndex item) -> (Boolean _rv)"},
2950 #endif
2952 #if TARGET_API_MAC_CARBON
2953 {"InvalidateMenuItems", (PyCFunction)MenuObj_InvalidateMenuItems, 1,
2954 "(MenuItemIndex firstItem, ItemCount numItems) -> None"},
2955 #endif
2957 #if TARGET_API_MAC_CARBON
2958 {"UpdateInvalidMenuItems", (PyCFunction)MenuObj_UpdateInvalidMenuItems, 1,
2959 "() -> None"},
2960 #endif
2962 #if TARGET_API_MAC_CARBON
2963 {"CreateStandardFontMenu", (PyCFunction)MenuObj_CreateStandardFontMenu, 1,
2964 "(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)"},
2965 #endif
2967 #if TARGET_API_MAC_CARBON
2968 {"UpdateStandardFontMenu", (PyCFunction)MenuObj_UpdateStandardFontMenu, 1,
2969 "() -> (ItemCount outHierMenuCount)"},
2970 #endif
2972 #if TARGET_API_MAC_CARBON
2973 {"GetFontFamilyFromMenuSelection", (PyCFunction)MenuObj_GetFontFamilyFromMenuSelection, 1,
2974 "(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)"},
2975 #endif
2976 {"GetMenuID", (PyCFunction)MenuObj_GetMenuID, 1,
2977 "() -> (MenuID _rv)"},
2978 {"GetMenuWidth", (PyCFunction)MenuObj_GetMenuWidth, 1,
2979 "() -> (SInt16 _rv)"},
2980 {"GetMenuHeight", (PyCFunction)MenuObj_GetMenuHeight, 1,
2981 "() -> (SInt16 _rv)"},
2982 {"SetMenuID", (PyCFunction)MenuObj_SetMenuID, 1,
2983 "(MenuID menuID) -> None"},
2984 {"SetMenuWidth", (PyCFunction)MenuObj_SetMenuWidth, 1,
2985 "(SInt16 width) -> None"},
2986 {"SetMenuHeight", (PyCFunction)MenuObj_SetMenuHeight, 1,
2987 "(SInt16 height) -> None"},
2988 {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
2989 "() -> (Handle _rv)"},
2990 {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
2991 "(Str255 data) -> None"},
2992 {"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
2993 "(short beforeID) -> None"},
2994 {"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
2995 "(Str255 itemString, short afterItem) -> None"},
2996 {"EnableMenuItem", (PyCFunction)MenuObj_EnableMenuItem, 1,
2997 "(UInt16 item) -> None"},
2998 {"CheckMenuItem", (PyCFunction)MenuObj_CheckMenuItem, 1,
2999 "(short item, Boolean checked) -> None"},
3000 {NULL, NULL, 0}
3003 PyMethodChain MenuObj_chain = { MenuObj_methods, NULL };
3005 static PyObject *MenuObj_getattr(MenuObject *self, char *name)
3007 return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name);
3010 #define MenuObj_setattr NULL
3012 #define MenuObj_compare NULL
3014 #define MenuObj_repr NULL
3016 #define MenuObj_hash NULL
3018 PyTypeObject Menu_Type = {
3019 PyObject_HEAD_INIT(NULL)
3020 0, /*ob_size*/
3021 "_Menu.Menu", /*tp_name*/
3022 sizeof(MenuObject), /*tp_basicsize*/
3023 0, /*tp_itemsize*/
3024 /* methods */
3025 (destructor) MenuObj_dealloc, /*tp_dealloc*/
3026 0, /*tp_print*/
3027 (getattrfunc) MenuObj_getattr, /*tp_getattr*/
3028 (setattrfunc) MenuObj_setattr, /*tp_setattr*/
3029 (cmpfunc) MenuObj_compare, /*tp_compare*/
3030 (reprfunc) MenuObj_repr, /*tp_repr*/
3031 (PyNumberMethods *)0, /* tp_as_number */
3032 (PySequenceMethods *)0, /* tp_as_sequence */
3033 (PyMappingMethods *)0, /* tp_as_mapping */
3034 (hashfunc) MenuObj_hash, /*tp_hash*/
3037 /* ---------------------- End object type Menu ---------------------- */
3040 #if !TARGET_API_MAC_CARBON
3042 static PyObject *Menu_InitProcMenu(PyObject *_self, PyObject *_args)
3044 PyObject *_res = NULL;
3045 short resID;
3046 #ifndef InitProcMenu
3047 PyMac_PRECHECK(InitProcMenu);
3048 #endif
3049 if (!PyArg_ParseTuple(_args, "h",
3050 &resID))
3051 return NULL;
3052 InitProcMenu(resID);
3053 Py_INCREF(Py_None);
3054 _res = Py_None;
3055 return _res;
3057 #endif
3059 #if !TARGET_API_MAC_CARBON
3061 static PyObject *Menu_InitMenus(PyObject *_self, PyObject *_args)
3063 PyObject *_res = NULL;
3064 #ifndef InitMenus
3065 PyMac_PRECHECK(InitMenus);
3066 #endif
3067 if (!PyArg_ParseTuple(_args, ""))
3068 return NULL;
3069 InitMenus();
3070 Py_INCREF(Py_None);
3071 _res = Py_None;
3072 return _res;
3074 #endif
3076 static PyObject *Menu_NewMenu(PyObject *_self, PyObject *_args)
3078 PyObject *_res = NULL;
3079 MenuHandle _rv;
3080 MenuID menuID;
3081 Str255 menuTitle;
3082 #ifndef NewMenu
3083 PyMac_PRECHECK(NewMenu);
3084 #endif
3085 if (!PyArg_ParseTuple(_args, "hO&",
3086 &menuID,
3087 PyMac_GetStr255, menuTitle))
3088 return NULL;
3089 _rv = NewMenu(menuID,
3090 menuTitle);
3091 _res = Py_BuildValue("O&",
3092 MenuObj_New, _rv);
3093 return _res;
3096 static PyObject *Menu_MacGetMenu(PyObject *_self, PyObject *_args)
3098 PyObject *_res = NULL;
3099 MenuHandle _rv;
3100 short resourceID;
3101 #ifndef MacGetMenu
3102 PyMac_PRECHECK(MacGetMenu);
3103 #endif
3104 if (!PyArg_ParseTuple(_args, "h",
3105 &resourceID))
3106 return NULL;
3107 _rv = MacGetMenu(resourceID);
3108 _res = Py_BuildValue("O&",
3109 MenuObj_New, _rv);
3110 return _res;
3113 #if TARGET_API_MAC_CARBON
3115 static PyObject *Menu_CreateNewMenu(PyObject *_self, PyObject *_args)
3117 PyObject *_res = NULL;
3118 OSStatus _err;
3119 MenuID inMenuID;
3120 MenuAttributes inMenuAttributes;
3121 MenuHandle outMenuRef;
3122 #ifndef CreateNewMenu
3123 PyMac_PRECHECK(CreateNewMenu);
3124 #endif
3125 if (!PyArg_ParseTuple(_args, "hl",
3126 &inMenuID,
3127 &inMenuAttributes))
3128 return NULL;
3129 _err = CreateNewMenu(inMenuID,
3130 inMenuAttributes,
3131 &outMenuRef);
3132 if (_err != noErr) return PyMac_Error(_err);
3133 _res = Py_BuildValue("O&",
3134 MenuObj_New, outMenuRef);
3135 return _res;
3137 #endif
3139 static PyObject *Menu_MenuKey(PyObject *_self, PyObject *_args)
3141 PyObject *_res = NULL;
3142 long _rv;
3143 CharParameter ch;
3144 #ifndef MenuKey
3145 PyMac_PRECHECK(MenuKey);
3146 #endif
3147 if (!PyArg_ParseTuple(_args, "h",
3148 &ch))
3149 return NULL;
3150 _rv = MenuKey(ch);
3151 _res = Py_BuildValue("l",
3152 _rv);
3153 return _res;
3156 static PyObject *Menu_MenuSelect(PyObject *_self, PyObject *_args)
3158 PyObject *_res = NULL;
3159 long _rv;
3160 Point startPt;
3161 #ifndef MenuSelect
3162 PyMac_PRECHECK(MenuSelect);
3163 #endif
3164 if (!PyArg_ParseTuple(_args, "O&",
3165 PyMac_GetPoint, &startPt))
3166 return NULL;
3167 _rv = MenuSelect(startPt);
3168 _res = Py_BuildValue("l",
3169 _rv);
3170 return _res;
3173 static PyObject *Menu_MenuChoice(PyObject *_self, PyObject *_args)
3175 PyObject *_res = NULL;
3176 long _rv;
3177 #ifndef MenuChoice
3178 PyMac_PRECHECK(MenuChoice);
3179 #endif
3180 if (!PyArg_ParseTuple(_args, ""))
3181 return NULL;
3182 _rv = MenuChoice();
3183 _res = Py_BuildValue("l",
3184 _rv);
3185 return _res;
3188 static PyObject *Menu_MenuEvent(PyObject *_self, PyObject *_args)
3190 PyObject *_res = NULL;
3191 UInt32 _rv;
3192 EventRecord inEvent;
3193 #ifndef MenuEvent
3194 PyMac_PRECHECK(MenuEvent);
3195 #endif
3196 if (!PyArg_ParseTuple(_args, "O&",
3197 PyMac_GetEventRecord, &inEvent))
3198 return NULL;
3199 _rv = MenuEvent(&inEvent);
3200 _res = Py_BuildValue("l",
3201 _rv);
3202 return _res;
3205 static PyObject *Menu_GetMBarHeight(PyObject *_self, PyObject *_args)
3207 PyObject *_res = NULL;
3208 short _rv;
3209 #ifndef GetMBarHeight
3210 PyMac_PRECHECK(GetMBarHeight);
3211 #endif
3212 if (!PyArg_ParseTuple(_args, ""))
3213 return NULL;
3214 _rv = GetMBarHeight();
3215 _res = Py_BuildValue("h",
3216 _rv);
3217 return _res;
3220 static PyObject *Menu_MacDrawMenuBar(PyObject *_self, PyObject *_args)
3222 PyObject *_res = NULL;
3223 #ifndef MacDrawMenuBar
3224 PyMac_PRECHECK(MacDrawMenuBar);
3225 #endif
3226 if (!PyArg_ParseTuple(_args, ""))
3227 return NULL;
3228 MacDrawMenuBar();
3229 Py_INCREF(Py_None);
3230 _res = Py_None;
3231 return _res;
3234 static PyObject *Menu_InvalMenuBar(PyObject *_self, PyObject *_args)
3236 PyObject *_res = NULL;
3237 #ifndef InvalMenuBar
3238 PyMac_PRECHECK(InvalMenuBar);
3239 #endif
3240 if (!PyArg_ParseTuple(_args, ""))
3241 return NULL;
3242 InvalMenuBar();
3243 Py_INCREF(Py_None);
3244 _res = Py_None;
3245 return _res;
3248 static PyObject *Menu_HiliteMenu(PyObject *_self, PyObject *_args)
3250 PyObject *_res = NULL;
3251 MenuID menuID;
3252 #ifndef HiliteMenu
3253 PyMac_PRECHECK(HiliteMenu);
3254 #endif
3255 if (!PyArg_ParseTuple(_args, "h",
3256 &menuID))
3257 return NULL;
3258 HiliteMenu(menuID);
3259 Py_INCREF(Py_None);
3260 _res = Py_None;
3261 return _res;
3264 static PyObject *Menu_GetNewMBar(PyObject *_self, PyObject *_args)
3266 PyObject *_res = NULL;
3267 MenuBarHandle _rv;
3268 short menuBarID;
3269 #ifndef GetNewMBar
3270 PyMac_PRECHECK(GetNewMBar);
3271 #endif
3272 if (!PyArg_ParseTuple(_args, "h",
3273 &menuBarID))
3274 return NULL;
3275 _rv = GetNewMBar(menuBarID);
3276 _res = Py_BuildValue("O&",
3277 ResObj_New, _rv);
3278 return _res;
3281 static PyObject *Menu_GetMenuBar(PyObject *_self, PyObject *_args)
3283 PyObject *_res = NULL;
3284 MenuBarHandle _rv;
3285 #ifndef GetMenuBar
3286 PyMac_PRECHECK(GetMenuBar);
3287 #endif
3288 if (!PyArg_ParseTuple(_args, ""))
3289 return NULL;
3290 _rv = GetMenuBar();
3291 _res = Py_BuildValue("O&",
3292 ResObj_New, _rv);
3293 return _res;
3296 static PyObject *Menu_SetMenuBar(PyObject *_self, PyObject *_args)
3298 PyObject *_res = NULL;
3299 MenuBarHandle mbar;
3300 #ifndef SetMenuBar
3301 PyMac_PRECHECK(SetMenuBar);
3302 #endif
3303 if (!PyArg_ParseTuple(_args, "O&",
3304 ResObj_Convert, &mbar))
3305 return NULL;
3306 SetMenuBar(mbar);
3307 Py_INCREF(Py_None);
3308 _res = Py_None;
3309 return _res;
3312 #if TARGET_API_MAC_CARBON
3314 static PyObject *Menu_DuplicateMenuBar(PyObject *_self, PyObject *_args)
3316 PyObject *_res = NULL;
3317 OSStatus _err;
3318 MenuBarHandle inMbar;
3319 MenuBarHandle outMbar;
3320 #ifndef DuplicateMenuBar
3321 PyMac_PRECHECK(DuplicateMenuBar);
3322 #endif
3323 if (!PyArg_ParseTuple(_args, "O&",
3324 ResObj_Convert, &inMbar))
3325 return NULL;
3326 _err = DuplicateMenuBar(inMbar,
3327 &outMbar);
3328 if (_err != noErr) return PyMac_Error(_err);
3329 _res = Py_BuildValue("O&",
3330 ResObj_New, outMbar);
3331 return _res;
3333 #endif
3335 #if TARGET_API_MAC_CARBON
3337 static PyObject *Menu_DisposeMenuBar(PyObject *_self, PyObject *_args)
3339 PyObject *_res = NULL;
3340 OSStatus _err;
3341 MenuBarHandle inMbar;
3342 #ifndef DisposeMenuBar
3343 PyMac_PRECHECK(DisposeMenuBar);
3344 #endif
3345 if (!PyArg_ParseTuple(_args, "O&",
3346 ResObj_Convert, &inMbar))
3347 return NULL;
3348 _err = DisposeMenuBar(inMbar);
3349 if (_err != noErr) return PyMac_Error(_err);
3350 Py_INCREF(Py_None);
3351 _res = Py_None;
3352 return _res;
3354 #endif
3356 static PyObject *Menu_GetMenuHandle(PyObject *_self, PyObject *_args)
3358 PyObject *_res = NULL;
3359 MenuHandle _rv;
3360 MenuID menuID;
3361 #ifndef GetMenuHandle
3362 PyMac_PRECHECK(GetMenuHandle);
3363 #endif
3364 if (!PyArg_ParseTuple(_args, "h",
3365 &menuID))
3366 return NULL;
3367 _rv = GetMenuHandle(menuID);
3368 _res = Py_BuildValue("O&",
3369 MenuObj_New, _rv);
3370 return _res;
3373 static PyObject *Menu_MacDeleteMenu(PyObject *_self, PyObject *_args)
3375 PyObject *_res = NULL;
3376 MenuID menuID;
3377 #ifndef MacDeleteMenu
3378 PyMac_PRECHECK(MacDeleteMenu);
3379 #endif
3380 if (!PyArg_ParseTuple(_args, "h",
3381 &menuID))
3382 return NULL;
3383 MacDeleteMenu(menuID);
3384 Py_INCREF(Py_None);
3385 _res = Py_None;
3386 return _res;
3389 static PyObject *Menu_ClearMenuBar(PyObject *_self, PyObject *_args)
3391 PyObject *_res = NULL;
3392 #ifndef ClearMenuBar
3393 PyMac_PRECHECK(ClearMenuBar);
3394 #endif
3395 if (!PyArg_ParseTuple(_args, ""))
3396 return NULL;
3397 ClearMenuBar();
3398 Py_INCREF(Py_None);
3399 _res = Py_None;
3400 return _res;
3403 #if !TARGET_API_MAC_CARBON
3405 static PyObject *Menu_SetMenuFlash(PyObject *_self, PyObject *_args)
3407 PyObject *_res = NULL;
3408 short count;
3409 #ifndef SetMenuFlash
3410 PyMac_PRECHECK(SetMenuFlash);
3411 #endif
3412 if (!PyArg_ParseTuple(_args, "h",
3413 &count))
3414 return NULL;
3415 SetMenuFlash(count);
3416 Py_INCREF(Py_None);
3417 _res = Py_None;
3418 return _res;
3420 #endif
3422 static PyObject *Menu_SetMenuFlashCount(PyObject *_self, PyObject *_args)
3424 PyObject *_res = NULL;
3425 short count;
3426 #ifndef SetMenuFlashCount
3427 PyMac_PRECHECK(SetMenuFlashCount);
3428 #endif
3429 if (!PyArg_ParseTuple(_args, "h",
3430 &count))
3431 return NULL;
3432 SetMenuFlashCount(count);
3433 Py_INCREF(Py_None);
3434 _res = Py_None;
3435 return _res;
3438 static PyObject *Menu_FlashMenuBar(PyObject *_self, PyObject *_args)
3440 PyObject *_res = NULL;
3441 MenuID menuID;
3442 #ifndef FlashMenuBar
3443 PyMac_PRECHECK(FlashMenuBar);
3444 #endif
3445 if (!PyArg_ParseTuple(_args, "h",
3446 &menuID))
3447 return NULL;
3448 FlashMenuBar(menuID);
3449 Py_INCREF(Py_None);
3450 _res = Py_None;
3451 return _res;
3454 #if !TARGET_API_MAC_CARBON
3456 static PyObject *Menu_SystemEdit(PyObject *_self, PyObject *_args)
3458 PyObject *_res = NULL;
3459 Boolean _rv;
3460 short editCmd;
3461 #ifndef SystemEdit
3462 PyMac_PRECHECK(SystemEdit);
3463 #endif
3464 if (!PyArg_ParseTuple(_args, "h",
3465 &editCmd))
3466 return NULL;
3467 _rv = SystemEdit(editCmd);
3468 _res = Py_BuildValue("b",
3469 _rv);
3470 return _res;
3472 #endif
3474 #if !TARGET_API_MAC_CARBON
3476 static PyObject *Menu_SystemMenu(PyObject *_self, PyObject *_args)
3478 PyObject *_res = NULL;
3479 long menuResult;
3480 #ifndef SystemMenu
3481 PyMac_PRECHECK(SystemMenu);
3482 #endif
3483 if (!PyArg_ParseTuple(_args, "l",
3484 &menuResult))
3485 return NULL;
3486 SystemMenu(menuResult);
3487 Py_INCREF(Py_None);
3488 _res = Py_None;
3489 return _res;
3491 #endif
3493 static PyObject *Menu_IsMenuBarVisible(PyObject *_self, PyObject *_args)
3495 PyObject *_res = NULL;
3496 Boolean _rv;
3497 #ifndef IsMenuBarVisible
3498 PyMac_PRECHECK(IsMenuBarVisible);
3499 #endif
3500 if (!PyArg_ParseTuple(_args, ""))
3501 return NULL;
3502 _rv = IsMenuBarVisible();
3503 _res = Py_BuildValue("b",
3504 _rv);
3505 return _res;
3508 static PyObject *Menu_ShowMenuBar(PyObject *_self, PyObject *_args)
3510 PyObject *_res = NULL;
3511 #ifndef ShowMenuBar
3512 PyMac_PRECHECK(ShowMenuBar);
3513 #endif
3514 if (!PyArg_ParseTuple(_args, ""))
3515 return NULL;
3516 ShowMenuBar();
3517 Py_INCREF(Py_None);
3518 _res = Py_None;
3519 return _res;
3522 static PyObject *Menu_HideMenuBar(PyObject *_self, PyObject *_args)
3524 PyObject *_res = NULL;
3525 #ifndef HideMenuBar
3526 PyMac_PRECHECK(HideMenuBar);
3527 #endif
3528 if (!PyArg_ParseTuple(_args, ""))
3529 return NULL;
3530 HideMenuBar();
3531 Py_INCREF(Py_None);
3532 _res = Py_None;
3533 return _res;
3536 #if TARGET_API_MAC_CARBON
3538 static PyObject *Menu_AcquireRootMenu(PyObject *_self, PyObject *_args)
3540 PyObject *_res = NULL;
3541 MenuHandle _rv;
3542 #ifndef AcquireRootMenu
3543 PyMac_PRECHECK(AcquireRootMenu);
3544 #endif
3545 if (!PyArg_ParseTuple(_args, ""))
3546 return NULL;
3547 _rv = AcquireRootMenu();
3548 _res = Py_BuildValue("O&",
3549 MenuObj_New, _rv);
3550 return _res;
3552 #endif
3554 static PyObject *Menu_DeleteMCEntries(PyObject *_self, PyObject *_args)
3556 PyObject *_res = NULL;
3557 MenuID menuID;
3558 short menuItem;
3559 #ifndef DeleteMCEntries
3560 PyMac_PRECHECK(DeleteMCEntries);
3561 #endif
3562 if (!PyArg_ParseTuple(_args, "hh",
3563 &menuID,
3564 &menuItem))
3565 return NULL;
3566 DeleteMCEntries(menuID,
3567 menuItem);
3568 Py_INCREF(Py_None);
3569 _res = Py_None;
3570 return _res;
3573 static PyObject *Menu_InitContextualMenus(PyObject *_self, PyObject *_args)
3575 PyObject *_res = NULL;
3576 OSStatus _err;
3577 #ifndef InitContextualMenus
3578 PyMac_PRECHECK(InitContextualMenus);
3579 #endif
3580 if (!PyArg_ParseTuple(_args, ""))
3581 return NULL;
3582 _err = InitContextualMenus();
3583 if (_err != noErr) return PyMac_Error(_err);
3584 Py_INCREF(Py_None);
3585 _res = Py_None;
3586 return _res;
3589 static PyObject *Menu_IsShowContextualMenuClick(PyObject *_self, PyObject *_args)
3591 PyObject *_res = NULL;
3592 Boolean _rv;
3593 EventRecord inEvent;
3594 #ifndef IsShowContextualMenuClick
3595 PyMac_PRECHECK(IsShowContextualMenuClick);
3596 #endif
3597 if (!PyArg_ParseTuple(_args, "O&",
3598 PyMac_GetEventRecord, &inEvent))
3599 return NULL;
3600 _rv = IsShowContextualMenuClick(&inEvent);
3601 _res = Py_BuildValue("b",
3602 _rv);
3603 return _res;
3606 static PyObject *Menu_LMGetTheMenu(PyObject *_self, PyObject *_args)
3608 PyObject *_res = NULL;
3609 SInt16 _rv;
3610 #ifndef LMGetTheMenu
3611 PyMac_PRECHECK(LMGetTheMenu);
3612 #endif
3613 if (!PyArg_ParseTuple(_args, ""))
3614 return NULL;
3615 _rv = LMGetTheMenu();
3616 _res = Py_BuildValue("h",
3617 _rv);
3618 return _res;
3621 #if !TARGET_API_MAC_CARBON
3623 static PyObject *Menu_OpenDeskAcc(PyObject *_self, PyObject *_args)
3625 PyObject *_res = NULL;
3626 Str255 name;
3627 #ifndef OpenDeskAcc
3628 PyMac_PRECHECK(OpenDeskAcc);
3629 #endif
3630 if (!PyArg_ParseTuple(_args, "O&",
3631 PyMac_GetStr255, name))
3632 return NULL;
3633 OpenDeskAcc(name);
3634 Py_INCREF(Py_None);
3635 _res = Py_None;
3636 return _res;
3638 #endif
3640 static PyObject *Menu_as_Menu(PyObject *_self, PyObject *_args)
3642 PyObject *_res = NULL;
3643 MenuHandle _rv;
3644 Handle h;
3645 #ifndef as_Menu
3646 PyMac_PRECHECK(as_Menu);
3647 #endif
3648 if (!PyArg_ParseTuple(_args, "O&",
3649 ResObj_Convert, &h))
3650 return NULL;
3651 _rv = as_Menu(h);
3652 _res = Py_BuildValue("O&",
3653 MenuObj_New, _rv);
3654 return _res;
3657 static PyObject *Menu_GetMenu(PyObject *_self, PyObject *_args)
3659 PyObject *_res = NULL;
3660 MenuHandle _rv;
3661 short resourceID;
3662 #ifndef GetMenu
3663 PyMac_PRECHECK(GetMenu);
3664 #endif
3665 if (!PyArg_ParseTuple(_args, "h",
3666 &resourceID))
3667 return NULL;
3668 _rv = GetMenu(resourceID);
3669 _res = Py_BuildValue("O&",
3670 MenuObj_New, _rv);
3671 return _res;
3674 static PyObject *Menu_DeleteMenu(PyObject *_self, PyObject *_args)
3676 PyObject *_res = NULL;
3677 short menuID;
3678 #ifndef DeleteMenu
3679 PyMac_PRECHECK(DeleteMenu);
3680 #endif
3681 if (!PyArg_ParseTuple(_args, "h",
3682 &menuID))
3683 return NULL;
3684 DeleteMenu(menuID);
3685 Py_INCREF(Py_None);
3686 _res = Py_None;
3687 return _res;
3690 static PyObject *Menu_DrawMenuBar(PyObject *_self, PyObject *_args)
3692 PyObject *_res = NULL;
3693 #ifndef DrawMenuBar
3694 PyMac_PRECHECK(DrawMenuBar);
3695 #endif
3696 if (!PyArg_ParseTuple(_args, ""))
3697 return NULL;
3698 DrawMenuBar();
3699 Py_INCREF(Py_None);
3700 _res = Py_None;
3701 return _res;
3704 #if TARGET_API_MAC_CARBON
3706 static PyObject *Menu_CountMenuItemsWithCommandID(PyObject *_self, PyObject *_args)
3708 PyObject *_res = NULL;
3709 ItemCount _rv;
3710 MenuHandle inMenu;
3711 MenuCommand inCommandID;
3712 #ifndef CountMenuItemsWithCommandID
3713 PyMac_PRECHECK(CountMenuItemsWithCommandID);
3714 #endif
3715 if (!PyArg_ParseTuple(_args, "O&l",
3716 OptMenuObj_Convert, &inMenu,
3717 &inCommandID))
3718 return NULL;
3719 _rv = CountMenuItemsWithCommandID(inMenu,
3720 inCommandID);
3721 _res = Py_BuildValue("l",
3722 _rv);
3723 return _res;
3725 #endif
3727 #if TARGET_API_MAC_CARBON
3729 static PyObject *Menu_GetIndMenuItemWithCommandID(PyObject *_self, PyObject *_args)
3731 PyObject *_res = NULL;
3732 OSStatus _err;
3733 MenuHandle inMenu;
3734 MenuCommand inCommandID;
3735 UInt32 inItemIndex;
3736 MenuHandle outMenu;
3737 MenuItemIndex outIndex;
3738 #ifndef GetIndMenuItemWithCommandID
3739 PyMac_PRECHECK(GetIndMenuItemWithCommandID);
3740 #endif
3741 if (!PyArg_ParseTuple(_args, "O&ll",
3742 OptMenuObj_Convert, &inMenu,
3743 &inCommandID,
3744 &inItemIndex))
3745 return NULL;
3746 _err = GetIndMenuItemWithCommandID(inMenu,
3747 inCommandID,
3748 inItemIndex,
3749 &outMenu,
3750 &outIndex);
3751 if (_err != noErr) return PyMac_Error(_err);
3752 _res = Py_BuildValue("O&h",
3753 MenuObj_New, outMenu,
3754 outIndex);
3755 return _res;
3757 #endif
3759 #if TARGET_API_MAC_CARBON
3761 static PyObject *Menu_EnableMenuCommand(PyObject *_self, PyObject *_args)
3763 PyObject *_res = NULL;
3764 MenuHandle inMenu;
3765 MenuCommand inCommandID;
3766 #ifndef EnableMenuCommand
3767 PyMac_PRECHECK(EnableMenuCommand);
3768 #endif
3769 if (!PyArg_ParseTuple(_args, "O&l",
3770 OptMenuObj_Convert, &inMenu,
3771 &inCommandID))
3772 return NULL;
3773 EnableMenuCommand(inMenu,
3774 inCommandID);
3775 Py_INCREF(Py_None);
3776 _res = Py_None;
3777 return _res;
3779 #endif
3781 #if TARGET_API_MAC_CARBON
3783 static PyObject *Menu_DisableMenuCommand(PyObject *_self, PyObject *_args)
3785 PyObject *_res = NULL;
3786 MenuHandle inMenu;
3787 MenuCommand inCommandID;
3788 #ifndef DisableMenuCommand
3789 PyMac_PRECHECK(DisableMenuCommand);
3790 #endif
3791 if (!PyArg_ParseTuple(_args, "O&l",
3792 OptMenuObj_Convert, &inMenu,
3793 &inCommandID))
3794 return NULL;
3795 DisableMenuCommand(inMenu,
3796 inCommandID);
3797 Py_INCREF(Py_None);
3798 _res = Py_None;
3799 return _res;
3801 #endif
3803 #if TARGET_API_MAC_CARBON
3805 static PyObject *Menu_IsMenuCommandEnabled(PyObject *_self, PyObject *_args)
3807 PyObject *_res = NULL;
3808 Boolean _rv;
3809 MenuHandle inMenu;
3810 MenuCommand inCommandID;
3811 #ifndef IsMenuCommandEnabled
3812 PyMac_PRECHECK(IsMenuCommandEnabled);
3813 #endif
3814 if (!PyArg_ParseTuple(_args, "O&l",
3815 OptMenuObj_Convert, &inMenu,
3816 &inCommandID))
3817 return NULL;
3818 _rv = IsMenuCommandEnabled(inMenu,
3819 inCommandID);
3820 _res = Py_BuildValue("b",
3821 _rv);
3822 return _res;
3824 #endif
3826 #if TARGET_API_MAC_CARBON
3828 static PyObject *Menu_SetMenuCommandMark(PyObject *_self, PyObject *_args)
3830 PyObject *_res = NULL;
3831 OSStatus _err;
3832 MenuHandle inMenu;
3833 MenuCommand inCommandID;
3834 UniChar inMark;
3835 #ifndef SetMenuCommandMark
3836 PyMac_PRECHECK(SetMenuCommandMark);
3837 #endif
3838 if (!PyArg_ParseTuple(_args, "O&lh",
3839 OptMenuObj_Convert, &inMenu,
3840 &inCommandID,
3841 &inMark))
3842 return NULL;
3843 _err = SetMenuCommandMark(inMenu,
3844 inCommandID,
3845 inMark);
3846 if (_err != noErr) return PyMac_Error(_err);
3847 Py_INCREF(Py_None);
3848 _res = Py_None;
3849 return _res;
3851 #endif
3853 #if TARGET_API_MAC_CARBON
3855 static PyObject *Menu_GetMenuCommandMark(PyObject *_self, PyObject *_args)
3857 PyObject *_res = NULL;
3858 OSStatus _err;
3859 MenuHandle inMenu;
3860 MenuCommand inCommandID;
3861 UniChar outMark;
3862 #ifndef GetMenuCommandMark
3863 PyMac_PRECHECK(GetMenuCommandMark);
3864 #endif
3865 if (!PyArg_ParseTuple(_args, "O&l",
3866 OptMenuObj_Convert, &inMenu,
3867 &inCommandID))
3868 return NULL;
3869 _err = GetMenuCommandMark(inMenu,
3870 inCommandID,
3871 &outMark);
3872 if (_err != noErr) return PyMac_Error(_err);
3873 _res = Py_BuildValue("h",
3874 outMark);
3875 return _res;
3877 #endif
3879 #if TARGET_API_MAC_CARBON
3881 static PyObject *Menu_GetMenuCommandPropertySize(PyObject *_self, PyObject *_args)
3883 PyObject *_res = NULL;
3884 OSStatus _err;
3885 MenuHandle inMenu;
3886 MenuCommand inCommandID;
3887 OSType inPropertyCreator;
3888 OSType inPropertyTag;
3889 ByteCount outSize;
3890 #ifndef GetMenuCommandPropertySize
3891 PyMac_PRECHECK(GetMenuCommandPropertySize);
3892 #endif
3893 if (!PyArg_ParseTuple(_args, "O&lO&O&",
3894 OptMenuObj_Convert, &inMenu,
3895 &inCommandID,
3896 PyMac_GetOSType, &inPropertyCreator,
3897 PyMac_GetOSType, &inPropertyTag))
3898 return NULL;
3899 _err = GetMenuCommandPropertySize(inMenu,
3900 inCommandID,
3901 inPropertyCreator,
3902 inPropertyTag,
3903 &outSize);
3904 if (_err != noErr) return PyMac_Error(_err);
3905 _res = Py_BuildValue("l",
3906 outSize);
3907 return _res;
3909 #endif
3911 #if TARGET_API_MAC_CARBON
3913 static PyObject *Menu_RemoveMenuCommandProperty(PyObject *_self, PyObject *_args)
3915 PyObject *_res = NULL;
3916 OSStatus _err;
3917 MenuHandle inMenu;
3918 MenuCommand inCommandID;
3919 OSType inPropertyCreator;
3920 OSType inPropertyTag;
3921 #ifndef RemoveMenuCommandProperty
3922 PyMac_PRECHECK(RemoveMenuCommandProperty);
3923 #endif
3924 if (!PyArg_ParseTuple(_args, "O&lO&O&",
3925 OptMenuObj_Convert, &inMenu,
3926 &inCommandID,
3927 PyMac_GetOSType, &inPropertyCreator,
3928 PyMac_GetOSType, &inPropertyTag))
3929 return NULL;
3930 _err = RemoveMenuCommandProperty(inMenu,
3931 inCommandID,
3932 inPropertyCreator,
3933 inPropertyTag);
3934 if (_err != noErr) return PyMac_Error(_err);
3935 Py_INCREF(Py_None);
3936 _res = Py_None;
3937 return _res;
3939 #endif
3941 static PyMethodDef Menu_methods[] = {
3943 #if !TARGET_API_MAC_CARBON
3944 {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1,
3945 "(short resID) -> None"},
3946 #endif
3948 #if !TARGET_API_MAC_CARBON
3949 {"InitMenus", (PyCFunction)Menu_InitMenus, 1,
3950 "() -> None"},
3951 #endif
3952 {"NewMenu", (PyCFunction)Menu_NewMenu, 1,
3953 "(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)"},
3954 {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1,
3955 "(short resourceID) -> (MenuHandle _rv)"},
3957 #if TARGET_API_MAC_CARBON
3958 {"CreateNewMenu", (PyCFunction)Menu_CreateNewMenu, 1,
3959 "(MenuID inMenuID, MenuAttributes inMenuAttributes) -> (MenuHandle outMenuRef)"},
3960 #endif
3961 {"MenuKey", (PyCFunction)Menu_MenuKey, 1,
3962 "(CharParameter ch) -> (long _rv)"},
3963 {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
3964 "(Point startPt) -> (long _rv)"},
3965 {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1,
3966 "() -> (long _rv)"},
3967 {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1,
3968 "(EventRecord inEvent) -> (UInt32 _rv)"},
3969 {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1,
3970 "() -> (short _rv)"},
3971 {"MacDrawMenuBar", (PyCFunction)Menu_MacDrawMenuBar, 1,
3972 "() -> None"},
3973 {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
3974 "() -> None"},
3975 {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
3976 "(MenuID menuID) -> None"},
3977 {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
3978 "(short menuBarID) -> (MenuBarHandle _rv)"},
3979 {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
3980 "() -> (MenuBarHandle _rv)"},
3981 {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
3982 "(MenuBarHandle mbar) -> None"},
3984 #if TARGET_API_MAC_CARBON
3985 {"DuplicateMenuBar", (PyCFunction)Menu_DuplicateMenuBar, 1,
3986 "(MenuBarHandle inMbar) -> (MenuBarHandle outMbar)"},
3987 #endif
3989 #if TARGET_API_MAC_CARBON
3990 {"DisposeMenuBar", (PyCFunction)Menu_DisposeMenuBar, 1,
3991 "(MenuBarHandle inMbar) -> None"},
3992 #endif
3993 {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
3994 "(MenuID menuID) -> (MenuHandle _rv)"},
3995 {"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1,
3996 "(MenuID menuID) -> None"},
3997 {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
3998 "() -> None"},
4000 #if !TARGET_API_MAC_CARBON
4001 {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1,
4002 "(short count) -> None"},
4003 #endif
4004 {"SetMenuFlashCount", (PyCFunction)Menu_SetMenuFlashCount, 1,
4005 "(short count) -> None"},
4006 {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
4007 "(MenuID menuID) -> None"},
4009 #if !TARGET_API_MAC_CARBON
4010 {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1,
4011 "(short editCmd) -> (Boolean _rv)"},
4012 #endif
4014 #if !TARGET_API_MAC_CARBON
4015 {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1,
4016 "(long menuResult) -> None"},
4017 #endif
4018 {"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1,
4019 "() -> (Boolean _rv)"},
4020 {"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1,
4021 "() -> None"},
4022 {"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1,
4023 "() -> None"},
4025 #if TARGET_API_MAC_CARBON
4026 {"AcquireRootMenu", (PyCFunction)Menu_AcquireRootMenu, 1,
4027 "() -> (MenuHandle _rv)"},
4028 #endif
4029 {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
4030 "(MenuID menuID, short menuItem) -> None"},
4031 {"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1,
4032 "() -> None"},
4033 {"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1,
4034 "(EventRecord inEvent) -> (Boolean _rv)"},
4035 {"LMGetTheMenu", (PyCFunction)Menu_LMGetTheMenu, 1,
4036 "() -> (SInt16 _rv)"},
4038 #if !TARGET_API_MAC_CARBON
4039 {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1,
4040 "(Str255 name) -> None"},
4041 #endif
4042 {"as_Menu", (PyCFunction)Menu_as_Menu, 1,
4043 "(Handle h) -> (MenuHandle _rv)"},
4044 {"GetMenu", (PyCFunction)Menu_GetMenu, 1,
4045 "(short resourceID) -> (MenuHandle _rv)"},
4046 {"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1,
4047 "(short menuID) -> None"},
4048 {"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1,
4049 "() -> None"},
4051 #if TARGET_API_MAC_CARBON
4052 {"CountMenuItemsWithCommandID", (PyCFunction)Menu_CountMenuItemsWithCommandID, 1,
4053 "(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)"},
4054 #endif
4056 #if TARGET_API_MAC_CARBON
4057 {"GetIndMenuItemWithCommandID", (PyCFunction)Menu_GetIndMenuItemWithCommandID, 1,
4058 "(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)"},
4059 #endif
4061 #if TARGET_API_MAC_CARBON
4062 {"EnableMenuCommand", (PyCFunction)Menu_EnableMenuCommand, 1,
4063 "(MenuHandle inMenu, MenuCommand inCommandID) -> None"},
4064 #endif
4066 #if TARGET_API_MAC_CARBON
4067 {"DisableMenuCommand", (PyCFunction)Menu_DisableMenuCommand, 1,
4068 "(MenuHandle inMenu, MenuCommand inCommandID) -> None"},
4069 #endif
4071 #if TARGET_API_MAC_CARBON
4072 {"IsMenuCommandEnabled", (PyCFunction)Menu_IsMenuCommandEnabled, 1,
4073 "(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)"},
4074 #endif
4076 #if TARGET_API_MAC_CARBON
4077 {"SetMenuCommandMark", (PyCFunction)Menu_SetMenuCommandMark, 1,
4078 "(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None"},
4079 #endif
4081 #if TARGET_API_MAC_CARBON
4082 {"GetMenuCommandMark", (PyCFunction)Menu_GetMenuCommandMark, 1,
4083 "(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)"},
4084 #endif
4086 #if TARGET_API_MAC_CARBON
4087 {"GetMenuCommandPropertySize", (PyCFunction)Menu_GetMenuCommandPropertySize, 1,
4088 "(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)"},
4089 #endif
4091 #if TARGET_API_MAC_CARBON
4092 {"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1,
4093 "(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None"},
4094 #endif
4095 {NULL, NULL, 0}
4101 void init_Menu(void)
4103 PyObject *m;
4104 PyObject *d;
4108 PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New);
4109 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
4112 m = Py_InitModule("_Menu", Menu_methods);
4113 d = PyModule_GetDict(m);
4114 Menu_Error = PyMac_GetOSErrException();
4115 if (Menu_Error == NULL ||
4116 PyDict_SetItemString(d, "Error", Menu_Error) != 0)
4117 return;
4118 Menu_Type.ob_type = &PyType_Type;
4119 Py_INCREF(&Menu_Type);
4120 if (PyDict_SetItemString(d, "MenuType", (PyObject *)&Menu_Type) != 0)
4121 Py_FatalError("can't initialize MenuType");
4124 /* ======================== End module _Menu ======================== */