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
;
76 int MenuObj_Convert(PyObject
*v
, MenuHandle
*p_itself
)
78 if (!MenuObj_Check(v
))
80 PyErr_SetString(PyExc_TypeError
, "Menu required");
83 *p_itself
= ((MenuObject
*)v
)->ob_itself
;
87 static void MenuObj_dealloc(MenuObject
*self
)
89 /* Cleanup of self->ob_itself goes here */
90 self
->ob_type
->tp_free((PyObject
*)self
);
93 static PyObject
*MenuObj_DisposeMenu(MenuObject
*_self
, PyObject
*_args
)
95 PyObject
*_res
= NULL
;
97 PyMac_PRECHECK(DisposeMenu
);
99 if (!PyArg_ParseTuple(_args
, ""))
101 DisposeMenu(_self
->ob_itself
);
107 static PyObject
*MenuObj_CalcMenuSize(MenuObject
*_self
, PyObject
*_args
)
109 PyObject
*_res
= NULL
;
111 PyMac_PRECHECK(CalcMenuSize
);
113 if (!PyArg_ParseTuple(_args
, ""))
115 CalcMenuSize(_self
->ob_itself
);
121 static PyObject
*MenuObj_CountMenuItems(MenuObject
*_self
, PyObject
*_args
)
123 PyObject
*_res
= NULL
;
125 #ifndef CountMenuItems
126 PyMac_PRECHECK(CountMenuItems
);
128 if (!PyArg_ParseTuple(_args
, ""))
130 _rv
= CountMenuItems(_self
->ob_itself
);
131 _res
= Py_BuildValue("H",
136 static PyObject
*MenuObj_GetMenuFont(MenuObject
*_self
, PyObject
*_args
)
138 PyObject
*_res
= NULL
;
143 PyMac_PRECHECK(GetMenuFont
);
145 if (!PyArg_ParseTuple(_args
, ""))
147 _err
= GetMenuFont(_self
->ob_itself
,
150 if (_err
!= noErr
) return PyMac_Error(_err
);
151 _res
= Py_BuildValue("hH",
157 static PyObject
*MenuObj_SetMenuFont(MenuObject
*_self
, PyObject
*_args
)
159 PyObject
*_res
= NULL
;
164 PyMac_PRECHECK(SetMenuFont
);
166 if (!PyArg_ParseTuple(_args
, "hH",
170 _err
= SetMenuFont(_self
->ob_itself
,
173 if (_err
!= noErr
) return PyMac_Error(_err
);
179 static PyObject
*MenuObj_GetMenuExcludesMarkColumn(MenuObject
*_self
, PyObject
*_args
)
181 PyObject
*_res
= NULL
;
183 #ifndef GetMenuExcludesMarkColumn
184 PyMac_PRECHECK(GetMenuExcludesMarkColumn
);
186 if (!PyArg_ParseTuple(_args
, ""))
188 _rv
= GetMenuExcludesMarkColumn(_self
->ob_itself
);
189 _res
= Py_BuildValue("b",
194 static PyObject
*MenuObj_SetMenuExcludesMarkColumn(MenuObject
*_self
, PyObject
*_args
)
196 PyObject
*_res
= NULL
;
198 Boolean excludesMark
;
199 #ifndef SetMenuExcludesMarkColumn
200 PyMac_PRECHECK(SetMenuExcludesMarkColumn
);
202 if (!PyArg_ParseTuple(_args
, "b",
205 _err
= SetMenuExcludesMarkColumn(_self
->ob_itself
,
207 if (_err
!= noErr
) return PyMac_Error(_err
);
213 static PyObject
*MenuObj_IsValidMenu(MenuObject
*_self
, PyObject
*_args
)
215 PyObject
*_res
= NULL
;
218 PyMac_PRECHECK(IsValidMenu
);
220 if (!PyArg_ParseTuple(_args
, ""))
222 _rv
= IsValidMenu(_self
->ob_itself
);
223 _res
= Py_BuildValue("b",
228 static PyObject
*MenuObj_GetMenuRetainCount(MenuObject
*_self
, PyObject
*_args
)
230 PyObject
*_res
= NULL
;
232 #ifndef GetMenuRetainCount
233 PyMac_PRECHECK(GetMenuRetainCount
);
235 if (!PyArg_ParseTuple(_args
, ""))
237 _rv
= GetMenuRetainCount(_self
->ob_itself
);
238 _res
= Py_BuildValue("l",
243 static PyObject
*MenuObj_RetainMenu(MenuObject
*_self
, PyObject
*_args
)
245 PyObject
*_res
= NULL
;
248 PyMac_PRECHECK(RetainMenu
);
250 if (!PyArg_ParseTuple(_args
, ""))
252 _err
= RetainMenu(_self
->ob_itself
);
253 if (_err
!= noErr
) return PyMac_Error(_err
);
259 static PyObject
*MenuObj_ReleaseMenu(MenuObject
*_self
, PyObject
*_args
)
261 PyObject
*_res
= NULL
;
264 PyMac_PRECHECK(ReleaseMenu
);
266 if (!PyArg_ParseTuple(_args
, ""))
268 _err
= ReleaseMenu(_self
->ob_itself
);
269 if (_err
!= noErr
) return PyMac_Error(_err
);
275 static PyObject
*MenuObj_DuplicateMenu(MenuObject
*_self
, PyObject
*_args
)
277 PyObject
*_res
= NULL
;
280 #ifndef DuplicateMenu
281 PyMac_PRECHECK(DuplicateMenu
);
283 if (!PyArg_ParseTuple(_args
, ""))
285 _err
= DuplicateMenu(_self
->ob_itself
,
287 if (_err
!= noErr
) return PyMac_Error(_err
);
288 _res
= Py_BuildValue("O&",
289 MenuObj_New
, outMenu
);
293 static PyObject
*MenuObj_CopyMenuTitleAsCFString(MenuObject
*_self
, PyObject
*_args
)
295 PyObject
*_res
= NULL
;
297 CFStringRef outString
;
298 #ifndef CopyMenuTitleAsCFString
299 PyMac_PRECHECK(CopyMenuTitleAsCFString
);
301 if (!PyArg_ParseTuple(_args
, ""))
303 _err
= CopyMenuTitleAsCFString(_self
->ob_itself
,
305 if (_err
!= noErr
) return PyMac_Error(_err
);
306 _res
= Py_BuildValue("O&",
307 CFStringRefObj_New
, outString
);
311 static PyObject
*MenuObj_SetMenuTitleWithCFString(MenuObject
*_self
, PyObject
*_args
)
313 PyObject
*_res
= NULL
;
315 CFStringRef inString
;
316 #ifndef SetMenuTitleWithCFString
317 PyMac_PRECHECK(SetMenuTitleWithCFString
);
319 if (!PyArg_ParseTuple(_args
, "O&",
320 CFStringRefObj_Convert
, &inString
))
322 _err
= SetMenuTitleWithCFString(_self
->ob_itself
,
324 if (_err
!= noErr
) return PyMac_Error(_err
);
330 static PyObject
*MenuObj_InvalidateMenuSize(MenuObject
*_self
, PyObject
*_args
)
332 PyObject
*_res
= NULL
;
334 #ifndef InvalidateMenuSize
335 PyMac_PRECHECK(InvalidateMenuSize
);
337 if (!PyArg_ParseTuple(_args
, ""))
339 _err
= InvalidateMenuSize(_self
->ob_itself
);
340 if (_err
!= noErr
) return PyMac_Error(_err
);
346 static PyObject
*MenuObj_IsMenuSizeInvalid(MenuObject
*_self
, PyObject
*_args
)
348 PyObject
*_res
= NULL
;
350 #ifndef IsMenuSizeInvalid
351 PyMac_PRECHECK(IsMenuSizeInvalid
);
353 if (!PyArg_ParseTuple(_args
, ""))
355 _rv
= IsMenuSizeInvalid(_self
->ob_itself
);
356 _res
= Py_BuildValue("b",
361 static PyObject
*MenuObj_MacAppendMenu(MenuObject
*_self
, PyObject
*_args
)
363 PyObject
*_res
= NULL
;
365 #ifndef MacAppendMenu
366 PyMac_PRECHECK(MacAppendMenu
);
368 if (!PyArg_ParseTuple(_args
, "O&",
369 PyMac_GetStr255
, data
))
371 MacAppendMenu(_self
->ob_itself
,
378 static PyObject
*MenuObj_InsertResMenu(MenuObject
*_self
, PyObject
*_args
)
380 PyObject
*_res
= NULL
;
383 #ifndef InsertResMenu
384 PyMac_PRECHECK(InsertResMenu
);
386 if (!PyArg_ParseTuple(_args
, "O&h",
387 PyMac_GetOSType
, &theType
,
390 InsertResMenu(_self
->ob_itself
,
398 static PyObject
*MenuObj_AppendResMenu(MenuObject
*_self
, PyObject
*_args
)
400 PyObject
*_res
= NULL
;
402 #ifndef AppendResMenu
403 PyMac_PRECHECK(AppendResMenu
);
405 if (!PyArg_ParseTuple(_args
, "O&",
406 PyMac_GetOSType
, &theType
))
408 AppendResMenu(_self
->ob_itself
,
415 static PyObject
*MenuObj_MacInsertMenuItem(MenuObject
*_self
, PyObject
*_args
)
417 PyObject
*_res
= NULL
;
420 #ifndef MacInsertMenuItem
421 PyMac_PRECHECK(MacInsertMenuItem
);
423 if (!PyArg_ParseTuple(_args
, "O&h",
424 PyMac_GetStr255
, itemString
,
427 MacInsertMenuItem(_self
->ob_itself
,
435 static PyObject
*MenuObj_DeleteMenuItem(MenuObject
*_self
, PyObject
*_args
)
437 PyObject
*_res
= NULL
;
439 #ifndef DeleteMenuItem
440 PyMac_PRECHECK(DeleteMenuItem
);
442 if (!PyArg_ParseTuple(_args
, "h",
445 DeleteMenuItem(_self
->ob_itself
,
452 static PyObject
*MenuObj_InsertFontResMenu(MenuObject
*_self
, PyObject
*_args
)
454 PyObject
*_res
= NULL
;
457 #ifndef InsertFontResMenu
458 PyMac_PRECHECK(InsertFontResMenu
);
460 if (!PyArg_ParseTuple(_args
, "hh",
464 InsertFontResMenu(_self
->ob_itself
,
472 static PyObject
*MenuObj_InsertIntlResMenu(MenuObject
*_self
, PyObject
*_args
)
474 PyObject
*_res
= NULL
;
478 #ifndef InsertIntlResMenu
479 PyMac_PRECHECK(InsertIntlResMenu
);
481 if (!PyArg_ParseTuple(_args
, "O&hh",
482 PyMac_GetOSType
, &theType
,
486 InsertIntlResMenu(_self
->ob_itself
,
495 static PyObject
*MenuObj_AppendMenuItemText(MenuObject
*_self
, PyObject
*_args
)
497 PyObject
*_res
= NULL
;
500 #ifndef AppendMenuItemText
501 PyMac_PRECHECK(AppendMenuItemText
);
503 if (!PyArg_ParseTuple(_args
, "O&",
504 PyMac_GetStr255
, inString
))
506 _err
= AppendMenuItemText(_self
->ob_itself
,
508 if (_err
!= noErr
) return PyMac_Error(_err
);
514 static PyObject
*MenuObj_InsertMenuItemText(MenuObject
*_self
, PyObject
*_args
)
516 PyObject
*_res
= NULL
;
519 MenuItemIndex afterItem
;
520 #ifndef InsertMenuItemText
521 PyMac_PRECHECK(InsertMenuItemText
);
523 if (!PyArg_ParseTuple(_args
, "O&h",
524 PyMac_GetStr255
, inString
,
527 _err
= InsertMenuItemText(_self
->ob_itself
,
530 if (_err
!= noErr
) return PyMac_Error(_err
);
536 static PyObject
*MenuObj_CopyMenuItems(MenuObject
*_self
, PyObject
*_args
)
538 PyObject
*_res
= NULL
;
540 MenuItemIndex inFirstItem
;
541 ItemCount inNumItems
;
542 MenuHandle inDestMenu
;
543 MenuItemIndex inInsertAfter
;
544 #ifndef CopyMenuItems
545 PyMac_PRECHECK(CopyMenuItems
);
547 if (!PyArg_ParseTuple(_args
, "hlO&h",
550 MenuObj_Convert
, &inDestMenu
,
553 _err
= CopyMenuItems(_self
->ob_itself
,
558 if (_err
!= noErr
) return PyMac_Error(_err
);
564 static PyObject
*MenuObj_DeleteMenuItems(MenuObject
*_self
, PyObject
*_args
)
566 PyObject
*_res
= NULL
;
568 MenuItemIndex inFirstItem
;
569 ItemCount inNumItems
;
570 #ifndef DeleteMenuItems
571 PyMac_PRECHECK(DeleteMenuItems
);
573 if (!PyArg_ParseTuple(_args
, "hl",
577 _err
= DeleteMenuItems(_self
->ob_itself
,
580 if (_err
!= noErr
) return PyMac_Error(_err
);
586 static PyObject
*MenuObj_AppendMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
588 PyObject
*_res
= NULL
;
590 CFStringRef inString
;
591 MenuItemAttributes inAttributes
;
592 MenuCommand inCommandID
;
593 MenuItemIndex outNewItem
;
594 #ifndef AppendMenuItemTextWithCFString
595 PyMac_PRECHECK(AppendMenuItemTextWithCFString
);
597 if (!PyArg_ParseTuple(_args
, "O&ll",
598 CFStringRefObj_Convert
, &inString
,
602 _err
= AppendMenuItemTextWithCFString(_self
->ob_itself
,
607 if (_err
!= noErr
) return PyMac_Error(_err
);
608 _res
= Py_BuildValue("h",
613 static PyObject
*MenuObj_InsertMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
615 PyObject
*_res
= NULL
;
617 CFStringRef inString
;
618 MenuItemIndex inAfterItem
;
619 MenuItemAttributes inAttributes
;
620 MenuCommand inCommandID
;
621 #ifndef InsertMenuItemTextWithCFString
622 PyMac_PRECHECK(InsertMenuItemTextWithCFString
);
624 if (!PyArg_ParseTuple(_args
, "O&hll",
625 CFStringRefObj_Convert
, &inString
,
630 _err
= InsertMenuItemTextWithCFString(_self
->ob_itself
,
635 if (_err
!= noErr
) return PyMac_Error(_err
);
641 static PyObject
*MenuObj_PopUpMenuSelect(MenuObject
*_self
, PyObject
*_args
)
643 PyObject
*_res
= NULL
;
648 #ifndef PopUpMenuSelect
649 PyMac_PRECHECK(PopUpMenuSelect
);
651 if (!PyArg_ParseTuple(_args
, "hhh",
656 _rv
= PopUpMenuSelect(_self
->ob_itself
,
660 _res
= Py_BuildValue("l",
665 static PyObject
*MenuObj_InvalidateMenuEnabling(MenuObject
*_self
, PyObject
*_args
)
667 PyObject
*_res
= NULL
;
669 #ifndef InvalidateMenuEnabling
670 PyMac_PRECHECK(InvalidateMenuEnabling
);
672 if (!PyArg_ParseTuple(_args
, ""))
674 _err
= InvalidateMenuEnabling(_self
->ob_itself
);
675 if (_err
!= noErr
) return PyMac_Error(_err
);
681 static PyObject
*MenuObj_IsMenuBarInvalid(MenuObject
*_self
, PyObject
*_args
)
683 PyObject
*_res
= NULL
;
685 #ifndef IsMenuBarInvalid
686 PyMac_PRECHECK(IsMenuBarInvalid
);
688 if (!PyArg_ParseTuple(_args
, ""))
690 _rv
= IsMenuBarInvalid(_self
->ob_itself
);
691 _res
= Py_BuildValue("b",
696 static PyObject
*MenuObj_MacInsertMenu(MenuObject
*_self
, PyObject
*_args
)
698 PyObject
*_res
= NULL
;
700 #ifndef MacInsertMenu
701 PyMac_PRECHECK(MacInsertMenu
);
703 if (!PyArg_ParseTuple(_args
, "h",
706 MacInsertMenu(_self
->ob_itself
,
713 static PyObject
*MenuObj_SetRootMenu(MenuObject
*_self
, PyObject
*_args
)
715 PyObject
*_res
= NULL
;
718 PyMac_PRECHECK(SetRootMenu
);
720 if (!PyArg_ParseTuple(_args
, ""))
722 _err
= SetRootMenu(_self
->ob_itself
);
723 if (_err
!= noErr
) return PyMac_Error(_err
);
729 static PyObject
*MenuObj_MacCheckMenuItem(MenuObject
*_self
, PyObject
*_args
)
731 PyObject
*_res
= NULL
;
734 #ifndef MacCheckMenuItem
735 PyMac_PRECHECK(MacCheckMenuItem
);
737 if (!PyArg_ParseTuple(_args
, "hb",
741 MacCheckMenuItem(_self
->ob_itself
,
749 static PyObject
*MenuObj_SetMenuItemText(MenuObject
*_self
, PyObject
*_args
)
751 PyObject
*_res
= NULL
;
754 #ifndef SetMenuItemText
755 PyMac_PRECHECK(SetMenuItemText
);
757 if (!PyArg_ParseTuple(_args
, "hO&",
759 PyMac_GetStr255
, itemString
))
761 SetMenuItemText(_self
->ob_itself
,
769 static PyObject
*MenuObj_GetMenuItemText(MenuObject
*_self
, PyObject
*_args
)
771 PyObject
*_res
= NULL
;
774 #ifndef GetMenuItemText
775 PyMac_PRECHECK(GetMenuItemText
);
777 if (!PyArg_ParseTuple(_args
, "h",
780 GetMenuItemText(_self
->ob_itself
,
783 _res
= Py_BuildValue("O&",
784 PyMac_BuildStr255
, itemString
);
788 static PyObject
*MenuObj_SetItemMark(MenuObject
*_self
, PyObject
*_args
)
790 PyObject
*_res
= NULL
;
792 CharParameter markChar
;
794 PyMac_PRECHECK(SetItemMark
);
796 if (!PyArg_ParseTuple(_args
, "hh",
800 SetItemMark(_self
->ob_itself
,
808 static PyObject
*MenuObj_GetItemMark(MenuObject
*_self
, PyObject
*_args
)
810 PyObject
*_res
= NULL
;
812 CharParameter markChar
;
814 PyMac_PRECHECK(GetItemMark
);
816 if (!PyArg_ParseTuple(_args
, "h",
819 GetItemMark(_self
->ob_itself
,
822 _res
= Py_BuildValue("h",
827 static PyObject
*MenuObj_SetItemCmd(MenuObject
*_self
, PyObject
*_args
)
829 PyObject
*_res
= NULL
;
831 CharParameter cmdChar
;
833 PyMac_PRECHECK(SetItemCmd
);
835 if (!PyArg_ParseTuple(_args
, "hh",
839 SetItemCmd(_self
->ob_itself
,
847 static PyObject
*MenuObj_GetItemCmd(MenuObject
*_self
, PyObject
*_args
)
849 PyObject
*_res
= NULL
;
851 CharParameter cmdChar
;
853 PyMac_PRECHECK(GetItemCmd
);
855 if (!PyArg_ParseTuple(_args
, "h",
858 GetItemCmd(_self
->ob_itself
,
861 _res
= Py_BuildValue("h",
866 static PyObject
*MenuObj_SetItemIcon(MenuObject
*_self
, PyObject
*_args
)
868 PyObject
*_res
= NULL
;
872 PyMac_PRECHECK(SetItemIcon
);
874 if (!PyArg_ParseTuple(_args
, "hh",
878 SetItemIcon(_self
->ob_itself
,
886 static PyObject
*MenuObj_GetItemIcon(MenuObject
*_self
, PyObject
*_args
)
888 PyObject
*_res
= NULL
;
892 PyMac_PRECHECK(GetItemIcon
);
894 if (!PyArg_ParseTuple(_args
, "h",
897 GetItemIcon(_self
->ob_itself
,
900 _res
= Py_BuildValue("h",
905 static PyObject
*MenuObj_SetItemStyle(MenuObject
*_self
, PyObject
*_args
)
907 PyObject
*_res
= NULL
;
909 StyleParameter chStyle
;
911 PyMac_PRECHECK(SetItemStyle
);
913 if (!PyArg_ParseTuple(_args
, "hh",
917 SetItemStyle(_self
->ob_itself
,
925 static PyObject
*MenuObj_GetItemStyle(MenuObject
*_self
, PyObject
*_args
)
927 PyObject
*_res
= NULL
;
931 PyMac_PRECHECK(GetItemStyle
);
933 if (!PyArg_ParseTuple(_args
, "h",
936 GetItemStyle(_self
->ob_itself
,
939 _res
= Py_BuildValue("b",
944 static PyObject
*MenuObj_SetMenuItemCommandID(MenuObject
*_self
, PyObject
*_args
)
946 PyObject
*_res
= NULL
;
949 MenuCommand inCommandID
;
950 #ifndef SetMenuItemCommandID
951 PyMac_PRECHECK(SetMenuItemCommandID
);
953 if (!PyArg_ParseTuple(_args
, "hl",
957 _err
= SetMenuItemCommandID(_self
->ob_itself
,
960 if (_err
!= noErr
) return PyMac_Error(_err
);
966 static PyObject
*MenuObj_GetMenuItemCommandID(MenuObject
*_self
, PyObject
*_args
)
968 PyObject
*_res
= NULL
;
971 MenuCommand outCommandID
;
972 #ifndef GetMenuItemCommandID
973 PyMac_PRECHECK(GetMenuItemCommandID
);
975 if (!PyArg_ParseTuple(_args
, "h",
978 _err
= GetMenuItemCommandID(_self
->ob_itself
,
981 if (_err
!= noErr
) return PyMac_Error(_err
);
982 _res
= Py_BuildValue("l",
987 static PyObject
*MenuObj_SetMenuItemModifiers(MenuObject
*_self
, PyObject
*_args
)
989 PyObject
*_res
= NULL
;
993 #ifndef SetMenuItemModifiers
994 PyMac_PRECHECK(SetMenuItemModifiers
);
996 if (!PyArg_ParseTuple(_args
, "hb",
1000 _err
= SetMenuItemModifiers(_self
->ob_itself
,
1003 if (_err
!= noErr
) return PyMac_Error(_err
);
1009 static PyObject
*MenuObj_GetMenuItemModifiers(MenuObject
*_self
, PyObject
*_args
)
1011 PyObject
*_res
= NULL
;
1015 #ifndef GetMenuItemModifiers
1016 PyMac_PRECHECK(GetMenuItemModifiers
);
1018 if (!PyArg_ParseTuple(_args
, "h",
1021 _err
= GetMenuItemModifiers(_self
->ob_itself
,
1024 if (_err
!= noErr
) return PyMac_Error(_err
);
1025 _res
= Py_BuildValue("b",
1030 static PyObject
*MenuObj_SetMenuItemIconHandle(MenuObject
*_self
, PyObject
*_args
)
1032 PyObject
*_res
= NULL
;
1036 Handle inIconHandle
;
1037 #ifndef SetMenuItemIconHandle
1038 PyMac_PRECHECK(SetMenuItemIconHandle
);
1040 if (!PyArg_ParseTuple(_args
, "hbO&",
1043 ResObj_Convert
, &inIconHandle
))
1045 _err
= SetMenuItemIconHandle(_self
->ob_itself
,
1049 if (_err
!= noErr
) return PyMac_Error(_err
);
1055 static PyObject
*MenuObj_GetMenuItemIconHandle(MenuObject
*_self
, PyObject
*_args
)
1057 PyObject
*_res
= NULL
;
1061 Handle outIconHandle
;
1062 #ifndef GetMenuItemIconHandle
1063 PyMac_PRECHECK(GetMenuItemIconHandle
);
1065 if (!PyArg_ParseTuple(_args
, "h",
1068 _err
= GetMenuItemIconHandle(_self
->ob_itself
,
1072 if (_err
!= noErr
) return PyMac_Error(_err
);
1073 _res
= Py_BuildValue("bO&",
1075 ResObj_New
, outIconHandle
);
1079 static PyObject
*MenuObj_SetMenuItemTextEncoding(MenuObject
*_self
, PyObject
*_args
)
1081 PyObject
*_res
= NULL
;
1084 TextEncoding inScriptID
;
1085 #ifndef SetMenuItemTextEncoding
1086 PyMac_PRECHECK(SetMenuItemTextEncoding
);
1088 if (!PyArg_ParseTuple(_args
, "hl",
1092 _err
= SetMenuItemTextEncoding(_self
->ob_itself
,
1095 if (_err
!= noErr
) return PyMac_Error(_err
);
1101 static PyObject
*MenuObj_GetMenuItemTextEncoding(MenuObject
*_self
, PyObject
*_args
)
1103 PyObject
*_res
= NULL
;
1106 TextEncoding outScriptID
;
1107 #ifndef GetMenuItemTextEncoding
1108 PyMac_PRECHECK(GetMenuItemTextEncoding
);
1110 if (!PyArg_ParseTuple(_args
, "h",
1113 _err
= GetMenuItemTextEncoding(_self
->ob_itself
,
1116 if (_err
!= noErr
) return PyMac_Error(_err
);
1117 _res
= Py_BuildValue("l",
1122 static PyObject
*MenuObj_SetMenuItemHierarchicalID(MenuObject
*_self
, PyObject
*_args
)
1124 PyObject
*_res
= NULL
;
1128 #ifndef SetMenuItemHierarchicalID
1129 PyMac_PRECHECK(SetMenuItemHierarchicalID
);
1131 if (!PyArg_ParseTuple(_args
, "hh",
1135 _err
= SetMenuItemHierarchicalID(_self
->ob_itself
,
1138 if (_err
!= noErr
) return PyMac_Error(_err
);
1144 static PyObject
*MenuObj_GetMenuItemHierarchicalID(MenuObject
*_self
, PyObject
*_args
)
1146 PyObject
*_res
= NULL
;
1150 #ifndef GetMenuItemHierarchicalID
1151 PyMac_PRECHECK(GetMenuItemHierarchicalID
);
1153 if (!PyArg_ParseTuple(_args
, "h",
1156 _err
= GetMenuItemHierarchicalID(_self
->ob_itself
,
1159 if (_err
!= noErr
) return PyMac_Error(_err
);
1160 _res
= Py_BuildValue("h",
1165 static PyObject
*MenuObj_SetMenuItemFontID(MenuObject
*_self
, PyObject
*_args
)
1167 PyObject
*_res
= NULL
;
1171 #ifndef SetMenuItemFontID
1172 PyMac_PRECHECK(SetMenuItemFontID
);
1174 if (!PyArg_ParseTuple(_args
, "hh",
1178 _err
= SetMenuItemFontID(_self
->ob_itself
,
1181 if (_err
!= noErr
) return PyMac_Error(_err
);
1187 static PyObject
*MenuObj_GetMenuItemFontID(MenuObject
*_self
, PyObject
*_args
)
1189 PyObject
*_res
= NULL
;
1193 #ifndef GetMenuItemFontID
1194 PyMac_PRECHECK(GetMenuItemFontID
);
1196 if (!PyArg_ParseTuple(_args
, "h",
1199 _err
= GetMenuItemFontID(_self
->ob_itself
,
1202 if (_err
!= noErr
) return PyMac_Error(_err
);
1203 _res
= Py_BuildValue("h",
1208 static PyObject
*MenuObj_SetMenuItemRefCon(MenuObject
*_self
, PyObject
*_args
)
1210 PyObject
*_res
= NULL
;
1214 #ifndef SetMenuItemRefCon
1215 PyMac_PRECHECK(SetMenuItemRefCon
);
1217 if (!PyArg_ParseTuple(_args
, "hl",
1221 _err
= SetMenuItemRefCon(_self
->ob_itself
,
1224 if (_err
!= noErr
) return PyMac_Error(_err
);
1230 static PyObject
*MenuObj_GetMenuItemRefCon(MenuObject
*_self
, PyObject
*_args
)
1232 PyObject
*_res
= NULL
;
1236 #ifndef GetMenuItemRefCon
1237 PyMac_PRECHECK(GetMenuItemRefCon
);
1239 if (!PyArg_ParseTuple(_args
, "h",
1242 _err
= GetMenuItemRefCon(_self
->ob_itself
,
1245 if (_err
!= noErr
) return PyMac_Error(_err
);
1246 _res
= Py_BuildValue("l",
1251 static PyObject
*MenuObj_SetMenuItemKeyGlyph(MenuObject
*_self
, PyObject
*_args
)
1253 PyObject
*_res
= NULL
;
1257 #ifndef SetMenuItemKeyGlyph
1258 PyMac_PRECHECK(SetMenuItemKeyGlyph
);
1260 if (!PyArg_ParseTuple(_args
, "hh",
1264 _err
= SetMenuItemKeyGlyph(_self
->ob_itself
,
1267 if (_err
!= noErr
) return PyMac_Error(_err
);
1273 static PyObject
*MenuObj_GetMenuItemKeyGlyph(MenuObject
*_self
, PyObject
*_args
)
1275 PyObject
*_res
= NULL
;
1279 #ifndef GetMenuItemKeyGlyph
1280 PyMac_PRECHECK(GetMenuItemKeyGlyph
);
1282 if (!PyArg_ParseTuple(_args
, "h",
1285 _err
= GetMenuItemKeyGlyph(_self
->ob_itself
,
1288 if (_err
!= noErr
) return PyMac_Error(_err
);
1289 _res
= Py_BuildValue("h",
1294 static PyObject
*MenuObj_MacEnableMenuItem(MenuObject
*_self
, PyObject
*_args
)
1296 PyObject
*_res
= NULL
;
1298 #ifndef MacEnableMenuItem
1299 PyMac_PRECHECK(MacEnableMenuItem
);
1301 if (!PyArg_ParseTuple(_args
, "h",
1304 MacEnableMenuItem(_self
->ob_itself
,
1311 static PyObject
*MenuObj_DisableMenuItem(MenuObject
*_self
, PyObject
*_args
)
1313 PyObject
*_res
= NULL
;
1315 #ifndef DisableMenuItem
1316 PyMac_PRECHECK(DisableMenuItem
);
1318 if (!PyArg_ParseTuple(_args
, "h",
1321 DisableMenuItem(_self
->ob_itself
,
1328 static PyObject
*MenuObj_IsMenuItemEnabled(MenuObject
*_self
, PyObject
*_args
)
1330 PyObject
*_res
= NULL
;
1333 #ifndef IsMenuItemEnabled
1334 PyMac_PRECHECK(IsMenuItemEnabled
);
1336 if (!PyArg_ParseTuple(_args
, "h",
1339 _rv
= IsMenuItemEnabled(_self
->ob_itself
,
1341 _res
= Py_BuildValue("b",
1346 static PyObject
*MenuObj_EnableMenuItemIcon(MenuObject
*_self
, PyObject
*_args
)
1348 PyObject
*_res
= NULL
;
1350 #ifndef EnableMenuItemIcon
1351 PyMac_PRECHECK(EnableMenuItemIcon
);
1353 if (!PyArg_ParseTuple(_args
, "h",
1356 EnableMenuItemIcon(_self
->ob_itself
,
1363 static PyObject
*MenuObj_DisableMenuItemIcon(MenuObject
*_self
, PyObject
*_args
)
1365 PyObject
*_res
= NULL
;
1367 #ifndef DisableMenuItemIcon
1368 PyMac_PRECHECK(DisableMenuItemIcon
);
1370 if (!PyArg_ParseTuple(_args
, "h",
1373 DisableMenuItemIcon(_self
->ob_itself
,
1380 static PyObject
*MenuObj_IsMenuItemIconEnabled(MenuObject
*_self
, PyObject
*_args
)
1382 PyObject
*_res
= NULL
;
1385 #ifndef IsMenuItemIconEnabled
1386 PyMac_PRECHECK(IsMenuItemIconEnabled
);
1388 if (!PyArg_ParseTuple(_args
, "h",
1391 _rv
= IsMenuItemIconEnabled(_self
->ob_itself
,
1393 _res
= Py_BuildValue("b",
1398 static PyObject
*MenuObj_SetMenuItemHierarchicalMenu(MenuObject
*_self
, PyObject
*_args
)
1400 PyObject
*_res
= NULL
;
1402 MenuItemIndex inItem
;
1403 MenuHandle inHierMenu
;
1404 #ifndef SetMenuItemHierarchicalMenu
1405 PyMac_PRECHECK(SetMenuItemHierarchicalMenu
);
1407 if (!PyArg_ParseTuple(_args
, "hO&",
1409 MenuObj_Convert
, &inHierMenu
))
1411 _err
= SetMenuItemHierarchicalMenu(_self
->ob_itself
,
1414 if (_err
!= noErr
) return PyMac_Error(_err
);
1420 static PyObject
*MenuObj_GetMenuItemHierarchicalMenu(MenuObject
*_self
, PyObject
*_args
)
1422 PyObject
*_res
= NULL
;
1424 MenuItemIndex inItem
;
1425 MenuHandle outHierMenu
;
1426 #ifndef GetMenuItemHierarchicalMenu
1427 PyMac_PRECHECK(GetMenuItemHierarchicalMenu
);
1429 if (!PyArg_ParseTuple(_args
, "h",
1432 _err
= GetMenuItemHierarchicalMenu(_self
->ob_itself
,
1435 if (_err
!= noErr
) return PyMac_Error(_err
);
1436 _res
= Py_BuildValue("O&",
1437 OptMenuObj_New
, outHierMenu
);
1441 static PyObject
*MenuObj_CopyMenuItemTextAsCFString(MenuObject
*_self
, PyObject
*_args
)
1443 PyObject
*_res
= NULL
;
1445 MenuItemIndex inItem
;
1446 CFStringRef outString
;
1447 #ifndef CopyMenuItemTextAsCFString
1448 PyMac_PRECHECK(CopyMenuItemTextAsCFString
);
1450 if (!PyArg_ParseTuple(_args
, "h",
1453 _err
= CopyMenuItemTextAsCFString(_self
->ob_itself
,
1456 if (_err
!= noErr
) return PyMac_Error(_err
);
1457 _res
= Py_BuildValue("O&",
1458 CFStringRefObj_New
, outString
);
1462 static PyObject
*MenuObj_SetMenuItemTextWithCFString(MenuObject
*_self
, PyObject
*_args
)
1464 PyObject
*_res
= NULL
;
1466 MenuItemIndex inItem
;
1467 CFStringRef inString
;
1468 #ifndef SetMenuItemTextWithCFString
1469 PyMac_PRECHECK(SetMenuItemTextWithCFString
);
1471 if (!PyArg_ParseTuple(_args
, "hO&",
1473 CFStringRefObj_Convert
, &inString
))
1475 _err
= SetMenuItemTextWithCFString(_self
->ob_itself
,
1478 if (_err
!= noErr
) return PyMac_Error(_err
);
1484 static PyObject
*MenuObj_GetMenuItemIndent(MenuObject
*_self
, PyObject
*_args
)
1486 PyObject
*_res
= NULL
;
1488 MenuItemIndex inItem
;
1490 #ifndef GetMenuItemIndent
1491 PyMac_PRECHECK(GetMenuItemIndent
);
1493 if (!PyArg_ParseTuple(_args
, "h",
1496 _err
= GetMenuItemIndent(_self
->ob_itself
,
1499 if (_err
!= noErr
) return PyMac_Error(_err
);
1500 _res
= Py_BuildValue("l",
1505 static PyObject
*MenuObj_SetMenuItemIndent(MenuObject
*_self
, PyObject
*_args
)
1507 PyObject
*_res
= NULL
;
1509 MenuItemIndex inItem
;
1511 #ifndef SetMenuItemIndent
1512 PyMac_PRECHECK(SetMenuItemIndent
);
1514 if (!PyArg_ParseTuple(_args
, "hl",
1518 _err
= SetMenuItemIndent(_self
->ob_itself
,
1521 if (_err
!= noErr
) return PyMac_Error(_err
);
1527 static PyObject
*MenuObj_GetMenuItemCommandKey(MenuObject
*_self
, PyObject
*_args
)
1529 PyObject
*_res
= NULL
;
1531 MenuItemIndex inItem
;
1532 Boolean inGetVirtualKey
;
1534 #ifndef GetMenuItemCommandKey
1535 PyMac_PRECHECK(GetMenuItemCommandKey
);
1537 if (!PyArg_ParseTuple(_args
, "hb",
1541 _err
= GetMenuItemCommandKey(_self
->ob_itself
,
1545 if (_err
!= noErr
) return PyMac_Error(_err
);
1546 _res
= Py_BuildValue("H",
1551 static PyObject
*MenuObj_SetMenuItemCommandKey(MenuObject
*_self
, PyObject
*_args
)
1553 PyObject
*_res
= NULL
;
1555 MenuItemIndex inItem
;
1556 Boolean inSetVirtualKey
;
1558 #ifndef SetMenuItemCommandKey
1559 PyMac_PRECHECK(SetMenuItemCommandKey
);
1561 if (!PyArg_ParseTuple(_args
, "hbH",
1566 _err
= SetMenuItemCommandKey(_self
->ob_itself
,
1570 if (_err
!= noErr
) return PyMac_Error(_err
);
1576 static PyObject
*MenuObj_GetMenuItemPropertyAttributes(MenuObject
*_self
, PyObject
*_args
)
1578 PyObject
*_res
= NULL
;
1581 OSType propertyCreator
;
1584 #ifndef GetMenuItemPropertyAttributes
1585 PyMac_PRECHECK(GetMenuItemPropertyAttributes
);
1587 if (!PyArg_ParseTuple(_args
, "hO&O&",
1589 PyMac_GetOSType
, &propertyCreator
,
1590 PyMac_GetOSType
, &propertyTag
))
1592 _err
= GetMenuItemPropertyAttributes(_self
->ob_itself
,
1597 if (_err
!= noErr
) return PyMac_Error(_err
);
1598 _res
= Py_BuildValue("l",
1603 static PyObject
*MenuObj_ChangeMenuItemPropertyAttributes(MenuObject
*_self
, PyObject
*_args
)
1605 PyObject
*_res
= NULL
;
1608 OSType propertyCreator
;
1610 UInt32 attributesToSet
;
1611 UInt32 attributesToClear
;
1612 #ifndef ChangeMenuItemPropertyAttributes
1613 PyMac_PRECHECK(ChangeMenuItemPropertyAttributes
);
1615 if (!PyArg_ParseTuple(_args
, "hO&O&ll",
1617 PyMac_GetOSType
, &propertyCreator
,
1618 PyMac_GetOSType
, &propertyTag
,
1620 &attributesToClear
))
1622 _err
= ChangeMenuItemPropertyAttributes(_self
->ob_itself
,
1628 if (_err
!= noErr
) return PyMac_Error(_err
);
1634 static PyObject
*MenuObj_GetMenuAttributes(MenuObject
*_self
, PyObject
*_args
)
1636 PyObject
*_res
= NULL
;
1638 MenuAttributes outAttributes
;
1639 #ifndef GetMenuAttributes
1640 PyMac_PRECHECK(GetMenuAttributes
);
1642 if (!PyArg_ParseTuple(_args
, ""))
1644 _err
= GetMenuAttributes(_self
->ob_itself
,
1646 if (_err
!= noErr
) return PyMac_Error(_err
);
1647 _res
= Py_BuildValue("l",
1652 static PyObject
*MenuObj_ChangeMenuAttributes(MenuObject
*_self
, PyObject
*_args
)
1654 PyObject
*_res
= NULL
;
1656 MenuAttributes setTheseAttributes
;
1657 MenuAttributes clearTheseAttributes
;
1658 #ifndef ChangeMenuAttributes
1659 PyMac_PRECHECK(ChangeMenuAttributes
);
1661 if (!PyArg_ParseTuple(_args
, "ll",
1662 &setTheseAttributes
,
1663 &clearTheseAttributes
))
1665 _err
= ChangeMenuAttributes(_self
->ob_itself
,
1667 clearTheseAttributes
);
1668 if (_err
!= noErr
) return PyMac_Error(_err
);
1674 static PyObject
*MenuObj_GetMenuItemAttributes(MenuObject
*_self
, PyObject
*_args
)
1676 PyObject
*_res
= NULL
;
1679 MenuItemAttributes outAttributes
;
1680 #ifndef GetMenuItemAttributes
1681 PyMac_PRECHECK(GetMenuItemAttributes
);
1683 if (!PyArg_ParseTuple(_args
, "h",
1686 _err
= GetMenuItemAttributes(_self
->ob_itself
,
1689 if (_err
!= noErr
) return PyMac_Error(_err
);
1690 _res
= Py_BuildValue("l",
1695 static PyObject
*MenuObj_ChangeMenuItemAttributes(MenuObject
*_self
, PyObject
*_args
)
1697 PyObject
*_res
= NULL
;
1700 MenuItemAttributes setTheseAttributes
;
1701 MenuItemAttributes clearTheseAttributes
;
1702 #ifndef ChangeMenuItemAttributes
1703 PyMac_PRECHECK(ChangeMenuItemAttributes
);
1705 if (!PyArg_ParseTuple(_args
, "hll",
1707 &setTheseAttributes
,
1708 &clearTheseAttributes
))
1710 _err
= ChangeMenuItemAttributes(_self
->ob_itself
,
1713 clearTheseAttributes
);
1714 if (_err
!= noErr
) return PyMac_Error(_err
);
1720 static PyObject
*MenuObj_DisableAllMenuItems(MenuObject
*_self
, PyObject
*_args
)
1722 PyObject
*_res
= NULL
;
1723 #ifndef DisableAllMenuItems
1724 PyMac_PRECHECK(DisableAllMenuItems
);
1726 if (!PyArg_ParseTuple(_args
, ""))
1728 DisableAllMenuItems(_self
->ob_itself
);
1734 static PyObject
*MenuObj_EnableAllMenuItems(MenuObject
*_self
, PyObject
*_args
)
1736 PyObject
*_res
= NULL
;
1737 #ifndef EnableAllMenuItems
1738 PyMac_PRECHECK(EnableAllMenuItems
);
1740 if (!PyArg_ParseTuple(_args
, ""))
1742 EnableAllMenuItems(_self
->ob_itself
);
1748 static PyObject
*MenuObj_MenuHasEnabledItems(MenuObject
*_self
, PyObject
*_args
)
1750 PyObject
*_res
= NULL
;
1752 #ifndef MenuHasEnabledItems
1753 PyMac_PRECHECK(MenuHasEnabledItems
);
1755 if (!PyArg_ParseTuple(_args
, ""))
1757 _rv
= MenuHasEnabledItems(_self
->ob_itself
);
1758 _res
= Py_BuildValue("b",
1763 static PyObject
*MenuObj_GetMenuType(MenuObject
*_self
, PyObject
*_args
)
1765 PyObject
*_res
= NULL
;
1769 PyMac_PRECHECK(GetMenuType
);
1771 if (!PyArg_ParseTuple(_args
, ""))
1773 _err
= GetMenuType(_self
->ob_itself
,
1775 if (_err
!= noErr
) return PyMac_Error(_err
);
1776 _res
= Py_BuildValue("H",
1781 static PyObject
*MenuObj_CountMenuItemsWithCommandID(MenuObject
*_self
, PyObject
*_args
)
1783 PyObject
*_res
= NULL
;
1785 MenuCommand inCommandID
;
1786 #ifndef CountMenuItemsWithCommandID
1787 PyMac_PRECHECK(CountMenuItemsWithCommandID
);
1789 if (!PyArg_ParseTuple(_args
, "l",
1792 _rv
= CountMenuItemsWithCommandID(_self
->ob_itself
,
1794 _res
= Py_BuildValue("l",
1799 static PyObject
*MenuObj_GetIndMenuItemWithCommandID(MenuObject
*_self
, PyObject
*_args
)
1801 PyObject
*_res
= NULL
;
1803 MenuCommand inCommandID
;
1806 MenuItemIndex outIndex
;
1807 #ifndef GetIndMenuItemWithCommandID
1808 PyMac_PRECHECK(GetIndMenuItemWithCommandID
);
1810 if (!PyArg_ParseTuple(_args
, "ll",
1814 _err
= GetIndMenuItemWithCommandID(_self
->ob_itself
,
1819 if (_err
!= noErr
) return PyMac_Error(_err
);
1820 _res
= Py_BuildValue("O&h",
1821 MenuObj_New
, outMenu
,
1826 static PyObject
*MenuObj_EnableMenuCommand(MenuObject
*_self
, PyObject
*_args
)
1828 PyObject
*_res
= NULL
;
1829 MenuCommand inCommandID
;
1830 #ifndef EnableMenuCommand
1831 PyMac_PRECHECK(EnableMenuCommand
);
1833 if (!PyArg_ParseTuple(_args
, "l",
1836 EnableMenuCommand(_self
->ob_itself
,
1843 static PyObject
*MenuObj_DisableMenuCommand(MenuObject
*_self
, PyObject
*_args
)
1845 PyObject
*_res
= NULL
;
1846 MenuCommand inCommandID
;
1847 #ifndef DisableMenuCommand
1848 PyMac_PRECHECK(DisableMenuCommand
);
1850 if (!PyArg_ParseTuple(_args
, "l",
1853 DisableMenuCommand(_self
->ob_itself
,
1860 static PyObject
*MenuObj_IsMenuCommandEnabled(MenuObject
*_self
, PyObject
*_args
)
1862 PyObject
*_res
= NULL
;
1864 MenuCommand inCommandID
;
1865 #ifndef IsMenuCommandEnabled
1866 PyMac_PRECHECK(IsMenuCommandEnabled
);
1868 if (!PyArg_ParseTuple(_args
, "l",
1871 _rv
= IsMenuCommandEnabled(_self
->ob_itself
,
1873 _res
= Py_BuildValue("b",
1878 static PyObject
*MenuObj_SetMenuCommandMark(MenuObject
*_self
, PyObject
*_args
)
1880 PyObject
*_res
= NULL
;
1882 MenuCommand inCommandID
;
1884 #ifndef SetMenuCommandMark
1885 PyMac_PRECHECK(SetMenuCommandMark
);
1887 if (!PyArg_ParseTuple(_args
, "lh",
1891 _err
= SetMenuCommandMark(_self
->ob_itself
,
1894 if (_err
!= noErr
) return PyMac_Error(_err
);
1900 static PyObject
*MenuObj_GetMenuCommandMark(MenuObject
*_self
, PyObject
*_args
)
1902 PyObject
*_res
= NULL
;
1904 MenuCommand inCommandID
;
1906 #ifndef GetMenuCommandMark
1907 PyMac_PRECHECK(GetMenuCommandMark
);
1909 if (!PyArg_ParseTuple(_args
, "l",
1912 _err
= GetMenuCommandMark(_self
->ob_itself
,
1915 if (_err
!= noErr
) return PyMac_Error(_err
);
1916 _res
= Py_BuildValue("h",
1921 static PyObject
*MenuObj_GetMenuCommandPropertySize(MenuObject
*_self
, PyObject
*_args
)
1923 PyObject
*_res
= NULL
;
1925 MenuCommand inCommandID
;
1926 OSType inPropertyCreator
;
1927 OSType inPropertyTag
;
1929 #ifndef GetMenuCommandPropertySize
1930 PyMac_PRECHECK(GetMenuCommandPropertySize
);
1932 if (!PyArg_ParseTuple(_args
, "lO&O&",
1934 PyMac_GetOSType
, &inPropertyCreator
,
1935 PyMac_GetOSType
, &inPropertyTag
))
1937 _err
= GetMenuCommandPropertySize(_self
->ob_itself
,
1942 if (_err
!= noErr
) return PyMac_Error(_err
);
1943 _res
= Py_BuildValue("l",
1948 static PyObject
*MenuObj_RemoveMenuCommandProperty(MenuObject
*_self
, PyObject
*_args
)
1950 PyObject
*_res
= NULL
;
1952 MenuCommand inCommandID
;
1953 OSType inPropertyCreator
;
1954 OSType inPropertyTag
;
1955 #ifndef RemoveMenuCommandProperty
1956 PyMac_PRECHECK(RemoveMenuCommandProperty
);
1958 if (!PyArg_ParseTuple(_args
, "lO&O&",
1960 PyMac_GetOSType
, &inPropertyCreator
,
1961 PyMac_GetOSType
, &inPropertyTag
))
1963 _err
= RemoveMenuCommandProperty(_self
->ob_itself
,
1967 if (_err
!= noErr
) return PyMac_Error(_err
);
1973 static PyObject
*MenuObj_IsMenuItemInvalid(MenuObject
*_self
, PyObject
*_args
)
1975 PyObject
*_res
= NULL
;
1977 MenuItemIndex inItem
;
1978 #ifndef IsMenuItemInvalid
1979 PyMac_PRECHECK(IsMenuItemInvalid
);
1981 if (!PyArg_ParseTuple(_args
, "h",
1984 _rv
= IsMenuItemInvalid(_self
->ob_itself
,
1986 _res
= Py_BuildValue("b",
1991 static PyObject
*MenuObj_InvalidateMenuItems(MenuObject
*_self
, PyObject
*_args
)
1993 PyObject
*_res
= NULL
;
1995 MenuItemIndex inFirstItem
;
1996 ItemCount inNumItems
;
1997 #ifndef InvalidateMenuItems
1998 PyMac_PRECHECK(InvalidateMenuItems
);
2000 if (!PyArg_ParseTuple(_args
, "hl",
2004 _err
= InvalidateMenuItems(_self
->ob_itself
,
2007 if (_err
!= noErr
) return PyMac_Error(_err
);
2013 static PyObject
*MenuObj_UpdateInvalidMenuItems(MenuObject
*_self
, PyObject
*_args
)
2015 PyObject
*_res
= NULL
;
2017 #ifndef UpdateInvalidMenuItems
2018 PyMac_PRECHECK(UpdateInvalidMenuItems
);
2020 if (!PyArg_ParseTuple(_args
, ""))
2022 _err
= UpdateInvalidMenuItems(_self
->ob_itself
);
2023 if (_err
!= noErr
) return PyMac_Error(_err
);
2029 static PyObject
*MenuObj_CreateStandardFontMenu(MenuObject
*_self
, PyObject
*_args
)
2031 PyObject
*_res
= NULL
;
2033 MenuItemIndex afterItem
;
2034 MenuID firstHierMenuID
;
2036 ItemCount outHierMenuCount
;
2037 #ifndef CreateStandardFontMenu
2038 PyMac_PRECHECK(CreateStandardFontMenu
);
2040 if (!PyArg_ParseTuple(_args
, "hhl",
2045 _err
= CreateStandardFontMenu(_self
->ob_itself
,
2050 if (_err
!= noErr
) return PyMac_Error(_err
);
2051 _res
= Py_BuildValue("l",
2056 static PyObject
*MenuObj_UpdateStandardFontMenu(MenuObject
*_self
, PyObject
*_args
)
2058 PyObject
*_res
= NULL
;
2060 ItemCount outHierMenuCount
;
2061 #ifndef UpdateStandardFontMenu
2062 PyMac_PRECHECK(UpdateStandardFontMenu
);
2064 if (!PyArg_ParseTuple(_args
, ""))
2066 _err
= UpdateStandardFontMenu(_self
->ob_itself
,
2068 if (_err
!= noErr
) return PyMac_Error(_err
);
2069 _res
= Py_BuildValue("l",
2074 static PyObject
*MenuObj_GetFontFamilyFromMenuSelection(MenuObject
*_self
, PyObject
*_args
)
2076 PyObject
*_res
= NULL
;
2079 FMFontFamily outFontFamily
;
2080 FMFontStyle outStyle
;
2081 #ifndef GetFontFamilyFromMenuSelection
2082 PyMac_PRECHECK(GetFontFamilyFromMenuSelection
);
2084 if (!PyArg_ParseTuple(_args
, "h",
2087 _err
= GetFontFamilyFromMenuSelection(_self
->ob_itself
,
2091 if (_err
!= noErr
) return PyMac_Error(_err
);
2092 _res
= Py_BuildValue("hh",
2098 static PyObject
*MenuObj_GetMenuID(MenuObject
*_self
, PyObject
*_args
)
2100 PyObject
*_res
= NULL
;
2103 PyMac_PRECHECK(GetMenuID
);
2105 if (!PyArg_ParseTuple(_args
, ""))
2107 _rv
= GetMenuID(_self
->ob_itself
);
2108 _res
= Py_BuildValue("h",
2113 static PyObject
*MenuObj_GetMenuWidth(MenuObject
*_self
, PyObject
*_args
)
2115 PyObject
*_res
= NULL
;
2117 #ifndef GetMenuWidth
2118 PyMac_PRECHECK(GetMenuWidth
);
2120 if (!PyArg_ParseTuple(_args
, ""))
2122 _rv
= GetMenuWidth(_self
->ob_itself
);
2123 _res
= Py_BuildValue("h",
2128 static PyObject
*MenuObj_GetMenuHeight(MenuObject
*_self
, PyObject
*_args
)
2130 PyObject
*_res
= NULL
;
2132 #ifndef GetMenuHeight
2133 PyMac_PRECHECK(GetMenuHeight
);
2135 if (!PyArg_ParseTuple(_args
, ""))
2137 _rv
= GetMenuHeight(_self
->ob_itself
);
2138 _res
= Py_BuildValue("h",
2143 static PyObject
*MenuObj_SetMenuID(MenuObject
*_self
, PyObject
*_args
)
2145 PyObject
*_res
= NULL
;
2148 PyMac_PRECHECK(SetMenuID
);
2150 if (!PyArg_ParseTuple(_args
, "h",
2153 SetMenuID(_self
->ob_itself
,
2160 static PyObject
*MenuObj_SetMenuWidth(MenuObject
*_self
, PyObject
*_args
)
2162 PyObject
*_res
= NULL
;
2164 #ifndef SetMenuWidth
2165 PyMac_PRECHECK(SetMenuWidth
);
2167 if (!PyArg_ParseTuple(_args
, "h",
2170 SetMenuWidth(_self
->ob_itself
,
2177 static PyObject
*MenuObj_SetMenuHeight(MenuObject
*_self
, PyObject
*_args
)
2179 PyObject
*_res
= NULL
;
2181 #ifndef SetMenuHeight
2182 PyMac_PRECHECK(SetMenuHeight
);
2184 if (!PyArg_ParseTuple(_args
, "h",
2187 SetMenuHeight(_self
->ob_itself
,
2194 static PyObject
*MenuObj_as_Resource(MenuObject
*_self
, PyObject
*_args
)
2196 PyObject
*_res
= NULL
;
2199 PyMac_PRECHECK(as_Resource
);
2201 if (!PyArg_ParseTuple(_args
, ""))
2203 _rv
= as_Resource(_self
->ob_itself
);
2204 _res
= Py_BuildValue("O&",
2209 static PyObject
*MenuObj_AppendMenu(MenuObject
*_self
, PyObject
*_args
)
2211 PyObject
*_res
= NULL
;
2214 PyMac_PRECHECK(AppendMenu
);
2216 if (!PyArg_ParseTuple(_args
, "O&",
2217 PyMac_GetStr255
, data
))
2219 AppendMenu(_self
->ob_itself
,
2226 static PyObject
*MenuObj_InsertMenu(MenuObject
*_self
, PyObject
*_args
)
2228 PyObject
*_res
= NULL
;
2231 PyMac_PRECHECK(InsertMenu
);
2233 if (!PyArg_ParseTuple(_args
, "h",
2236 InsertMenu(_self
->ob_itself
,
2243 static PyObject
*MenuObj_InsertMenuItem(MenuObject
*_self
, PyObject
*_args
)
2245 PyObject
*_res
= NULL
;
2248 #ifndef InsertMenuItem
2249 PyMac_PRECHECK(InsertMenuItem
);
2251 if (!PyArg_ParseTuple(_args
, "O&h",
2252 PyMac_GetStr255
, itemString
,
2255 InsertMenuItem(_self
->ob_itself
,
2263 static PyObject
*MenuObj_EnableMenuItem(MenuObject
*_self
, PyObject
*_args
)
2265 PyObject
*_res
= NULL
;
2267 #ifndef EnableMenuItem
2268 PyMac_PRECHECK(EnableMenuItem
);
2270 if (!PyArg_ParseTuple(_args
, "H",
2273 EnableMenuItem(_self
->ob_itself
,
2280 static PyObject
*MenuObj_CheckMenuItem(MenuObject
*_self
, PyObject
*_args
)
2282 PyObject
*_res
= NULL
;
2285 #ifndef CheckMenuItem
2286 PyMac_PRECHECK(CheckMenuItem
);
2288 if (!PyArg_ParseTuple(_args
, "hb",
2292 CheckMenuItem(_self
->ob_itself
,
2300 static PyMethodDef MenuObj_methods
[] = {
2301 {"DisposeMenu", (PyCFunction
)MenuObj_DisposeMenu
, 1,
2302 PyDoc_STR("() -> None")},
2303 {"CalcMenuSize", (PyCFunction
)MenuObj_CalcMenuSize
, 1,
2304 PyDoc_STR("() -> None")},
2305 {"CountMenuItems", (PyCFunction
)MenuObj_CountMenuItems
, 1,
2306 PyDoc_STR("() -> (UInt16 _rv)")},
2307 {"GetMenuFont", (PyCFunction
)MenuObj_GetMenuFont
, 1,
2308 PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")},
2309 {"SetMenuFont", (PyCFunction
)MenuObj_SetMenuFont
, 1,
2310 PyDoc_STR("(SInt16 inFontID, UInt16 inFontSize) -> None")},
2311 {"GetMenuExcludesMarkColumn", (PyCFunction
)MenuObj_GetMenuExcludesMarkColumn
, 1,
2312 PyDoc_STR("() -> (Boolean _rv)")},
2313 {"SetMenuExcludesMarkColumn", (PyCFunction
)MenuObj_SetMenuExcludesMarkColumn
, 1,
2314 PyDoc_STR("(Boolean excludesMark) -> None")},
2315 {"IsValidMenu", (PyCFunction
)MenuObj_IsValidMenu
, 1,
2316 PyDoc_STR("() -> (Boolean _rv)")},
2317 {"GetMenuRetainCount", (PyCFunction
)MenuObj_GetMenuRetainCount
, 1,
2318 PyDoc_STR("() -> (ItemCount _rv)")},
2319 {"RetainMenu", (PyCFunction
)MenuObj_RetainMenu
, 1,
2320 PyDoc_STR("() -> None")},
2321 {"ReleaseMenu", (PyCFunction
)MenuObj_ReleaseMenu
, 1,
2322 PyDoc_STR("() -> None")},
2323 {"DuplicateMenu", (PyCFunction
)MenuObj_DuplicateMenu
, 1,
2324 PyDoc_STR("() -> (MenuHandle outMenu)")},
2325 {"CopyMenuTitleAsCFString", (PyCFunction
)MenuObj_CopyMenuTitleAsCFString
, 1,
2326 PyDoc_STR("() -> (CFStringRef outString)")},
2327 {"SetMenuTitleWithCFString", (PyCFunction
)MenuObj_SetMenuTitleWithCFString
, 1,
2328 PyDoc_STR("(CFStringRef inString) -> None")},
2329 {"InvalidateMenuSize", (PyCFunction
)MenuObj_InvalidateMenuSize
, 1,
2330 PyDoc_STR("() -> None")},
2331 {"IsMenuSizeInvalid", (PyCFunction
)MenuObj_IsMenuSizeInvalid
, 1,
2332 PyDoc_STR("() -> (Boolean _rv)")},
2333 {"MacAppendMenu", (PyCFunction
)MenuObj_MacAppendMenu
, 1,
2334 PyDoc_STR("(Str255 data) -> None")},
2335 {"InsertResMenu", (PyCFunction
)MenuObj_InsertResMenu
, 1,
2336 PyDoc_STR("(ResType theType, short afterItem) -> None")},
2337 {"AppendResMenu", (PyCFunction
)MenuObj_AppendResMenu
, 1,
2338 PyDoc_STR("(ResType theType) -> None")},
2339 {"MacInsertMenuItem", (PyCFunction
)MenuObj_MacInsertMenuItem
, 1,
2340 PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
2341 {"DeleteMenuItem", (PyCFunction
)MenuObj_DeleteMenuItem
, 1,
2342 PyDoc_STR("(short item) -> None")},
2343 {"InsertFontResMenu", (PyCFunction
)MenuObj_InsertFontResMenu
, 1,
2344 PyDoc_STR("(short afterItem, short scriptFilter) -> None")},
2345 {"InsertIntlResMenu", (PyCFunction
)MenuObj_InsertIntlResMenu
, 1,
2346 PyDoc_STR("(ResType theType, short afterItem, short scriptFilter) -> None")},
2347 {"AppendMenuItemText", (PyCFunction
)MenuObj_AppendMenuItemText
, 1,
2348 PyDoc_STR("(Str255 inString) -> None")},
2349 {"InsertMenuItemText", (PyCFunction
)MenuObj_InsertMenuItemText
, 1,
2350 PyDoc_STR("(Str255 inString, MenuItemIndex afterItem) -> None")},
2351 {"CopyMenuItems", (PyCFunction
)MenuObj_CopyMenuItems
, 1,
2352 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems, MenuHandle inDestMenu, MenuItemIndex inInsertAfter) -> None")},
2353 {"DeleteMenuItems", (PyCFunction
)MenuObj_DeleteMenuItems
, 1,
2354 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
2355 {"AppendMenuItemTextWithCFString", (PyCFunction
)MenuObj_AppendMenuItemTextWithCFString
, 1,
2356 PyDoc_STR("(CFStringRef inString, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> (MenuItemIndex outNewItem)")},
2357 {"InsertMenuItemTextWithCFString", (PyCFunction
)MenuObj_InsertMenuItemTextWithCFString
, 1,
2358 PyDoc_STR("(CFStringRef inString, MenuItemIndex inAfterItem, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> None")},
2359 {"PopUpMenuSelect", (PyCFunction
)MenuObj_PopUpMenuSelect
, 1,
2360 PyDoc_STR("(short top, short left, short popUpItem) -> (long _rv)")},
2361 {"InvalidateMenuEnabling", (PyCFunction
)MenuObj_InvalidateMenuEnabling
, 1,
2362 PyDoc_STR("() -> None")},
2363 {"IsMenuBarInvalid", (PyCFunction
)MenuObj_IsMenuBarInvalid
, 1,
2364 PyDoc_STR("() -> (Boolean _rv)")},
2365 {"MacInsertMenu", (PyCFunction
)MenuObj_MacInsertMenu
, 1,
2366 PyDoc_STR("(MenuID beforeID) -> None")},
2367 {"SetRootMenu", (PyCFunction
)MenuObj_SetRootMenu
, 1,
2368 PyDoc_STR("() -> None")},
2369 {"MacCheckMenuItem", (PyCFunction
)MenuObj_MacCheckMenuItem
, 1,
2370 PyDoc_STR("(short item, Boolean checked) -> None")},
2371 {"SetMenuItemText", (PyCFunction
)MenuObj_SetMenuItemText
, 1,
2372 PyDoc_STR("(short item, Str255 itemString) -> None")},
2373 {"GetMenuItemText", (PyCFunction
)MenuObj_GetMenuItemText
, 1,
2374 PyDoc_STR("(short item) -> (Str255 itemString)")},
2375 {"SetItemMark", (PyCFunction
)MenuObj_SetItemMark
, 1,
2376 PyDoc_STR("(short item, CharParameter markChar) -> None")},
2377 {"GetItemMark", (PyCFunction
)MenuObj_GetItemMark
, 1,
2378 PyDoc_STR("(short item) -> (CharParameter markChar)")},
2379 {"SetItemCmd", (PyCFunction
)MenuObj_SetItemCmd
, 1,
2380 PyDoc_STR("(short item, CharParameter cmdChar) -> None")},
2381 {"GetItemCmd", (PyCFunction
)MenuObj_GetItemCmd
, 1,
2382 PyDoc_STR("(short item) -> (CharParameter cmdChar)")},
2383 {"SetItemIcon", (PyCFunction
)MenuObj_SetItemIcon
, 1,
2384 PyDoc_STR("(short item, short iconIndex) -> None")},
2385 {"GetItemIcon", (PyCFunction
)MenuObj_GetItemIcon
, 1,
2386 PyDoc_STR("(short item) -> (short iconIndex)")},
2387 {"SetItemStyle", (PyCFunction
)MenuObj_SetItemStyle
, 1,
2388 PyDoc_STR("(short item, StyleParameter chStyle) -> None")},
2389 {"GetItemStyle", (PyCFunction
)MenuObj_GetItemStyle
, 1,
2390 PyDoc_STR("(short item) -> (Style chStyle)")},
2391 {"SetMenuItemCommandID", (PyCFunction
)MenuObj_SetMenuItemCommandID
, 1,
2392 PyDoc_STR("(SInt16 inItem, MenuCommand inCommandID) -> None")},
2393 {"GetMenuItemCommandID", (PyCFunction
)MenuObj_GetMenuItemCommandID
, 1,
2394 PyDoc_STR("(SInt16 inItem) -> (MenuCommand outCommandID)")},
2395 {"SetMenuItemModifiers", (PyCFunction
)MenuObj_SetMenuItemModifiers
, 1,
2396 PyDoc_STR("(SInt16 inItem, UInt8 inModifiers) -> None")},
2397 {"GetMenuItemModifiers", (PyCFunction
)MenuObj_GetMenuItemModifiers
, 1,
2398 PyDoc_STR("(SInt16 inItem) -> (UInt8 outModifiers)")},
2399 {"SetMenuItemIconHandle", (PyCFunction
)MenuObj_SetMenuItemIconHandle
, 1,
2400 PyDoc_STR("(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None")},
2401 {"GetMenuItemIconHandle", (PyCFunction
)MenuObj_GetMenuItemIconHandle
, 1,
2402 PyDoc_STR("(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)")},
2403 {"SetMenuItemTextEncoding", (PyCFunction
)MenuObj_SetMenuItemTextEncoding
, 1,
2404 PyDoc_STR("(SInt16 inItem, TextEncoding inScriptID) -> None")},
2405 {"GetMenuItemTextEncoding", (PyCFunction
)MenuObj_GetMenuItemTextEncoding
, 1,
2406 PyDoc_STR("(SInt16 inItem) -> (TextEncoding outScriptID)")},
2407 {"SetMenuItemHierarchicalID", (PyCFunction
)MenuObj_SetMenuItemHierarchicalID
, 1,
2408 PyDoc_STR("(SInt16 inItem, MenuID inHierID) -> None")},
2409 {"GetMenuItemHierarchicalID", (PyCFunction
)MenuObj_GetMenuItemHierarchicalID
, 1,
2410 PyDoc_STR("(SInt16 inItem) -> (MenuID outHierID)")},
2411 {"SetMenuItemFontID", (PyCFunction
)MenuObj_SetMenuItemFontID
, 1,
2412 PyDoc_STR("(SInt16 inItem, SInt16 inFontID) -> None")},
2413 {"GetMenuItemFontID", (PyCFunction
)MenuObj_GetMenuItemFontID
, 1,
2414 PyDoc_STR("(SInt16 inItem) -> (SInt16 outFontID)")},
2415 {"SetMenuItemRefCon", (PyCFunction
)MenuObj_SetMenuItemRefCon
, 1,
2416 PyDoc_STR("(SInt16 inItem, UInt32 inRefCon) -> None")},
2417 {"GetMenuItemRefCon", (PyCFunction
)MenuObj_GetMenuItemRefCon
, 1,
2418 PyDoc_STR("(SInt16 inItem) -> (UInt32 outRefCon)")},
2419 {"SetMenuItemKeyGlyph", (PyCFunction
)MenuObj_SetMenuItemKeyGlyph
, 1,
2420 PyDoc_STR("(SInt16 inItem, SInt16 inGlyph) -> None")},
2421 {"GetMenuItemKeyGlyph", (PyCFunction
)MenuObj_GetMenuItemKeyGlyph
, 1,
2422 PyDoc_STR("(SInt16 inItem) -> (SInt16 outGlyph)")},
2423 {"MacEnableMenuItem", (PyCFunction
)MenuObj_MacEnableMenuItem
, 1,
2424 PyDoc_STR("(MenuItemIndex item) -> None")},
2425 {"DisableMenuItem", (PyCFunction
)MenuObj_DisableMenuItem
, 1,
2426 PyDoc_STR("(MenuItemIndex item) -> None")},
2427 {"IsMenuItemEnabled", (PyCFunction
)MenuObj_IsMenuItemEnabled
, 1,
2428 PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
2429 {"EnableMenuItemIcon", (PyCFunction
)MenuObj_EnableMenuItemIcon
, 1,
2430 PyDoc_STR("(MenuItemIndex item) -> None")},
2431 {"DisableMenuItemIcon", (PyCFunction
)MenuObj_DisableMenuItemIcon
, 1,
2432 PyDoc_STR("(MenuItemIndex item) -> None")},
2433 {"IsMenuItemIconEnabled", (PyCFunction
)MenuObj_IsMenuItemIconEnabled
, 1,
2434 PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
2435 {"SetMenuItemHierarchicalMenu", (PyCFunction
)MenuObj_SetMenuItemHierarchicalMenu
, 1,
2436 PyDoc_STR("(MenuItemIndex inItem, MenuHandle inHierMenu) -> None")},
2437 {"GetMenuItemHierarchicalMenu", (PyCFunction
)MenuObj_GetMenuItemHierarchicalMenu
, 1,
2438 PyDoc_STR("(MenuItemIndex inItem) -> (MenuHandle outHierMenu)")},
2439 {"CopyMenuItemTextAsCFString", (PyCFunction
)MenuObj_CopyMenuItemTextAsCFString
, 1,
2440 PyDoc_STR("(MenuItemIndex inItem) -> (CFStringRef outString)")},
2441 {"SetMenuItemTextWithCFString", (PyCFunction
)MenuObj_SetMenuItemTextWithCFString
, 1,
2442 PyDoc_STR("(MenuItemIndex inItem, CFStringRef inString) -> None")},
2443 {"GetMenuItemIndent", (PyCFunction
)MenuObj_GetMenuItemIndent
, 1,
2444 PyDoc_STR("(MenuItemIndex inItem) -> (UInt32 outIndent)")},
2445 {"SetMenuItemIndent", (PyCFunction
)MenuObj_SetMenuItemIndent
, 1,
2446 PyDoc_STR("(MenuItemIndex inItem, UInt32 inIndent) -> None")},
2447 {"GetMenuItemCommandKey", (PyCFunction
)MenuObj_GetMenuItemCommandKey
, 1,
2448 PyDoc_STR("(MenuItemIndex inItem, Boolean inGetVirtualKey) -> (UInt16 outKey)")},
2449 {"SetMenuItemCommandKey", (PyCFunction
)MenuObj_SetMenuItemCommandKey
, 1,
2450 PyDoc_STR("(MenuItemIndex inItem, Boolean inSetVirtualKey, UInt16 inKey) -> None")},
2451 {"GetMenuItemPropertyAttributes", (PyCFunction
)MenuObj_GetMenuItemPropertyAttributes
, 1,
2452 PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
2453 {"ChangeMenuItemPropertyAttributes", (PyCFunction
)MenuObj_ChangeMenuItemPropertyAttributes
, 1,
2454 PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
2455 {"GetMenuAttributes", (PyCFunction
)MenuObj_GetMenuAttributes
, 1,
2456 PyDoc_STR("() -> (MenuAttributes outAttributes)")},
2457 {"ChangeMenuAttributes", (PyCFunction
)MenuObj_ChangeMenuAttributes
, 1,
2458 PyDoc_STR("(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None")},
2459 {"GetMenuItemAttributes", (PyCFunction
)MenuObj_GetMenuItemAttributes
, 1,
2460 PyDoc_STR("(MenuItemIndex item) -> (MenuItemAttributes outAttributes)")},
2461 {"ChangeMenuItemAttributes", (PyCFunction
)MenuObj_ChangeMenuItemAttributes
, 1,
2462 PyDoc_STR("(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None")},
2463 {"DisableAllMenuItems", (PyCFunction
)MenuObj_DisableAllMenuItems
, 1,
2464 PyDoc_STR("() -> None")},
2465 {"EnableAllMenuItems", (PyCFunction
)MenuObj_EnableAllMenuItems
, 1,
2466 PyDoc_STR("() -> None")},
2467 {"MenuHasEnabledItems", (PyCFunction
)MenuObj_MenuHasEnabledItems
, 1,
2468 PyDoc_STR("() -> (Boolean _rv)")},
2469 {"GetMenuType", (PyCFunction
)MenuObj_GetMenuType
, 1,
2470 PyDoc_STR("() -> (UInt16 outType)")},
2471 {"CountMenuItemsWithCommandID", (PyCFunction
)MenuObj_CountMenuItemsWithCommandID
, 1,
2472 PyDoc_STR("(MenuCommand inCommandID) -> (ItemCount _rv)")},
2473 {"GetIndMenuItemWithCommandID", (PyCFunction
)MenuObj_GetIndMenuItemWithCommandID
, 1,
2474 PyDoc_STR("(MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
2475 {"EnableMenuCommand", (PyCFunction
)MenuObj_EnableMenuCommand
, 1,
2476 PyDoc_STR("(MenuCommand inCommandID) -> None")},
2477 {"DisableMenuCommand", (PyCFunction
)MenuObj_DisableMenuCommand
, 1,
2478 PyDoc_STR("(MenuCommand inCommandID) -> None")},
2479 {"IsMenuCommandEnabled", (PyCFunction
)MenuObj_IsMenuCommandEnabled
, 1,
2480 PyDoc_STR("(MenuCommand inCommandID) -> (Boolean _rv)")},
2481 {"SetMenuCommandMark", (PyCFunction
)MenuObj_SetMenuCommandMark
, 1,
2482 PyDoc_STR("(MenuCommand inCommandID, UniChar inMark) -> None")},
2483 {"GetMenuCommandMark", (PyCFunction
)MenuObj_GetMenuCommandMark
, 1,
2484 PyDoc_STR("(MenuCommand inCommandID) -> (UniChar outMark)")},
2485 {"GetMenuCommandPropertySize", (PyCFunction
)MenuObj_GetMenuCommandPropertySize
, 1,
2486 PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
2487 {"RemoveMenuCommandProperty", (PyCFunction
)MenuObj_RemoveMenuCommandProperty
, 1,
2488 PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
2489 {"IsMenuItemInvalid", (PyCFunction
)MenuObj_IsMenuItemInvalid
, 1,
2490 PyDoc_STR("(MenuItemIndex inItem) -> (Boolean _rv)")},
2491 {"InvalidateMenuItems", (PyCFunction
)MenuObj_InvalidateMenuItems
, 1,
2492 PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
2493 {"UpdateInvalidMenuItems", (PyCFunction
)MenuObj_UpdateInvalidMenuItems
, 1,
2494 PyDoc_STR("() -> None")},
2495 {"CreateStandardFontMenu", (PyCFunction
)MenuObj_CreateStandardFontMenu
, 1,
2496 PyDoc_STR("(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)")},
2497 {"UpdateStandardFontMenu", (PyCFunction
)MenuObj_UpdateStandardFontMenu
, 1,
2498 PyDoc_STR("() -> (ItemCount outHierMenuCount)")},
2499 {"GetFontFamilyFromMenuSelection", (PyCFunction
)MenuObj_GetFontFamilyFromMenuSelection
, 1,
2500 PyDoc_STR("(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)")},
2501 {"GetMenuID", (PyCFunction
)MenuObj_GetMenuID
, 1,
2502 PyDoc_STR("() -> (MenuID _rv)")},
2503 {"GetMenuWidth", (PyCFunction
)MenuObj_GetMenuWidth
, 1,
2504 PyDoc_STR("() -> (SInt16 _rv)")},
2505 {"GetMenuHeight", (PyCFunction
)MenuObj_GetMenuHeight
, 1,
2506 PyDoc_STR("() -> (SInt16 _rv)")},
2507 {"SetMenuID", (PyCFunction
)MenuObj_SetMenuID
, 1,
2508 PyDoc_STR("(MenuID menuID) -> None")},
2509 {"SetMenuWidth", (PyCFunction
)MenuObj_SetMenuWidth
, 1,
2510 PyDoc_STR("(SInt16 width) -> None")},
2511 {"SetMenuHeight", (PyCFunction
)MenuObj_SetMenuHeight
, 1,
2512 PyDoc_STR("(SInt16 height) -> None")},
2513 {"as_Resource", (PyCFunction
)MenuObj_as_Resource
, 1,
2514 PyDoc_STR("() -> (Handle _rv)")},
2515 {"AppendMenu", (PyCFunction
)MenuObj_AppendMenu
, 1,
2516 PyDoc_STR("(Str255 data) -> None")},
2517 {"InsertMenu", (PyCFunction
)MenuObj_InsertMenu
, 1,
2518 PyDoc_STR("(short beforeID) -> None")},
2519 {"InsertMenuItem", (PyCFunction
)MenuObj_InsertMenuItem
, 1,
2520 PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
2521 {"EnableMenuItem", (PyCFunction
)MenuObj_EnableMenuItem
, 1,
2522 PyDoc_STR("(UInt16 item) -> None")},
2523 {"CheckMenuItem", (PyCFunction
)MenuObj_CheckMenuItem
, 1,
2524 PyDoc_STR("(short item, Boolean checked) -> None")},
2528 #define MenuObj_getsetlist NULL
2531 #define MenuObj_compare NULL
2533 #define MenuObj_repr NULL
2535 #define MenuObj_hash NULL
2536 #define MenuObj_tp_init 0
2538 #define MenuObj_tp_alloc PyType_GenericAlloc
2540 static PyObject
*MenuObj_tp_new(PyTypeObject
*type
, PyObject
*_args
, PyObject
*_kwds
)
2544 char *kw
[] = {"itself", 0};
2546 if (!PyArg_ParseTupleAndKeywords(_args
, _kwds
, "O&", kw
, MenuObj_Convert
, &itself
)) return NULL
;
2547 if ((_self
= type
->tp_alloc(type
, 0)) == NULL
) return NULL
;
2548 ((MenuObject
*)_self
)->ob_itself
= itself
;
2552 #define MenuObj_tp_free PyObject_Del
2555 PyTypeObject Menu_Type
= {
2556 PyObject_HEAD_INIT(NULL
)
2558 "_Menu.Menu", /*tp_name*/
2559 sizeof(MenuObject
), /*tp_basicsize*/
2562 (destructor
) MenuObj_dealloc
, /*tp_dealloc*/
2564 (getattrfunc
)0, /*tp_getattr*/
2565 (setattrfunc
)0, /*tp_setattr*/
2566 (cmpfunc
) MenuObj_compare
, /*tp_compare*/
2567 (reprfunc
) MenuObj_repr
, /*tp_repr*/
2568 (PyNumberMethods
*)0, /* tp_as_number */
2569 (PySequenceMethods
*)0, /* tp_as_sequence */
2570 (PyMappingMethods
*)0, /* tp_as_mapping */
2571 (hashfunc
) MenuObj_hash
, /*tp_hash*/
2574 PyObject_GenericGetAttr
, /*tp_getattro*/
2575 PyObject_GenericSetAttr
, /*tp_setattro */
2577 Py_TPFLAGS_DEFAULT
|Py_TPFLAGS_BASETYPE
, /* tp_flags */
2581 0, /*tp_richcompare*/
2582 0, /*tp_weaklistoffset*/
2585 MenuObj_methods
, /* tp_methods */
2587 MenuObj_getsetlist
, /*tp_getset*/
2592 0, /*tp_dictoffset*/
2593 MenuObj_tp_init
, /* tp_init */
2594 MenuObj_tp_alloc
, /* tp_alloc */
2595 MenuObj_tp_new
, /* tp_new */
2596 MenuObj_tp_free
, /* tp_free */
2599 /* ---------------------- End object type Menu ---------------------- */
2602 static PyObject
*Menu_NewMenu(PyObject
*_self
, PyObject
*_args
)
2604 PyObject
*_res
= NULL
;
2609 PyMac_PRECHECK(NewMenu
);
2611 if (!PyArg_ParseTuple(_args
, "hO&",
2613 PyMac_GetStr255
, menuTitle
))
2615 _rv
= NewMenu(menuID
,
2617 _res
= Py_BuildValue("O&",
2622 static PyObject
*Menu_MacGetMenu(PyObject
*_self
, PyObject
*_args
)
2624 PyObject
*_res
= NULL
;
2628 PyMac_PRECHECK(MacGetMenu
);
2630 if (!PyArg_ParseTuple(_args
, "h",
2633 _rv
= MacGetMenu(resourceID
);
2634 _res
= Py_BuildValue("O&",
2639 static PyObject
*Menu_CreateNewMenu(PyObject
*_self
, PyObject
*_args
)
2641 PyObject
*_res
= NULL
;
2644 MenuAttributes inMenuAttributes
;
2645 MenuHandle outMenuRef
;
2646 #ifndef CreateNewMenu
2647 PyMac_PRECHECK(CreateNewMenu
);
2649 if (!PyArg_ParseTuple(_args
, "hl",
2653 _err
= CreateNewMenu(inMenuID
,
2656 if (_err
!= noErr
) return PyMac_Error(_err
);
2657 _res
= Py_BuildValue("O&",
2658 MenuObj_New
, outMenuRef
);
2662 static PyObject
*Menu_MenuKey(PyObject
*_self
, PyObject
*_args
)
2664 PyObject
*_res
= NULL
;
2668 PyMac_PRECHECK(MenuKey
);
2670 if (!PyArg_ParseTuple(_args
, "h",
2674 _res
= Py_BuildValue("l",
2679 static PyObject
*Menu_MenuSelect(PyObject
*_self
, PyObject
*_args
)
2681 PyObject
*_res
= NULL
;
2685 PyMac_PRECHECK(MenuSelect
);
2687 if (!PyArg_ParseTuple(_args
, "O&",
2688 PyMac_GetPoint
, &startPt
))
2690 _rv
= MenuSelect(startPt
);
2691 _res
= Py_BuildValue("l",
2696 static PyObject
*Menu_MenuChoice(PyObject
*_self
, PyObject
*_args
)
2698 PyObject
*_res
= NULL
;
2701 PyMac_PRECHECK(MenuChoice
);
2703 if (!PyArg_ParseTuple(_args
, ""))
2706 _res
= Py_BuildValue("l",
2711 static PyObject
*Menu_MenuEvent(PyObject
*_self
, PyObject
*_args
)
2713 PyObject
*_res
= NULL
;
2715 EventRecord inEvent
;
2717 PyMac_PRECHECK(MenuEvent
);
2719 if (!PyArg_ParseTuple(_args
, "O&",
2720 PyMac_GetEventRecord
, &inEvent
))
2722 _rv
= MenuEvent(&inEvent
);
2723 _res
= Py_BuildValue("l",
2728 static PyObject
*Menu_GetMBarHeight(PyObject
*_self
, PyObject
*_args
)
2730 PyObject
*_res
= NULL
;
2732 #ifndef GetMBarHeight
2733 PyMac_PRECHECK(GetMBarHeight
);
2735 if (!PyArg_ParseTuple(_args
, ""))
2737 _rv
= GetMBarHeight();
2738 _res
= Py_BuildValue("h",
2743 static PyObject
*Menu_MacDrawMenuBar(PyObject
*_self
, PyObject
*_args
)
2745 PyObject
*_res
= NULL
;
2746 #ifndef MacDrawMenuBar
2747 PyMac_PRECHECK(MacDrawMenuBar
);
2749 if (!PyArg_ParseTuple(_args
, ""))
2757 static PyObject
*Menu_InvalMenuBar(PyObject
*_self
, PyObject
*_args
)
2759 PyObject
*_res
= NULL
;
2760 #ifndef InvalMenuBar
2761 PyMac_PRECHECK(InvalMenuBar
);
2763 if (!PyArg_ParseTuple(_args
, ""))
2771 static PyObject
*Menu_HiliteMenu(PyObject
*_self
, PyObject
*_args
)
2773 PyObject
*_res
= NULL
;
2776 PyMac_PRECHECK(HiliteMenu
);
2778 if (!PyArg_ParseTuple(_args
, "h",
2787 static PyObject
*Menu_GetNewMBar(PyObject
*_self
, PyObject
*_args
)
2789 PyObject
*_res
= NULL
;
2793 PyMac_PRECHECK(GetNewMBar
);
2795 if (!PyArg_ParseTuple(_args
, "h",
2798 _rv
= GetNewMBar(menuBarID
);
2799 _res
= Py_BuildValue("O&",
2804 static PyObject
*Menu_GetMenuBar(PyObject
*_self
, PyObject
*_args
)
2806 PyObject
*_res
= NULL
;
2809 PyMac_PRECHECK(GetMenuBar
);
2811 if (!PyArg_ParseTuple(_args
, ""))
2814 _res
= Py_BuildValue("O&",
2819 static PyObject
*Menu_SetMenuBar(PyObject
*_self
, PyObject
*_args
)
2821 PyObject
*_res
= NULL
;
2824 PyMac_PRECHECK(SetMenuBar
);
2826 if (!PyArg_ParseTuple(_args
, "O&",
2827 ResObj_Convert
, &mbar
))
2835 static PyObject
*Menu_DuplicateMenuBar(PyObject
*_self
, PyObject
*_args
)
2837 PyObject
*_res
= NULL
;
2839 MenuBarHandle inMbar
;
2840 MenuBarHandle outMbar
;
2841 #ifndef DuplicateMenuBar
2842 PyMac_PRECHECK(DuplicateMenuBar
);
2844 if (!PyArg_ParseTuple(_args
, "O&",
2845 ResObj_Convert
, &inMbar
))
2847 _err
= DuplicateMenuBar(inMbar
,
2849 if (_err
!= noErr
) return PyMac_Error(_err
);
2850 _res
= Py_BuildValue("O&",
2851 ResObj_New
, outMbar
);
2855 static PyObject
*Menu_DisposeMenuBar(PyObject
*_self
, PyObject
*_args
)
2857 PyObject
*_res
= NULL
;
2859 MenuBarHandle inMbar
;
2860 #ifndef DisposeMenuBar
2861 PyMac_PRECHECK(DisposeMenuBar
);
2863 if (!PyArg_ParseTuple(_args
, "O&",
2864 ResObj_Convert
, &inMbar
))
2866 _err
= DisposeMenuBar(inMbar
);
2867 if (_err
!= noErr
) return PyMac_Error(_err
);
2873 static PyObject
*Menu_GetMenuHandle(PyObject
*_self
, PyObject
*_args
)
2875 PyObject
*_res
= NULL
;
2878 #ifndef GetMenuHandle
2879 PyMac_PRECHECK(GetMenuHandle
);
2881 if (!PyArg_ParseTuple(_args
, "h",
2884 _rv
= GetMenuHandle(menuID
);
2885 _res
= Py_BuildValue("O&",
2890 static PyObject
*Menu_MacDeleteMenu(PyObject
*_self
, PyObject
*_args
)
2892 PyObject
*_res
= NULL
;
2894 #ifndef MacDeleteMenu
2895 PyMac_PRECHECK(MacDeleteMenu
);
2897 if (!PyArg_ParseTuple(_args
, "h",
2900 MacDeleteMenu(menuID
);
2906 static PyObject
*Menu_ClearMenuBar(PyObject
*_self
, PyObject
*_args
)
2908 PyObject
*_res
= NULL
;
2909 #ifndef ClearMenuBar
2910 PyMac_PRECHECK(ClearMenuBar
);
2912 if (!PyArg_ParseTuple(_args
, ""))
2920 static PyObject
*Menu_SetMenuFlashCount(PyObject
*_self
, PyObject
*_args
)
2922 PyObject
*_res
= NULL
;
2924 #ifndef SetMenuFlashCount
2925 PyMac_PRECHECK(SetMenuFlashCount
);
2927 if (!PyArg_ParseTuple(_args
, "h",
2930 SetMenuFlashCount(count
);
2936 static PyObject
*Menu_FlashMenuBar(PyObject
*_self
, PyObject
*_args
)
2938 PyObject
*_res
= NULL
;
2940 #ifndef FlashMenuBar
2941 PyMac_PRECHECK(FlashMenuBar
);
2943 if (!PyArg_ParseTuple(_args
, "h",
2946 FlashMenuBar(menuID
);
2952 static PyObject
*Menu_IsMenuBarVisible(PyObject
*_self
, PyObject
*_args
)
2954 PyObject
*_res
= NULL
;
2956 #ifndef IsMenuBarVisible
2957 PyMac_PRECHECK(IsMenuBarVisible
);
2959 if (!PyArg_ParseTuple(_args
, ""))
2961 _rv
= IsMenuBarVisible();
2962 _res
= Py_BuildValue("b",
2967 static PyObject
*Menu_ShowMenuBar(PyObject
*_self
, PyObject
*_args
)
2969 PyObject
*_res
= NULL
;
2971 PyMac_PRECHECK(ShowMenuBar
);
2973 if (!PyArg_ParseTuple(_args
, ""))
2981 static PyObject
*Menu_HideMenuBar(PyObject
*_self
, PyObject
*_args
)
2983 PyObject
*_res
= NULL
;
2985 PyMac_PRECHECK(HideMenuBar
);
2987 if (!PyArg_ParseTuple(_args
, ""))
2995 static PyObject
*Menu_AcquireRootMenu(PyObject
*_self
, PyObject
*_args
)
2997 PyObject
*_res
= NULL
;
2999 #ifndef AcquireRootMenu
3000 PyMac_PRECHECK(AcquireRootMenu
);
3002 if (!PyArg_ParseTuple(_args
, ""))
3004 _rv
= AcquireRootMenu();
3005 _res
= Py_BuildValue("O&",
3010 static PyObject
*Menu_DeleteMCEntries(PyObject
*_self
, PyObject
*_args
)
3012 PyObject
*_res
= NULL
;
3015 #ifndef DeleteMCEntries
3016 PyMac_PRECHECK(DeleteMCEntries
);
3018 if (!PyArg_ParseTuple(_args
, "hh",
3022 DeleteMCEntries(menuID
,
3029 static PyObject
*Menu_InitContextualMenus(PyObject
*_self
, PyObject
*_args
)
3031 PyObject
*_res
= NULL
;
3033 #ifndef InitContextualMenus
3034 PyMac_PRECHECK(InitContextualMenus
);
3036 if (!PyArg_ParseTuple(_args
, ""))
3038 _err
= InitContextualMenus();
3039 if (_err
!= noErr
) return PyMac_Error(_err
);
3045 static PyObject
*Menu_IsShowContextualMenuClick(PyObject
*_self
, PyObject
*_args
)
3047 PyObject
*_res
= NULL
;
3049 EventRecord inEvent
;
3050 #ifndef IsShowContextualMenuClick
3051 PyMac_PRECHECK(IsShowContextualMenuClick
);
3053 if (!PyArg_ParseTuple(_args
, "O&",
3054 PyMac_GetEventRecord
, &inEvent
))
3056 _rv
= IsShowContextualMenuClick(&inEvent
);
3057 _res
= Py_BuildValue("b",
3062 static PyObject
*Menu_LMGetTheMenu(PyObject
*_self
, PyObject
*_args
)
3064 PyObject
*_res
= NULL
;
3066 #ifndef LMGetTheMenu
3067 PyMac_PRECHECK(LMGetTheMenu
);
3069 if (!PyArg_ParseTuple(_args
, ""))
3071 _rv
= LMGetTheMenu();
3072 _res
= Py_BuildValue("h",
3077 static PyObject
*Menu_as_Menu(PyObject
*_self
, PyObject
*_args
)
3079 PyObject
*_res
= NULL
;
3083 PyMac_PRECHECK(as_Menu
);
3085 if (!PyArg_ParseTuple(_args
, "O&",
3086 ResObj_Convert
, &h
))
3089 _res
= Py_BuildValue("O&",
3094 static PyObject
*Menu_GetMenu(PyObject
*_self
, PyObject
*_args
)
3096 PyObject
*_res
= NULL
;
3100 PyMac_PRECHECK(GetMenu
);
3102 if (!PyArg_ParseTuple(_args
, "h",
3105 _rv
= GetMenu(resourceID
);
3106 _res
= Py_BuildValue("O&",
3111 static PyObject
*Menu_DeleteMenu(PyObject
*_self
, PyObject
*_args
)
3113 PyObject
*_res
= NULL
;
3116 PyMac_PRECHECK(DeleteMenu
);
3118 if (!PyArg_ParseTuple(_args
, "h",
3127 static PyObject
*Menu_DrawMenuBar(PyObject
*_self
, PyObject
*_args
)
3129 PyObject
*_res
= NULL
;
3131 PyMac_PRECHECK(DrawMenuBar
);
3133 if (!PyArg_ParseTuple(_args
, ""))
3141 static PyObject
*Menu_CountMenuItemsWithCommandID(PyObject
*_self
, PyObject
*_args
)
3143 PyObject
*_res
= NULL
;
3146 MenuCommand inCommandID
;
3147 #ifndef CountMenuItemsWithCommandID
3148 PyMac_PRECHECK(CountMenuItemsWithCommandID
);
3150 if (!PyArg_ParseTuple(_args
, "O&l",
3151 OptMenuObj_Convert
, &inMenu
,
3154 _rv
= CountMenuItemsWithCommandID(inMenu
,
3156 _res
= Py_BuildValue("l",
3161 static PyObject
*Menu_GetIndMenuItemWithCommandID(PyObject
*_self
, PyObject
*_args
)
3163 PyObject
*_res
= NULL
;
3166 MenuCommand inCommandID
;
3169 MenuItemIndex outIndex
;
3170 #ifndef GetIndMenuItemWithCommandID
3171 PyMac_PRECHECK(GetIndMenuItemWithCommandID
);
3173 if (!PyArg_ParseTuple(_args
, "O&ll",
3174 OptMenuObj_Convert
, &inMenu
,
3178 _err
= GetIndMenuItemWithCommandID(inMenu
,
3183 if (_err
!= noErr
) return PyMac_Error(_err
);
3184 _res
= Py_BuildValue("O&h",
3185 MenuObj_New
, outMenu
,
3190 static PyObject
*Menu_EnableMenuCommand(PyObject
*_self
, PyObject
*_args
)
3192 PyObject
*_res
= NULL
;
3194 MenuCommand inCommandID
;
3195 #ifndef EnableMenuCommand
3196 PyMac_PRECHECK(EnableMenuCommand
);
3198 if (!PyArg_ParseTuple(_args
, "O&l",
3199 OptMenuObj_Convert
, &inMenu
,
3202 EnableMenuCommand(inMenu
,
3209 static PyObject
*Menu_DisableMenuCommand(PyObject
*_self
, PyObject
*_args
)
3211 PyObject
*_res
= NULL
;
3213 MenuCommand inCommandID
;
3214 #ifndef DisableMenuCommand
3215 PyMac_PRECHECK(DisableMenuCommand
);
3217 if (!PyArg_ParseTuple(_args
, "O&l",
3218 OptMenuObj_Convert
, &inMenu
,
3221 DisableMenuCommand(inMenu
,
3228 static PyObject
*Menu_IsMenuCommandEnabled(PyObject
*_self
, PyObject
*_args
)
3230 PyObject
*_res
= NULL
;
3233 MenuCommand inCommandID
;
3234 #ifndef IsMenuCommandEnabled
3235 PyMac_PRECHECK(IsMenuCommandEnabled
);
3237 if (!PyArg_ParseTuple(_args
, "O&l",
3238 OptMenuObj_Convert
, &inMenu
,
3241 _rv
= IsMenuCommandEnabled(inMenu
,
3243 _res
= Py_BuildValue("b",
3248 static PyObject
*Menu_SetMenuCommandMark(PyObject
*_self
, PyObject
*_args
)
3250 PyObject
*_res
= NULL
;
3253 MenuCommand inCommandID
;
3255 #ifndef SetMenuCommandMark
3256 PyMac_PRECHECK(SetMenuCommandMark
);
3258 if (!PyArg_ParseTuple(_args
, "O&lh",
3259 OptMenuObj_Convert
, &inMenu
,
3263 _err
= SetMenuCommandMark(inMenu
,
3266 if (_err
!= noErr
) return PyMac_Error(_err
);
3272 static PyObject
*Menu_GetMenuCommandMark(PyObject
*_self
, PyObject
*_args
)
3274 PyObject
*_res
= NULL
;
3277 MenuCommand inCommandID
;
3279 #ifndef GetMenuCommandMark
3280 PyMac_PRECHECK(GetMenuCommandMark
);
3282 if (!PyArg_ParseTuple(_args
, "O&l",
3283 OptMenuObj_Convert
, &inMenu
,
3286 _err
= GetMenuCommandMark(inMenu
,
3289 if (_err
!= noErr
) return PyMac_Error(_err
);
3290 _res
= Py_BuildValue("h",
3295 static PyObject
*Menu_GetMenuCommandPropertySize(PyObject
*_self
, PyObject
*_args
)
3297 PyObject
*_res
= NULL
;
3300 MenuCommand inCommandID
;
3301 OSType inPropertyCreator
;
3302 OSType inPropertyTag
;
3304 #ifndef GetMenuCommandPropertySize
3305 PyMac_PRECHECK(GetMenuCommandPropertySize
);
3307 if (!PyArg_ParseTuple(_args
, "O&lO&O&",
3308 OptMenuObj_Convert
, &inMenu
,
3310 PyMac_GetOSType
, &inPropertyCreator
,
3311 PyMac_GetOSType
, &inPropertyTag
))
3313 _err
= GetMenuCommandPropertySize(inMenu
,
3318 if (_err
!= noErr
) return PyMac_Error(_err
);
3319 _res
= Py_BuildValue("l",
3324 static PyObject
*Menu_RemoveMenuCommandProperty(PyObject
*_self
, PyObject
*_args
)
3326 PyObject
*_res
= NULL
;
3329 MenuCommand inCommandID
;
3330 OSType inPropertyCreator
;
3331 OSType inPropertyTag
;
3332 #ifndef RemoveMenuCommandProperty
3333 PyMac_PRECHECK(RemoveMenuCommandProperty
);
3335 if (!PyArg_ParseTuple(_args
, "O&lO&O&",
3336 OptMenuObj_Convert
, &inMenu
,
3338 PyMac_GetOSType
, &inPropertyCreator
,
3339 PyMac_GetOSType
, &inPropertyTag
))
3341 _err
= RemoveMenuCommandProperty(inMenu
,
3345 if (_err
!= noErr
) return PyMac_Error(_err
);
3351 static PyMethodDef Menu_methods
[] = {
3352 {"NewMenu", (PyCFunction
)Menu_NewMenu
, 1,
3353 PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")},
3354 {"MacGetMenu", (PyCFunction
)Menu_MacGetMenu
, 1,
3355 PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
3356 {"CreateNewMenu", (PyCFunction
)Menu_CreateNewMenu
, 1,
3357 PyDoc_STR("(MenuID inMenuID, MenuAttributes inMenuAttributes) -> (MenuHandle outMenuRef)")},
3358 {"MenuKey", (PyCFunction
)Menu_MenuKey
, 1,
3359 PyDoc_STR("(CharParameter ch) -> (long _rv)")},
3360 {"MenuSelect", (PyCFunction
)Menu_MenuSelect
, 1,
3361 PyDoc_STR("(Point startPt) -> (long _rv)")},
3362 {"MenuChoice", (PyCFunction
)Menu_MenuChoice
, 1,
3363 PyDoc_STR("() -> (long _rv)")},
3364 {"MenuEvent", (PyCFunction
)Menu_MenuEvent
, 1,
3365 PyDoc_STR("(EventRecord inEvent) -> (UInt32 _rv)")},
3366 {"GetMBarHeight", (PyCFunction
)Menu_GetMBarHeight
, 1,
3367 PyDoc_STR("() -> (short _rv)")},
3368 {"MacDrawMenuBar", (PyCFunction
)Menu_MacDrawMenuBar
, 1,
3369 PyDoc_STR("() -> None")},
3370 {"InvalMenuBar", (PyCFunction
)Menu_InvalMenuBar
, 1,
3371 PyDoc_STR("() -> None")},
3372 {"HiliteMenu", (PyCFunction
)Menu_HiliteMenu
, 1,
3373 PyDoc_STR("(MenuID menuID) -> None")},
3374 {"GetNewMBar", (PyCFunction
)Menu_GetNewMBar
, 1,
3375 PyDoc_STR("(short menuBarID) -> (MenuBarHandle _rv)")},
3376 {"GetMenuBar", (PyCFunction
)Menu_GetMenuBar
, 1,
3377 PyDoc_STR("() -> (MenuBarHandle _rv)")},
3378 {"SetMenuBar", (PyCFunction
)Menu_SetMenuBar
, 1,
3379 PyDoc_STR("(MenuBarHandle mbar) -> None")},
3380 {"DuplicateMenuBar", (PyCFunction
)Menu_DuplicateMenuBar
, 1,
3381 PyDoc_STR("(MenuBarHandle inMbar) -> (MenuBarHandle outMbar)")},
3382 {"DisposeMenuBar", (PyCFunction
)Menu_DisposeMenuBar
, 1,
3383 PyDoc_STR("(MenuBarHandle inMbar) -> None")},
3384 {"GetMenuHandle", (PyCFunction
)Menu_GetMenuHandle
, 1,
3385 PyDoc_STR("(MenuID menuID) -> (MenuHandle _rv)")},
3386 {"MacDeleteMenu", (PyCFunction
)Menu_MacDeleteMenu
, 1,
3387 PyDoc_STR("(MenuID menuID) -> None")},
3388 {"ClearMenuBar", (PyCFunction
)Menu_ClearMenuBar
, 1,
3389 PyDoc_STR("() -> None")},
3390 {"SetMenuFlashCount", (PyCFunction
)Menu_SetMenuFlashCount
, 1,
3391 PyDoc_STR("(short count) -> None")},
3392 {"FlashMenuBar", (PyCFunction
)Menu_FlashMenuBar
, 1,
3393 PyDoc_STR("(MenuID menuID) -> None")},
3394 {"IsMenuBarVisible", (PyCFunction
)Menu_IsMenuBarVisible
, 1,
3395 PyDoc_STR("() -> (Boolean _rv)")},
3396 {"ShowMenuBar", (PyCFunction
)Menu_ShowMenuBar
, 1,
3397 PyDoc_STR("() -> None")},
3398 {"HideMenuBar", (PyCFunction
)Menu_HideMenuBar
, 1,
3399 PyDoc_STR("() -> None")},
3400 {"AcquireRootMenu", (PyCFunction
)Menu_AcquireRootMenu
, 1,
3401 PyDoc_STR("() -> (MenuHandle _rv)")},
3402 {"DeleteMCEntries", (PyCFunction
)Menu_DeleteMCEntries
, 1,
3403 PyDoc_STR("(MenuID menuID, short menuItem) -> None")},
3404 {"InitContextualMenus", (PyCFunction
)Menu_InitContextualMenus
, 1,
3405 PyDoc_STR("() -> None")},
3406 {"IsShowContextualMenuClick", (PyCFunction
)Menu_IsShowContextualMenuClick
, 1,
3407 PyDoc_STR("(EventRecord inEvent) -> (Boolean _rv)")},
3408 {"LMGetTheMenu", (PyCFunction
)Menu_LMGetTheMenu
, 1,
3409 PyDoc_STR("() -> (SInt16 _rv)")},
3410 {"as_Menu", (PyCFunction
)Menu_as_Menu
, 1,
3411 PyDoc_STR("(Handle h) -> (MenuHandle _rv)")},
3412 {"GetMenu", (PyCFunction
)Menu_GetMenu
, 1,
3413 PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
3414 {"DeleteMenu", (PyCFunction
)Menu_DeleteMenu
, 1,
3415 PyDoc_STR("(short menuID) -> None")},
3416 {"DrawMenuBar", (PyCFunction
)Menu_DrawMenuBar
, 1,
3417 PyDoc_STR("() -> None")},
3418 {"CountMenuItemsWithCommandID", (PyCFunction
)Menu_CountMenuItemsWithCommandID
, 1,
3419 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)")},
3420 {"GetIndMenuItemWithCommandID", (PyCFunction
)Menu_GetIndMenuItemWithCommandID
, 1,
3421 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
3422 {"EnableMenuCommand", (PyCFunction
)Menu_EnableMenuCommand
, 1,
3423 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
3424 {"DisableMenuCommand", (PyCFunction
)Menu_DisableMenuCommand
, 1,
3425 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
3426 {"IsMenuCommandEnabled", (PyCFunction
)Menu_IsMenuCommandEnabled
, 1,
3427 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)")},
3428 {"SetMenuCommandMark", (PyCFunction
)Menu_SetMenuCommandMark
, 1,
3429 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None")},
3430 {"GetMenuCommandMark", (PyCFunction
)Menu_GetMenuCommandMark
, 1,
3431 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)")},
3432 {"GetMenuCommandPropertySize", (PyCFunction
)Menu_GetMenuCommandPropertySize
, 1,
3433 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
3434 {"RemoveMenuCommandProperty", (PyCFunction
)Menu_RemoveMenuCommandProperty
, 1,
3435 PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
3442 void init_Menu(void)
3449 PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle
, MenuObj_New
);
3450 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle
, MenuObj_Convert
);
3453 m
= Py_InitModule("_Menu", Menu_methods
);
3454 d
= PyModule_GetDict(m
);
3455 Menu_Error
= PyMac_GetOSErrException();
3456 if (Menu_Error
== NULL
||
3457 PyDict_SetItemString(d
, "Error", Menu_Error
) != 0)
3459 Menu_Type
.ob_type
= &PyType_Type
;
3460 if (PyType_Ready(&Menu_Type
) < 0) return;
3461 Py_INCREF(&Menu_Type
);
3462 PyModule_AddObject(m
, "Menu", (PyObject
*)&Menu_Type
);
3463 /* Backward-compatible name */
3464 Py_INCREF(&Menu_Type
);
3465 PyModule_AddObject(m
, "MenuType", (PyObject
*)&Menu_Type
);
3468 /* ======================== End module _Menu ======================== */