2 /* ========================== Module _Menu ========================== */
8 #include "pymactoolbox.h"
10 /* Macro to test whether a weak-loaded CFM function exists */
11 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
12 PyErr_SetString(PyExc_NotImplementedError, \
13 "Not available in this shared library/OS version"); \
18 #include <Carbon/Carbon.h>
21 #ifdef USE_TOOLBOX_OBJECT_GLUE
23 extern PyObject
*_MenuObj_New(MenuHandle
);
24 extern int _MenuObj_Convert(PyObject
*, MenuHandle
*);
26 #define MenuObj_New _MenuObj_New
27 #define MenuObj_Convert _MenuObj_Convert
30 #define as_Menu(h) ((MenuHandle)h)
31 #define as_Resource(h) ((Handle)h)
34 /* Alternative version of MenuObj_New, which returns None for NULL argument */
35 PyObject
*OptMenuObj_New(MenuRef itself
)
41 return MenuObj_New(itself
);
44 /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */
45 int OptMenuObj_Convert(PyObject
*v
, MenuRef
*p_itself
)
51 return MenuObj_Convert(v
, p_itself
);
54 static PyObject
*Menu_Error
;
56 /* ------------------------ Object type Menu ------------------------ */
58 PyTypeObject Menu_Type
;
60 #define MenuObj_Check(x) ((x)->ob_type == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type))
62 typedef struct MenuObject
{
67 PyObject
*MenuObj_New(MenuHandle itself
)
70 it
= PyObject_NEW(MenuObject
, &Menu_Type
);
71 if (it
== NULL
) return NULL
;
72 it
->ob_itself
= itself
;
73 return (PyObject
*)it
;
75 int MenuObj_Convert(PyObject
*v
, MenuHandle
*p_itself
)
77 if (!MenuObj_Check(v
))
79 PyErr_SetString(PyExc_TypeError
, "Menu required");
82 *p_itself
= ((MenuObject
*)v
)->ob_itself
;
86 static void MenuObj_dealloc(MenuObject
*self
)
88 /* Cleanup of self->ob_itself goes here */
89 self
->ob_type
->tp_free((PyObject
*)self
);
92 static PyObject
*MenuObj_DisposeMenu(MenuObject
*_self
, PyObject
*_args
)
94 PyObject
*_res
= NULL
;
96 PyMac_PRECHECK(DisposeMenu
);
98 if (!PyArg_ParseTuple(_args
, ""))
100 DisposeMenu(_self
->ob_itself
);
106 static PyObject
*MenuObj_CalcMenuSize(MenuObject
*_self
, PyObject
*_args
)
108 PyObject
*_res
= NULL
;
110 PyMac_PRECHECK(CalcMenuSize
);
112 if (!PyArg_ParseTuple(_args
, ""))
114 CalcMenuSize(_self
->ob_itself
);
120 static PyObject
*MenuObj_CountMenuItems(MenuObject
*_self
, PyObject
*_args
)
122 PyObject
*_res
= NULL
;
124 #ifndef CountMenuItems
125 PyMac_PRECHECK(CountMenuItems
);
127 if (!PyArg_ParseTuple(_args
, ""))
129 _rv
= CountMenuItems(_self
->ob_itself
);
130 _res
= Py_BuildValue("H",
135 static PyObject
*MenuObj_GetMenuFont(MenuObject
*_self
, PyObject
*_args
)
137 PyObject
*_res
= NULL
;
142 PyMac_PRECHECK(GetMenuFont
);
144 if (!PyArg_ParseTuple(_args
, ""))
146 _err
= GetMenuFont(_self
->ob_itself
,
149 if (_err
!= noErr
) return PyMac_Error(_err
);
150 _res
= Py_BuildValue("hH",
156 static PyObject
*MenuObj_SetMenuFont(MenuObject
*_self
, PyObject
*_args
)
158 PyObject
*_res
= NULL
;
163 PyMac_PRECHECK(SetMenuFont
);
165 if (!PyArg_ParseTuple(_args
, "hH",
169 _err
= SetMenuFont(_self
->ob_itself
,
172 if (_err
!= noErr
) return PyMac_Error(_err
);
178 static PyObject
*MenuObj_GetMenuExcludesMarkColumn(MenuObject
*_self
, PyObject
*_args
)
180 PyObject
*_res
= NULL
;
182 #ifndef GetMenuExcludesMarkColumn
183 PyMac_PRECHECK(GetMenuExcludesMarkColumn
);
185 if (!PyArg_ParseTuple(_args
, ""))
187 _rv
= GetMenuExcludesMarkColumn(_self
->ob_itself
);
188 _res
= Py_BuildValue("b",
193 static PyObject
*MenuObj_SetMenuExcludesMarkColumn(MenuObject
*_self
, PyObject
*_args
)
195 PyObject
*_res
= NULL
;
197 Boolean excludesMark
;
198 #ifndef SetMenuExcludesMarkColumn
199 PyMac_PRECHECK(SetMenuExcludesMarkColumn
);
201 if (!PyArg_ParseTuple(_args
, "b",
204 _err
= SetMenuExcludesMarkColumn(_self
->ob_itself
,
206 if (_err
!= noErr
) return PyMac_Error(_err
);
212 static PyObject
*MenuObj_IsValidMenu(MenuObject
*_self
, PyObject
*_args
)
214 PyObject
*_res
= NULL
;
217 PyMac_PRECHECK(IsValidMenu
);
219 if (!PyArg_ParseTuple(_args
, ""))
221 _rv
= IsValidMenu(_self
->ob_itself
);
222 _res
= Py_BuildValue("b",
227 static PyObject
*MenuObj_GetMenuRetainCount(MenuObject
*_self
, PyObject
*_args
)
229 PyObject
*_res
= NULL
;
231 #ifndef GetMenuRetainCount
232 PyMac_PRECHECK(GetMenuRetainCount
);
234 if (!PyArg_ParseTuple(_args
, ""))
236 _rv
= GetMenuRetainCount(_self
->ob_itself
);
237 _res
= Py_BuildValue("l",
242 static PyObject
*MenuObj_RetainMenu(MenuObject
*_self
, PyObject
*_args
)
244 PyObject
*_res
= NULL
;
247 PyMac_PRECHECK(RetainMenu
);
249 if (!PyArg_ParseTuple(_args
, ""))
251 _err
= RetainMenu(_self
->ob_itself
);
252 if (_err
!= noErr
) return PyMac_Error(_err
);
258 static PyObject
*MenuObj_ReleaseMenu(MenuObject
*_self
, PyObject
*_args
)
260 PyObject
*_res
= NULL
;
263 PyMac_PRECHECK(ReleaseMenu
);
265 if (!PyArg_ParseTuple(_args
, ""))
267 _err
= ReleaseMenu(_self
->ob_itself
);
268 if (_err
!= noErr
) return PyMac_Error(_err
);
274 static PyObject
*MenuObj_DuplicateMenu(MenuObject
*_self
, PyObject
*_args
)
276 PyObject
*_res
= NULL
;
279 #ifndef DuplicateMenu
280 PyMac_PRECHECK(DuplicateMenu
);
282 if (!PyArg_ParseTuple(_args
, ""))
284 _err
= DuplicateMenu(_self
->ob_itself
,
286 if (_err
!= noErr
) return PyMac_Error(_err
);
287 _res
= Py_BuildValue("O&",
288 MenuObj_New
, outMenu
);
292 static PyObject
*MenuObj_CopyMenuTitleAsCFString(MenuObject
*_self
, PyObject
*_args
)
294 PyObject
*_res
= NULL
;
296 CFStringRef outString
;
297 #ifndef CopyMenuTitleAsCFString
298 PyMac_PRECHECK(CopyMenuTitleAsCFString
);
300 if (!PyArg_ParseTuple(_args
, ""))
302 _err
= CopyMenuTitleAsCFString(_self
->ob_itself
,
304 if (_err
!= noErr
) return PyMac_Error(_err
);
305 _res
= Py_BuildValue("O&",
306 CFStringRefObj_New
, outString
);
310 static PyObject
*MenuObj_SetMenuTitleWithCFString(MenuObject
*_self
, PyObject
*_args
)
312 PyObject
*_res
= NULL
;
314 CFStringRef inString
;
315 #ifndef SetMenuTitleWithCFString
316 PyMac_PRECHECK(SetMenuTitleWithCFString
);
318 if (!PyArg_ParseTuple(_args
, "O&",
319 CFStringRefObj_Convert
, &inString
))
321 _err
= SetMenuTitleWithCFString(_self
->ob_itself
,
323 if (_err
!= noErr
) return PyMac_Error(_err
);
329 static PyObject
*MenuObj_InvalidateMenuSize(MenuObject
*_self
, PyObject
*_args
)
331 PyObject
*_res
= NULL
;
333 #ifndef InvalidateMenuSize
334 PyMac_PRECHECK(InvalidateMenuSize
);
336 if (!PyArg_ParseTuple(_args
, ""))
338 _err
= InvalidateMenuSize(_self
->ob_itself
);
339 if (_err
!= noErr
) return PyMac_Error(_err
);
345 static PyObject
*MenuObj_IsMenuSizeInvalid(MenuObject
*_self
, PyObject
*_args
)
347 PyObject
*_res
= NULL
;
349 #ifndef IsMenuSizeInvalid
350 PyMac_PRECHECK(IsMenuSizeInvalid
);
352 if (!PyArg_ParseTuple(_args
, ""))
354 _rv
= IsMenuSizeInvalid(_self
->ob_itself
);
355 _res
= Py_BuildValue("b",
360 static PyObject
*MenuObj_MacAppendMenu(MenuObject
*_self
, PyObject
*_args
)
362 PyObject
*_res
= NULL
;
364 #ifndef MacAppendMenu
365 PyMac_PRECHECK(MacAppendMenu
);
367 if (!PyArg_ParseTuple(_args
, "O&",
368 PyMac_GetStr255
, data
))
370 MacAppendMenu(_self
->ob_itself
,
377 static PyObject
*MenuObj_InsertResMenu(MenuObject
*_self
, PyObject
*_args
)
379 PyObject
*_res
= NULL
;
382 #ifndef InsertResMenu
383 PyMac_PRECHECK(InsertResMenu
);
385 if (!PyArg_ParseTuple(_args
, "O&h",
386 PyMac_GetOSType
, &theType
,
389 InsertResMenu(_self
->ob_itself
,
397 static PyObject
*MenuObj_AppendResMenu(MenuObject
*_self
, PyObject
*_args
)
399 PyObject
*_res
= NULL
;
401 #ifndef AppendResMenu
402 PyMac_PRECHECK(AppendResMenu
);
404 if (!PyArg_ParseTuple(_args
, "O&",
405 PyMac_GetOSType
, &theType
))
407 AppendResMenu(_self
->ob_itself
,
414 static PyObject
*MenuObj_MacInsertMenuItem(MenuObject
*_self
, PyObject
*_args
)
416 PyObject
*_res
= NULL
;
419 #ifndef MacInsertMenuItem
420 PyMac_PRECHECK(MacInsertMenuItem
);
422 if (!PyArg_ParseTuple(_args
, "O&h",
423 PyMac_GetStr255
, itemString
,
426 MacInsertMenuItem(_self
->ob_itself
,
434 static PyObject
*MenuObj_DeleteMenuItem(MenuObject
*_self
, PyObject
*_args
)
436 PyObject
*_res
= NULL
;
438 #ifndef DeleteMenuItem
439 PyMac_PRECHECK(DeleteMenuItem
);
441 if (!PyArg_ParseTuple(_args
, "h",
444 DeleteMenuItem(_self
->ob_itself
,
451 static PyObject
*MenuObj_InsertFontResMenu(MenuObject
*_self
, PyObject
*_args
)
453 PyObject
*_res
= NULL
;
456 #ifndef InsertFontResMenu
457 PyMac_PRECHECK(InsertFontResMenu
);
459 if (!PyArg_ParseTuple(_args
, "hh",
463 InsertFontResMenu(_self
->ob_itself
,
471 static PyObject
*MenuObj_InsertIntlResMenu(MenuObject
*_self
, PyObject
*_args
)
473 PyObject
*_res
= NULL
;
477 #ifndef InsertIntlResMenu
478 PyMac_PRECHECK(InsertIntlResMenu
);
480 if (!PyArg_ParseTuple(_args
, "O&hh",
481 PyMac_GetOSType
, &theType
,
485 InsertIntlResMenu(_self
->ob_itself
,
494 static PyObject
*MenuObj_AppendMenuItemText(MenuObject
*_self
, PyObject
*_args
)
496 PyObject
*_res
= NULL
;
499 #ifndef AppendMenuItemText
500 PyMac_PRECHECK(AppendMenuItemText
);
502 if (!PyArg_ParseTuple(_args
, "O&",
503 PyMac_GetStr255
, inString
))
505 _err
= AppendMenuItemText(_self
->ob_itself
,
507 if (_err
!= noErr
) return PyMac_Error(_err
);
513 static PyObject
*MenuObj_InsertMenuItemText(MenuObject
*_self
, PyObject
*_args
)
515 PyObject
*_res
= NULL
;
518 MenuItemIndex afterItem
;
519 #ifndef InsertMenuItemText
520 PyMac_PRECHECK(InsertMenuItemText
);
522 if (!PyArg_ParseTuple(_args
, "O&h",
523 PyMac_GetStr255
, inString
,
526 _err
= InsertMenuItemText(_self
->ob_itself
,
529 if (_err
!= noErr
) return PyMac_Error(_err
);
535 static PyObject
*MenuObj_CopyMenuItems(MenuObject
*_self
, PyObject
*_args
)
537 PyObject
*_res
= NULL
;
539 MenuItemIndex inFirstItem
;
540 ItemCount inNumItems
;
541 MenuHandle inDestMenu
;
542 MenuItemIndex inInsertAfter
;
543 #ifndef CopyMenuItems
544 PyMac_PRECHECK(CopyMenuItems
);
546 if (!PyArg_ParseTuple(_args
, "hlO&h",
549 MenuObj_Convert
, &inDestMenu
,
552 _err
= CopyMenuItems(_self
->ob_itself
,
557 if (_err
!= noErr
) return PyMac_Error(_err
);
563 static PyObject
*MenuObj_DeleteMenuItems(MenuObject
*_self
, PyObject
*_args
)
565 PyObject
*_res
= NULL
;
567 MenuItemIndex inFirstItem
;
568 ItemCount inNumItems
;
569 #ifndef DeleteMenuItems
570 PyMac_PRECHECK(DeleteMenuItems
);
572 if (!PyArg_ParseTuple(_args
, "hl",
576 _err
= DeleteMenuItems(_self
->ob_itself
,
579 if (_err
!= noErr
) return PyMac_Error(_err
);
585 static PyObject
*MenuObj_AppendMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
587 PyObject
*_res
= NULL
;
589 CFStringRef inString
;
590 MenuItemAttributes inAttributes
;
591 MenuCommand inCommandID
;
592 MenuItemIndex outNewItem
;
593 #ifndef AppendMenuItemTextWithCFString
594 PyMac_PRECHECK(AppendMenuItemTextWithCFString
);
596 if (!PyArg_ParseTuple(_args
, "O&ll",
597 CFStringRefObj_Convert
, &inString
,
601 _err
= AppendMenuItemTextWithCFString(_self
->ob_itself
,
606 if (_err
!= noErr
) return PyMac_Error(_err
);
607 _res
= Py_BuildValue("h",
612 static PyObject
*MenuObj_InsertMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
614 PyObject
*_res
= NULL
;
616 CFStringRef inString
;
617 MenuItemIndex inAfterItem
;
618 MenuItemAttributes inAttributes
;
619 MenuCommand inCommandID
;
620 #ifndef InsertMenuItemTextWithCFString
621 PyMac_PRECHECK(InsertMenuItemTextWithCFString
);
623 if (!PyArg_ParseTuple(_args
, "O&hll",
624 CFStringRefObj_Convert
, &inString
,
629 _err
= InsertMenuItemTextWithCFString(_self
->ob_itself
,
634 if (_err
!= noErr
) return PyMac_Error(_err
);
640 static PyObject
*MenuObj_PopUpMenuSelect(MenuObject
*_self
, PyObject
*_args
)
642 PyObject
*_res
= NULL
;
647 #ifndef PopUpMenuSelect
648 PyMac_PRECHECK(PopUpMenuSelect
);
650 if (!PyArg_ParseTuple(_args
, "hhh",
655 _rv
= PopUpMenuSelect(_self
->ob_itself
,
659 _res
= Py_BuildValue("l",
664 static PyObject
*MenuObj_InvalidateMenuEnabling(MenuObject
*_self
, PyObject
*_args
)
666 PyObject
*_res
= NULL
;
668 #ifndef InvalidateMenuEnabling
669 PyMac_PRECHECK(InvalidateMenuEnabling
);
671 if (!PyArg_ParseTuple(_args
, ""))
673 _err
= InvalidateMenuEnabling(_self
->ob_itself
);
674 if (_err
!= noErr
) return PyMac_Error(_err
);
680 static PyObject
*MenuObj_IsMenuBarInvalid(MenuObject
*_self
, PyObject
*_args
)
682 PyObject
*_res
= NULL
;
684 #ifndef IsMenuBarInvalid
685 PyMac_PRECHECK(IsMenuBarInvalid
);
687 if (!PyArg_ParseTuple(_args
, ""))
689 _rv
= IsMenuBarInvalid(_self
->ob_itself
);
690 _res
= Py_BuildValue("b",
695 static PyObject
*MenuObj_MacInsertMenu(MenuObject
*_self
, PyObject
*_args
)
697 PyObject
*_res
= NULL
;
699 #ifndef MacInsertMenu
700 PyMac_PRECHECK(MacInsertMenu
);
702 if (!PyArg_ParseTuple(_args
, "h",
705 MacInsertMenu(_self
->ob_itself
,
712 static PyObject
*MenuObj_SetRootMenu(MenuObject
*_self
, PyObject
*_args
)
714 PyObject
*_res
= NULL
;
717 PyMac_PRECHECK(SetRootMenu
);
719 if (!PyArg_ParseTuple(_args
, ""))
721 _err
= SetRootMenu(_self
->ob_itself
);
722 if (_err
!= noErr
) return PyMac_Error(_err
);
728 static PyObject
*MenuObj_MacCheckMenuItem(MenuObject
*_self
, PyObject
*_args
)
730 PyObject
*_res
= NULL
;
733 #ifndef MacCheckMenuItem
734 PyMac_PRECHECK(MacCheckMenuItem
);
736 if (!PyArg_ParseTuple(_args
, "hb",
740 MacCheckMenuItem(_self
->ob_itself
,
748 static PyObject
*MenuObj_SetMenuItemText(MenuObject
*_self
, PyObject
*_args
)
750 PyObject
*_res
= NULL
;
753 #ifndef SetMenuItemText
754 PyMac_PRECHECK(SetMenuItemText
);
756 if (!PyArg_ParseTuple(_args
, "hO&",
758 PyMac_GetStr255
, itemString
))
760 SetMenuItemText(_self
->ob_itself
,
768 static PyObject
*MenuObj_GetMenuItemText(MenuObject
*_self
, PyObject
*_args
)
770 PyObject
*_res
= NULL
;
773 #ifndef GetMenuItemText
774 PyMac_PRECHECK(GetMenuItemText
);
776 if (!PyArg_ParseTuple(_args
, "h",
779 GetMenuItemText(_self
->ob_itself
,
782 _res
= Py_BuildValue("O&",
783 PyMac_BuildStr255
, itemString
);
787 static PyObject
*MenuObj_SetItemMark(MenuObject
*_self
, PyObject
*_args
)
789 PyObject
*_res
= NULL
;
791 CharParameter markChar
;
793 PyMac_PRECHECK(SetItemMark
);
795 if (!PyArg_ParseTuple(_args
, "hh",
799 SetItemMark(_self
->ob_itself
,
807 static PyObject
*MenuObj_GetItemMark(MenuObject
*_self
, PyObject
*_args
)
809 PyObject
*_res
= NULL
;
811 CharParameter markChar
;
813 PyMac_PRECHECK(GetItemMark
);
815 if (!PyArg_ParseTuple(_args
, "h",
818 GetItemMark(_self
->ob_itself
,
821 _res
= Py_BuildValue("h",
826 static PyObject
*MenuObj_SetItemCmd(MenuObject
*_self
, PyObject
*_args
)
828 PyObject
*_res
= NULL
;
830 CharParameter cmdChar
;
832 PyMac_PRECHECK(SetItemCmd
);
834 if (!PyArg_ParseTuple(_args
, "hh",
838 SetItemCmd(_self
->ob_itself
,
846 static PyObject
*MenuObj_GetItemCmd(MenuObject
*_self
, PyObject
*_args
)
848 PyObject
*_res
= NULL
;
850 CharParameter cmdChar
;
852 PyMac_PRECHECK(GetItemCmd
);
854 if (!PyArg_ParseTuple(_args
, "h",
857 GetItemCmd(_self
->ob_itself
,
860 _res
= Py_BuildValue("h",
865 static PyObject
*MenuObj_SetItemIcon(MenuObject
*_self
, PyObject
*_args
)
867 PyObject
*_res
= NULL
;
871 PyMac_PRECHECK(SetItemIcon
);
873 if (!PyArg_ParseTuple(_args
, "hh",
877 SetItemIcon(_self
->ob_itself
,
885 static PyObject
*MenuObj_GetItemIcon(MenuObject
*_self
, PyObject
*_args
)
887 PyObject
*_res
= NULL
;
891 PyMac_PRECHECK(GetItemIcon
);
893 if (!PyArg_ParseTuple(_args
, "h",
896 GetItemIcon(_self
->ob_itself
,
899 _res
= Py_BuildValue("h",
904 static PyObject
*MenuObj_SetItemStyle(MenuObject
*_self
, PyObject
*_args
)
906 PyObject
*_res
= NULL
;
908 StyleParameter chStyle
;
910 PyMac_PRECHECK(SetItemStyle
);
912 if (!PyArg_ParseTuple(_args
, "hh",
916 SetItemStyle(_self
->ob_itself
,
924 static PyObject
*MenuObj_GetItemStyle(MenuObject
*_self
, PyObject
*_args
)
926 PyObject
*_res
= NULL
;
930 PyMac_PRECHECK(GetItemStyle
);
932 if (!PyArg_ParseTuple(_args
, "h",
935 GetItemStyle(_self
->ob_itself
,
938 _res
= Py_BuildValue("b",
943 static PyObject
*MenuObj_SetMenuItemCommandID(MenuObject
*_self
, PyObject
*_args
)
945 PyObject
*_res
= NULL
;
948 MenuCommand inCommandID
;
949 #ifndef SetMenuItemCommandID
950 PyMac_PRECHECK(SetMenuItemCommandID
);
952 if (!PyArg_ParseTuple(_args
, "hl",
956 _err
= SetMenuItemCommandID(_self
->ob_itself
,
959 if (_err
!= noErr
) return PyMac_Error(_err
);
965 static PyObject
*MenuObj_GetMenuItemCommandID(MenuObject
*_self
, PyObject
*_args
)
967 PyObject
*_res
= NULL
;
970 MenuCommand outCommandID
;
971 #ifndef GetMenuItemCommandID
972 PyMac_PRECHECK(GetMenuItemCommandID
);
974 if (!PyArg_ParseTuple(_args
, "h",
977 _err
= GetMenuItemCommandID(_self
->ob_itself
,
980 if (_err
!= noErr
) return PyMac_Error(_err
);
981 _res
= Py_BuildValue("l",
986 static PyObject
*MenuObj_SetMenuItemModifiers(MenuObject
*_self
, PyObject
*_args
)
988 PyObject
*_res
= NULL
;
992 #ifndef SetMenuItemModifiers
993 PyMac_PRECHECK(SetMenuItemModifiers
);
995 if (!PyArg_ParseTuple(_args
, "hb",
999 _err
= SetMenuItemModifiers(_self
->ob_itself
,
1002 if (_err
!= noErr
) return PyMac_Error(_err
);
1008 static PyObject
*MenuObj_GetMenuItemModifiers(MenuObject
*_self
, PyObject
*_args
)
1010 PyObject
*_res
= NULL
;
1014 #ifndef GetMenuItemModifiers
1015 PyMac_PRECHECK(GetMenuItemModifiers
);
1017 if (!PyArg_ParseTuple(_args
, "h",
1020 _err
= GetMenuItemModifiers(_self
->ob_itself
,
1023 if (_err
!= noErr
) return PyMac_Error(_err
);
1024 _res
= Py_BuildValue("b",
1029 static PyObject
*MenuObj_SetMenuItemIconHandle(MenuObject
*_self
, PyObject
*_args
)
1031 PyObject
*_res
= NULL
;
1035 Handle inIconHandle
;
1036 #ifndef SetMenuItemIconHandle
1037 PyMac_PRECHECK(SetMenuItemIconHandle
);
1039 if (!PyArg_ParseTuple(_args
, "hbO&",
1042 ResObj_Convert
, &inIconHandle
))
1044 _err
= SetMenuItemIconHandle(_self
->ob_itself
,
1048 if (_err
!= noErr
) return PyMac_Error(_err
);
1054 static PyObject
*MenuObj_GetMenuItemIconHandle(MenuObject
*_self
, PyObject
*_args
)
1056 PyObject
*_res
= NULL
;
1060 Handle outIconHandle
;
1061 #ifndef GetMenuItemIconHandle
1062 PyMac_PRECHECK(GetMenuItemIconHandle
);
1064 if (!PyArg_ParseTuple(_args
, "h",
1067 _err
= GetMenuItemIconHandle(_self
->ob_itself
,
1071 if (_err
!= noErr
) return PyMac_Error(_err
);
1072 _res
= Py_BuildValue("bO&",
1074 ResObj_New
, outIconHandle
);
1078 static PyObject
*MenuObj_SetMenuItemTextEncoding(MenuObject
*_self
, PyObject
*_args
)
1080 PyObject
*_res
= NULL
;
1083 TextEncoding inScriptID
;
1084 #ifndef SetMenuItemTextEncoding
1085 PyMac_PRECHECK(SetMenuItemTextEncoding
);
1087 if (!PyArg_ParseTuple(_args
, "hl",
1091 _err
= SetMenuItemTextEncoding(_self
->ob_itself
,
1094 if (_err
!= noErr
) return PyMac_Error(_err
);
1100 static PyObject
*MenuObj_GetMenuItemTextEncoding(MenuObject
*_self
, PyObject
*_args
)
1102 PyObject
*_res
= NULL
;
1105 TextEncoding outScriptID
;
1106 #ifndef GetMenuItemTextEncoding
1107 PyMac_PRECHECK(GetMenuItemTextEncoding
);
1109 if (!PyArg_ParseTuple(_args
, "h",
1112 _err
= GetMenuItemTextEncoding(_self
->ob_itself
,
1115 if (_err
!= noErr
) return PyMac_Error(_err
);
1116 _res
= Py_BuildValue("l",
1121 static PyObject
*MenuObj_SetMenuItemHierarchicalID(MenuObject
*_self
, PyObject
*_args
)
1123 PyObject
*_res
= NULL
;
1127 #ifndef SetMenuItemHierarchicalID
1128 PyMac_PRECHECK(SetMenuItemHierarchicalID
);
1130 if (!PyArg_ParseTuple(_args
, "hh",
1134 _err
= SetMenuItemHierarchicalID(_self
->ob_itself
,
1137 if (_err
!= noErr
) return PyMac_Error(_err
);
1143 static PyObject
*MenuObj_GetMenuItemHierarchicalID(MenuObject
*_self
, PyObject
*_args
)
1145 PyObject
*_res
= NULL
;
1149 #ifndef GetMenuItemHierarchicalID
1150 PyMac_PRECHECK(GetMenuItemHierarchicalID
);
1152 if (!PyArg_ParseTuple(_args
, "h",
1155 _err
= GetMenuItemHierarchicalID(_self
->ob_itself
,
1158 if (_err
!= noErr
) return PyMac_Error(_err
);
1159 _res
= Py_BuildValue("h",
1164 static PyObject
*MenuObj_SetMenuItemFontID(MenuObject
*_self
, PyObject
*_args
)
1166 PyObject
*_res
= NULL
;
1170 #ifndef SetMenuItemFontID
1171 PyMac_PRECHECK(SetMenuItemFontID
);
1173 if (!PyArg_ParseTuple(_args
, "hh",
1177 _err
= SetMenuItemFontID(_self
->ob_itself
,
1180 if (_err
!= noErr
) return PyMac_Error(_err
);
1186 static PyObject
*MenuObj_GetMenuItemFontID(MenuObject
*_self
, PyObject
*_args
)
1188 PyObject
*_res
= NULL
;
1192 #ifndef GetMenuItemFontID
1193 PyMac_PRECHECK(GetMenuItemFontID
);
1195 if (!PyArg_ParseTuple(_args
, "h",
1198 _err
= GetMenuItemFontID(_self
->ob_itself
,
1201 if (_err
!= noErr
) return PyMac_Error(_err
);
1202 _res
= Py_BuildValue("h",
1207 static PyObject
*MenuObj_SetMenuItemRefCon(MenuObject
*_self
, PyObject
*_args
)
1209 PyObject
*_res
= NULL
;
1213 #ifndef SetMenuItemRefCon
1214 PyMac_PRECHECK(SetMenuItemRefCon
);
1216 if (!PyArg_ParseTuple(_args
, "hl",
1220 _err
= SetMenuItemRefCon(_self
->ob_itself
,
1223 if (_err
!= noErr
) return PyMac_Error(_err
);
1229 static PyObject
*MenuObj_GetMenuItemRefCon(MenuObject
*_self
, PyObject
*_args
)
1231 PyObject
*_res
= NULL
;
1235 #ifndef GetMenuItemRefCon
1236 PyMac_PRECHECK(GetMenuItemRefCon
);
1238 if (!PyArg_ParseTuple(_args
, "h",
1241 _err
= GetMenuItemRefCon(_self
->ob_itself
,
1244 if (_err
!= noErr
) return PyMac_Error(_err
);
1245 _res
= Py_BuildValue("l",
1250 static PyObject
*MenuObj_SetMenuItemKeyGlyph(MenuObject
*_self
, PyObject
*_args
)
1252 PyObject
*_res
= NULL
;
1256 #ifndef SetMenuItemKeyGlyph
1257 PyMac_PRECHECK(SetMenuItemKeyGlyph
);
1259 if (!PyArg_ParseTuple(_args
, "hh",
1263 _err
= SetMenuItemKeyGlyph(_self
->ob_itself
,
1266 if (_err
!= noErr
) return PyMac_Error(_err
);
1272 static PyObject
*MenuObj_GetMenuItemKeyGlyph(MenuObject
*_self
, PyObject
*_args
)
1274 PyObject
*_res
= NULL
;
1278 #ifndef GetMenuItemKeyGlyph
1279 PyMac_PRECHECK(GetMenuItemKeyGlyph
);
1281 if (!PyArg_ParseTuple(_args
, "h",
1284 _err
= GetMenuItemKeyGlyph(_self
->ob_itself
,
1287 if (_err
!= noErr
) return PyMac_Error(_err
);
1288 _res
= Py_BuildValue("h",
1293 static PyObject
*MenuObj_MacEnableMenuItem(MenuObject
*_self
, PyObject
*_args
)
1295 PyObject
*_res
= NULL
;
1297 #ifndef MacEnableMenuItem
1298 PyMac_PRECHECK(MacEnableMenuItem
);
1300 if (!PyArg_ParseTuple(_args
, "h",
1303 MacEnableMenuItem(_self
->ob_itself
,
1310 static PyObject
*MenuObj_DisableMenuItem(MenuObject
*_self
, PyObject
*_args
)
1312 PyObject
*_res
= NULL
;
1314 #ifndef DisableMenuItem
1315 PyMac_PRECHECK(DisableMenuItem
);
1317 if (!PyArg_ParseTuple(_args
, "h",
1320 DisableMenuItem(_self
->ob_itself
,
1327 static PyObject
*MenuObj_IsMenuItemEnabled(MenuObject
*_self
, PyObject
*_args
)
1329 PyObject
*_res
= NULL
;
1332 #ifndef IsMenuItemEnabled
1333 PyMac_PRECHECK(IsMenuItemEnabled
);
1335 if (!PyArg_ParseTuple(_args
, "h",
1338 _rv
= IsMenuItemEnabled(_self
->ob_itself
,
1340 _res
= Py_BuildValue("b",
1345 static PyObject
*MenuObj_EnableMenuItemIcon(MenuObject
*_self
, PyObject
*_args
)
1347 PyObject
*_res
= NULL
;
1349 #ifndef EnableMenuItemIcon
1350 PyMac_PRECHECK(EnableMenuItemIcon
);
1352 if (!PyArg_ParseTuple(_args
, "h",
1355 EnableMenuItemIcon(_self
->ob_itself
,
1362 static PyObject
*MenuObj_DisableMenuItemIcon(MenuObject
*_self
, PyObject
*_args
)
1364 PyObject
*_res
= NULL
;
1366 #ifndef DisableMenuItemIcon
1367 PyMac_PRECHECK(DisableMenuItemIcon
);
1369 if (!PyArg_ParseTuple(_args
, "h",
1372 DisableMenuItemIcon(_self
->ob_itself
,
1379 static PyObject
*MenuObj_IsMenuItemIconEnabled(MenuObject
*_self
, PyObject
*_args
)
1381 PyObject
*_res
= NULL
;
1384 #ifndef IsMenuItemIconEnabled
1385 PyMac_PRECHECK(IsMenuItemIconEnabled
);
1387 if (!PyArg_ParseTuple(_args
, "h",
1390 _rv
= IsMenuItemIconEnabled(_self
->ob_itself
,
1392 _res
= Py_BuildValue("b",
1397 static PyObject
*MenuObj_SetMenuItemHierarchicalMenu(MenuObject
*_self
, PyObject
*_args
)
1399 PyObject
*_res
= NULL
;
1401 MenuItemIndex inItem
;
1402 MenuHandle inHierMenu
;
1403 #ifndef SetMenuItemHierarchicalMenu
1404 PyMac_PRECHECK(SetMenuItemHierarchicalMenu
);
1406 if (!PyArg_ParseTuple(_args
, "hO&",
1408 MenuObj_Convert
, &inHierMenu
))
1410 _err
= SetMenuItemHierarchicalMenu(_self
->ob_itself
,
1413 if (_err
!= noErr
) return PyMac_Error(_err
);
1419 static PyObject
*MenuObj_GetMenuItemHierarchicalMenu(MenuObject
*_self
, PyObject
*_args
)
1421 PyObject
*_res
= NULL
;
1423 MenuItemIndex inItem
;
1424 MenuHandle outHierMenu
;
1425 #ifndef GetMenuItemHierarchicalMenu
1426 PyMac_PRECHECK(GetMenuItemHierarchicalMenu
);
1428 if (!PyArg_ParseTuple(_args
, "h",
1431 _err
= GetMenuItemHierarchicalMenu(_self
->ob_itself
,
1434 if (_err
!= noErr
) return PyMac_Error(_err
);
1435 _res
= Py_BuildValue("O&",
1436 OptMenuObj_New
, outHierMenu
);
1440 static PyObject
*MenuObj_CopyMenuItemTextAsCFString(MenuObject
*_self
, PyObject
*_args
)
1442 PyObject
*_res
= NULL
;
1444 MenuItemIndex inItem
;
1445 CFStringRef outString
;
1446 #ifndef CopyMenuItemTextAsCFString
1447 PyMac_PRECHECK(CopyMenuItemTextAsCFString
);
1449 if (!PyArg_ParseTuple(_args
, "h",
1452 _err
= CopyMenuItemTextAsCFString(_self
->ob_itself
,
1455 if (_err
!= noErr
) return PyMac_Error(_err
);
1456 _res
= Py_BuildValue("O&",
1457 CFStringRefObj_New
, outString
);
1461 static PyObject
*MenuObj_SetMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
1463 PyObject
*_res
= NULL
;
1465 MenuItemIndex inItem
;
1466 CFStringRef inString
;
1467 #ifndef SetMenuItemTextWithCFString
1468 PyMac_PRECHECK(SetMenuItemTextWithCFString
);
1470 if (!PyArg_ParseTuple(_args
, "hO&",
1472 CFStringRefObj_Convert
, &inString
))
1474 _err
= SetMenuItemTextWithCFString(_self
->ob_itself
,
1477 if (_err
!= noErr
) return PyMac_Error(_err
);
1483 static PyObject
*MenuObj_GetMenuItemIndent(MenuObject
*_self
, PyObject
*_args
)
1485 PyObject
*_res
= NULL
;
1487 MenuItemIndex inItem
;
1489 #ifndef GetMenuItemIndent
1490 PyMac_PRECHECK(GetMenuItemIndent
);
1492 if (!PyArg_ParseTuple(_args
, "h",
1495 _err
= GetMenuItemIndent(_self
->ob_itself
,
1498 if (_err
!= noErr
) return PyMac_Error(_err
);
1499 _res
= Py_BuildValue("l",
1504 static PyObject
*MenuObj_SetMenuItemIndent(MenuObject
*_self
, PyObject
*_args
)
1506 PyObject
*_res
= NULL
;
1508 MenuItemIndex inItem
;
1510 #ifndef SetMenuItemIndent
1511 PyMac_PRECHECK(SetMenuItemIndent
);
1513 if (!PyArg_ParseTuple(_args
, "hl",
1517 _err
= SetMenuItemIndent(_self
->ob_itself
,
1520 if (_err
!= noErr
) return PyMac_Error(_err
);
1526 static PyObject
*MenuObj_GetMenuItemCommandKey(MenuObject
*_self
, PyObject
*_args
)
1528 PyObject
*_res
= NULL
;
1530 MenuItemIndex inItem
;
1531 Boolean inGetVirtualKey
;
1533 #ifndef GetMenuItemCommandKey
1534 PyMac_PRECHECK(GetMenuItemCommandKey
);
1536 if (!PyArg_ParseTuple(_args
, "hb",
1540 _err
= GetMenuItemCommandKey(_self
->ob_itself
,
1544 if (_err
!= noErr
) return PyMac_Error(_err
);
1545 _res
= Py_BuildValue("H",
1550 static PyObject
*MenuObj_SetMenuItemCommandKey(MenuObject
*_self
, PyObject
*_args
)
1552 PyObject
*_res
= NULL
;
1554 MenuItemIndex inItem
;
1555 Boolean inSetVirtualKey
;
1557 #ifndef SetMenuItemCommandKey
1558 PyMac_PRECHECK(SetMenuItemCommandKey
);
1560 if (!PyArg_ParseTuple(_args
, "hbH",
1565 _err
= SetMenuItemCommandKey(_self
->ob_itself
,
1569 if (_err
!= noErr
) return PyMac_Error(_err
);
1575 static PyObject
*MenuObj_GetMenuItemPropertyAttributes(MenuObject
*_self
, PyObject
*_args
)
1577 PyObject
*_res
= NULL
;
1580 OSType propertyCreator
;
1583 #ifndef GetMenuItemPropertyAttributes
1584 PyMac_PRECHECK(GetMenuItemPropertyAttributes
);
1586 if (!PyArg_ParseTuple(_args
, "hO&O&",
1588 PyMac_GetOSType
, &propertyCreator
,
1589 PyMac_GetOSType
, &propertyTag
))
1591 _err
= GetMenuItemPropertyAttributes(_self
->ob_itself
,
1596 if (_err
!= noErr
) return PyMac_Error(_err
);
1597 _res
= Py_BuildValue("l",
1602 static PyObject
*MenuObj_ChangeMenuItemPropertyAttributes(MenuObject
*_self
, PyObject
*_args
)
1604 PyObject
*_res
= NULL
;
1607 OSType propertyCreator
;
1609 UInt32 attributesToSet
;
1610 UInt32 attributesToClear
;
1611 #ifndef ChangeMenuItemPropertyAttributes
1612 PyMac_PRECHECK(ChangeMenuItemPropertyAttributes
);
1614 if (!PyArg_ParseTuple(_args
, "hO&O&ll",
1616 PyMac_GetOSType
, &propertyCreator
,
1617 PyMac_GetOSType
, &propertyTag
,
1619 &attributesToClear
))
1621 _err
= ChangeMenuItemPropertyAttributes(_self
->ob_itself
,
1627 if (_err
!= noErr
) return PyMac_Error(_err
);
1633 static PyObject
*MenuObj_GetMenuAttributes(MenuObject
*_self
, PyObject
*_args
)
1635 PyObject
*_res
= NULL
;
1637 MenuAttributes outAttributes
;
1638 #ifndef GetMenuAttributes
1639 PyMac_PRECHECK(GetMenuAttributes
);
1641 if (!PyArg_ParseTuple(_args
, ""))
1643 _err
= GetMenuAttributes(_self
->ob_itself
,
1645 if (_err
!= noErr
) return PyMac_Error(_err
);
1646 _res
= Py_BuildValue("l",
1651 static PyObject
*MenuObj_ChangeMenuAttributes(MenuObject
*_self
, PyObject
*_args
)
1653 PyObject
*_res
= NULL
;
1655 MenuAttributes setTheseAttributes
;
1656 MenuAttributes clearTheseAttributes
;
1657 #ifndef ChangeMenuAttributes
1658 PyMac_PRECHECK(ChangeMenuAttributes
);
1660 if (!PyArg_ParseTuple(_args
, "ll",
1661 &setTheseAttributes
,
1662 &clearTheseAttributes
))
1664 _err
= ChangeMenuAttributes(_self
->ob_itself
,
1666 clearTheseAttributes
);
1667 if (_err
!= noErr
) return PyMac_Error(_err
);
1673 static PyObject
*MenuObj_GetMenuItemAttributes(MenuObject
*_self
, PyObject
*_args
)
1675 PyObject
*_res
= NULL
;
1678 MenuItemAttributes outAttributes
;
1679 #ifndef GetMenuItemAttributes
1680 PyMac_PRECHECK(GetMenuItemAttributes
);
1682 if (!PyArg_ParseTuple(_args
, "h",
1685 _err
= GetMenuItemAttributes(_self
->ob_itself
,
1688 if (_err
!= noErr
) return PyMac_Error(_err
);
1689 _res
= Py_BuildValue("l",
1694 static PyObject
*MenuObj_ChangeMenuItemAttributes(MenuObject
*_self
, PyObject
*_args
)
1696 PyObject
*_res
= NULL
;
1699 MenuItemAttributes setTheseAttributes
;
1700 MenuItemAttributes clearTheseAttributes
;
1701 #ifndef ChangeMenuItemAttributes
1702 PyMac_PRECHECK(ChangeMenuItemAttributes
);
1704 if (!PyArg_ParseTuple(_args
, "hll",
1706 &setTheseAttributes
,
1707 &clearTheseAttributes
))
1709 _err
= ChangeMenuItemAttributes(_self
->ob_itself
,
1712 clearTheseAttributes
);
1713 if (_err
!= noErr
) return PyMac_Error(_err
);
1719 static PyObject
*MenuObj_DisableAllMenuItems(MenuObject
*_self
, PyObject
*_args
)
1721 PyObject
*_res
= NULL
;
1722 #ifndef DisableAllMenuItems
1723 PyMac_PRECHECK(DisableAllMenuItems
);
1725 if (!PyArg_ParseTuple(_args
, ""))
1727 DisableAllMenuItems(_self
->ob_itself
);
1733 static PyObject
*MenuObj_EnableAllMenuItems(MenuObject
*_self
, PyObject
*_args
)
1735 PyObject
*_res
= NULL
;
1736 #ifndef EnableAllMenuItems
1737 PyMac_PRECHECK(EnableAllMenuItems
);
1739 if (!PyArg_ParseTuple(_args
, ""))
1741 EnableAllMenuItems(_self
->ob_itself
);
1747 static PyObject
*MenuObj_MenuHasEnabledItems(MenuObject
*_self
, PyObject
*_args
)
1749 PyObject
*_res
= NULL
;
1751 #ifndef MenuHasEnabledItems
1752 PyMac_PRECHECK(MenuHasEnabledItems
);
1754 if (!PyArg_ParseTuple(_args
, ""))
1756 _rv
= MenuHasEnabledItems(_self
->ob_itself
);
1757 _res
= Py_BuildValue("b",
1762 static PyObject
*MenuObj_GetMenuType(MenuObject
*_self
, PyObject
*_args
)
1764 PyObject
*_res
= NULL
;
1768 PyMac_PRECHECK(GetMenuType
);
1770 if (!PyArg_ParseTuple(_args
, ""))
1772 _err
= GetMenuType(_self
->ob_itself
,
1774 if (_err
!= noErr
) return PyMac_Error(_err
);
1775 _res
= Py_BuildValue("H",
1780 static PyObject
*MenuObj_CountMenuItemsWithCommandID(MenuObject
*_self
, PyObject
*_args
)
1782 PyObject
*_res
= NULL
;
1784 MenuCommand inCommandID
;
1785 #ifndef CountMenuItemsWithCommandID
1786 PyMac_PRECHECK(CountMenuItemsWithCommandID
);
1788 if (!PyArg_ParseTuple(_args
, "l",
1791 _rv
= CountMenuItemsWithCommandID(_self
->ob_itself
,
1793 _res
= Py_BuildValue("l",
1798 static PyObject
*MenuObj_GetIndMenuItemWithCommandID(MenuObject
*_self
, PyObject
*_args
)
1800 PyObject
*_res
= NULL
;
1802 MenuCommand inCommandID
;
1805 MenuItemIndex outIndex
;
1806 #ifndef GetIndMenuItemWithCommandID
1807 PyMac_PRECHECK(GetIndMenuItemWithCommandID
);
1809 if (!PyArg_ParseTuple(_args
, "ll",
1813 _err
= GetIndMenuItemWithCommandID(_self
->ob_itself
,
1818 if (_err
!= noErr
) return PyMac_Error(_err
);
1819 _res
= Py_BuildValue("O&h",
1820 MenuObj_New
, outMenu
,
1825 static PyObject
*MenuObj_EnableMenuCommand(MenuObject
*_self
, PyObject
*_args
)
1827 PyObject
*_res
= NULL
;
1828 MenuCommand inCommandID
;
1829 #ifndef EnableMenuCommand
1830 PyMac_PRECHECK(EnableMenuCommand
);
1832 if (!PyArg_ParseTuple(_args
, "l",
1835 EnableMenuCommand(_self
->ob_itself
,
1842 static PyObject
*MenuObj_DisableMenuCommand(MenuObject
*_self
, PyObject
*_args
)
1844 PyObject
*_res
= NULL
;
1845 MenuCommand inCommandID
;
1846 #ifndef DisableMenuCommand
1847 PyMac_PRECHECK(DisableMenuCommand
);
1849 if (!PyArg_ParseTuple(_args
, "l",
1852 DisableMenuCommand(_self
->ob_itself
,
1859 static PyObject
*MenuObj_IsMenuCommandEnabled(MenuObject
*_self
, PyObject
*_args
)
1861 PyObject
*_res
= NULL
;
1863 MenuCommand inCommandID
;
1864 #ifndef IsMenuCommandEnabled
1865 PyMac_PRECHECK(IsMenuCommandEnabled
);
1867 if (!PyArg_ParseTuple(_args
, "l",
1870 _rv
= IsMenuCommandEnabled(_self
->ob_itself
,
1872 _res
= Py_BuildValue("b",
1877 static PyObject
*MenuObj_SetMenuCommandMark(MenuObject
*_self
, PyObject
*_args
)
1879 PyObject
*_res
= NULL
;
1881 MenuCommand inCommandID
;
1883 #ifndef SetMenuCommandMark
1884 PyMac_PRECHECK(SetMenuCommandMark
);
1886 if (!PyArg_ParseTuple(_args
, "lh",
1890 _err
= SetMenuCommandMark(_self
->ob_itself
,
1893 if (_err
!= noErr
) return PyMac_Error(_err
);
1899 static PyObject
*MenuObj_GetMenuCommandMark(MenuObject
*_self
, PyObject
*_args
)
1901 PyObject
*_res
= NULL
;
1903 MenuCommand inCommandID
;
1905 #ifndef GetMenuCommandMark
1906 PyMac_PRECHECK(GetMenuCommandMark
);
1908 if (!PyArg_ParseTuple(_args
, "l",
1911 _err
= GetMenuCommandMark(_self
->ob_itself
,
1914 if (_err
!= noErr
) return PyMac_Error(_err
);
1915 _res
= Py_BuildValue("h",
1920 static PyObject
*MenuObj_GetMenuCommandPropertySize(MenuObject
*_self
, PyObject
*_args
)
1922 PyObject
*_res
= NULL
;
1924 MenuCommand inCommandID
;
1925 OSType inPropertyCreator
;
1926 OSType inPropertyTag
;
1928 #ifndef GetMenuCommandPropertySize
1929 PyMac_PRECHECK(GetMenuCommandPropertySize
);
1931 if (!PyArg_ParseTuple(_args
, "lO&O&",
1933 PyMac_GetOSType
, &inPropertyCreator
,
1934 PyMac_GetOSType
, &inPropertyTag
))
1936 _err
= GetMenuCommandPropertySize(_self
->ob_itself
,
1941 if (_err
!= noErr
) return PyMac_Error(_err
);
1942 _res
= Py_BuildValue("l",
1947 static PyObject
*MenuObj_RemoveMenuCommandProperty(MenuObject
*_self
, PyObject
*_args
)
1949 PyObject
*_res
= NULL
;
1951 MenuCommand inCommandID
;
1952 OSType inPropertyCreator
;
1953 OSType inPropertyTag
;
1954 #ifndef RemoveMenuCommandProperty
1955 PyMac_PRECHECK(RemoveMenuCommandProperty
);
1957 if (!PyArg_ParseTuple(_args
, "lO&O&",
1959 PyMac_GetOSType
, &inPropertyCreator
,
1960 PyMac_GetOSType
, &inPropertyTag
))
1962 _err
= RemoveMenuCommandProperty(_self
->ob_itself
,
1966 if (_err
!= noErr
) return PyMac_Error(_err
);
1972 static PyObject
*MenuObj_IsMenuItemInvalid(MenuObject
*_self
, PyObject
*_args
)
1974 PyObject
*_res
= NULL
;
1976 MenuItemIndex inItem
;
1977 #ifndef IsMenuItemInvalid
1978 PyMac_PRECHECK(IsMenuItemInvalid
);
1980 if (!PyArg_ParseTuple(_args
, "h",
1983 _rv
= IsMenuItemInvalid(_self
->ob_itself
,
1985 _res
= Py_BuildValue("b",
1990 static PyObject
*MenuObj_InvalidateMenuItems(MenuObject
*_self
, PyObject
*_args
)
1992 PyObject
*_res
= NULL
;
1994 MenuItemIndex inFirstItem
;
1995 ItemCount inNumItems
;
1996 #ifndef InvalidateMenuItems
1997 PyMac_PRECHECK(InvalidateMenuItems
);
1999 if (!PyArg_ParseTuple(_args
, "hl",
2003 _err
= InvalidateMenuItems(_self
->ob_itself
,
2006 if (_err
!= noErr
) return PyMac_Error(_err
);
2012 static PyObject
*MenuObj_UpdateInvalidMenuItems(MenuObject
*_self
, PyObject
*_args
)
2014 PyObject
*_res
= NULL
;
2016 #ifndef UpdateInvalidMenuItems
2017 PyMac_PRECHECK(UpdateInvalidMenuItems
);
2019 if (!PyArg_ParseTuple(_args
, ""))
2021 _err
= UpdateInvalidMenuItems(_self
->ob_itself
);
2022 if (_err
!= noErr
) return PyMac_Error(_err
);
2028 static PyObject
*MenuObj_CreateStandardFontMenu(MenuObject
*_self
, PyObject
*_args
)
2030 PyObject
*_res
= NULL
;
2032 MenuItemIndex afterItem
;
2033 MenuID firstHierMenuID
;
2035 ItemCount outHierMenuCount
;
2036 #ifndef CreateStandardFontMenu
2037 PyMac_PRECHECK(CreateStandardFontMenu
);
2039 if (!PyArg_ParseTuple(_args
, "hhl",
2044 _err
= CreateStandardFontMenu(_self
->ob_itself
,
2049 if (_err
!= noErr
) return PyMac_Error(_err
);
2050 _res
= Py_BuildValue("l",
2055 static PyObject
*MenuObj_UpdateStandardFontMenu(MenuObject
*_self
, PyObject
*_args
)
2057 PyObject
*_res
= NULL
;
2059 ItemCount outHierMenuCount
;
2060 #ifndef UpdateStandardFontMenu
2061 PyMac_PRECHECK(UpdateStandardFontMenu
);
2063 if (!PyArg_ParseTuple(_args
, ""))
2065 _err
= UpdateStandardFontMenu(_self
->ob_itself
,
2067 if (_err
!= noErr
) return PyMac_Error(_err
);
2068 _res
= Py_BuildValue("l",
2073 static PyObject
*MenuObj_GetFontFamilyFromMenuSelection(MenuObject
*_self
, PyObject
*_args
)
2075 PyObject
*_res
= NULL
;
2078 FMFontFamily outFontFamily
;
2079 FMFontStyle outStyle
;
2080 #ifndef GetFontFamilyFromMenuSelection
2081 PyMac_PRECHECK(GetFontFamilyFromMenuSelection
);
2083 if (!PyArg_ParseTuple(_args
, "h",
2086 _err
= GetFontFamilyFromMenuSelection(_self
->ob_itself
,
2090 if (_err
!= noErr
) return PyMac_Error(_err
);
2091 _res
= Py_BuildValue("hh",
2097 static PyObject
*MenuObj_GetMenuID(MenuObject
*_self
, PyObject
*_args
)
2099 PyObject
*_res
= NULL
;
2102 PyMac_PRECHECK(GetMenuID
);
2104 if (!PyArg_ParseTuple(_args
, ""))
2106 _rv
= GetMenuID(_self
->ob_itself
);
2107 _res
= Py_BuildValue("h",
2112 static PyObject
*MenuObj_GetMenuWidth(MenuObject
*_self
, PyObject
*_args
)
2114 PyObject
*_res
= NULL
;
2116 #ifndef GetMenuWidth
2117 PyMac_PRECHECK(GetMenuWidth
);
2119 if (!PyArg_ParseTuple(_args
, ""))
2121 _rv
= GetMenuWidth(_self
->ob_itself
);
2122 _res
= Py_BuildValue("h",
2127 static PyObject
*MenuObj_GetMenuHeight(MenuObject
*_self
, PyObject
*_args
)
2129 PyObject
*_res
= NULL
;
2131 #ifndef GetMenuHeight
2132 PyMac_PRECHECK(GetMenuHeight
);
2134 if (!PyArg_ParseTuple(_args
, ""))
2136 _rv
= GetMenuHeight(_self
->ob_itself
);
2137 _res
= Py_BuildValue("h",
2142 static PyObject
*MenuObj_SetMenuID(MenuObject
*_self
, PyObject
*_args
)
2144 PyObject
*_res
= NULL
;
2147 PyMac_PRECHECK(SetMenuID
);
2149 if (!PyArg_ParseTuple(_args
, "h",
2152 SetMenuID(_self
->ob_itself
,
2159 static PyObject
*MenuObj_SetMenuWidth(MenuObject
*_self
, PyObject
*_args
)
2161 PyObject
*_res
= NULL
;
2163 #ifndef SetMenuWidth
2164 PyMac_PRECHECK(SetMenuWidth
);
2166 if (!PyArg_ParseTuple(_args
, "h",
2169 SetMenuWidth(_self
->ob_itself
,
2176 static PyObject
*MenuObj_SetMenuHeight(MenuObject
*_self
, PyObject
*_args
)
2178 PyObject
*_res
= NULL
;
2180 #ifndef SetMenuHeight
2181 PyMac_PRECHECK(SetMenuHeight
);
2183 if (!PyArg_ParseTuple(_args
, "h",
2186 SetMenuHeight(_self
->ob_itself
,
2193 static PyObject
*MenuObj_as_Resource(MenuObject
*_self
, PyObject
*_args
)
2195 PyObject
*_res
= NULL
;
2198 PyMac_PRECHECK(as_Resource
);
2200 if (!PyArg_ParseTuple(_args
, ""))
2202 _rv
= as_Resource(_self
->ob_itself
);
2203 _res
= Py_BuildValue("O&",
2208 static PyObject
*MenuObj_AppendMenu(MenuObject
*_self
, PyObject
*_args
)
2210 PyObject
*_res
= NULL
;
2213 PyMac_PRECHECK(AppendMenu
);
2215 if (!PyArg_ParseTuple(_args
, "O&",
2216 PyMac_GetStr255
, data
))
2218 AppendMenu(_self
->ob_itself
,
2225 static PyObject
*MenuObj_InsertMenu(MenuObject
*_self
, PyObject
*_args
)
2227 PyObject
*_res
= NULL
;
2230 PyMac_PRECHECK(InsertMenu
);
2232 if (!PyArg_ParseTuple(_args
, "h",
2235 InsertMenu(_self
->ob_itself
,
2242 static PyObject
*MenuObj_InsertMenuItem(MenuObject
*_self
, PyObject
*_args
)
2244 PyObject
*_res
= NULL
;
2247 #ifndef InsertMenuItem
2248 PyMac_PRECHECK(InsertMenuItem
);
2250 if (!PyArg_ParseTuple(_args
, "O&h",
2251 PyMac_GetStr255
, itemString
,
2254 InsertMenuItem(_self
->ob_itself
,
2262 static PyObject
*MenuObj_EnableMenuItem(MenuObject
*_self
, PyObject
*_args
)
2264 PyObject
*_res
= NULL
;
2266 #ifndef EnableMenuItem
2267 PyMac_PRECHECK(EnableMenuItem
);
2269 if (!PyArg_ParseTuple(_args
, "H",
2272 EnableMenuItem(_self
->ob_itself
,
2279 static PyObject
*MenuObj_CheckMenuItem(MenuObject
*_self
, PyObject
*_args
)
2281 PyObject
*_res
= NULL
;
2284 #ifndef CheckMenuItem
2285 PyMac_PRECHECK(CheckMenuItem
);
2287 if (!PyArg_ParseTuple(_args
, "hb",
2291 CheckMenuItem(_self
->ob_itself
,
2299 static PyMethodDef MenuObj_methods
[] = {
2300 {"DisposeMenu", (PyCFunction
)MenuObj_DisposeMenu
, 1,
2301 PyDoc_STR("() -> None")},
2302 {"CalcMenuSize", (PyCFunction
)MenuObj_CalcMenuSize
, 1,
2303 PyDoc_STR("() -> None")},
2304 {"CountMenuItems", (PyCFunction
)MenuObj_CountMenuItems
, 1,
2305 PyDoc_STR("() -> (UInt16 _rv)")},
2306 {"GetMenuFont", (PyCFunction
)MenuObj_GetMenuFont
, 1,
2307 PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")},
2308 {"SetMenuFont", (PyCFunction
)MenuObj_SetMenuFont
, 1,
2309 PyDoc_STR("(SInt16 inFontID, UInt16 inFontSize) -> None")},
2310 {"GetMenuExcludesMarkColumn", (PyCFunction
)MenuObj_GetMenuExcludesMarkColumn
, 1,
2311 PyDoc_STR("() -> (Boolean _rv)")},
2312 {"SetMenuExcludesMarkColumn", (PyCFunction
)MenuObj_SetMenuExcludesMarkColumn
, 1,
2313 PyDoc_STR("(Boolean excludesMark) -> None")},
2314 {"IsValidMenu", (PyCFunction
)MenuObj_IsValidMenu
, 1,
2315 PyDoc_STR("() -> (Boolean _rv)")},
2316 {"GetMenuRetainCount", (PyCFunction
)MenuObj_GetMenuRetainCount
, 1,
2317 PyDoc_STR("() -> (ItemCount _rv)")},
2318 {"RetainMenu", (PyCFunction
)MenuObj_RetainMenu
, 1,
2319 PyDoc_STR("() -> None")},
2320 {"ReleaseMenu", (PyCFunction
)MenuObj_ReleaseMenu
, 1,
2321 PyDoc_STR("() -> None")},
2322 {"DuplicateMenu", (PyCFunction
)MenuObj_DuplicateMenu
, 1,
2323 PyDoc_STR("() -> (MenuHandle outMenu)")},
2324 {"CopyMenuTitleAsCFString", (PyCFunction
)MenuObj_CopyMenuTitleAsCFString
, 1,
2325 PyDoc_STR("() -> (CFStringRef outString)")},
2326 {"SetMenuTitleWithCFString", (PyCFunction
)MenuObj_SetMenuTitleWithCFString
, 1,
2327 PyDoc_STR("(CFStringRef inString) -> None")},
2328 {"InvalidateMenuSize", (PyCFunction
)MenuObj_InvalidateMenuSize
, 1,
2329 PyDoc_STR("() -> None")},
2330 {"IsMenuSizeInvalid", (PyCFunction
)MenuObj_IsMenuSizeInvalid
, 1,
2331 PyDoc_STR("() -> (Boolean _rv)")},
2332 {"MacAppendMenu", (PyCFunction
)MenuObj_MacAppendMenu
, 1,
2333 PyDoc_STR("(Str255 data) -> None")},
2334 {"InsertResMenu", (PyCFunction
)MenuObj_InsertResMenu
, 1,
2335 PyDoc_STR("(ResType theType, short afterItem) -> None")},
2336 {"AppendResMenu", (PyCFunction
)MenuObj_AppendResMenu
, 1,
2337 PyDoc_STR("(ResType theType) -> None")},
2338 {"MacInsertMenuItem", (PyCFunction
)MenuObj_MacInsertMenuItem
, 1,
2339 PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
2340 {"DeleteMenuItem", (PyCFunction
)MenuObj_DeleteMenuItem
, 1,
2341 PyDoc_STR("(short item) -> None")},
2342 {"InsertFontResMenu", (PyCFunction
)MenuObj_InsertFontResMenu
, 1,
2343 PyDoc_STR("(short afterItem, short scriptFilter) -> None")},
2344 {"InsertIntlResMenu", (PyCFunction
)MenuObj_InsertIntlResMenu
, 1,
2345 PyDoc_STR("(ResType theType, short afterItem, short scriptFilter) -> None")},
2346 {"AppendMenuItemText", (PyCFunction
)MenuObj_AppendMenuItemText
, 1,
2347 PyDoc_STR("(Str255 inString) -> None")},
2348 {"InsertMenuItemText", (PyCFunction
)MenuObj_InsertMenuItemText
, 1,
2349 PyDoc_STR("(Str255 inString, MenuItemIndex afterItem) -> None")},
2350 {"CopyMenuItems", (PyCFunction
)MenuObj_CopyMenuItems
, 1,
2351 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems, MenuHandle inDestMenu, MenuItemIndex inInsertAfter) -> None")},
2352 {"DeleteMenuItems", (PyCFunction
)MenuObj_DeleteMenuItems
, 1,
2353 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
2354 {"AppendMenuItemTextWithCFString", (PyCFunction
)MenuObj_AppendMenuItemTextWithCFString
, 1,
2355 PyDoc_STR("(CFStringRef inString, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> (MenuItemIndex outNewItem)")},
2356 {"InsertMenuItemTextWithCFString", (PyCFunction
)MenuObj_InsertMenuItemTextWithCFString
, 1,
2357 PyDoc_STR("(CFStringRef inString, MenuItemIndex inAfterItem, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> None")},
2358 {"PopUpMenuSelect", (PyCFunction
)MenuObj_PopUpMenuSelect
, 1,
2359 PyDoc_STR("(short top, short left, short popUpItem) -> (long _rv)")},
2360 {"InvalidateMenuEnabling", (PyCFunction
)MenuObj_InvalidateMenuEnabling
, 1,
2361 PyDoc_STR("() -> None")},
2362 {"IsMenuBarInvalid", (PyCFunction
)MenuObj_IsMenuBarInvalid
, 1,
2363 PyDoc_STR("() -> (Boolean _rv)")},
2364 {"MacInsertMenu", (PyCFunction
)MenuObj_MacInsertMenu
, 1,
2365 PyDoc_STR("(MenuID beforeID) -> None")},
2366 {"SetRootMenu", (PyCFunction
)MenuObj_SetRootMenu
, 1,
2367 PyDoc_STR("() -> None")},
2368 {"MacCheckMenuItem", (PyCFunction
)MenuObj_MacCheckMenuItem
, 1,
2369 PyDoc_STR("(short item, Boolean checked) -> None")},
2370 {"SetMenuItemText", (PyCFunction
)MenuObj_SetMenuItemText
, 1,
2371 PyDoc_STR("(short item, Str255 itemString) -> None")},
2372 {"GetMenuItemText", (PyCFunction
)MenuObj_GetMenuItemText
, 1,
2373 PyDoc_STR("(short item) -> (Str255 itemString)")},
2374 {"SetItemMark", (PyCFunction
)MenuObj_SetItemMark
, 1,
2375 PyDoc_STR("(short item, CharParameter markChar) -> None")},
2376 {"GetItemMark", (PyCFunction
)MenuObj_GetItemMark
, 1,
2377 PyDoc_STR("(short item) -> (CharParameter markChar)")},
2378 {"SetItemCmd", (PyCFunction
)MenuObj_SetItemCmd
, 1,
2379 PyDoc_STR("(short item, CharParameter cmdChar) -> None")},
2380 {"GetItemCmd", (PyCFunction
)MenuObj_GetItemCmd
, 1,
2381 PyDoc_STR("(short item) -> (CharParameter cmdChar)")},
2382 {"SetItemIcon", (PyCFunction
)MenuObj_SetItemIcon
, 1,
2383 PyDoc_STR("(short item, short iconIndex) -> None")},
2384 {"GetItemIcon", (PyCFunction
)MenuObj_GetItemIcon
, 1,
2385 PyDoc_STR("(short item) -> (short iconIndex)")},
2386 {"SetItemStyle", (PyCFunction
)MenuObj_SetItemStyle
, 1,
2387 PyDoc_STR("(short item, StyleParameter chStyle) -> None")},
2388 {"GetItemStyle", (PyCFunction
)MenuObj_GetItemStyle
, 1,
2389 PyDoc_STR("(short item) -> (Style chStyle)")},
2390 {"SetMenuItemCommandID", (PyCFunction
)MenuObj_SetMenuItemCommandID
, 1,
2391 PyDoc_STR("(SInt16 inItem, MenuCommand inCommandID) -> None")},
2392 {"GetMenuItemCommandID", (PyCFunction
)MenuObj_GetMenuItemCommandID
, 1,
2393 PyDoc_STR("(SInt16 inItem) -> (MenuCommand outCommandID)")},
2394 {"SetMenuItemModifiers", (PyCFunction
)MenuObj_SetMenuItemModifiers
, 1,
2395 PyDoc_STR("(SInt16 inItem, UInt8 inModifiers) -> None")},
2396 {"GetMenuItemModifiers", (PyCFunction
)MenuObj_GetMenuItemModifiers
, 1,
2397 PyDoc_STR("(SInt16 inItem) -> (UInt8 outModifiers)")},
2398 {"SetMenuItemIconHandle", (PyCFunction
)MenuObj_SetMenuItemIconHandle
, 1,
2399 PyDoc_STR("(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None")},
2400 {"GetMenuItemIconHandle", (PyCFunction
)MenuObj_GetMenuItemIconHandle
, 1,
2401 PyDoc_STR("(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)")},
2402 {"SetMenuItemTextEncoding", (PyCFunction
)MenuObj_SetMenuItemTextEncoding
, 1,
2403 PyDoc_STR("(SInt16 inItem, TextEncoding inScriptID) -> None")},
2404 {"GetMenuItemTextEncoding", (PyCFunction
)MenuObj_GetMenuItemTextEncoding
, 1,
2405 PyDoc_STR("(SInt16 inItem) -> (TextEncoding outScriptID)")},
2406 {"SetMenuItemHierarchicalID", (PyCFunction
)MenuObj_SetMenuItemHierarchicalID
, 1,
2407 PyDoc_STR("(SInt16 inItem, MenuID inHierID) -> None")},
2408 {"GetMenuItemHierarchicalID", (PyCFunction
)MenuObj_GetMenuItemHierarchicalID
, 1,
2409 PyDoc_STR("(SInt16 inItem) -> (MenuID outHierID)")},
2410 {"SetMenuItemFontID", (PyCFunction
)MenuObj_SetMenuItemFontID
, 1,
2411 PyDoc_STR("(SInt16 inItem, SInt16 inFontID) -> None")},
2412 {"GetMenuItemFontID", (PyCFunction
)MenuObj_GetMenuItemFontID
, 1,
2413 PyDoc_STR("(SInt16 inItem) -> (SInt16 outFontID)")},
2414 {"SetMenuItemRefCon", (PyCFunction
)MenuObj_SetMenuItemRefCon
, 1,
2415 PyDoc_STR("(SInt16 inItem, UInt32 inRefCon) -> None")},
2416 {"GetMenuItemRefCon", (PyCFunction
)MenuObj_GetMenuItemRefCon
, 1,
2417 PyDoc_STR("(SInt16 inItem) -> (UInt32 outRefCon)")},
2418 {"SetMenuItemKeyGlyph", (PyCFunction
)MenuObj_SetMenuItemKeyGlyph
, 1,
2419 PyDoc_STR("(SInt16 inItem, SInt16 inGlyph) -> None")},
2420 {"GetMenuItemKeyGlyph", (PyCFunction
)MenuObj_GetMenuItemKeyGlyph
, 1,
2421 PyDoc_STR("(SInt16 inItem) -> (SInt16 outGlyph)")},
2422 {"MacEnableMenuItem", (PyCFunction
)MenuObj_MacEnableMenuItem
, 1,
2423 PyDoc_STR("(MenuItemIndex item) -> None")},
2424 {"DisableMenuItem", (PyCFunction
)MenuObj_DisableMenuItem
, 1,
2425 PyDoc_STR("(MenuItemIndex item) -> None")},
2426 {"IsMenuItemEnabled", (PyCFunction
)MenuObj_IsMenuItemEnabled
, 1,
2427 PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
2428 {"EnableMenuItemIcon", (PyCFunction
)MenuObj_EnableMenuItemIcon
, 1,
2429 PyDoc_STR("(MenuItemIndex item) -> None")},
2430 {"DisableMenuItemIcon", (PyCFunction
)MenuObj_DisableMenuItemIcon
, 1,
2431 PyDoc_STR("(MenuItemIndex item) -> None")},
2432 {"IsMenuItemIconEnabled", (PyCFunction
)MenuObj_IsMenuItemIconEnabled
, 1,
2433 PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
2434 {"SetMenuItemHierarchicalMenu", (PyCFunction
)MenuObj_SetMenuItemHierarchicalMenu
, 1,
2435 PyDoc_STR("(MenuItemIndex inItem, MenuHandle inHierMenu) -> None")},
2436 {"GetMenuItemHierarchicalMenu", (PyCFunction
)MenuObj_GetMenuItemHierarchicalMenu
, 1,
2437 PyDoc_STR("(MenuItemIndex inItem) -> (MenuHandle outHierMenu)")},
2438 {"CopyMenuItemTextAsCFString", (PyCFunction
)MenuObj_CopyMenuItemTextAsCFString
, 1,
2439 PyDoc_STR("(MenuItemIndex inItem) -> (CFStringRef outString)")},
2440 {"SetMenuItemTextWithCFString", (PyCFunction
)MenuObj_SetMenuItemTextWithCFString
, 1,
2441 PyDoc_STR("(MenuItemIndex inItem, CFStringRef inString) -> None")},
2442 {"GetMenuItemIndent", (PyCFunction
)MenuObj_GetMenuItemIndent
, 1,
2443 PyDoc_STR("(MenuItemIndex inItem) -> (UInt32 outIndent)")},
2444 {"SetMenuItemIndent", (PyCFunction
)MenuObj_SetMenuItemIndent
, 1,
2445 PyDoc_STR("(MenuItemIndex inItem, UInt32 inIndent) -> None")},
2446 {"GetMenuItemCommandKey", (PyCFunction
)MenuObj_GetMenuItemCommandKey
, 1,
2447 PyDoc_STR("(MenuItemIndex inItem, Boolean inGetVirtualKey) -> (UInt16 outKey)")},
2448 {"SetMenuItemCommandKey", (PyCFunction
)MenuObj_SetMenuItemCommandKey
, 1,
2449 PyDoc_STR("(MenuItemIndex inItem, Boolean inSetVirtualKey, UInt16 inKey) -> None")},
2450 {"GetMenuItemPropertyAttributes", (PyCFunction
)MenuObj_GetMenuItemPropertyAttributes
, 1,
2451 PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
2452 {"ChangeMenuItemPropertyAttributes", (PyCFunction
)MenuObj_ChangeMenuItemPropertyAttributes
, 1,
2453 PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
2454 {"GetMenuAttributes", (PyCFunction
)MenuObj_GetMenuAttributes
, 1,
2455 PyDoc_STR("() -> (MenuAttributes outAttributes)")},
2456 {"ChangeMenuAttributes", (PyCFunction
)MenuObj_ChangeMenuAttributes
, 1,
2457 PyDoc_STR("(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None")},
2458 {"GetMenuItemAttributes", (PyCFunction
)MenuObj_GetMenuItemAttributes
, 1,
2459 PyDoc_STR("(MenuItemIndex item) -> (MenuItemAttributes outAttributes)")},
2460 {"ChangeMenuItemAttributes", (PyCFunction
)MenuObj_ChangeMenuItemAttributes
, 1,
2461 PyDoc_STR("(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None")},
2462 {"DisableAllMenuItems", (PyCFunction
)MenuObj_DisableAllMenuItems
, 1,
2463 PyDoc_STR("() -> None")},
2464 {"EnableAllMenuItems", (PyCFunction
)MenuObj_EnableAllMenuItems
, 1,
2465 PyDoc_STR("() -> None")},
2466 {"MenuHasEnabledItems", (PyCFunction
)MenuObj_MenuHasEnabledItems
, 1,
2467 PyDoc_STR("() -> (Boolean _rv)")},
2468 {"GetMenuType", (PyCFunction
)MenuObj_GetMenuType
, 1,
2469 PyDoc_STR("() -> (UInt16 outType)")},
2470 {"CountMenuItemsWithCommandID", (PyCFunction
)MenuObj_CountMenuItemsWithCommandID
, 1,
2471 PyDoc_STR("(MenuCommand inCommandID) -> (ItemCount _rv)")},
2472 {"GetIndMenuItemWithCommandID", (PyCFunction
)MenuObj_GetIndMenuItemWithCommandID
, 1,
2473 PyDoc_STR("(MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
2474 {"EnableMenuCommand", (PyCFunction
)MenuObj_EnableMenuCommand
, 1,
2475 PyDoc_STR("(MenuCommand inCommandID) -> None")},
2476 {"DisableMenuCommand", (PyCFunction
)MenuObj_DisableMenuCommand
, 1,
2477 PyDoc_STR("(MenuCommand inCommandID) -> None")},
2478 {"IsMenuCommandEnabled", (PyCFunction
)MenuObj_IsMenuCommandEnabled
, 1,
2479 PyDoc_STR("(MenuCommand inCommandID) -> (Boolean _rv)")},
2480 {"SetMenuCommandMark", (PyCFunction
)MenuObj_SetMenuCommandMark
, 1,
2481 PyDoc_STR("(MenuCommand inCommandID, UniChar inMark) -> None")},
2482 {"GetMenuCommandMark", (PyCFunction
)MenuObj_GetMenuCommandMark
, 1,
2483 PyDoc_STR("(MenuCommand inCommandID) -> (UniChar outMark)")},
2484 {"GetMenuCommandPropertySize", (PyCFunction
)MenuObj_GetMenuCommandPropertySize
, 1,
2485 PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
2486 {"RemoveMenuCommandProperty", (PyCFunction
)MenuObj_RemoveMenuCommandProperty
, 1,
2487 PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
2488 {"IsMenuItemInvalid", (PyCFunction
)MenuObj_IsMenuItemInvalid
, 1,
2489 PyDoc_STR("(MenuItemIndex inItem) -> (Boolean _rv)")},
2490 {"InvalidateMenuItems", (PyCFunction
)MenuObj_InvalidateMenuItems
, 1,
2491 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
2492 {"UpdateInvalidMenuItems", (PyCFunction
)MenuObj_UpdateInvalidMenuItems
, 1,
2493 PyDoc_STR("() -> None")},
2494 {"CreateStandardFontMenu", (PyCFunction
)MenuObj_CreateStandardFontMenu
, 1,
2495 PyDoc_STR("(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)")},
2496 {"UpdateStandardFontMenu", (PyCFunction
)MenuObj_UpdateStandardFontMenu
, 1,
2497 PyDoc_STR("() -> (ItemCount outHierMenuCount)")},
2498 {"GetFontFamilyFromMenuSelection", (PyCFunction
)MenuObj_GetFontFamilyFromMenuSelection
, 1,
2499 PyDoc_STR("(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)")},
2500 {"GetMenuID", (PyCFunction
)MenuObj_GetMenuID
, 1,
2501 PyDoc_STR("() -> (MenuID _rv)")},
2502 {"GetMenuWidth", (PyCFunction
)MenuObj_GetMenuWidth
, 1,
2503 PyDoc_STR("() -> (SInt16 _rv)")},
2504 {"GetMenuHeight", (PyCFunction
)MenuObj_GetMenuHeight
, 1,
2505 PyDoc_STR("() -> (SInt16 _rv)")},
2506 {"SetMenuID", (PyCFunction
)MenuObj_SetMenuID
, 1,
2507 PyDoc_STR("(MenuID menuID) -> None")},
2508 {"SetMenuWidth", (PyCFunction
)MenuObj_SetMenuWidth
, 1,
2509 PyDoc_STR("(SInt16 width) -> None")},
2510 {"SetMenuHeight", (PyCFunction
)MenuObj_SetMenuHeight
, 1,
2511 PyDoc_STR("(SInt16 height) -> None")},
2512 {"as_Resource", (PyCFunction
)MenuObj_as_Resource
, 1,
2513 PyDoc_STR("() -> (Handle _rv)")},
2514 {"AppendMenu", (PyCFunction
)MenuObj_AppendMenu
, 1,
2515 PyDoc_STR("(Str255 data) -> None")},
2516 {"InsertMenu", (PyCFunction
)MenuObj_InsertMenu
, 1,
2517 PyDoc_STR("(short beforeID) -> None")},
2518 {"InsertMenuItem", (PyCFunction
)MenuObj_InsertMenuItem
, 1,
2519 PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
2520 {"EnableMenuItem", (PyCFunction
)MenuObj_EnableMenuItem
, 1,
2521 PyDoc_STR("(UInt16 item) -> None")},
2522 {"CheckMenuItem", (PyCFunction
)MenuObj_CheckMenuItem
, 1,
2523 PyDoc_STR("(short item, Boolean checked) -> None")},
2527 #define MenuObj_getsetlist NULL
2530 #define MenuObj_compare NULL
2532 #define MenuObj_repr NULL
2534 #define MenuObj_hash NULL
2535 #define MenuObj_tp_init 0
2537 #define MenuObj_tp_alloc PyType_GenericAlloc
2539 static PyObject
*MenuObj_tp_new(PyTypeObject
*type
, PyObject
*args
, PyObject
*kwds
)
2543 char *kw
[] = {"itself", 0};
2545 if (!PyArg_ParseTupleAndKeywords(args
, kwds
, "O&", kw
, MenuObj_Convert
, &itself
)) return NULL
;
2546 if ((self
= type
->tp_alloc(type
, 0)) == NULL
) return NULL
;
2547 ((MenuObject
*)self
)->ob_itself
= itself
;
2551 #define MenuObj_tp_free PyObject_Del
2554 PyTypeObject Menu_Type
= {
2555 PyObject_HEAD_INIT(NULL
)
2557 "_Menu.Menu", /*tp_name*/
2558 sizeof(MenuObject
), /*tp_basicsize*/
2561 (destructor
) MenuObj_dealloc
, /*tp_dealloc*/
2563 (getattrfunc
)0, /*tp_getattr*/
2564 (setattrfunc
)0, /*tp_setattr*/
2565 (cmpfunc
) MenuObj_compare
, /*tp_compare*/
2566 (reprfunc
) MenuObj_repr
, /*tp_repr*/
2567 (PyNumberMethods
*)0, /* tp_as_number */
2568 (PySequenceMethods
*)0, /* tp_as_sequence */
2569 (PyMappingMethods
*)0, /* tp_as_mapping */
2570 (hashfunc
) MenuObj_hash
, /*tp_hash*/
2573 PyObject_GenericGetAttr
, /*tp_getattro*/
2574 PyObject_GenericSetAttr
, /*tp_setattro */
2576 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
2580 0, /*tp_richcompare*/
2581 0, /*tp_weaklistoffset*/
2584 MenuObj_methods
, /* tp_methods */
2586 MenuObj_getsetlist
, /*tp_getset*/
2591 0, /*tp_dictoffset*/
2592 MenuObj_tp_init
, /* tp_init */
2593 MenuObj_tp_alloc
, /* tp_alloc */
2594 MenuObj_tp_new
, /* tp_new */
2595 MenuObj_tp_free
, /* tp_free */
2598 /* ---------------------- End object type Menu ---------------------- */
2601 static PyObject
*Menu_NewMenu(PyObject
*_self
, PyObject
*_args
)
2603 PyObject
*_res
= NULL
;
2608 PyMac_PRECHECK(NewMenu
);
2610 if (!PyArg_ParseTuple(_args
, "hO&",
2612 PyMac_GetStr255
, menuTitle
))
2614 _rv
= NewMenu(menuID
,
2616 _res
= Py_BuildValue("O&",
2621 static PyObject
*Menu_MacGetMenu(PyObject
*_self
, PyObject
*_args
)
2623 PyObject
*_res
= NULL
;
2627 PyMac_PRECHECK(MacGetMenu
);
2629 if (!PyArg_ParseTuple(_args
, "h",
2632 _rv
= MacGetMenu(resourceID
);
2633 _res
= Py_BuildValue("O&",
2638 static PyObject
*Menu_CreateNewMenu(PyObject
*_self
, PyObject
*_args
)
2640 PyObject
*_res
= NULL
;
2643 MenuAttributes inMenuAttributes
;
2644 MenuHandle outMenuRef
;
2645 #ifndef CreateNewMenu
2646 PyMac_PRECHECK(CreateNewMenu
);
2648 if (!PyArg_ParseTuple(_args
, "hl",
2652 _err
= CreateNewMenu(inMenuID
,
2655 if (_err
!= noErr
) return PyMac_Error(_err
);
2656 _res
= Py_BuildValue("O&",
2657 MenuObj_New
, outMenuRef
);
2661 static PyObject
*Menu_MenuKey(PyObject
*_self
, PyObject
*_args
)
2663 PyObject
*_res
= NULL
;
2667 PyMac_PRECHECK(MenuKey
);
2669 if (!PyArg_ParseTuple(_args
, "h",
2673 _res
= Py_BuildValue("l",
2678 static PyObject
*Menu_MenuSelect(PyObject
*_self
, PyObject
*_args
)
2680 PyObject
*_res
= NULL
;
2684 PyMac_PRECHECK(MenuSelect
);
2686 if (!PyArg_ParseTuple(_args
, "O&",
2687 PyMac_GetPoint
, &startPt
))
2689 _rv
= MenuSelect(startPt
);
2690 _res
= Py_BuildValue("l",
2695 static PyObject
*Menu_MenuChoice(PyObject
*_self
, PyObject
*_args
)
2697 PyObject
*_res
= NULL
;
2700 PyMac_PRECHECK(MenuChoice
);
2702 if (!PyArg_ParseTuple(_args
, ""))
2705 _res
= Py_BuildValue("l",
2710 static PyObject
*Menu_MenuEvent(PyObject
*_self
, PyObject
*_args
)
2712 PyObject
*_res
= NULL
;
2714 EventRecord inEvent
;
2716 PyMac_PRECHECK(MenuEvent
);
2718 if (!PyArg_ParseTuple(_args
, "O&",
2719 PyMac_GetEventRecord
, &inEvent
))
2721 _rv
= MenuEvent(&inEvent
);
2722 _res
= Py_BuildValue("l",
2727 static PyObject
*Menu_GetMBarHeight(PyObject
*_self
, PyObject
*_args
)
2729 PyObject
*_res
= NULL
;
2731 #ifndef GetMBarHeight
2732 PyMac_PRECHECK(GetMBarHeight
);
2734 if (!PyArg_ParseTuple(_args
, ""))
2736 _rv
= GetMBarHeight();
2737 _res
= Py_BuildValue("h",
2742 static PyObject
*Menu_MacDrawMenuBar(PyObject
*_self
, PyObject
*_args
)
2744 PyObject
*_res
= NULL
;
2745 #ifndef MacDrawMenuBar
2746 PyMac_PRECHECK(MacDrawMenuBar
);
2748 if (!PyArg_ParseTuple(_args
, ""))
2756 static PyObject
*Menu_InvalMenuBar(PyObject
*_self
, PyObject
*_args
)
2758 PyObject
*_res
= NULL
;
2759 #ifndef InvalMenuBar
2760 PyMac_PRECHECK(InvalMenuBar
);
2762 if (!PyArg_ParseTuple(_args
, ""))
2770 static PyObject
*Menu_HiliteMenu(PyObject
*_self
, PyObject
*_args
)
2772 PyObject
*_res
= NULL
;
2775 PyMac_PRECHECK(HiliteMenu
);
2777 if (!PyArg_ParseTuple(_args
, "h",
2786 static PyObject
*Menu_GetNewMBar(PyObject
*_self
, PyObject
*_args
)
2788 PyObject
*_res
= NULL
;
2792 PyMac_PRECHECK(GetNewMBar
);
2794 if (!PyArg_ParseTuple(_args
, "h",
2797 _rv
= GetNewMBar(menuBarID
);
2798 _res
= Py_BuildValue("O&",
2803 static PyObject
*Menu_GetMenuBar(PyObject
*_self
, PyObject
*_args
)
2805 PyObject
*_res
= NULL
;
2808 PyMac_PRECHECK(GetMenuBar
);
2810 if (!PyArg_ParseTuple(_args
, ""))
2813 _res
= Py_BuildValue("O&",
2818 static PyObject
*Menu_SetMenuBar(PyObject
*_self
, PyObject
*_args
)
2820 PyObject
*_res
= NULL
;
2823 PyMac_PRECHECK(SetMenuBar
);
2825 if (!PyArg_ParseTuple(_args
, "O&",
2826 ResObj_Convert
, &mbar
))
2834 static PyObject
*Menu_DuplicateMenuBar(PyObject
*_self
, PyObject
*_args
)
2836 PyObject
*_res
= NULL
;
2838 MenuBarHandle inMbar
;
2839 MenuBarHandle outMbar
;
2840 #ifndef DuplicateMenuBar
2841 PyMac_PRECHECK(DuplicateMenuBar
);
2843 if (!PyArg_ParseTuple(_args
, "O&",
2844 ResObj_Convert
, &inMbar
))
2846 _err
= DuplicateMenuBar(inMbar
,
2848 if (_err
!= noErr
) return PyMac_Error(_err
);
2849 _res
= Py_BuildValue("O&",
2850 ResObj_New
, outMbar
);
2854 static PyObject
*Menu_DisposeMenuBar(PyObject
*_self
, PyObject
*_args
)
2856 PyObject
*_res
= NULL
;
2858 MenuBarHandle inMbar
;
2859 #ifndef DisposeMenuBar
2860 PyMac_PRECHECK(DisposeMenuBar
);
2862 if (!PyArg_ParseTuple(_args
, "O&",
2863 ResObj_Convert
, &inMbar
))
2865 _err
= DisposeMenuBar(inMbar
);
2866 if (_err
!= noErr
) return PyMac_Error(_err
);
2872 static PyObject
*Menu_GetMenuHandle(PyObject
*_self
, PyObject
*_args
)
2874 PyObject
*_res
= NULL
;
2877 #ifndef GetMenuHandle
2878 PyMac_PRECHECK(GetMenuHandle
);
2880 if (!PyArg_ParseTuple(_args
, "h",
2883 _rv
= GetMenuHandle(menuID
);
2884 _res
= Py_BuildValue("O&",
2889 static PyObject
*Menu_MacDeleteMenu(PyObject
*_self
, PyObject
*_args
)
2891 PyObject
*_res
= NULL
;
2893 #ifndef MacDeleteMenu
2894 PyMac_PRECHECK(MacDeleteMenu
);
2896 if (!PyArg_ParseTuple(_args
, "h",
2899 MacDeleteMenu(menuID
);
2905 static PyObject
*Menu_ClearMenuBar(PyObject
*_self
, PyObject
*_args
)
2907 PyObject
*_res
= NULL
;
2908 #ifndef ClearMenuBar
2909 PyMac_PRECHECK(ClearMenuBar
);
2911 if (!PyArg_ParseTuple(_args
, ""))
2919 static PyObject
*Menu_SetMenuFlashCount(PyObject
*_self
, PyObject
*_args
)
2921 PyObject
*_res
= NULL
;
2923 #ifndef SetMenuFlashCount
2924 PyMac_PRECHECK(SetMenuFlashCount
);
2926 if (!PyArg_ParseTuple(_args
, "h",
2929 SetMenuFlashCount(count
);
2935 static PyObject
*Menu_FlashMenuBar(PyObject
*_self
, PyObject
*_args
)
2937 PyObject
*_res
= NULL
;
2939 #ifndef FlashMenuBar
2940 PyMac_PRECHECK(FlashMenuBar
);
2942 if (!PyArg_ParseTuple(_args
, "h",
2945 FlashMenuBar(menuID
);
2951 static PyObject
*Menu_IsMenuBarVisible(PyObject
*_self
, PyObject
*_args
)
2953 PyObject
*_res
= NULL
;
2955 #ifndef IsMenuBarVisible
2956 PyMac_PRECHECK(IsMenuBarVisible
);
2958 if (!PyArg_ParseTuple(_args
, ""))
2960 _rv
= IsMenuBarVisible();
2961 _res
= Py_BuildValue("b",
2966 static PyObject
*Menu_ShowMenuBar(PyObject
*_self
, PyObject
*_args
)
2968 PyObject
*_res
= NULL
;
2970 PyMac_PRECHECK(ShowMenuBar
);
2972 if (!PyArg_ParseTuple(_args
, ""))
2980 static PyObject
*Menu_HideMenuBar(PyObject
*_self
, PyObject
*_args
)
2982 PyObject
*_res
= NULL
;
2984 PyMac_PRECHECK(HideMenuBar
);
2986 if (!PyArg_ParseTuple(_args
, ""))
2994 static PyObject
*Menu_AcquireRootMenu(PyObject
*_self
, PyObject
*_args
)
2996 PyObject
*_res
= NULL
;
2998 #ifndef AcquireRootMenu
2999 PyMac_PRECHECK(AcquireRootMenu
);
3001 if (!PyArg_ParseTuple(_args
, ""))
3003 _rv
= AcquireRootMenu();
3004 _res
= Py_BuildValue("O&",
3009 static PyObject
*Menu_DeleteMCEntries(PyObject
*_self
, PyObject
*_args
)
3011 PyObject
*_res
= NULL
;
3014 #ifndef DeleteMCEntries
3015 PyMac_PRECHECK(DeleteMCEntries
);
3017 if (!PyArg_ParseTuple(_args
, "hh",
3021 DeleteMCEntries(menuID
,
3028 static PyObject
*Menu_InitContextualMenus(PyObject
*_self
, PyObject
*_args
)
3030 PyObject
*_res
= NULL
;
3032 #ifndef InitContextualMenus
3033 PyMac_PRECHECK(InitContextualMenus
);
3035 if (!PyArg_ParseTuple(_args
, ""))
3037 _err
= InitContextualMenus();
3038 if (_err
!= noErr
) return PyMac_Error(_err
);
3044 static PyObject
*Menu_IsShowContextualMenuClick(PyObject
*_self
, PyObject
*_args
)
3046 PyObject
*_res
= NULL
;
3048 EventRecord inEvent
;
3049 #ifndef IsShowContextualMenuClick
3050 PyMac_PRECHECK(IsShowContextualMenuClick
);
3052 if (!PyArg_ParseTuple(_args
, "O&",
3053 PyMac_GetEventRecord
, &inEvent
))
3055 _rv
= IsShowContextualMenuClick(&inEvent
);
3056 _res
= Py_BuildValue("b",
3061 static PyObject
*Menu_LMGetTheMenu(PyObject
*_self
, PyObject
*_args
)
3063 PyObject
*_res
= NULL
;
3065 #ifndef LMGetTheMenu
3066 PyMac_PRECHECK(LMGetTheMenu
);
3068 if (!PyArg_ParseTuple(_args
, ""))
3070 _rv
= LMGetTheMenu();
3071 _res
= Py_BuildValue("h",
3076 static PyObject
*Menu_as_Menu(PyObject
*_self
, PyObject
*_args
)
3078 PyObject
*_res
= NULL
;
3082 PyMac_PRECHECK(as_Menu
);
3084 if (!PyArg_ParseTuple(_args
, "O&",
3085 ResObj_Convert
, &h
))
3088 _res
= Py_BuildValue("O&",
3093 static PyObject
*Menu_GetMenu(PyObject
*_self
, PyObject
*_args
)
3095 PyObject
*_res
= NULL
;
3099 PyMac_PRECHECK(GetMenu
);
3101 if (!PyArg_ParseTuple(_args
, "h",
3104 _rv
= GetMenu(resourceID
);
3105 _res
= Py_BuildValue("O&",
3110 static PyObject
*Menu_DeleteMenu(PyObject
*_self
, PyObject
*_args
)
3112 PyObject
*_res
= NULL
;
3115 PyMac_PRECHECK(DeleteMenu
);
3117 if (!PyArg_ParseTuple(_args
, "h",
3126 static PyObject
*Menu_DrawMenuBar(PyObject
*_self
, PyObject
*_args
)
3128 PyObject
*_res
= NULL
;
3130 PyMac_PRECHECK(DrawMenuBar
);
3132 if (!PyArg_ParseTuple(_args
, ""))
3140 static PyObject
*Menu_CountMenuItemsWithCommandID(PyObject
*_self
, PyObject
*_args
)
3142 PyObject
*_res
= NULL
;
3145 MenuCommand inCommandID
;
3146 #ifndef CountMenuItemsWithCommandID
3147 PyMac_PRECHECK(CountMenuItemsWithCommandID
);
3149 if (!PyArg_ParseTuple(_args
, "O&l",
3150 OptMenuObj_Convert
, &inMenu
,
3153 _rv
= CountMenuItemsWithCommandID(inMenu
,
3155 _res
= Py_BuildValue("l",
3160 static PyObject
*Menu_GetIndMenuItemWithCommandID(PyObject
*_self
, PyObject
*_args
)
3162 PyObject
*_res
= NULL
;
3165 MenuCommand inCommandID
;
3168 MenuItemIndex outIndex
;
3169 #ifndef GetIndMenuItemWithCommandID
3170 PyMac_PRECHECK(GetIndMenuItemWithCommandID
);
3172 if (!PyArg_ParseTuple(_args
, "O&ll",
3173 OptMenuObj_Convert
, &inMenu
,
3177 _err
= GetIndMenuItemWithCommandID(inMenu
,
3182 if (_err
!= noErr
) return PyMac_Error(_err
);
3183 _res
= Py_BuildValue("O&h",
3184 MenuObj_New
, outMenu
,
3189 static PyObject
*Menu_EnableMenuCommand(PyObject
*_self
, PyObject
*_args
)
3191 PyObject
*_res
= NULL
;
3193 MenuCommand inCommandID
;
3194 #ifndef EnableMenuCommand
3195 PyMac_PRECHECK(EnableMenuCommand
);
3197 if (!PyArg_ParseTuple(_args
, "O&l",
3198 OptMenuObj_Convert
, &inMenu
,
3201 EnableMenuCommand(inMenu
,
3208 static PyObject
*Menu_DisableMenuCommand(PyObject
*_self
, PyObject
*_args
)
3210 PyObject
*_res
= NULL
;
3212 MenuCommand inCommandID
;
3213 #ifndef DisableMenuCommand
3214 PyMac_PRECHECK(DisableMenuCommand
);
3216 if (!PyArg_ParseTuple(_args
, "O&l",
3217 OptMenuObj_Convert
, &inMenu
,
3220 DisableMenuCommand(inMenu
,
3227 static PyObject
*Menu_IsMenuCommandEnabled(PyObject
*_self
, PyObject
*_args
)
3229 PyObject
*_res
= NULL
;
3232 MenuCommand inCommandID
;
3233 #ifndef IsMenuCommandEnabled
3234 PyMac_PRECHECK(IsMenuCommandEnabled
);
3236 if (!PyArg_ParseTuple(_args
, "O&l",
3237 OptMenuObj_Convert
, &inMenu
,
3240 _rv
= IsMenuCommandEnabled(inMenu
,
3242 _res
= Py_BuildValue("b",
3247 static PyObject
*Menu_SetMenuCommandMark(PyObject
*_self
, PyObject
*_args
)
3249 PyObject
*_res
= NULL
;
3252 MenuCommand inCommandID
;
3254 #ifndef SetMenuCommandMark
3255 PyMac_PRECHECK(SetMenuCommandMark
);
3257 if (!PyArg_ParseTuple(_args
, "O&lh",
3258 OptMenuObj_Convert
, &inMenu
,
3262 _err
= SetMenuCommandMark(inMenu
,
3265 if (_err
!= noErr
) return PyMac_Error(_err
);
3271 static PyObject
*Menu_GetMenuCommandMark(PyObject
*_self
, PyObject
*_args
)
3273 PyObject
*_res
= NULL
;
3276 MenuCommand inCommandID
;
3278 #ifndef GetMenuCommandMark
3279 PyMac_PRECHECK(GetMenuCommandMark
);
3281 if (!PyArg_ParseTuple(_args
, "O&l",
3282 OptMenuObj_Convert
, &inMenu
,
3285 _err
= GetMenuCommandMark(inMenu
,
3288 if (_err
!= noErr
) return PyMac_Error(_err
);
3289 _res
= Py_BuildValue("h",
3294 static PyObject
*Menu_GetMenuCommandPropertySize(PyObject
*_self
, PyObject
*_args
)
3296 PyObject
*_res
= NULL
;
3299 MenuCommand inCommandID
;
3300 OSType inPropertyCreator
;
3301 OSType inPropertyTag
;
3303 #ifndef GetMenuCommandPropertySize
3304 PyMac_PRECHECK(GetMenuCommandPropertySize
);
3306 if (!PyArg_ParseTuple(_args
, "O&lO&O&",
3307 OptMenuObj_Convert
, &inMenu
,
3309 PyMac_GetOSType
, &inPropertyCreator
,
3310 PyMac_GetOSType
, &inPropertyTag
))
3312 _err
= GetMenuCommandPropertySize(inMenu
,
3317 if (_err
!= noErr
) return PyMac_Error(_err
);
3318 _res
= Py_BuildValue("l",
3323 static PyObject
*Menu_RemoveMenuCommandProperty(PyObject
*_self
, PyObject
*_args
)
3325 PyObject
*_res
= NULL
;
3328 MenuCommand inCommandID
;
3329 OSType inPropertyCreator
;
3330 OSType inPropertyTag
;
3331 #ifndef RemoveMenuCommandProperty
3332 PyMac_PRECHECK(RemoveMenuCommandProperty
);
3334 if (!PyArg_ParseTuple(_args
, "O&lO&O&",
3335 OptMenuObj_Convert
, &inMenu
,
3337 PyMac_GetOSType
, &inPropertyCreator
,
3338 PyMac_GetOSType
, &inPropertyTag
))
3340 _err
= RemoveMenuCommandProperty(inMenu
,
3344 if (_err
!= noErr
) return PyMac_Error(_err
);
3350 static PyMethodDef Menu_methods
[] = {
3351 {"NewMenu", (PyCFunction
)Menu_NewMenu
, 1,
3352 PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")},
3353 {"MacGetMenu", (PyCFunction
)Menu_MacGetMenu
, 1,
3354 PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
3355 {"CreateNewMenu", (PyCFunction
)Menu_CreateNewMenu
, 1,
3356 PyDoc_STR("(MenuID inMenuID, MenuAttributes inMenuAttributes) -> (MenuHandle outMenuRef)")},
3357 {"MenuKey", (PyCFunction
)Menu_MenuKey
, 1,
3358 PyDoc_STR("(CharParameter ch) -> (long _rv)")},
3359 {"MenuSelect", (PyCFunction
)Menu_MenuSelect
, 1,
3360 PyDoc_STR("(Point startPt) -> (long _rv)")},
3361 {"MenuChoice", (PyCFunction
)Menu_MenuChoice
, 1,
3362 PyDoc_STR("() -> (long _rv)")},
3363 {"MenuEvent", (PyCFunction
)Menu_MenuEvent
, 1,
3364 PyDoc_STR("(EventRecord inEvent) -> (UInt32 _rv)")},
3365 {"GetMBarHeight", (PyCFunction
)Menu_GetMBarHeight
, 1,
3366 PyDoc_STR("() -> (short _rv)")},
3367 {"MacDrawMenuBar", (PyCFunction
)Menu_MacDrawMenuBar
, 1,
3368 PyDoc_STR("() -> None")},
3369 {"InvalMenuBar", (PyCFunction
)Menu_InvalMenuBar
, 1,
3370 PyDoc_STR("() -> None")},
3371 {"HiliteMenu", (PyCFunction
)Menu_HiliteMenu
, 1,
3372 PyDoc_STR("(MenuID menuID) -> None")},
3373 {"GetNewMBar", (PyCFunction
)Menu_GetNewMBar
, 1,
3374 PyDoc_STR("(short menuBarID) -> (MenuBarHandle _rv)")},
3375 {"GetMenuBar", (PyCFunction
)Menu_GetMenuBar
, 1,
3376 PyDoc_STR("() -> (MenuBarHandle _rv)")},
3377 {"SetMenuBar", (PyCFunction
)Menu_SetMenuBar
, 1,
3378 PyDoc_STR("(MenuBarHandle mbar) -> None")},
3379 {"DuplicateMenuBar", (PyCFunction
)Menu_DuplicateMenuBar
, 1,
3380 PyDoc_STR("(MenuBarHandle inMbar) -> (MenuBarHandle outMbar)")},
3381 {"DisposeMenuBar", (PyCFunction
)Menu_DisposeMenuBar
, 1,
3382 PyDoc_STR("(MenuBarHandle inMbar) -> None")},
3383 {"GetMenuHandle", (PyCFunction
)Menu_GetMenuHandle
, 1,
3384 PyDoc_STR("(MenuID menuID) -> (MenuHandle _rv)")},
3385 {"MacDeleteMenu", (PyCFunction
)Menu_MacDeleteMenu
, 1,
3386 PyDoc_STR("(MenuID menuID) -> None")},
3387 {"ClearMenuBar", (PyCFunction
)Menu_ClearMenuBar
, 1,
3388 PyDoc_STR("() -> None")},
3389 {"SetMenuFlashCount", (PyCFunction
)Menu_SetMenuFlashCount
, 1,
3390 PyDoc_STR("(short count) -> None")},
3391 {"FlashMenuBar", (PyCFunction
)Menu_FlashMenuBar
, 1,
3392 PyDoc_STR("(MenuID menuID) -> None")},
3393 {"IsMenuBarVisible", (PyCFunction
)Menu_IsMenuBarVisible
, 1,
3394 PyDoc_STR("() -> (Boolean _rv)")},
3395 {"ShowMenuBar", (PyCFunction
)Menu_ShowMenuBar
, 1,
3396 PyDoc_STR("() -> None")},
3397 {"HideMenuBar", (PyCFunction
)Menu_HideMenuBar
, 1,
3398 PyDoc_STR("() -> None")},
3399 {"AcquireRootMenu", (PyCFunction
)Menu_AcquireRootMenu
, 1,
3400 PyDoc_STR("() -> (MenuHandle _rv)")},
3401 {"DeleteMCEntries", (PyCFunction
)Menu_DeleteMCEntries
, 1,
3402 PyDoc_STR("(MenuID menuID, short menuItem) -> None")},
3403 {"InitContextualMenus", (PyCFunction
)Menu_InitContextualMenus
, 1,
3404 PyDoc_STR("() -> None")},
3405 {"IsShowContextualMenuClick", (PyCFunction
)Menu_IsShowContextualMenuClick
, 1,
3406 PyDoc_STR("(EventRecord inEvent) -> (Boolean _rv)")},
3407 {"LMGetTheMenu", (PyCFunction
)Menu_LMGetTheMenu
, 1,
3408 PyDoc_STR("() -> (SInt16 _rv)")},
3409 {"as_Menu", (PyCFunction
)Menu_as_Menu
, 1,
3410 PyDoc_STR("(Handle h) -> (MenuHandle _rv)")},
3411 {"GetMenu", (PyCFunction
)Menu_GetMenu
, 1,
3412 PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
3413 {"DeleteMenu", (PyCFunction
)Menu_DeleteMenu
, 1,
3414 PyDoc_STR("(short menuID) -> None")},
3415 {"DrawMenuBar", (PyCFunction
)Menu_DrawMenuBar
, 1,
3416 PyDoc_STR("() -> None")},
3417 {"CountMenuItemsWithCommandID", (PyCFunction
)Menu_CountMenuItemsWithCommandID
, 1,
3418 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)")},
3419 {"GetIndMenuItemWithCommandID", (PyCFunction
)Menu_GetIndMenuItemWithCommandID
, 1,
3420 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
3421 {"EnableMenuCommand", (PyCFunction
)Menu_EnableMenuCommand
, 1,
3422 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
3423 {"DisableMenuCommand", (PyCFunction
)Menu_DisableMenuCommand
, 1,
3424 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
3425 {"IsMenuCommandEnabled", (PyCFunction
)Menu_IsMenuCommandEnabled
, 1,
3426 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)")},
3427 {"SetMenuCommandMark", (PyCFunction
)Menu_SetMenuCommandMark
, 1,
3428 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None")},
3429 {"GetMenuCommandMark", (PyCFunction
)Menu_GetMenuCommandMark
, 1,
3430 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)")},
3431 {"GetMenuCommandPropertySize", (PyCFunction
)Menu_GetMenuCommandPropertySize
, 1,
3432 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
3433 {"RemoveMenuCommandProperty", (PyCFunction
)Menu_RemoveMenuCommandProperty
, 1,
3434 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
3441 void init_Menu(void)
3448 PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle
, MenuObj_New
);
3449 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle
, MenuObj_Convert
);
3452 m
= Py_InitModule("_Menu", Menu_methods
);
3453 d
= PyModule_GetDict(m
);
3454 Menu_Error
= PyMac_GetOSErrException();
3455 if (Menu_Error
== NULL
||
3456 PyDict_SetItemString(d
, "Error", Menu_Error
) != 0)
3458 Menu_Type
.ob_type
= &PyType_Type
;
3459 if (PyType_Ready(&Menu_Type
) < 0) return;
3460 Py_INCREF(&Menu_Type
);
3461 PyModule_AddObject(m
, "Menu", (PyObject
*)&Menu_Type
);
3462 /* Backward-compatible name */
3463 Py_INCREF(&Menu_Type
);
3464 PyModule_AddObject(m
, "MenuType", (PyObject
*)&Menu_Type
);
3467 /* ======================== End module _Menu ======================== */