ยปCore Development>Code coverage>Mac/Modules/menu/_Menumodule.c

Python code coverage for Mac/Modules/menu/_Menumodule.c

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