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