2 /* ========================== Module _Menu ========================== */
9 #include "pymactoolbox.h"
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"); \
19 #include <Carbon/Carbon.h>
22 #ifdef USE_TOOLBOX_OBJECT_GLUE
24 extern PyObject
*_MenuObj_New(MenuHandle
);
25 extern int _MenuObj_Convert(PyObject
*, MenuHandle
*);
27 #define MenuObj_New _MenuObj_New
28 #define MenuObj_Convert _MenuObj_Convert
31 #define as_Menu(h) ((MenuHandle)h)
32 #define as_Resource(h) ((Handle)h)
35 /* Alternative version of MenuObj_New, which returns None for NULL argument */
36 PyObject
*OptMenuObj_New(MenuRef itself
)
42 return MenuObj_New(itself
);
45 /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */
46 int OptMenuObj_Convert(PyObject
*v
, MenuRef
*p_itself
)
52 return MenuObj_Convert(v
, p_itself
);
55 static PyObject
*Menu_Error
;
57 /* ------------------------ Object type Menu ------------------------ */
59 PyTypeObject Menu_Type
;
61 #define MenuObj_Check(x) ((x)->ob_type == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type))
63 typedef struct MenuObject
{
68 PyObject
*MenuObj_New(MenuHandle itself
)
71 it
= PyObject_NEW(MenuObject
, &Menu_Type
);
72 if (it
== NULL
) return NULL
;
73 it
->ob_itself
= itself
;
74 return (PyObject
*)it
;
77 int MenuObj_Convert(PyObject
*v
, MenuHandle
*p_itself
)
79 if (!MenuObj_Check(v
))
81 PyErr_SetString(PyExc_TypeError
, "Menu required");
84 *p_itself
= ((MenuObject
*)v
)->ob_itself
;
88 static void MenuObj_dealloc(MenuObject
*self
)
90 /* Cleanup of self->ob_itself goes here */
91 self
->ob_type
->tp_free((PyObject
*)self
);
94 static PyObject
*MenuObj_DisposeMenu(MenuObject
*_self
, PyObject
*_args
)
96 PyObject
*_res
= NULL
;
98 PyMac_PRECHECK(DisposeMenu
);
100 if (!PyArg_ParseTuple(_args
, ""))
102 DisposeMenu(_self
->ob_itself
);
108 static PyObject
*MenuObj_CalcMenuSize(MenuObject
*_self
, PyObject
*_args
)
110 PyObject
*_res
= NULL
;
112 PyMac_PRECHECK(CalcMenuSize
);
114 if (!PyArg_ParseTuple(_args
, ""))
116 CalcMenuSize(_self
->ob_itself
);
122 static PyObject
*MenuObj_CountMenuItems(MenuObject
*_self
, PyObject
*_args
)
124 PyObject
*_res
= NULL
;
126 #ifndef CountMenuItems
127 PyMac_PRECHECK(CountMenuItems
);
129 if (!PyArg_ParseTuple(_args
, ""))
131 _rv
= CountMenuItems(_self
->ob_itself
);
132 _res
= Py_BuildValue("H",
137 static PyObject
*MenuObj_GetMenuFont(MenuObject
*_self
, PyObject
*_args
)
139 PyObject
*_res
= NULL
;
144 PyMac_PRECHECK(GetMenuFont
);
146 if (!PyArg_ParseTuple(_args
, ""))
148 _err
= GetMenuFont(_self
->ob_itself
,
151 if (_err
!= noErr
) return PyMac_Error(_err
);
152 _res
= Py_BuildValue("hH",
158 static PyObject
*MenuObj_SetMenuFont(MenuObject
*_self
, PyObject
*_args
)
160 PyObject
*_res
= NULL
;
165 PyMac_PRECHECK(SetMenuFont
);
167 if (!PyArg_ParseTuple(_args
, "hH",
171 _err
= SetMenuFont(_self
->ob_itself
,
174 if (_err
!= noErr
) return PyMac_Error(_err
);
180 static PyObject
*MenuObj_GetMenuExcludesMarkColumn(MenuObject
*_self
, PyObject
*_args
)
182 PyObject
*_res
= NULL
;
184 #ifndef GetMenuExcludesMarkColumn
185 PyMac_PRECHECK(GetMenuExcludesMarkColumn
);
187 if (!PyArg_ParseTuple(_args
, ""))
189 _rv
= GetMenuExcludesMarkColumn(_self
->ob_itself
);
190 _res
= Py_BuildValue("b",
195 static PyObject
*MenuObj_SetMenuExcludesMarkColumn(MenuObject
*_self
, PyObject
*_args
)
197 PyObject
*_res
= NULL
;
199 Boolean excludesMark
;
200 #ifndef SetMenuExcludesMarkColumn
201 PyMac_PRECHECK(SetMenuExcludesMarkColumn
);
203 if (!PyArg_ParseTuple(_args
, "b",
206 _err
= SetMenuExcludesMarkColumn(_self
->ob_itself
,
208 if (_err
!= noErr
) return PyMac_Error(_err
);
214 static PyObject
*MenuObj_IsValidMenu(MenuObject
*_self
, PyObject
*_args
)
216 PyObject
*_res
= NULL
;
219 PyMac_PRECHECK(IsValidMenu
);
221 if (!PyArg_ParseTuple(_args
, ""))
223 _rv
= IsValidMenu(_self
->ob_itself
);
224 _res
= Py_BuildValue("b",
229 static PyObject
*MenuObj_GetMenuRetainCount(MenuObject
*_self
, PyObject
*_args
)
231 PyObject
*_res
= NULL
;
233 #ifndef GetMenuRetainCount
234 PyMac_PRECHECK(GetMenuRetainCount
);
236 if (!PyArg_ParseTuple(_args
, ""))
238 _rv
= GetMenuRetainCount(_self
->ob_itself
);
239 _res
= Py_BuildValue("l",
244 static PyObject
*MenuObj_RetainMenu(MenuObject
*_self
, PyObject
*_args
)
246 PyObject
*_res
= NULL
;
249 PyMac_PRECHECK(RetainMenu
);
251 if (!PyArg_ParseTuple(_args
, ""))
253 _err
= RetainMenu(_self
->ob_itself
);
254 if (_err
!= noErr
) return PyMac_Error(_err
);
260 static PyObject
*MenuObj_ReleaseMenu(MenuObject
*_self
, PyObject
*_args
)
262 PyObject
*_res
= NULL
;
265 PyMac_PRECHECK(ReleaseMenu
);
267 if (!PyArg_ParseTuple(_args
, ""))
269 _err
= ReleaseMenu(_self
->ob_itself
);
270 if (_err
!= noErr
) return PyMac_Error(_err
);
276 static PyObject
*MenuObj_DuplicateMenu(MenuObject
*_self
, PyObject
*_args
)
278 PyObject
*_res
= NULL
;
281 #ifndef DuplicateMenu
282 PyMac_PRECHECK(DuplicateMenu
);
284 if (!PyArg_ParseTuple(_args
, ""))
286 _err
= DuplicateMenu(_self
->ob_itself
,
288 if (_err
!= noErr
) return PyMac_Error(_err
);
289 _res
= Py_BuildValue("O&",
290 MenuObj_New
, outMenu
);
294 static PyObject
*MenuObj_CopyMenuTitleAsCFString(MenuObject
*_self
, PyObject
*_args
)
296 PyObject
*_res
= NULL
;
298 CFStringRef outString
;
299 #ifndef CopyMenuTitleAsCFString
300 PyMac_PRECHECK(CopyMenuTitleAsCFString
);
302 if (!PyArg_ParseTuple(_args
, ""))
304 _err
= CopyMenuTitleAsCFString(_self
->ob_itself
,
306 if (_err
!= noErr
) return PyMac_Error(_err
);
307 _res
= Py_BuildValue("O&",
308 CFStringRefObj_New
, outString
);
312 static PyObject
*MenuObj_SetMenuTitleWithCFString(MenuObject
*_self
, PyObject
*_args
)
314 PyObject
*_res
= NULL
;
316 CFStringRef inString
;
317 #ifndef SetMenuTitleWithCFString
318 PyMac_PRECHECK(SetMenuTitleWithCFString
);
320 if (!PyArg_ParseTuple(_args
, "O&",
321 CFStringRefObj_Convert
, &inString
))
323 _err
= SetMenuTitleWithCFString(_self
->ob_itself
,
325 if (_err
!= noErr
) return PyMac_Error(_err
);
331 static PyObject
*MenuObj_InvalidateMenuSize(MenuObject
*_self
, PyObject
*_args
)
333 PyObject
*_res
= NULL
;
335 #ifndef InvalidateMenuSize
336 PyMac_PRECHECK(InvalidateMenuSize
);
338 if (!PyArg_ParseTuple(_args
, ""))
340 _err
= InvalidateMenuSize(_self
->ob_itself
);
341 if (_err
!= noErr
) return PyMac_Error(_err
);
347 static PyObject
*MenuObj_IsMenuSizeInvalid(MenuObject
*_self
, PyObject
*_args
)
349 PyObject
*_res
= NULL
;
351 #ifndef IsMenuSizeInvalid
352 PyMac_PRECHECK(IsMenuSizeInvalid
);
354 if (!PyArg_ParseTuple(_args
, ""))
356 _rv
= IsMenuSizeInvalid(_self
->ob_itself
);
357 _res
= Py_BuildValue("b",
362 static PyObject
*MenuObj_MacAppendMenu(MenuObject
*_self
, PyObject
*_args
)
364 PyObject
*_res
= NULL
;
366 #ifndef MacAppendMenu
367 PyMac_PRECHECK(MacAppendMenu
);
369 if (!PyArg_ParseTuple(_args
, "O&",
370 PyMac_GetStr255
, data
))
372 MacAppendMenu(_self
->ob_itself
,
379 static PyObject
*MenuObj_InsertResMenu(MenuObject
*_self
, PyObject
*_args
)
381 PyObject
*_res
= NULL
;
384 #ifndef InsertResMenu
385 PyMac_PRECHECK(InsertResMenu
);
387 if (!PyArg_ParseTuple(_args
, "O&h",
388 PyMac_GetOSType
, &theType
,
391 InsertResMenu(_self
->ob_itself
,
399 static PyObject
*MenuObj_AppendResMenu(MenuObject
*_self
, PyObject
*_args
)
401 PyObject
*_res
= NULL
;
403 #ifndef AppendResMenu
404 PyMac_PRECHECK(AppendResMenu
);
406 if (!PyArg_ParseTuple(_args
, "O&",
407 PyMac_GetOSType
, &theType
))
409 AppendResMenu(_self
->ob_itself
,
416 static PyObject
*MenuObj_MacInsertMenuItem(MenuObject
*_self
, PyObject
*_args
)
418 PyObject
*_res
= NULL
;
421 #ifndef MacInsertMenuItem
422 PyMac_PRECHECK(MacInsertMenuItem
);
424 if (!PyArg_ParseTuple(_args
, "O&h",
425 PyMac_GetStr255
, itemString
,
428 MacInsertMenuItem(_self
->ob_itself
,
436 static PyObject
*MenuObj_DeleteMenuItem(MenuObject
*_self
, PyObject
*_args
)
438 PyObject
*_res
= NULL
;
440 #ifndef DeleteMenuItem
441 PyMac_PRECHECK(DeleteMenuItem
);
443 if (!PyArg_ParseTuple(_args
, "h",
446 DeleteMenuItem(_self
->ob_itself
,
453 static PyObject
*MenuObj_InsertFontResMenu(MenuObject
*_self
, PyObject
*_args
)
455 PyObject
*_res
= NULL
;
458 #ifndef InsertFontResMenu
459 PyMac_PRECHECK(InsertFontResMenu
);
461 if (!PyArg_ParseTuple(_args
, "hh",
465 InsertFontResMenu(_self
->ob_itself
,
473 static PyObject
*MenuObj_InsertIntlResMenu(MenuObject
*_self
, PyObject
*_args
)
475 PyObject
*_res
= NULL
;
479 #ifndef InsertIntlResMenu
480 PyMac_PRECHECK(InsertIntlResMenu
);
482 if (!PyArg_ParseTuple(_args
, "O&hh",
483 PyMac_GetOSType
, &theType
,
487 InsertIntlResMenu(_self
->ob_itself
,
496 static PyObject
*MenuObj_AppendMenuItemText(MenuObject
*_self
, PyObject
*_args
)
498 PyObject
*_res
= NULL
;
501 #ifndef AppendMenuItemText
502 PyMac_PRECHECK(AppendMenuItemText
);
504 if (!PyArg_ParseTuple(_args
, "O&",
505 PyMac_GetStr255
, inString
))
507 _err
= AppendMenuItemText(_self
->ob_itself
,
509 if (_err
!= noErr
) return PyMac_Error(_err
);
515 static PyObject
*MenuObj_InsertMenuItemText(MenuObject
*_self
, PyObject
*_args
)
517 PyObject
*_res
= NULL
;
520 MenuItemIndex afterItem
;
521 #ifndef InsertMenuItemText
522 PyMac_PRECHECK(InsertMenuItemText
);
524 if (!PyArg_ParseTuple(_args
, "O&h",
525 PyMac_GetStr255
, inString
,
528 _err
= InsertMenuItemText(_self
->ob_itself
,
531 if (_err
!= noErr
) return PyMac_Error(_err
);
537 static PyObject
*MenuObj_CopyMenuItems(MenuObject
*_self
, PyObject
*_args
)
539 PyObject
*_res
= NULL
;
541 MenuItemIndex inFirstItem
;
542 ItemCount inNumItems
;
543 MenuHandle inDestMenu
;
544 MenuItemIndex inInsertAfter
;
545 #ifndef CopyMenuItems
546 PyMac_PRECHECK(CopyMenuItems
);
548 if (!PyArg_ParseTuple(_args
, "hlO&h",
551 MenuObj_Convert
, &inDestMenu
,
554 _err
= CopyMenuItems(_self
->ob_itself
,
559 if (_err
!= noErr
) return PyMac_Error(_err
);
565 static PyObject
*MenuObj_DeleteMenuItems(MenuObject
*_self
, PyObject
*_args
)
567 PyObject
*_res
= NULL
;
569 MenuItemIndex inFirstItem
;
570 ItemCount inNumItems
;
571 #ifndef DeleteMenuItems
572 PyMac_PRECHECK(DeleteMenuItems
);
574 if (!PyArg_ParseTuple(_args
, "hl",
578 _err
= DeleteMenuItems(_self
->ob_itself
,
581 if (_err
!= noErr
) return PyMac_Error(_err
);
587 static PyObject
*MenuObj_AppendMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
589 PyObject
*_res
= NULL
;
591 CFStringRef inString
;
592 MenuItemAttributes inAttributes
;
593 MenuCommand inCommandID
;
594 MenuItemIndex outNewItem
;
595 #ifndef AppendMenuItemTextWithCFString
596 PyMac_PRECHECK(AppendMenuItemTextWithCFString
);
598 if (!PyArg_ParseTuple(_args
, "O&ll",
599 CFStringRefObj_Convert
, &inString
,
603 _err
= AppendMenuItemTextWithCFString(_self
->ob_itself
,
608 if (_err
!= noErr
) return PyMac_Error(_err
);
609 _res
= Py_BuildValue("h",
614 static PyObject
*MenuObj_InsertMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
616 PyObject
*_res
= NULL
;
618 CFStringRef inString
;
619 MenuItemIndex inAfterItem
;
620 MenuItemAttributes inAttributes
;
621 MenuCommand inCommandID
;
622 #ifndef InsertMenuItemTextWithCFString
623 PyMac_PRECHECK(InsertMenuItemTextWithCFString
);
625 if (!PyArg_ParseTuple(_args
, "O&hll",
626 CFStringRefObj_Convert
, &inString
,
631 _err
= InsertMenuItemTextWithCFString(_self
->ob_itself
,
636 if (_err
!= noErr
) return PyMac_Error(_err
);
642 static PyObject
*MenuObj_PopUpMenuSelect(MenuObject
*_self
, PyObject
*_args
)
644 PyObject
*_res
= NULL
;
649 #ifndef PopUpMenuSelect
650 PyMac_PRECHECK(PopUpMenuSelect
);
652 if (!PyArg_ParseTuple(_args
, "hhh",
657 _rv
= PopUpMenuSelect(_self
->ob_itself
,
661 _res
= Py_BuildValue("l",
666 static PyObject
*MenuObj_InvalidateMenuEnabling(MenuObject
*_self
, PyObject
*_args
)
668 PyObject
*_res
= NULL
;
670 #ifndef InvalidateMenuEnabling
671 PyMac_PRECHECK(InvalidateMenuEnabling
);
673 if (!PyArg_ParseTuple(_args
, ""))
675 _err
= InvalidateMenuEnabling(_self
->ob_itself
);
676 if (_err
!= noErr
) return PyMac_Error(_err
);
682 static PyObject
*MenuObj_IsMenuBarInvalid(MenuObject
*_self
, PyObject
*_args
)
684 PyObject
*_res
= NULL
;
686 #ifndef IsMenuBarInvalid
687 PyMac_PRECHECK(IsMenuBarInvalid
);
689 if (!PyArg_ParseTuple(_args
, ""))
691 _rv
= IsMenuBarInvalid(_self
->ob_itself
);
692 _res
= Py_BuildValue("b",
697 static PyObject
*MenuObj_MacInsertMenu(MenuObject
*_self
, PyObject
*_args
)
699 PyObject
*_res
= NULL
;
701 #ifndef MacInsertMenu
702 PyMac_PRECHECK(MacInsertMenu
);
704 if (!PyArg_ParseTuple(_args
, "h",
707 MacInsertMenu(_self
->ob_itself
,
714 static PyObject
*MenuObj_SetRootMenu(MenuObject
*_self
, PyObject
*_args
)
716 PyObject
*_res
= NULL
;
719 PyMac_PRECHECK(SetRootMenu
);
721 if (!PyArg_ParseTuple(_args
, ""))
723 _err
= SetRootMenu(_self
->ob_itself
);
724 if (_err
!= noErr
) return PyMac_Error(_err
);
730 static PyObject
*MenuObj_MacCheckMenuItem(MenuObject
*_self
, PyObject
*_args
)
732 PyObject
*_res
= NULL
;
735 #ifndef MacCheckMenuItem
736 PyMac_PRECHECK(MacCheckMenuItem
);
738 if (!PyArg_ParseTuple(_args
, "hb",
742 MacCheckMenuItem(_self
->ob_itself
,
750 static PyObject
*MenuObj_SetMenuItemText(MenuObject
*_self
, PyObject
*_args
)
752 PyObject
*_res
= NULL
;
755 #ifndef SetMenuItemText
756 PyMac_PRECHECK(SetMenuItemText
);
758 if (!PyArg_ParseTuple(_args
, "hO&",
760 PyMac_GetStr255
, itemString
))
762 SetMenuItemText(_self
->ob_itself
,
770 static PyObject
*MenuObj_GetMenuItemText(MenuObject
*_self
, PyObject
*_args
)
772 PyObject
*_res
= NULL
;
775 #ifndef GetMenuItemText
776 PyMac_PRECHECK(GetMenuItemText
);
778 if (!PyArg_ParseTuple(_args
, "h",
781 GetMenuItemText(_self
->ob_itself
,
784 _res
= Py_BuildValue("O&",
785 PyMac_BuildStr255
, itemString
);
789 static PyObject
*MenuObj_SetItemMark(MenuObject
*_self
, PyObject
*_args
)
791 PyObject
*_res
= NULL
;
793 CharParameter markChar
;
795 PyMac_PRECHECK(SetItemMark
);
797 if (!PyArg_ParseTuple(_args
, "hh",
801 SetItemMark(_self
->ob_itself
,
809 static PyObject
*MenuObj_GetItemMark(MenuObject
*_self
, PyObject
*_args
)
811 PyObject
*_res
= NULL
;
813 CharParameter markChar
;
815 PyMac_PRECHECK(GetItemMark
);
817 if (!PyArg_ParseTuple(_args
, "h",
820 GetItemMark(_self
->ob_itself
,
823 _res
= Py_BuildValue("h",
828 static PyObject
*MenuObj_SetItemCmd(MenuObject
*_self
, PyObject
*_args
)
830 PyObject
*_res
= NULL
;
832 CharParameter cmdChar
;
834 PyMac_PRECHECK(SetItemCmd
);
836 if (!PyArg_ParseTuple(_args
, "hh",
840 SetItemCmd(_self
->ob_itself
,
848 static PyObject
*MenuObj_GetItemCmd(MenuObject
*_self
, PyObject
*_args
)
850 PyObject
*_res
= NULL
;
852 CharParameter cmdChar
;
854 PyMac_PRECHECK(GetItemCmd
);
856 if (!PyArg_ParseTuple(_args
, "h",
859 GetItemCmd(_self
->ob_itself
,
862 _res
= Py_BuildValue("h",
867 static PyObject
*MenuObj_SetItemIcon(MenuObject
*_self
, PyObject
*_args
)
869 PyObject
*_res
= NULL
;
873 PyMac_PRECHECK(SetItemIcon
);
875 if (!PyArg_ParseTuple(_args
, "hh",
879 SetItemIcon(_self
->ob_itself
,
887 static PyObject
*MenuObj_GetItemIcon(MenuObject
*_self
, PyObject
*_args
)
889 PyObject
*_res
= NULL
;
893 PyMac_PRECHECK(GetItemIcon
);
895 if (!PyArg_ParseTuple(_args
, "h",
898 GetItemIcon(_self
->ob_itself
,
901 _res
= Py_BuildValue("h",
906 static PyObject
*MenuObj_SetItemStyle(MenuObject
*_self
, PyObject
*_args
)
908 PyObject
*_res
= NULL
;
910 StyleParameter chStyle
;
912 PyMac_PRECHECK(SetItemStyle
);
914 if (!PyArg_ParseTuple(_args
, "hh",
918 SetItemStyle(_self
->ob_itself
,
926 static PyObject
*MenuObj_GetItemStyle(MenuObject
*_self
, PyObject
*_args
)
928 PyObject
*_res
= NULL
;
932 PyMac_PRECHECK(GetItemStyle
);
934 if (!PyArg_ParseTuple(_args
, "h",
937 GetItemStyle(_self
->ob_itself
,
940 _res
= Py_BuildValue("b",
945 static PyObject
*MenuObj_SetMenuItemCommandID(MenuObject
*_self
, PyObject
*_args
)
947 PyObject
*_res
= NULL
;
950 MenuCommand inCommandID
;
951 #ifndef SetMenuItemCommandID
952 PyMac_PRECHECK(SetMenuItemCommandID
);
954 if (!PyArg_ParseTuple(_args
, "hl",
958 _err
= SetMenuItemCommandID(_self
->ob_itself
,
961 if (_err
!= noErr
) return PyMac_Error(_err
);
967 static PyObject
*MenuObj_GetMenuItemCommandID(MenuObject
*_self
, PyObject
*_args
)
969 PyObject
*_res
= NULL
;
972 MenuCommand outCommandID
;
973 #ifndef GetMenuItemCommandID
974 PyMac_PRECHECK(GetMenuItemCommandID
);
976 if (!PyArg_ParseTuple(_args
, "h",
979 _err
= GetMenuItemCommandID(_self
->ob_itself
,
982 if (_err
!= noErr
) return PyMac_Error(_err
);
983 _res
= Py_BuildValue("l",
988 static PyObject
*MenuObj_SetMenuItemModifiers(MenuObject
*_self
, PyObject
*_args
)
990 PyObject
*_res
= NULL
;
994 #ifndef SetMenuItemModifiers
995 PyMac_PRECHECK(SetMenuItemModifiers
);
997 if (!PyArg_ParseTuple(_args
, "hb",
1001 _err
= SetMenuItemModifiers(_self
->ob_itself
,
1004 if (_err
!= noErr
) return PyMac_Error(_err
);
1010 static PyObject
*MenuObj_GetMenuItemModifiers(MenuObject
*_self
, PyObject
*_args
)
1012 PyObject
*_res
= NULL
;
1016 #ifndef GetMenuItemModifiers
1017 PyMac_PRECHECK(GetMenuItemModifiers
);
1019 if (!PyArg_ParseTuple(_args
, "h",
1022 _err
= GetMenuItemModifiers(_self
->ob_itself
,
1025 if (_err
!= noErr
) return PyMac_Error(_err
);
1026 _res
= Py_BuildValue("b",
1031 static PyObject
*MenuObj_SetMenuItemIconHandle(MenuObject
*_self
, PyObject
*_args
)
1033 PyObject
*_res
= NULL
;
1037 Handle inIconHandle
;
1038 #ifndef SetMenuItemIconHandle
1039 PyMac_PRECHECK(SetMenuItemIconHandle
);
1041 if (!PyArg_ParseTuple(_args
, "hbO&",
1044 ResObj_Convert
, &inIconHandle
))
1046 _err
= SetMenuItemIconHandle(_self
->ob_itself
,
1050 if (_err
!= noErr
) return PyMac_Error(_err
);
1056 static PyObject
*MenuObj_GetMenuItemIconHandle(MenuObject
*_self
, PyObject
*_args
)
1058 PyObject
*_res
= NULL
;
1062 Handle outIconHandle
;
1063 #ifndef GetMenuItemIconHandle
1064 PyMac_PRECHECK(GetMenuItemIconHandle
);
1066 if (!PyArg_ParseTuple(_args
, "h",
1069 _err
= GetMenuItemIconHandle(_self
->ob_itself
,
1073 if (_err
!= noErr
) return PyMac_Error(_err
);
1074 _res
= Py_BuildValue("bO&",
1076 ResObj_New
, outIconHandle
);
1080 static PyObject
*MenuObj_SetMenuItemTextEncoding(MenuObject
*_self
, PyObject
*_args
)
1082 PyObject
*_res
= NULL
;
1085 TextEncoding inScriptID
;
1086 #ifndef SetMenuItemTextEncoding
1087 PyMac_PRECHECK(SetMenuItemTextEncoding
);
1089 if (!PyArg_ParseTuple(_args
, "hl",
1093 _err
= SetMenuItemTextEncoding(_self
->ob_itself
,
1096 if (_err
!= noErr
) return PyMac_Error(_err
);
1102 static PyObject
*MenuObj_GetMenuItemTextEncoding(MenuObject
*_self
, PyObject
*_args
)
1104 PyObject
*_res
= NULL
;
1107 TextEncoding outScriptID
;
1108 #ifndef GetMenuItemTextEncoding
1109 PyMac_PRECHECK(GetMenuItemTextEncoding
);
1111 if (!PyArg_ParseTuple(_args
, "h",
1114 _err
= GetMenuItemTextEncoding(_self
->ob_itself
,
1117 if (_err
!= noErr
) return PyMac_Error(_err
);
1118 _res
= Py_BuildValue("l",
1123 static PyObject
*MenuObj_SetMenuItemHierarchicalID(MenuObject
*_self
, PyObject
*_args
)
1125 PyObject
*_res
= NULL
;
1129 #ifndef SetMenuItemHierarchicalID
1130 PyMac_PRECHECK(SetMenuItemHierarchicalID
);
1132 if (!PyArg_ParseTuple(_args
, "hh",
1136 _err
= SetMenuItemHierarchicalID(_self
->ob_itself
,
1139 if (_err
!= noErr
) return PyMac_Error(_err
);
1145 static PyObject
*MenuObj_GetMenuItemHierarchicalID(MenuObject
*_self
, PyObject
*_args
)
1147 PyObject
*_res
= NULL
;
1151 #ifndef GetMenuItemHierarchicalID
1152 PyMac_PRECHECK(GetMenuItemHierarchicalID
);
1154 if (!PyArg_ParseTuple(_args
, "h",
1157 _err
= GetMenuItemHierarchicalID(_self
->ob_itself
,
1160 if (_err
!= noErr
) return PyMac_Error(_err
);
1161 _res
= Py_BuildValue("h",
1166 static PyObject
*MenuObj_SetMenuItemFontID(MenuObject
*_self
, PyObject
*_args
)
1168 PyObject
*_res
= NULL
;
1172 #ifndef SetMenuItemFontID
1173 PyMac_PRECHECK(SetMenuItemFontID
);
1175 if (!PyArg_ParseTuple(_args
, "hh",
1179 _err
= SetMenuItemFontID(_self
->ob_itself
,
1182 if (_err
!= noErr
) return PyMac_Error(_err
);
1188 static PyObject
*MenuObj_GetMenuItemFontID(MenuObject
*_self
, PyObject
*_args
)
1190 PyObject
*_res
= NULL
;
1194 #ifndef GetMenuItemFontID
1195 PyMac_PRECHECK(GetMenuItemFontID
);
1197 if (!PyArg_ParseTuple(_args
, "h",
1200 _err
= GetMenuItemFontID(_self
->ob_itself
,
1203 if (_err
!= noErr
) return PyMac_Error(_err
);
1204 _res
= Py_BuildValue("h",
1209 static PyObject
*MenuObj_SetMenuItemRefCon(MenuObject
*_self
, PyObject
*_args
)
1211 PyObject
*_res
= NULL
;
1215 #ifndef SetMenuItemRefCon
1216 PyMac_PRECHECK(SetMenuItemRefCon
);
1218 if (!PyArg_ParseTuple(_args
, "hl",
1222 _err
= SetMenuItemRefCon(_self
->ob_itself
,
1225 if (_err
!= noErr
) return PyMac_Error(_err
);
1231 static PyObject
*MenuObj_GetMenuItemRefCon(MenuObject
*_self
, PyObject
*_args
)
1233 PyObject
*_res
= NULL
;
1237 #ifndef GetMenuItemRefCon
1238 PyMac_PRECHECK(GetMenuItemRefCon
);
1240 if (!PyArg_ParseTuple(_args
, "h",
1243 _err
= GetMenuItemRefCon(_self
->ob_itself
,
1246 if (_err
!= noErr
) return PyMac_Error(_err
);
1247 _res
= Py_BuildValue("l",
1252 static PyObject
*MenuObj_SetMenuItemKeyGlyph(MenuObject
*_self
, PyObject
*_args
)
1254 PyObject
*_res
= NULL
;
1258 #ifndef SetMenuItemKeyGlyph
1259 PyMac_PRECHECK(SetMenuItemKeyGlyph
);
1261 if (!PyArg_ParseTuple(_args
, "hh",
1265 _err
= SetMenuItemKeyGlyph(_self
->ob_itself
,
1268 if (_err
!= noErr
) return PyMac_Error(_err
);
1274 static PyObject
*MenuObj_GetMenuItemKeyGlyph(MenuObject
*_self
, PyObject
*_args
)
1276 PyObject
*_res
= NULL
;
1280 #ifndef GetMenuItemKeyGlyph
1281 PyMac_PRECHECK(GetMenuItemKeyGlyph
);
1283 if (!PyArg_ParseTuple(_args
, "h",
1286 _err
= GetMenuItemKeyGlyph(_self
->ob_itself
,
1289 if (_err
!= noErr
) return PyMac_Error(_err
);
1290 _res
= Py_BuildValue("h",
1295 static PyObject
*MenuObj_MacEnableMenuItem(MenuObject
*_self
, PyObject
*_args
)
1297 PyObject
*_res
= NULL
;
1299 #ifndef MacEnableMenuItem
1300 PyMac_PRECHECK(MacEnableMenuItem
);
1302 if (!PyArg_ParseTuple(_args
, "h",
1305 MacEnableMenuItem(_self
->ob_itself
,
1312 static PyObject
*MenuObj_DisableMenuItem(MenuObject
*_self
, PyObject
*_args
)
1314 PyObject
*_res
= NULL
;
1316 #ifndef DisableMenuItem
1317 PyMac_PRECHECK(DisableMenuItem
);
1319 if (!PyArg_ParseTuple(_args
, "h",
1322 DisableMenuItem(_self
->ob_itself
,
1329 static PyObject
*MenuObj_IsMenuItemEnabled(MenuObject
*_self
, PyObject
*_args
)
1331 PyObject
*_res
= NULL
;
1334 #ifndef IsMenuItemEnabled
1335 PyMac_PRECHECK(IsMenuItemEnabled
);
1337 if (!PyArg_ParseTuple(_args
, "h",
1340 _rv
= IsMenuItemEnabled(_self
->ob_itself
,
1342 _res
= Py_BuildValue("b",
1347 static PyObject
*MenuObj_EnableMenuItemIcon(MenuObject
*_self
, PyObject
*_args
)
1349 PyObject
*_res
= NULL
;
1351 #ifndef EnableMenuItemIcon
1352 PyMac_PRECHECK(EnableMenuItemIcon
);
1354 if (!PyArg_ParseTuple(_args
, "h",
1357 EnableMenuItemIcon(_self
->ob_itself
,
1364 static PyObject
*MenuObj_DisableMenuItemIcon(MenuObject
*_self
, PyObject
*_args
)
1366 PyObject
*_res
= NULL
;
1368 #ifndef DisableMenuItemIcon
1369 PyMac_PRECHECK(DisableMenuItemIcon
);
1371 if (!PyArg_ParseTuple(_args
, "h",
1374 DisableMenuItemIcon(_self
->ob_itself
,
1381 static PyObject
*MenuObj_IsMenuItemIconEnabled(MenuObject
*_self
, PyObject
*_args
)
1383 PyObject
*_res
= NULL
;
1386 #ifndef IsMenuItemIconEnabled
1387 PyMac_PRECHECK(IsMenuItemIconEnabled
);
1389 if (!PyArg_ParseTuple(_args
, "h",
1392 _rv
= IsMenuItemIconEnabled(_self
->ob_itself
,
1394 _res
= Py_BuildValue("b",
1399 static PyObject
*MenuObj_SetMenuItemHierarchicalMenu(MenuObject
*_self
, PyObject
*_args
)
1401 PyObject
*_res
= NULL
;
1403 MenuItemIndex inItem
;
1404 MenuHandle inHierMenu
;
1405 #ifndef SetMenuItemHierarchicalMenu
1406 PyMac_PRECHECK(SetMenuItemHierarchicalMenu
);
1408 if (!PyArg_ParseTuple(_args
, "hO&",
1410 MenuObj_Convert
, &inHierMenu
))
1412 _err
= SetMenuItemHierarchicalMenu(_self
->ob_itself
,
1415 if (_err
!= noErr
) return PyMac_Error(_err
);
1421 static PyObject
*MenuObj_GetMenuItemHierarchicalMenu(MenuObject
*_self
, PyObject
*_args
)
1423 PyObject
*_res
= NULL
;
1425 MenuItemIndex inItem
;
1426 MenuHandle outHierMenu
;
1427 #ifndef GetMenuItemHierarchicalMenu
1428 PyMac_PRECHECK(GetMenuItemHierarchicalMenu
);
1430 if (!PyArg_ParseTuple(_args
, "h",
1433 _err
= GetMenuItemHierarchicalMenu(_self
->ob_itself
,
1436 if (_err
!= noErr
) return PyMac_Error(_err
);
1437 _res
= Py_BuildValue("O&",
1438 OptMenuObj_New
, outHierMenu
);
1442 static PyObject
*MenuObj_CopyMenuItemTextAsCFString(MenuObject
*_self
, PyObject
*_args
)
1444 PyObject
*_res
= NULL
;
1446 MenuItemIndex inItem
;
1447 CFStringRef outString
;
1448 #ifndef CopyMenuItemTextAsCFString
1449 PyMac_PRECHECK(CopyMenuItemTextAsCFString
);
1451 if (!PyArg_ParseTuple(_args
, "h",
1454 _err
= CopyMenuItemTextAsCFString(_self
->ob_itself
,
1457 if (_err
!= noErr
) return PyMac_Error(_err
);
1458 _res
= Py_BuildValue("O&",
1459 CFStringRefObj_New
, outString
);
1463 static PyObject
*MenuObj_SetMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
1465 PyObject
*_res
= NULL
;
1467 MenuItemIndex inItem
;
1468 CFStringRef inString
;
1469 #ifndef SetMenuItemTextWithCFString
1470 PyMac_PRECHECK(SetMenuItemTextWithCFString
);
1472 if (!PyArg_ParseTuple(_args
, "hO&",
1474 CFStringRefObj_Convert
, &inString
))
1476 _err
= SetMenuItemTextWithCFString(_self
->ob_itself
,
1479 if (_err
!= noErr
) return PyMac_Error(_err
);
1485 static PyObject
*MenuObj_GetMenuItemIndent(MenuObject
*_self
, PyObject
*_args
)
1487 PyObject
*_res
= NULL
;
1489 MenuItemIndex inItem
;
1491 #ifndef GetMenuItemIndent
1492 PyMac_PRECHECK(GetMenuItemIndent
);
1494 if (!PyArg_ParseTuple(_args
, "h",
1497 _err
= GetMenuItemIndent(_self
->ob_itself
,
1500 if (_err
!= noErr
) return PyMac_Error(_err
);
1501 _res
= Py_BuildValue("l",
1506 static PyObject
*MenuObj_SetMenuItemIndent(MenuObject
*_self
, PyObject
*_args
)
1508 PyObject
*_res
= NULL
;
1510 MenuItemIndex inItem
;
1512 #ifndef SetMenuItemIndent
1513 PyMac_PRECHECK(SetMenuItemIndent
);
1515 if (!PyArg_ParseTuple(_args
, "hl",
1519 _err
= SetMenuItemIndent(_self
->ob_itself
,
1522 if (_err
!= noErr
) return PyMac_Error(_err
);
1528 static PyObject
*MenuObj_GetMenuItemCommandKey(MenuObject
*_self
, PyObject
*_args
)
1530 PyObject
*_res
= NULL
;
1532 MenuItemIndex inItem
;
1533 Boolean inGetVirtualKey
;
1535 #ifndef GetMenuItemCommandKey
1536 PyMac_PRECHECK(GetMenuItemCommandKey
);
1538 if (!PyArg_ParseTuple(_args
, "hb",
1542 _err
= GetMenuItemCommandKey(_self
->ob_itself
,
1546 if (_err
!= noErr
) return PyMac_Error(_err
);
1547 _res
= Py_BuildValue("H",
1552 static PyObject
*MenuObj_SetMenuItemCommandKey(MenuObject
*_self
, PyObject
*_args
)
1554 PyObject
*_res
= NULL
;
1556 MenuItemIndex inItem
;
1557 Boolean inSetVirtualKey
;
1559 #ifndef SetMenuItemCommandKey
1560 PyMac_PRECHECK(SetMenuItemCommandKey
);
1562 if (!PyArg_ParseTuple(_args
, "hbH",
1567 _err
= SetMenuItemCommandKey(_self
->ob_itself
,
1571 if (_err
!= noErr
) return PyMac_Error(_err
);
1577 static PyObject
*MenuObj_GetMenuItemPropertyAttributes(MenuObject
*_self
, PyObject
*_args
)
1579 PyObject
*_res
= NULL
;
1582 OSType propertyCreator
;
1585 #ifndef GetMenuItemPropertyAttributes
1586 PyMac_PRECHECK(GetMenuItemPropertyAttributes
);
1588 if (!PyArg_ParseTuple(_args
, "hO&O&",
1590 PyMac_GetOSType
, &propertyCreator
,
1591 PyMac_GetOSType
, &propertyTag
))
1593 _err
= GetMenuItemPropertyAttributes(_self
->ob_itself
,
1598 if (_err
!= noErr
) return PyMac_Error(_err
);
1599 _res
= Py_BuildValue("l",
1604 static PyObject
*MenuObj_ChangeMenuItemPropertyAttributes(MenuObject
*_self
, PyObject
*_args
)
1606 PyObject
*_res
= NULL
;
1609 OSType propertyCreator
;
1611 UInt32 attributesToSet
;
1612 UInt32 attributesToClear
;
1613 #ifndef ChangeMenuItemPropertyAttributes
1614 PyMac_PRECHECK(ChangeMenuItemPropertyAttributes
);
1616 if (!PyArg_ParseTuple(_args
, "hO&O&ll",
1618 PyMac_GetOSType
, &propertyCreator
,
1619 PyMac_GetOSType
, &propertyTag
,
1621 &attributesToClear
))
1623 _err
= ChangeMenuItemPropertyAttributes(_self
->ob_itself
,
1629 if (_err
!= noErr
) return PyMac_Error(_err
);
1635 static PyObject
*MenuObj_GetMenuAttributes(MenuObject
*_self
, PyObject
*_args
)
1637 PyObject
*_res
= NULL
;
1639 MenuAttributes outAttributes
;
1640 #ifndef GetMenuAttributes
1641 PyMac_PRECHECK(GetMenuAttributes
);
1643 if (!PyArg_ParseTuple(_args
, ""))
1645 _err
= GetMenuAttributes(_self
->ob_itself
,
1647 if (_err
!= noErr
) return PyMac_Error(_err
);
1648 _res
= Py_BuildValue("l",
1653 static PyObject
*MenuObj_ChangeMenuAttributes(MenuObject
*_self
, PyObject
*_args
)
1655 PyObject
*_res
= NULL
;
1657 MenuAttributes setTheseAttributes
;
1658 MenuAttributes clearTheseAttributes
;
1659 #ifndef ChangeMenuAttributes
1660 PyMac_PRECHECK(ChangeMenuAttributes
);
1662 if (!PyArg_ParseTuple(_args
, "ll",
1663 &setTheseAttributes
,
1664 &clearTheseAttributes
))
1666 _err
= ChangeMenuAttributes(_self
->ob_itself
,
1668 clearTheseAttributes
);
1669 if (_err
!= noErr
) return PyMac_Error(_err
);
1675 static PyObject
*MenuObj_GetMenuItemAttributes(MenuObject
*_self
, PyObject
*_args
)
1677 PyObject
*_res
= NULL
;
1680 MenuItemAttributes outAttributes
;
1681 #ifndef GetMenuItemAttributes
1682 PyMac_PRECHECK(GetMenuItemAttributes
);
1684 if (!PyArg_ParseTuple(_args
, "h",
1687 _err
= GetMenuItemAttributes(_self
->ob_itself
,
1690 if (_err
!= noErr
) return PyMac_Error(_err
);
1691 _res
= Py_BuildValue("l",
1696 static PyObject
*MenuObj_ChangeMenuItemAttributes(MenuObject
*_self
, PyObject
*_args
)
1698 PyObject
*_res
= NULL
;
1701 MenuItemAttributes setTheseAttributes
;
1702 MenuItemAttributes clearTheseAttributes
;
1703 #ifndef ChangeMenuItemAttributes
1704 PyMac_PRECHECK(ChangeMenuItemAttributes
);
1706 if (!PyArg_ParseTuple(_args
, "hll",
1708 &setTheseAttributes
,
1709 &clearTheseAttributes
))
1711 _err
= ChangeMenuItemAttributes(_self
->ob_itself
,
1714 clearTheseAttributes
);
1715 if (_err
!= noErr
) return PyMac_Error(_err
);
1721 static PyObject
*MenuObj_DisableAllMenuItems(MenuObject
*_self
, PyObject
*_args
)
1723 PyObject
*_res
= NULL
;
1724 #ifndef DisableAllMenuItems
1725 PyMac_PRECHECK(DisableAllMenuItems
);
1727 if (!PyArg_ParseTuple(_args
, ""))
1729 DisableAllMenuItems(_self
->ob_itself
);
1735 static PyObject
*MenuObj_EnableAllMenuItems(MenuObject
*_self
, PyObject
*_args
)
1737 PyObject
*_res
= NULL
;
1738 #ifndef EnableAllMenuItems
1739 PyMac_PRECHECK(EnableAllMenuItems
);
1741 if (!PyArg_ParseTuple(_args
, ""))
1743 EnableAllMenuItems(_self
->ob_itself
);
1749 static PyObject
*MenuObj_MenuHasEnabledItems(MenuObject
*_self
, PyObject
*_args
)
1751 PyObject
*_res
= NULL
;
1753 #ifndef MenuHasEnabledItems
1754 PyMac_PRECHECK(MenuHasEnabledItems
);
1756 if (!PyArg_ParseTuple(_args
, ""))
1758 _rv
= MenuHasEnabledItems(_self
->ob_itself
);
1759 _res
= Py_BuildValue("b",
1764 static PyObject
*MenuObj_GetMenuType(MenuObject
*_self
, PyObject
*_args
)
1766 PyObject
*_res
= NULL
;
1770 PyMac_PRECHECK(GetMenuType
);
1772 if (!PyArg_ParseTuple(_args
, ""))
1774 _err
= GetMenuType(_self
->ob_itself
,
1776 if (_err
!= noErr
) return PyMac_Error(_err
);
1777 _res
= Py_BuildValue("H",
1782 static PyObject
*MenuObj_CountMenuItemsWithCommandID(MenuObject
*_self
, PyObject
*_args
)
1784 PyObject
*_res
= NULL
;
1786 MenuCommand inCommandID
;
1787 #ifndef CountMenuItemsWithCommandID
1788 PyMac_PRECHECK(CountMenuItemsWithCommandID
);
1790 if (!PyArg_ParseTuple(_args
, "l",
1793 _rv
= CountMenuItemsWithCommandID(_self
->ob_itself
,
1795 _res
= Py_BuildValue("l",
1800 static PyObject
*MenuObj_GetIndMenuItemWithCommandID(MenuObject
*_self
, PyObject
*_args
)
1802 PyObject
*_res
= NULL
;
1804 MenuCommand inCommandID
;
1807 MenuItemIndex outIndex
;
1808 #ifndef GetIndMenuItemWithCommandID
1809 PyMac_PRECHECK(GetIndMenuItemWithCommandID
);
1811 if (!PyArg_ParseTuple(_args
, "ll",
1815 _err
= GetIndMenuItemWithCommandID(_self
->ob_itself
,
1820 if (_err
!= noErr
) return PyMac_Error(_err
);
1821 _res
= Py_BuildValue("O&h",
1822 MenuObj_New
, outMenu
,
1827 static PyObject
*MenuObj_EnableMenuCommand(MenuObject
*_self
, PyObject
*_args
)
1829 PyObject
*_res
= NULL
;
1830 MenuCommand inCommandID
;
1831 #ifndef EnableMenuCommand
1832 PyMac_PRECHECK(EnableMenuCommand
);
1834 if (!PyArg_ParseTuple(_args
, "l",
1837 EnableMenuCommand(_self
->ob_itself
,
1844 static PyObject
*MenuObj_DisableMenuCommand(MenuObject
*_self
, PyObject
*_args
)
1846 PyObject
*_res
= NULL
;
1847 MenuCommand inCommandID
;
1848 #ifndef DisableMenuCommand
1849 PyMac_PRECHECK(DisableMenuCommand
);
1851 if (!PyArg_ParseTuple(_args
, "l",
1854 DisableMenuCommand(_self
->ob_itself
,
1861 static PyObject
*MenuObj_IsMenuCommandEnabled(MenuObject
*_self
, PyObject
*_args
)
1863 PyObject
*_res
= NULL
;
1865 MenuCommand inCommandID
;
1866 #ifndef IsMenuCommandEnabled
1867 PyMac_PRECHECK(IsMenuCommandEnabled
);
1869 if (!PyArg_ParseTuple(_args
, "l",
1872 _rv
= IsMenuCommandEnabled(_self
->ob_itself
,
1874 _res
= Py_BuildValue("b",
1879 static PyObject
*MenuObj_SetMenuCommandMark(MenuObject
*_self
, PyObject
*_args
)
1881 PyObject
*_res
= NULL
;
1883 MenuCommand inCommandID
;
1885 #ifndef SetMenuCommandMark
1886 PyMac_PRECHECK(SetMenuCommandMark
);
1888 if (!PyArg_ParseTuple(_args
, "lh",
1892 _err
= SetMenuCommandMark(_self
->ob_itself
,
1895 if (_err
!= noErr
) return PyMac_Error(_err
);
1901 static PyObject
*MenuObj_GetMenuCommandMark(MenuObject
*_self
, PyObject
*_args
)
1903 PyObject
*_res
= NULL
;
1905 MenuCommand inCommandID
;
1907 #ifndef GetMenuCommandMark
1908 PyMac_PRECHECK(GetMenuCommandMark
);
1910 if (!PyArg_ParseTuple(_args
, "l",
1913 _err
= GetMenuCommandMark(_self
->ob_itself
,
1916 if (_err
!= noErr
) return PyMac_Error(_err
);
1917 _res
= Py_BuildValue("h",
1922 static PyObject
*MenuObj_GetMenuCommandPropertySize(MenuObject
*_self
, PyObject
*_args
)
1924 PyObject
*_res
= NULL
;
1926 MenuCommand inCommandID
;
1927 OSType inPropertyCreator
;
1928 OSType inPropertyTag
;
1930 #ifndef GetMenuCommandPropertySize
1931 PyMac_PRECHECK(GetMenuCommandPropertySize
);
1933 if (!PyArg_ParseTuple(_args
, "lO&O&",
1935 PyMac_GetOSType
, &inPropertyCreator
,
1936 PyMac_GetOSType
, &inPropertyTag
))
1938 _err
= GetMenuCommandPropertySize(_self
->ob_itself
,
1943 if (_err
!= noErr
) return PyMac_Error(_err
);
1944 _res
= Py_BuildValue("l",
1949 static PyObject
*MenuObj_RemoveMenuCommandProperty(MenuObject
*_self
, PyObject
*_args
)
1951 PyObject
*_res
= NULL
;
1953 MenuCommand inCommandID
;
1954 OSType inPropertyCreator
;
1955 OSType inPropertyTag
;
1956 #ifndef RemoveMenuCommandProperty
1957 PyMac_PRECHECK(RemoveMenuCommandProperty
);
1959 if (!PyArg_ParseTuple(_args
, "lO&O&",
1961 PyMac_GetOSType
, &inPropertyCreator
,
1962 PyMac_GetOSType
, &inPropertyTag
))
1964 _err
= RemoveMenuCommandProperty(_self
->ob_itself
,
1968 if (_err
!= noErr
) return PyMac_Error(_err
);
1974 static PyObject
*MenuObj_IsMenuItemInvalid(MenuObject
*_self
, PyObject
*_args
)
1976 PyObject
*_res
= NULL
;
1978 MenuItemIndex inItem
;
1979 #ifndef IsMenuItemInvalid
1980 PyMac_PRECHECK(IsMenuItemInvalid
);
1982 if (!PyArg_ParseTuple(_args
, "h",
1985 _rv
= IsMenuItemInvalid(_self
->ob_itself
,
1987 _res
= Py_BuildValue("b",
1992 static PyObject
*MenuObj_InvalidateMenuItems(MenuObject
*_self
, PyObject
*_args
)
1994 PyObject
*_res
= NULL
;
1996 MenuItemIndex inFirstItem
;
1997 ItemCount inNumItems
;
1998 #ifndef InvalidateMenuItems
1999 PyMac_PRECHECK(InvalidateMenuItems
);
2001 if (!PyArg_ParseTuple(_args
, "hl",
2005 _err
= InvalidateMenuItems(_self
->ob_itself
,
2008 if (_err
!= noErr
) return PyMac_Error(_err
);
2014 static PyObject
*MenuObj_UpdateInvalidMenuItems(MenuObject
*_self
, PyObject
*_args
)
2016 PyObject
*_res
= NULL
;
2018 #ifndef UpdateInvalidMenuItems
2019 PyMac_PRECHECK(UpdateInvalidMenuItems
);
2021 if (!PyArg_ParseTuple(_args
, ""))
2023 _err
= UpdateInvalidMenuItems(_self
->ob_itself
);
2024 if (_err
!= noErr
) return PyMac_Error(_err
);
2030 static PyObject
*MenuObj_CreateStandardFontMenu(MenuObject
*_self
, PyObject
*_args
)
2032 PyObject
*_res
= NULL
;
2034 MenuItemIndex afterItem
;
2035 MenuID firstHierMenuID
;
2037 ItemCount outHierMenuCount
;
2038 #ifndef CreateStandardFontMenu
2039 PyMac_PRECHECK(CreateStandardFontMenu
);
2041 if (!PyArg_ParseTuple(_args
, "hhl",
2046 _err
= CreateStandardFontMenu(_self
->ob_itself
,
2051 if (_err
!= noErr
) return PyMac_Error(_err
);
2052 _res
= Py_BuildValue("l",
2057 static PyObject
*MenuObj_UpdateStandardFontMenu(MenuObject
*_self
, PyObject
*_args
)
2059 PyObject
*_res
= NULL
;
2061 ItemCount outHierMenuCount
;
2062 #ifndef UpdateStandardFontMenu
2063 PyMac_PRECHECK(UpdateStandardFontMenu
);
2065 if (!PyArg_ParseTuple(_args
, ""))
2067 _err
= UpdateStandardFontMenu(_self
->ob_itself
,
2069 if (_err
!= noErr
) return PyMac_Error(_err
);
2070 _res
= Py_BuildValue("l",
2075 static PyObject
*MenuObj_GetFontFamilyFromMenuSelection(MenuObject
*_self
, PyObject
*_args
)
2077 PyObject
*_res
= NULL
;
2080 FMFontFamily outFontFamily
;
2081 FMFontStyle outStyle
;
2082 #ifndef GetFontFamilyFromMenuSelection
2083 PyMac_PRECHECK(GetFontFamilyFromMenuSelection
);
2085 if (!PyArg_ParseTuple(_args
, "h",
2088 _err
= GetFontFamilyFromMenuSelection(_self
->ob_itself
,
2092 if (_err
!= noErr
) return PyMac_Error(_err
);
2093 _res
= Py_BuildValue("hh",
2099 static PyObject
*MenuObj_GetMenuID(MenuObject
*_self
, PyObject
*_args
)
2101 PyObject
*_res
= NULL
;
2104 PyMac_PRECHECK(GetMenuID
);
2106 if (!PyArg_ParseTuple(_args
, ""))
2108 _rv
= GetMenuID(_self
->ob_itself
);
2109 _res
= Py_BuildValue("h",
2114 static PyObject
*MenuObj_GetMenuWidth(MenuObject
*_self
, PyObject
*_args
)
2116 PyObject
*_res
= NULL
;
2118 #ifndef GetMenuWidth
2119 PyMac_PRECHECK(GetMenuWidth
);
2121 if (!PyArg_ParseTuple(_args
, ""))
2123 _rv
= GetMenuWidth(_self
->ob_itself
);
2124 _res
= Py_BuildValue("h",
2129 static PyObject
*MenuObj_GetMenuHeight(MenuObject
*_self
, PyObject
*_args
)
2131 PyObject
*_res
= NULL
;
2133 #ifndef GetMenuHeight
2134 PyMac_PRECHECK(GetMenuHeight
);
2136 if (!PyArg_ParseTuple(_args
, ""))
2138 _rv
= GetMenuHeight(_self
->ob_itself
);
2139 _res
= Py_BuildValue("h",
2144 static PyObject
*MenuObj_SetMenuID(MenuObject
*_self
, PyObject
*_args
)
2146 PyObject
*_res
= NULL
;
2149 PyMac_PRECHECK(SetMenuID
);
2151 if (!PyArg_ParseTuple(_args
, "h",
2154 SetMenuID(_self
->ob_itself
,
2161 static PyObject
*MenuObj_SetMenuWidth(MenuObject
*_self
, PyObject
*_args
)
2163 PyObject
*_res
= NULL
;
2165 #ifndef SetMenuWidth
2166 PyMac_PRECHECK(SetMenuWidth
);
2168 if (!PyArg_ParseTuple(_args
, "h",
2171 SetMenuWidth(_self
->ob_itself
,
2178 static PyObject
*MenuObj_SetMenuHeight(MenuObject
*_self
, PyObject
*_args
)
2180 PyObject
*_res
= NULL
;
2182 #ifndef SetMenuHeight
2183 PyMac_PRECHECK(SetMenuHeight
);
2185 if (!PyArg_ParseTuple(_args
, "h",
2188 SetMenuHeight(_self
->ob_itself
,
2195 static PyObject
*MenuObj_as_Resource(MenuObject
*_self
, PyObject
*_args
)
2197 PyObject
*_res
= NULL
;
2200 PyMac_PRECHECK(as_Resource
);
2202 if (!PyArg_ParseTuple(_args
, ""))
2204 _rv
= as_Resource(_self
->ob_itself
);
2205 _res
= Py_BuildValue("O&",
2210 static PyObject
*MenuObj_AppendMenu(MenuObject
*_self
, PyObject
*_args
)
2212 PyObject
*_res
= NULL
;
2215 PyMac_PRECHECK(AppendMenu
);
2217 if (!PyArg_ParseTuple(_args
, "O&",
2218 PyMac_GetStr255
, data
))
2220 AppendMenu(_self
->ob_itself
,
2227 static PyObject
*MenuObj_InsertMenu(MenuObject
*_self
, PyObject
*_args
)
2229 PyObject
*_res
= NULL
;
2232 PyMac_PRECHECK(InsertMenu
);
2234 if (!PyArg_ParseTuple(_args
, "h",
2237 InsertMenu(_self
->ob_itself
,
2244 static PyObject
*MenuObj_InsertMenuItem(MenuObject
*_self
, PyObject
*_args
)
2246 PyObject
*_res
= NULL
;
2249 #ifndef InsertMenuItem
2250 PyMac_PRECHECK(InsertMenuItem
);
2252 if (!PyArg_ParseTuple(_args
, "O&h",
2253 PyMac_GetStr255
, itemString
,
2256 InsertMenuItem(_self
->ob_itself
,
2264 static PyObject
*MenuObj_EnableMenuItem(MenuObject
*_self
, PyObject
*_args
)
2266 PyObject
*_res
= NULL
;
2268 #ifndef EnableMenuItem
2269 PyMac_PRECHECK(EnableMenuItem
);
2271 if (!PyArg_ParseTuple(_args
, "H",
2274 EnableMenuItem(_self
->ob_itself
,
2281 static PyObject
*MenuObj_CheckMenuItem(MenuObject
*_self
, PyObject
*_args
)
2283 PyObject
*_res
= NULL
;
2286 #ifndef CheckMenuItem
2287 PyMac_PRECHECK(CheckMenuItem
);
2289 if (!PyArg_ParseTuple(_args
, "hb",
2293 CheckMenuItem(_self
->ob_itself
,
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")},
2529 #define MenuObj_getsetlist NULL
2532 #define MenuObj_compare NULL
2534 #define MenuObj_repr NULL
2536 #define MenuObj_hash NULL
2537 #define MenuObj_tp_init 0
2539 #define MenuObj_tp_alloc PyType_GenericAlloc
2541 static PyObject
*MenuObj_tp_new(PyTypeObject
*type
, PyObject
*_args
, PyObject
*_kwds
)
2545 char *kw
[] = {"itself", 0};
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
;
2553 #define MenuObj_tp_free PyObject_Del
2556 PyTypeObject Menu_Type
= {
2557 PyObject_HEAD_INIT(NULL
)
2559 "_Menu.Menu", /*tp_name*/
2560 sizeof(MenuObject
), /*tp_basicsize*/
2563 (destructor
) MenuObj_dealloc
, /*tp_dealloc*/
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*/
2575 PyObject_GenericGetAttr
, /*tp_getattro*/
2576 PyObject_GenericSetAttr
, /*tp_setattro */
2578 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
2582 0, /*tp_richcompare*/
2583 0, /*tp_weaklistoffset*/
2586 MenuObj_methods
, /* tp_methods */
2588 MenuObj_getsetlist
, /*tp_getset*/
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 */
2600 /* ---------------------- End object type Menu ---------------------- */
2603 static PyObject
*Menu_NewMenu(PyObject
*_self
, PyObject
*_args
)
2605 PyObject
*_res
= NULL
;
2610 PyMac_PRECHECK(NewMenu
);
2612 if (!PyArg_ParseTuple(_args
, "hO&",
2614 PyMac_GetStr255
, menuTitle
))
2616 _rv
= NewMenu(menuID
,
2618 _res
= Py_BuildValue("O&",
2623 static PyObject
*Menu_MacGetMenu(PyObject
*_self
, PyObject
*_args
)
2625 PyObject
*_res
= NULL
;
2629 PyMac_PRECHECK(MacGetMenu
);
2631 if (!PyArg_ParseTuple(_args
, "h",
2634 _rv
= MacGetMenu(resourceID
);
2635 _res
= Py_BuildValue("O&",
2640 static PyObject
*Menu_CreateNewMenu(PyObject
*_self
, PyObject
*_args
)
2642 PyObject
*_res
= NULL
;
2645 MenuAttributes inMenuAttributes
;
2646 MenuHandle outMenuRef
;
2647 #ifndef CreateNewMenu
2648 PyMac_PRECHECK(CreateNewMenu
);
2650 if (!PyArg_ParseTuple(_args
, "hl",
2654 _err
= CreateNewMenu(inMenuID
,
2657 if (_err
!= noErr
) return PyMac_Error(_err
);
2658 _res
= Py_BuildValue("O&",
2659 MenuObj_New
, outMenuRef
);
2663 static PyObject
*Menu_MenuKey(PyObject
*_self
, PyObject
*_args
)
2665 PyObject
*_res
= NULL
;
2669 PyMac_PRECHECK(MenuKey
);
2671 if (!PyArg_ParseTuple(_args
, "h",
2675 _res
= Py_BuildValue("l",
2680 static PyObject
*Menu_MenuSelect(PyObject
*_self
, PyObject
*_args
)
2682 PyObject
*_res
= NULL
;
2686 PyMac_PRECHECK(MenuSelect
);
2688 if (!PyArg_ParseTuple(_args
, "O&",
2689 PyMac_GetPoint
, &startPt
))
2691 _rv
= MenuSelect(startPt
);
2692 _res
= Py_BuildValue("l",
2697 static PyObject
*Menu_MenuChoice(PyObject
*_self
, PyObject
*_args
)
2699 PyObject
*_res
= NULL
;
2702 PyMac_PRECHECK(MenuChoice
);
2704 if (!PyArg_ParseTuple(_args
, ""))
2707 _res
= Py_BuildValue("l",
2712 static PyObject
*Menu_MenuEvent(PyObject
*_self
, PyObject
*_args
)
2714 PyObject
*_res
= NULL
;
2716 EventRecord inEvent
;
2718 PyMac_PRECHECK(MenuEvent
);
2720 if (!PyArg_ParseTuple(_args
, "O&",
2721 PyMac_GetEventRecord
, &inEvent
))
2723 _rv
= MenuEvent(&inEvent
);
2724 _res
= Py_BuildValue("l",
2729 static PyObject
*Menu_GetMBarHeight(PyObject
*_self
, PyObject
*_args
)
2731 PyObject
*_res
= NULL
;
2733 #ifndef GetMBarHeight
2734 PyMac_PRECHECK(GetMBarHeight
);
2736 if (!PyArg_ParseTuple(_args
, ""))
2738 _rv
= GetMBarHeight();
2739 _res
= Py_BuildValue("h",
2744 static PyObject
*Menu_MacDrawMenuBar(PyObject
*_self
, PyObject
*_args
)
2746 PyObject
*_res
= NULL
;
2747 #ifndef MacDrawMenuBar
2748 PyMac_PRECHECK(MacDrawMenuBar
);
2750 if (!PyArg_ParseTuple(_args
, ""))
2758 static PyObject
*Menu_InvalMenuBar(PyObject
*_self
, PyObject
*_args
)
2760 PyObject
*_res
= NULL
;
2761 #ifndef InvalMenuBar
2762 PyMac_PRECHECK(InvalMenuBar
);
2764 if (!PyArg_ParseTuple(_args
, ""))
2772 static PyObject
*Menu_HiliteMenu(PyObject
*_self
, PyObject
*_args
)
2774 PyObject
*_res
= NULL
;
2777 PyMac_PRECHECK(HiliteMenu
);
2779 if (!PyArg_ParseTuple(_args
, "h",
2788 static PyObject
*Menu_GetNewMBar(PyObject
*_self
, PyObject
*_args
)
2790 PyObject
*_res
= NULL
;
2794 PyMac_PRECHECK(GetNewMBar
);
2796 if (!PyArg_ParseTuple(_args
, "h",
2799 _rv
= GetNewMBar(menuBarID
);
2800 _res
= Py_BuildValue("O&",
2805 static PyObject
*Menu_GetMenuBar(PyObject
*_self
, PyObject
*_args
)
2807 PyObject
*_res
= NULL
;
2810 PyMac_PRECHECK(GetMenuBar
);
2812 if (!PyArg_ParseTuple(_args
, ""))
2815 _res
= Py_BuildValue("O&",
2820 static PyObject
*Menu_SetMenuBar(PyObject
*_self
, PyObject
*_args
)
2822 PyObject
*_res
= NULL
;
2825 PyMac_PRECHECK(SetMenuBar
);
2827 if (!PyArg_ParseTuple(_args
, "O&",
2828 ResObj_Convert
, &mbar
))
2836 static PyObject
*Menu_DuplicateMenuBar(PyObject
*_self
, PyObject
*_args
)
2838 PyObject
*_res
= NULL
;
2840 MenuBarHandle inMbar
;
2841 MenuBarHandle outMbar
;
2842 #ifndef DuplicateMenuBar
2843 PyMac_PRECHECK(DuplicateMenuBar
);
2845 if (!PyArg_ParseTuple(_args
, "O&",
2846 ResObj_Convert
, &inMbar
))
2848 _err
= DuplicateMenuBar(inMbar
,
2850 if (_err
!= noErr
) return PyMac_Error(_err
);
2851 _res
= Py_BuildValue("O&",
2852 ResObj_New
, outMbar
);
2856 static PyObject
*Menu_DisposeMenuBar(PyObject
*_self
, PyObject
*_args
)
2858 PyObject
*_res
= NULL
;
2860 MenuBarHandle inMbar
;
2861 #ifndef DisposeMenuBar
2862 PyMac_PRECHECK(DisposeMenuBar
);
2864 if (!PyArg_ParseTuple(_args
, "O&",
2865 ResObj_Convert
, &inMbar
))
2867 _err
= DisposeMenuBar(inMbar
);
2868 if (_err
!= noErr
) return PyMac_Error(_err
);
2874 static PyObject
*Menu_GetMenuHandle(PyObject
*_self
, PyObject
*_args
)
2876 PyObject
*_res
= NULL
;
2879 #ifndef GetMenuHandle
2880 PyMac_PRECHECK(GetMenuHandle
);
2882 if (!PyArg_ParseTuple(_args
, "h",
2885 _rv
= GetMenuHandle(menuID
);
2886 _res
= Py_BuildValue("O&",
2891 static PyObject
*Menu_MacDeleteMenu(PyObject
*_self
, PyObject
*_args
)
2893 PyObject
*_res
= NULL
;
2895 #ifndef MacDeleteMenu
2896 PyMac_PRECHECK(MacDeleteMenu
);
2898 if (!PyArg_ParseTuple(_args
, "h",
2901 MacDeleteMenu(menuID
);
2907 static PyObject
*Menu_ClearMenuBar(PyObject
*_self
, PyObject
*_args
)
2909 PyObject
*_res
= NULL
;
2910 #ifndef ClearMenuBar
2911 PyMac_PRECHECK(ClearMenuBar
);
2913 if (!PyArg_ParseTuple(_args
, ""))
2921 static PyObject
*Menu_SetMenuFlashCount(PyObject
*_self
, PyObject
*_args
)
2923 PyObject
*_res
= NULL
;
2925 #ifndef SetMenuFlashCount
2926 PyMac_PRECHECK(SetMenuFlashCount
);
2928 if (!PyArg_ParseTuple(_args
, "h",
2931 SetMenuFlashCount(count
);
2937 static PyObject
*Menu_FlashMenuBar(PyObject
*_self
, PyObject
*_args
)
2939 PyObject
*_res
= NULL
;
2941 #ifndef FlashMenuBar
2942 PyMac_PRECHECK(FlashMenuBar
);
2944 if (!PyArg_ParseTuple(_args
, "h",
2947 FlashMenuBar(menuID
);
2953 static PyObject
*Menu_IsMenuBarVisible(PyObject
*_self
, PyObject
*_args
)
2955 PyObject
*_res
= NULL
;
2957 #ifndef IsMenuBarVisible
2958 PyMac_PRECHECK(IsMenuBarVisible
);
2960 if (!PyArg_ParseTuple(_args
, ""))
2962 _rv
= IsMenuBarVisible();
2963 _res
= Py_BuildValue("b",
2968 static PyObject
*Menu_ShowMenuBar(PyObject
*_self
, PyObject
*_args
)
2970 PyObject
*_res
= NULL
;
2972 PyMac_PRECHECK(ShowMenuBar
);
2974 if (!PyArg_ParseTuple(_args
, ""))
2982 static PyObject
*Menu_HideMenuBar(PyObject
*_self
, PyObject
*_args
)
2984 PyObject
*_res
= NULL
;
2986 PyMac_PRECHECK(HideMenuBar
);
2988 if (!PyArg_ParseTuple(_args
, ""))
2996 static PyObject
*Menu_AcquireRootMenu(PyObject
*_self
, PyObject
*_args
)
2998 PyObject
*_res
= NULL
;
3000 #ifndef AcquireRootMenu
3001 PyMac_PRECHECK(AcquireRootMenu
);
3003 if (!PyArg_ParseTuple(_args
, ""))
3005 _rv
= AcquireRootMenu();
3006 _res
= Py_BuildValue("O&",
3011 static PyObject
*Menu_DeleteMCEntries(PyObject
*_self
, PyObject
*_args
)
3013 PyObject
*_res
= NULL
;
3016 #ifndef DeleteMCEntries
3017 PyMac_PRECHECK(DeleteMCEntries
);
3019 if (!PyArg_ParseTuple(_args
, "hh",
3023 DeleteMCEntries(menuID
,
3030 static PyObject
*Menu_InitContextualMenus(PyObject
*_self
, PyObject
*_args
)
3032 PyObject
*_res
= NULL
;
3034 #ifndef InitContextualMenus
3035 PyMac_PRECHECK(InitContextualMenus
);
3037 if (!PyArg_ParseTuple(_args
, ""))
3039 _err
= InitContextualMenus();
3040 if (_err
!= noErr
) return PyMac_Error(_err
);
3046 static PyObject
*Menu_IsShowContextualMenuClick(PyObject
*_self
, PyObject
*_args
)
3048 PyObject
*_res
= NULL
;
3050 EventRecord inEvent
;
3051 #ifndef IsShowContextualMenuClick
3052 PyMac_PRECHECK(IsShowContextualMenuClick
);
3054 if (!PyArg_ParseTuple(_args
, "O&",
3055 PyMac_GetEventRecord
, &inEvent
))
3057 _rv
= IsShowContextualMenuClick(&inEvent
);
3058 _res
= Py_BuildValue("b",
3063 static PyObject
*Menu_LMGetTheMenu(PyObject
*_self
, PyObject
*_args
)
3065 PyObject
*_res
= NULL
;
3067 #ifndef LMGetTheMenu
3068 PyMac_PRECHECK(LMGetTheMenu
);
3070 if (!PyArg_ParseTuple(_args
, ""))
3072 _rv
= LMGetTheMenu();
3073 _res
= Py_BuildValue("h",
3078 static PyObject
*Menu_as_Menu(PyObject
*_self
, PyObject
*_args
)
3080 PyObject
*_res
= NULL
;
3084 PyMac_PRECHECK(as_Menu
);
3086 if (!PyArg_ParseTuple(_args
, "O&",
3087 ResObj_Convert
, &h
))
3090 _res
= Py_BuildValue("O&",
3095 static PyObject
*Menu_GetMenu(PyObject
*_self
, PyObject
*_args
)
3097 PyObject
*_res
= NULL
;
3101 PyMac_PRECHECK(GetMenu
);
3103 if (!PyArg_ParseTuple(_args
, "h",
3106 _rv
= GetMenu(resourceID
);
3107 _res
= Py_BuildValue("O&",
3112 static PyObject
*Menu_DeleteMenu(PyObject
*_self
, PyObject
*_args
)
3114 PyObject
*_res
= NULL
;
3117 PyMac_PRECHECK(DeleteMenu
);
3119 if (!PyArg_ParseTuple(_args
, "h",
3128 static PyObject
*Menu_DrawMenuBar(PyObject
*_self
, PyObject
*_args
)
3130 PyObject
*_res
= NULL
;
3132 PyMac_PRECHECK(DrawMenuBar
);
3134 if (!PyArg_ParseTuple(_args
, ""))
3142 static PyObject
*Menu_CountMenuItemsWithCommandID(PyObject
*_self
, PyObject
*_args
)
3144 PyObject
*_res
= NULL
;
3147 MenuCommand inCommandID
;
3148 #ifndef CountMenuItemsWithCommandID
3149 PyMac_PRECHECK(CountMenuItemsWithCommandID
);
3151 if (!PyArg_ParseTuple(_args
, "O&l",
3152 OptMenuObj_Convert
, &inMenu
,
3155 _rv
= CountMenuItemsWithCommandID(inMenu
,
3157 _res
= Py_BuildValue("l",
3162 static PyObject
*Menu_GetIndMenuItemWithCommandID(PyObject
*_self
, PyObject
*_args
)
3164 PyObject
*_res
= NULL
;
3167 MenuCommand inCommandID
;
3170 MenuItemIndex outIndex
;
3171 #ifndef GetIndMenuItemWithCommandID
3172 PyMac_PRECHECK(GetIndMenuItemWithCommandID
);
3174 if (!PyArg_ParseTuple(_args
, "O&ll",
3175 OptMenuObj_Convert
, &inMenu
,
3179 _err
= GetIndMenuItemWithCommandID(inMenu
,
3184 if (_err
!= noErr
) return PyMac_Error(_err
);
3185 _res
= Py_BuildValue("O&h",
3186 MenuObj_New
, outMenu
,
3191 static PyObject
*Menu_EnableMenuCommand(PyObject
*_self
, PyObject
*_args
)
3193 PyObject
*_res
= NULL
;
3195 MenuCommand inCommandID
;
3196 #ifndef EnableMenuCommand
3197 PyMac_PRECHECK(EnableMenuCommand
);
3199 if (!PyArg_ParseTuple(_args
, "O&l",
3200 OptMenuObj_Convert
, &inMenu
,
3203 EnableMenuCommand(inMenu
,
3210 static PyObject
*Menu_DisableMenuCommand(PyObject
*_self
, PyObject
*_args
)
3212 PyObject
*_res
= NULL
;
3214 MenuCommand inCommandID
;
3215 #ifndef DisableMenuCommand
3216 PyMac_PRECHECK(DisableMenuCommand
);
3218 if (!PyArg_ParseTuple(_args
, "O&l",
3219 OptMenuObj_Convert
, &inMenu
,
3222 DisableMenuCommand(inMenu
,
3229 static PyObject
*Menu_IsMenuCommandEnabled(PyObject
*_self
, PyObject
*_args
)
3231 PyObject
*_res
= NULL
;
3234 MenuCommand inCommandID
;
3235 #ifndef IsMenuCommandEnabled
3236 PyMac_PRECHECK(IsMenuCommandEnabled
);
3238 if (!PyArg_ParseTuple(_args
, "O&l",
3239 OptMenuObj_Convert
, &inMenu
,
3242 _rv
= IsMenuCommandEnabled(inMenu
,
3244 _res
= Py_BuildValue("b",
3249 static PyObject
*Menu_SetMenuCommandMark(PyObject
*_self
, PyObject
*_args
)
3251 PyObject
*_res
= NULL
;
3254 MenuCommand inCommandID
;
3256 #ifndef SetMenuCommandMark
3257 PyMac_PRECHECK(SetMenuCommandMark
);
3259 if (!PyArg_ParseTuple(_args
, "O&lh",
3260 OptMenuObj_Convert
, &inMenu
,
3264 _err
= SetMenuCommandMark(inMenu
,
3267 if (_err
!= noErr
) return PyMac_Error(_err
);
3273 static PyObject
*Menu_GetMenuCommandMark(PyObject
*_self
, PyObject
*_args
)
3275 PyObject
*_res
= NULL
;
3278 MenuCommand inCommandID
;
3280 #ifndef GetMenuCommandMark
3281 PyMac_PRECHECK(GetMenuCommandMark
);
3283 if (!PyArg_ParseTuple(_args
, "O&l",
3284 OptMenuObj_Convert
, &inMenu
,
3287 _err
= GetMenuCommandMark(inMenu
,
3290 if (_err
!= noErr
) return PyMac_Error(_err
);
3291 _res
= Py_BuildValue("h",
3296 static PyObject
*Menu_GetMenuCommandPropertySize(PyObject
*_self
, PyObject
*_args
)
3298 PyObject
*_res
= NULL
;
3301 MenuCommand inCommandID
;
3302 OSType inPropertyCreator
;
3303 OSType inPropertyTag
;
3305 #ifndef GetMenuCommandPropertySize
3306 PyMac_PRECHECK(GetMenuCommandPropertySize
);
3308 if (!PyArg_ParseTuple(_args
, "O&lO&O&",
3309 OptMenuObj_Convert
, &inMenu
,
3311 PyMac_GetOSType
, &inPropertyCreator
,
3312 PyMac_GetOSType
, &inPropertyTag
))
3314 _err
= GetMenuCommandPropertySize(inMenu
,
3319 if (_err
!= noErr
) return PyMac_Error(_err
);
3320 _res
= Py_BuildValue("l",
3325 static PyObject
*Menu_RemoveMenuCommandProperty(PyObject
*_self
, PyObject
*_args
)
3327 PyObject
*_res
= NULL
;
3330 MenuCommand inCommandID
;
3331 OSType inPropertyCreator
;
3332 OSType inPropertyTag
;
3333 #ifndef RemoveMenuCommandProperty
3334 PyMac_PRECHECK(RemoveMenuCommandProperty
);
3336 if (!PyArg_ParseTuple(_args
, "O&lO&O&",
3337 OptMenuObj_Convert
, &inMenu
,
3339 PyMac_GetOSType
, &inPropertyCreator
,
3340 PyMac_GetOSType
, &inPropertyTag
))
3342 _err
= RemoveMenuCommandProperty(inMenu
,
3346 if (_err
!= noErr
) return PyMac_Error(_err
);
3351 #endif /* __LP64__ */
3353 static PyMethodDef Menu_methods
[] = {
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__ */
3446 void init_Menu(void)
3454 PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle
, MenuObj_New
);
3455 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle
, MenuObj_Convert
);
3456 #endif /* __LP64__ */
3459 m
= Py_InitModule("_Menu", Menu_methods
);
3461 d
= PyModule_GetDict(m
);
3462 Menu_Error
= PyMac_GetOSErrException();
3463 if (Menu_Error
== NULL
||
3464 PyDict_SetItemString(d
, "Error", Menu_Error
) != 0)
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__ */
3476 /* ======================== End module _Menu ======================== */