2001-08-23 11:02:09 -03:00
|
|
|
|
|
|
|
/* ========================== Module _Menu ========================== */
|
|
|
|
|
|
|
|
#include "Python.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "pymactoolbox.h"
|
|
|
|
|
|
|
|
/* Macro to test whether a weak-loaded CFM function exists */
|
|
|
|
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
|
2003-11-19 12:13:35 -04:00
|
|
|
PyErr_SetString(PyExc_NotImplementedError, \
|
|
|
|
"Not available in this shared library/OS version"); \
|
|
|
|
return NULL; \
|
2001-08-23 11:02:09 -03:00
|
|
|
}} while(0)
|
|
|
|
|
|
|
|
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_TOOLBOX_OBJECT_GLUE
|
|
|
|
|
|
|
|
extern PyObject *_MenuObj_New(MenuHandle);
|
|
|
|
extern int _MenuObj_Convert(PyObject *, MenuHandle *);
|
|
|
|
|
|
|
|
#define MenuObj_New _MenuObj_New
|
2005-07-03 17:59:44 -03:00
|
|
|
#define MenuObj_Convert _MenuObj_Convert
|
2001-08-23 11:02:09 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define as_Menu(h) ((MenuHandle)h)
|
|
|
|
#define as_Resource(h) ((Handle)h)
|
|
|
|
|
2002-01-02 10:48:36 -04:00
|
|
|
|
2002-01-02 10:59:03 -04:00
|
|
|
/* Alternative version of MenuObj_New, which returns None for NULL argument */
|
2002-01-02 10:48:36 -04:00
|
|
|
PyObject *OptMenuObj_New(MenuRef itself)
|
|
|
|
{
|
2005-07-03 17:59:44 -03:00
|
|
|
if (itself == NULL) {
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
return MenuObj_New(itself);
|
2002-01-02 10:48:36 -04:00
|
|
|
}
|
|
|
|
|
2002-01-02 10:59:03 -04:00
|
|
|
/* Alternative version of MenuObj_Convert, which returns NULL for a None argument */
|
2002-01-02 10:48:36 -04:00
|
|
|
int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself)
|
|
|
|
{
|
2005-07-03 17:59:44 -03:00
|
|
|
if ( v == Py_None ) {
|
|
|
|
*p_itself = NULL;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return MenuObj_Convert(v, p_itself);
|
2002-01-02 10:48:36 -04:00
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *Menu_Error;
|
|
|
|
|
|
|
|
/* ------------------------ Object type Menu ------------------------ */
|
|
|
|
|
|
|
|
PyTypeObject Menu_Type;
|
|
|
|
|
2002-12-19 17:24:35 -04:00
|
|
|
#define MenuObj_Check(x) ((x)->ob_type == &Menu_Type || PyObject_TypeCheck((x), &Menu_Type))
|
2001-08-23 11:02:09 -03:00
|
|
|
|
|
|
|
typedef struct MenuObject {
|
|
|
|
PyObject_HEAD
|
|
|
|
MenuHandle ob_itself;
|
|
|
|
} MenuObject;
|
|
|
|
|
|
|
|
PyObject *MenuObj_New(MenuHandle itself)
|
|
|
|
{
|
|
|
|
MenuObject *it;
|
|
|
|
it = PyObject_NEW(MenuObject, &Menu_Type);
|
|
|
|
if (it == NULL) return NULL;
|
|
|
|
it->ob_itself = itself;
|
|
|
|
return (PyObject *)it;
|
|
|
|
}
|
2005-07-03 17:59:44 -03:00
|
|
|
|
2001-09-04 19:19:18 -03:00
|
|
|
int MenuObj_Convert(PyObject *v, MenuHandle *p_itself)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
if (!MenuObj_Check(v))
|
|
|
|
{
|
|
|
|
PyErr_SetString(PyExc_TypeError, "Menu required");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
*p_itself = ((MenuObject *)v)->ob_itself;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void MenuObj_dealloc(MenuObject *self)
|
|
|
|
{
|
|
|
|
/* Cleanup of self->ob_itself goes here */
|
2002-12-23 19:16:25 -04:00
|
|
|
self->ob_type->tp_free((PyObject *)self);
|
2001-08-23 11:02:09 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DisposeMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DisposeMenu
|
|
|
|
PyMac_PRECHECK(DisposeMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
DisposeMenu(_self->ob_itself);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_CalcMenuSize(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef CalcMenuSize
|
|
|
|
PyMac_PRECHECK(CalcMenuSize);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
CalcMenuSize(_self->ob_itself);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_CountMenuItems(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2003-12-05 20:00:17 -04:00
|
|
|
UInt16 _rv;
|
2001-12-16 16:18:40 -04:00
|
|
|
#ifndef CountMenuItems
|
|
|
|
PyMac_PRECHECK(CountMenuItems);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_rv = CountMenuItems(_self->ob_itself);
|
2003-12-05 20:00:17 -04:00
|
|
|
_res = Py_BuildValue("H",
|
2001-08-23 11:02:09 -03:00
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuFont(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
SInt16 outFontID;
|
|
|
|
UInt16 outFontSize;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuFont
|
|
|
|
PyMac_PRECHECK(GetMenuFont);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuFont(_self->ob_itself,
|
|
|
|
&outFontID,
|
|
|
|
&outFontSize);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("hH",
|
|
|
|
outFontID,
|
|
|
|
outFontSize);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuFont(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
SInt16 inFontID;
|
|
|
|
UInt16 inFontSize;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuFont
|
|
|
|
PyMac_PRECHECK(SetMenuFont);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hH",
|
|
|
|
&inFontID,
|
|
|
|
&inFontSize))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuFont(_self->ob_itself,
|
|
|
|
inFontID,
|
|
|
|
inFontSize);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuExcludesMarkColumn
|
|
|
|
PyMac_PRECHECK(GetMenuExcludesMarkColumn);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuExcludesMarkColumn(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuExcludesMarkColumn(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
Boolean excludesMark;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuExcludesMarkColumn
|
|
|
|
PyMac_PRECHECK(SetMenuExcludesMarkColumn);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "b",
|
|
|
|
&excludesMark))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuExcludesMarkColumn(_self->ob_itself,
|
|
|
|
excludesMark);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_IsValidMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
#ifndef IsValidMenu
|
|
|
|
PyMac_PRECHECK(IsValidMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsValidMenu(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuRetainCount(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
ItemCount _rv;
|
|
|
|
#ifndef GetMenuRetainCount
|
|
|
|
PyMac_PRECHECK(GetMenuRetainCount);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuRetainCount(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_RetainMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
#ifndef RetainMenu
|
|
|
|
PyMac_PRECHECK(RetainMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = RetainMenu(_self->ob_itself);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_ReleaseMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
#ifndef ReleaseMenu
|
|
|
|
PyMac_PRECHECK(ReleaseMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = ReleaseMenu(_self->ob_itself);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DuplicateMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuHandle outMenu;
|
|
|
|
#ifndef DuplicateMenu
|
|
|
|
PyMac_PRECHECK(DuplicateMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = DuplicateMenu(_self->ob_itself,
|
|
|
|
&outMenu);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, outMenu);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_CopyMenuTitleAsCFString(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
CFStringRef outString;
|
|
|
|
#ifndef CopyMenuTitleAsCFString
|
|
|
|
PyMac_PRECHECK(CopyMenuTitleAsCFString);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = CopyMenuTitleAsCFString(_self->ob_itself,
|
|
|
|
&outString);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
CFStringRefObj_New, outString);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuTitleWithCFString(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
CFStringRef inString;
|
|
|
|
#ifndef SetMenuTitleWithCFString
|
|
|
|
PyMac_PRECHECK(SetMenuTitleWithCFString);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
CFStringRefObj_Convert, &inString))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuTitleWithCFString(_self->ob_itself,
|
|
|
|
inString);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InvalidateMenuSize(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
#ifndef InvalidateMenuSize
|
|
|
|
PyMac_PRECHECK(InvalidateMenuSize);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = InvalidateMenuSize(_self->ob_itself);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_IsMenuSizeInvalid(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
#ifndef IsMenuSizeInvalid
|
|
|
|
PyMac_PRECHECK(IsMenuSizeInvalid);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuSizeInvalid(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *MenuObj_MacAppendMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Str255 data;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacAppendMenu
|
|
|
|
PyMac_PRECHECK(MacAppendMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetStr255, data))
|
|
|
|
return NULL;
|
|
|
|
MacAppendMenu(_self->ob_itself,
|
|
|
|
data);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertResMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
ResType theType;
|
|
|
|
short afterItem;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InsertResMenu
|
|
|
|
PyMac_PRECHECK(InsertResMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&h",
|
|
|
|
PyMac_GetOSType, &theType,
|
|
|
|
&afterItem))
|
|
|
|
return NULL;
|
|
|
|
InsertResMenu(_self->ob_itself,
|
|
|
|
theType,
|
|
|
|
afterItem);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_AppendResMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
ResType theType;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef AppendResMenu
|
|
|
|
PyMac_PRECHECK(AppendResMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetOSType, &theType))
|
|
|
|
return NULL;
|
|
|
|
AppendResMenu(_self->ob_itself,
|
|
|
|
theType);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_MacInsertMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Str255 itemString;
|
|
|
|
short afterItem;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacInsertMenuItem
|
|
|
|
PyMac_PRECHECK(MacInsertMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&h",
|
|
|
|
PyMac_GetStr255, itemString,
|
|
|
|
&afterItem))
|
|
|
|
return NULL;
|
|
|
|
MacInsertMenuItem(_self->ob_itself,
|
|
|
|
itemString,
|
|
|
|
afterItem);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DeleteMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DeleteMenuItem
|
|
|
|
PyMac_PRECHECK(DeleteMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
DeleteMenuItem(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertFontResMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short afterItem;
|
|
|
|
short scriptFilter;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InsertFontResMenu
|
|
|
|
PyMac_PRECHECK(InsertFontResMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&afterItem,
|
|
|
|
&scriptFilter))
|
|
|
|
return NULL;
|
|
|
|
InsertFontResMenu(_self->ob_itself,
|
|
|
|
afterItem,
|
|
|
|
scriptFilter);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertIntlResMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
ResType theType;
|
|
|
|
short afterItem;
|
|
|
|
short scriptFilter;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InsertIntlResMenu
|
|
|
|
PyMac_PRECHECK(InsertIntlResMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&hh",
|
|
|
|
PyMac_GetOSType, &theType,
|
|
|
|
&afterItem,
|
|
|
|
&scriptFilter))
|
|
|
|
return NULL;
|
|
|
|
InsertIntlResMenu(_self->ob_itself,
|
|
|
|
theType,
|
|
|
|
afterItem,
|
|
|
|
scriptFilter);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_AppendMenuItemText(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
Str255 inString;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef AppendMenuItemText
|
|
|
|
PyMac_PRECHECK(AppendMenuItemText);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetStr255, inString))
|
|
|
|
return NULL;
|
|
|
|
_err = AppendMenuItemText(_self->ob_itself,
|
|
|
|
inString);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertMenuItemText(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
Str255 inString;
|
|
|
|
MenuItemIndex afterItem;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InsertMenuItemText
|
|
|
|
PyMac_PRECHECK(InsertMenuItemText);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&h",
|
|
|
|
PyMac_GetStr255, inString,
|
|
|
|
&afterItem))
|
|
|
|
return NULL;
|
|
|
|
_err = InsertMenuItemText(_self->ob_itself,
|
|
|
|
inString,
|
|
|
|
afterItem);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_CopyMenuItems(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inFirstItem;
|
|
|
|
ItemCount inNumItems;
|
|
|
|
MenuHandle inDestMenu;
|
|
|
|
MenuItemIndex inInsertAfter;
|
|
|
|
#ifndef CopyMenuItems
|
|
|
|
PyMac_PRECHECK(CopyMenuItems);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hlO&h",
|
|
|
|
&inFirstItem,
|
|
|
|
&inNumItems,
|
|
|
|
MenuObj_Convert, &inDestMenu,
|
|
|
|
&inInsertAfter))
|
|
|
|
return NULL;
|
|
|
|
_err = CopyMenuItems(_self->ob_itself,
|
|
|
|
inFirstItem,
|
|
|
|
inNumItems,
|
|
|
|
inDestMenu,
|
|
|
|
inInsertAfter);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DeleteMenuItems(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inFirstItem;
|
|
|
|
ItemCount inNumItems;
|
|
|
|
#ifndef DeleteMenuItems
|
|
|
|
PyMac_PRECHECK(DeleteMenuItems);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
|
|
|
&inFirstItem,
|
|
|
|
&inNumItems))
|
|
|
|
return NULL;
|
|
|
|
_err = DeleteMenuItems(_self->ob_itself,
|
|
|
|
inFirstItem,
|
|
|
|
inNumItems);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_AppendMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
CFStringRef inString;
|
|
|
|
MenuItemAttributes inAttributes;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
MenuItemIndex outNewItem;
|
|
|
|
#ifndef AppendMenuItemTextWithCFString
|
|
|
|
PyMac_PRECHECK(AppendMenuItemTextWithCFString);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&ll",
|
|
|
|
CFStringRefObj_Convert, &inString,
|
|
|
|
&inAttributes,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_err = AppendMenuItemTextWithCFString(_self->ob_itself,
|
|
|
|
inString,
|
|
|
|
inAttributes,
|
|
|
|
inCommandID,
|
|
|
|
&outNewItem);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
outNewItem);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
CFStringRef inString;
|
|
|
|
MenuItemIndex inAfterItem;
|
|
|
|
MenuItemAttributes inAttributes;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef InsertMenuItemTextWithCFString
|
|
|
|
PyMac_PRECHECK(InsertMenuItemTextWithCFString);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&hll",
|
|
|
|
CFStringRefObj_Convert, &inString,
|
|
|
|
&inAfterItem,
|
|
|
|
&inAttributes,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_err = InsertMenuItemTextWithCFString(_self->ob_itself,
|
|
|
|
inString,
|
|
|
|
inAfterItem,
|
|
|
|
inAttributes,
|
|
|
|
inCommandID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *MenuObj_PopUpMenuSelect(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
long _rv;
|
|
|
|
short top;
|
|
|
|
short left;
|
|
|
|
short popUpItem;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef PopUpMenuSelect
|
|
|
|
PyMac_PRECHECK(PopUpMenuSelect);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hhh",
|
|
|
|
&top,
|
|
|
|
&left,
|
|
|
|
&popUpItem))
|
|
|
|
return NULL;
|
|
|
|
_rv = PopUpMenuSelect(_self->ob_itself,
|
|
|
|
top,
|
|
|
|
left,
|
|
|
|
popUpItem);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_InvalidateMenuEnabling(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
#ifndef InvalidateMenuEnabling
|
|
|
|
PyMac_PRECHECK(InvalidateMenuEnabling);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = InvalidateMenuEnabling(_self->ob_itself);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_IsMenuBarInvalid(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
#ifndef IsMenuBarInvalid
|
|
|
|
PyMac_PRECHECK(IsMenuBarInvalid);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuBarInvalid(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *MenuObj_MacInsertMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID beforeID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacInsertMenu
|
|
|
|
PyMac_PRECHECK(MacInsertMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&beforeID))
|
|
|
|
return NULL;
|
|
|
|
MacInsertMenu(_self->ob_itself,
|
|
|
|
beforeID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_SetRootMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
#ifndef SetRootMenu
|
|
|
|
PyMac_PRECHECK(SetRootMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = SetRootMenu(_self->ob_itself);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
2001-08-23 11:02:09 -03:00
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_MacCheckMenuItem(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
Boolean checked;
|
2001-12-16 16:18:40 -04:00
|
|
|
#ifndef MacCheckMenuItem
|
|
|
|
PyMac_PRECHECK(MacCheckMenuItem);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hb",
|
|
|
|
&item,
|
|
|
|
&checked))
|
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
MacCheckMenuItem(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
checked);
|
2001-08-23 11:02:09 -03:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemText(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
Str255 itemString;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemText
|
|
|
|
PyMac_PRECHECK(SetMenuItemText);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hO&",
|
|
|
|
&item,
|
|
|
|
PyMac_GetStr255, itemString))
|
|
|
|
return NULL;
|
|
|
|
SetMenuItemText(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
itemString);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemText(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
Str255 itemString;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemText
|
|
|
|
PyMac_PRECHECK(GetMenuItemText);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
GetMenuItemText(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
itemString);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
PyMac_BuildStr255, itemString);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetItemMark(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
CharParameter markChar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetItemMark
|
|
|
|
PyMac_PRECHECK(SetItemMark);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&item,
|
|
|
|
&markChar))
|
|
|
|
return NULL;
|
|
|
|
SetItemMark(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
markChar);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetItemMark(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
CharParameter markChar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetItemMark
|
|
|
|
PyMac_PRECHECK(GetItemMark);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
GetItemMark(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
&markChar);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
markChar);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetItemCmd(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
CharParameter cmdChar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetItemCmd
|
|
|
|
PyMac_PRECHECK(SetItemCmd);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&item,
|
|
|
|
&cmdChar))
|
|
|
|
return NULL;
|
|
|
|
SetItemCmd(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
cmdChar);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetItemCmd(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
CharParameter cmdChar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetItemCmd
|
|
|
|
PyMac_PRECHECK(GetItemCmd);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
GetItemCmd(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
&cmdChar);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
cmdChar);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetItemIcon(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
short iconIndex;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetItemIcon
|
|
|
|
PyMac_PRECHECK(SetItemIcon);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&item,
|
|
|
|
&iconIndex))
|
|
|
|
return NULL;
|
|
|
|
SetItemIcon(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
iconIndex);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetItemIcon(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
short iconIndex;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetItemIcon
|
|
|
|
PyMac_PRECHECK(GetItemIcon);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
GetItemIcon(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
&iconIndex);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
iconIndex);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetItemStyle(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
StyleParameter chStyle;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetItemStyle
|
|
|
|
PyMac_PRECHECK(SetItemStyle);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&item,
|
|
|
|
&chStyle))
|
|
|
|
return NULL;
|
|
|
|
SetItemStyle(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
chStyle);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetItemStyle(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
Style chStyle;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetItemStyle
|
|
|
|
PyMac_PRECHECK(GetItemStyle);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
GetItemStyle(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
&chStyle);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
chStyle);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemCommandID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
MenuCommand inCommandID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemCommandID
|
|
|
|
PyMac_PRECHECK(SetMenuItemCommandID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
|
|
|
&inItem,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemCommandID(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inCommandID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemCommandID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
MenuCommand outCommandID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemCommandID
|
|
|
|
PyMac_PRECHECK(GetMenuItemCommandID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemCommandID(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outCommandID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outCommandID);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemModifiers(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
UInt8 inModifiers;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemModifiers
|
|
|
|
PyMac_PRECHECK(SetMenuItemModifiers);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hb",
|
|
|
|
&inItem,
|
|
|
|
&inModifiers))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemModifiers(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inModifiers);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemModifiers(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
UInt8 outModifiers;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemModifiers
|
|
|
|
PyMac_PRECHECK(GetMenuItemModifiers);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemModifiers(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outModifiers);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
outModifiers);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
UInt8 inIconType;
|
|
|
|
Handle inIconHandle;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemIconHandle
|
|
|
|
PyMac_PRECHECK(SetMenuItemIconHandle);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hbO&",
|
|
|
|
&inItem,
|
|
|
|
&inIconType,
|
|
|
|
ResObj_Convert, &inIconHandle))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemIconHandle(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inIconType,
|
|
|
|
inIconHandle);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemIconHandle(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
UInt8 outIconType;
|
|
|
|
Handle outIconHandle;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemIconHandle
|
|
|
|
PyMac_PRECHECK(GetMenuItemIconHandle);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemIconHandle(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outIconType,
|
|
|
|
&outIconHandle);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("bO&",
|
|
|
|
outIconType,
|
|
|
|
ResObj_New, outIconHandle);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
TextEncoding inScriptID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemTextEncoding
|
|
|
|
PyMac_PRECHECK(SetMenuItemTextEncoding);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
|
|
|
&inItem,
|
|
|
|
&inScriptID))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemTextEncoding(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inScriptID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemTextEncoding(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
TextEncoding outScriptID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemTextEncoding
|
|
|
|
PyMac_PRECHECK(GetMenuItemTextEncoding);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemTextEncoding(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outScriptID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outScriptID);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
MenuID inHierID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemHierarchicalID
|
|
|
|
PyMac_PRECHECK(SetMenuItemHierarchicalID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&inItem,
|
|
|
|
&inHierID))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemHierarchicalID(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inHierID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemHierarchicalID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
MenuID outHierID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemHierarchicalID
|
|
|
|
PyMac_PRECHECK(GetMenuItemHierarchicalID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemHierarchicalID(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outHierID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
outHierID);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemFontID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
SInt16 inFontID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemFontID
|
|
|
|
PyMac_PRECHECK(SetMenuItemFontID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&inItem,
|
|
|
|
&inFontID))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemFontID(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inFontID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemFontID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
SInt16 outFontID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemFontID
|
|
|
|
PyMac_PRECHECK(GetMenuItemFontID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemFontID(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outFontID);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
outFontID);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemRefCon(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
UInt32 inRefCon;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemRefCon
|
|
|
|
PyMac_PRECHECK(SetMenuItemRefCon);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
|
|
|
&inItem,
|
|
|
|
&inRefCon))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemRefCon(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inRefCon);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemRefCon(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
UInt32 outRefCon;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemRefCon
|
|
|
|
PyMac_PRECHECK(GetMenuItemRefCon);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemRefCon(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outRefCon);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outRefCon);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
SInt16 inGlyph;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuItemKeyGlyph
|
|
|
|
PyMac_PRECHECK(SetMenuItemKeyGlyph);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&inItem,
|
|
|
|
&inGlyph))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemKeyGlyph(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inGlyph);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemKeyGlyph(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSErr _err;
|
|
|
|
SInt16 inItem;
|
|
|
|
SInt16 outGlyph;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemKeyGlyph
|
|
|
|
PyMac_PRECHECK(GetMenuItemKeyGlyph);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemKeyGlyph(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outGlyph);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
outGlyph);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_MacEnableMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuItemIndex item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacEnableMenuItem
|
|
|
|
PyMac_PRECHECK(MacEnableMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
MacEnableMenuItem(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DisableMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuItemIndex item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DisableMenuItem
|
|
|
|
PyMac_PRECHECK(DisableMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
DisableMenuItem(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_IsMenuItemEnabled(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
MenuItemIndex item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef IsMenuItemEnabled
|
|
|
|
PyMac_PRECHECK(IsMenuItemEnabled);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuItemEnabled(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_EnableMenuItemIcon(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuItemIndex item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef EnableMenuItemIcon
|
|
|
|
PyMac_PRECHECK(EnableMenuItemIcon);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
EnableMenuItemIcon(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DisableMenuItemIcon(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuItemIndex item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DisableMenuItemIcon
|
|
|
|
PyMac_PRECHECK(DisableMenuItemIcon);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
DisableMenuItemIcon(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_IsMenuItemIconEnabled(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
MenuItemIndex item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef IsMenuItemIconEnabled
|
|
|
|
PyMac_PRECHECK(IsMenuItemIconEnabled);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuItemIconEnabled(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_SetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
MenuHandle inHierMenu;
|
|
|
|
#ifndef SetMenuItemHierarchicalMenu
|
|
|
|
PyMac_PRECHECK(SetMenuItemHierarchicalMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hO&",
|
|
|
|
&inItem,
|
|
|
|
MenuObj_Convert, &inHierMenu))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemHierarchicalMenu(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inHierMenu);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemHierarchicalMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
MenuHandle outHierMenu;
|
|
|
|
#ifndef GetMenuItemHierarchicalMenu
|
|
|
|
PyMac_PRECHECK(GetMenuItemHierarchicalMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemHierarchicalMenu(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outHierMenu);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&",
|
2002-01-03 08:16:18 -04:00
|
|
|
OptMenuObj_New, outHierMenu);
|
2001-12-16 16:18:40 -04:00
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_CopyMenuItemTextAsCFString(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
CFStringRef outString;
|
|
|
|
#ifndef CopyMenuItemTextAsCFString
|
|
|
|
PyMac_PRECHECK(CopyMenuItemTextAsCFString);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = CopyMenuItemTextAsCFString(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outString);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
CFStringRefObj_New, outString);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemTextWithCFString(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
CFStringRef inString;
|
|
|
|
#ifndef SetMenuItemTextWithCFString
|
|
|
|
PyMac_PRECHECK(SetMenuItemTextWithCFString);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hO&",
|
|
|
|
&inItem,
|
|
|
|
CFStringRefObj_Convert, &inString))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemTextWithCFString(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inString);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemIndent(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
UInt32 outIndent;
|
|
|
|
#ifndef GetMenuItemIndent
|
|
|
|
PyMac_PRECHECK(GetMenuItemIndent);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&inItem))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemIndent(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
&outIndent);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outIndent);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemIndent(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
UInt32 inIndent;
|
|
|
|
#ifndef SetMenuItemIndent
|
|
|
|
PyMac_PRECHECK(SetMenuItemIndent);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
|
|
|
&inItem,
|
|
|
|
&inIndent))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemIndent(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inIndent);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemCommandKey(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
Boolean inGetVirtualKey;
|
|
|
|
UInt16 outKey;
|
|
|
|
#ifndef GetMenuItemCommandKey
|
|
|
|
PyMac_PRECHECK(GetMenuItemCommandKey);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hb",
|
|
|
|
&inItem,
|
|
|
|
&inGetVirtualKey))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemCommandKey(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inGetVirtualKey,
|
|
|
|
&outKey);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("H",
|
|
|
|
outKey);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuItemCommandKey(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex inItem;
|
|
|
|
Boolean inSetVirtualKey;
|
|
|
|
UInt16 inKey;
|
|
|
|
#ifndef SetMenuItemCommandKey
|
|
|
|
PyMac_PRECHECK(SetMenuItemCommandKey);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "hbH",
|
|
|
|
&inItem,
|
|
|
|
&inSetVirtualKey,
|
|
|
|
&inKey))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuItemCommandKey(_self->ob_itself,
|
|
|
|
inItem,
|
|
|
|
inSetVirtualKey,
|
|
|
|
inKey);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *MenuObj_GetMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex item;
|
|
|
|
OSType propertyCreator;
|
|
|
|
OSType propertyTag;
|
|
|
|
UInt32 attributes;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemPropertyAttributes
|
|
|
|
PyMac_PRECHECK(GetMenuItemPropertyAttributes);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hO&O&",
|
|
|
|
&item,
|
|
|
|
PyMac_GetOSType, &propertyCreator,
|
|
|
|
PyMac_GetOSType, &propertyTag))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemPropertyAttributes(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
propertyCreator,
|
|
|
|
propertyTag,
|
|
|
|
&attributes);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
attributes);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_ChangeMenuItemPropertyAttributes(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex item;
|
|
|
|
OSType propertyCreator;
|
|
|
|
OSType propertyTag;
|
|
|
|
UInt32 attributesToSet;
|
|
|
|
UInt32 attributesToClear;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef ChangeMenuItemPropertyAttributes
|
|
|
|
PyMac_PRECHECK(ChangeMenuItemPropertyAttributes);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hO&O&ll",
|
|
|
|
&item,
|
|
|
|
PyMac_GetOSType, &propertyCreator,
|
|
|
|
PyMac_GetOSType, &propertyTag,
|
|
|
|
&attributesToSet,
|
|
|
|
&attributesToClear))
|
|
|
|
return NULL;
|
|
|
|
_err = ChangeMenuItemPropertyAttributes(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
propertyCreator,
|
|
|
|
propertyTag,
|
|
|
|
attributesToSet,
|
|
|
|
attributesToClear);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuAttributes(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuAttributes outAttributes;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuAttributes
|
|
|
|
PyMac_PRECHECK(GetMenuAttributes);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuAttributes(_self->ob_itself,
|
|
|
|
&outAttributes);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outAttributes);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_ChangeMenuAttributes(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuAttributes setTheseAttributes;
|
|
|
|
MenuAttributes clearTheseAttributes;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef ChangeMenuAttributes
|
|
|
|
PyMac_PRECHECK(ChangeMenuAttributes);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "ll",
|
|
|
|
&setTheseAttributes,
|
|
|
|
&clearTheseAttributes))
|
|
|
|
return NULL;
|
|
|
|
_err = ChangeMenuAttributes(_self->ob_itself,
|
|
|
|
setTheseAttributes,
|
|
|
|
clearTheseAttributes);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuItemAttributes(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex item;
|
|
|
|
MenuItemAttributes outAttributes;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuItemAttributes
|
|
|
|
PyMac_PRECHECK(GetMenuItemAttributes);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuItemAttributes(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
&outAttributes);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outAttributes);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_ChangeMenuItemAttributes(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex item;
|
|
|
|
MenuItemAttributes setTheseAttributes;
|
|
|
|
MenuItemAttributes clearTheseAttributes;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef ChangeMenuItemAttributes
|
|
|
|
PyMac_PRECHECK(ChangeMenuItemAttributes);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hll",
|
|
|
|
&item,
|
|
|
|
&setTheseAttributes,
|
|
|
|
&clearTheseAttributes))
|
|
|
|
return NULL;
|
|
|
|
_err = ChangeMenuItemAttributes(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
setTheseAttributes,
|
|
|
|
clearTheseAttributes);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DisableAllMenuItems(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DisableAllMenuItems
|
|
|
|
PyMac_PRECHECK(DisableAllMenuItems);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
DisableAllMenuItems(_self->ob_itself);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_EnableAllMenuItems(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef EnableAllMenuItems
|
|
|
|
PyMac_PRECHECK(EnableAllMenuItems);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
EnableAllMenuItems(_self->ob_itself);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_MenuHasEnabledItems(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MenuHasEnabledItems
|
|
|
|
PyMac_PRECHECK(MenuHasEnabledItems);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = MenuHasEnabledItems(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_GetMenuType(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
UInt16 outType;
|
|
|
|
#ifndef GetMenuType
|
|
|
|
PyMac_PRECHECK(GetMenuType);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuType(_self->ob_itself,
|
|
|
|
&outType);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("H",
|
|
|
|
outType);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *MenuObj_CountMenuItemsWithCommandID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
ItemCount _rv;
|
2001-12-16 16:18:40 -04:00
|
|
|
MenuCommand inCommandID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef CountMenuItemsWithCommandID
|
|
|
|
PyMac_PRECHECK(CountMenuItemsWithCommandID);
|
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, "l",
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_rv = CountMenuItemsWithCommandID(_self->ob_itself,
|
|
|
|
inCommandID);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetIndMenuItemWithCommandID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
UInt32 inItemIndex;
|
|
|
|
MenuHandle outMenu;
|
|
|
|
MenuItemIndex outIndex;
|
|
|
|
#ifndef GetIndMenuItemWithCommandID
|
|
|
|
PyMac_PRECHECK(GetIndMenuItemWithCommandID);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "ll",
|
|
|
|
&inCommandID,
|
|
|
|
&inItemIndex))
|
|
|
|
return NULL;
|
|
|
|
_err = GetIndMenuItemWithCommandID(_self->ob_itself,
|
|
|
|
inCommandID,
|
|
|
|
inItemIndex,
|
|
|
|
&outMenu,
|
|
|
|
&outIndex);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&h",
|
|
|
|
MenuObj_New, outMenu,
|
|
|
|
outIndex);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_EnableMenuCommand(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef EnableMenuCommand
|
|
|
|
PyMac_PRECHECK(EnableMenuCommand);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "l",
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
EnableMenuCommand(_self->ob_itself,
|
|
|
|
inCommandID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_DisableMenuCommand(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef DisableMenuCommand
|
|
|
|
PyMac_PRECHECK(DisableMenuCommand);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "l",
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
DisableMenuCommand(_self->ob_itself,
|
|
|
|
inCommandID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_IsMenuCommandEnabled(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef IsMenuCommandEnabled
|
|
|
|
PyMac_PRECHECK(IsMenuCommandEnabled);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "l",
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuCommandEnabled(_self->ob_itself,
|
|
|
|
inCommandID);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuCommandMark(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
UniChar inMark;
|
|
|
|
#ifndef SetMenuCommandMark
|
|
|
|
PyMac_PRECHECK(SetMenuCommandMark);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "lh",
|
|
|
|
&inCommandID,
|
|
|
|
&inMark))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = SetMenuCommandMark(_self->ob_itself,
|
|
|
|
inCommandID,
|
|
|
|
inMark);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
2001-08-23 11:02:09 -03:00
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_GetMenuCommandMark(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2001-12-16 16:18:40 -04:00
|
|
|
MenuCommand inCommandID;
|
|
|
|
UniChar outMark;
|
|
|
|
#ifndef GetMenuCommandMark
|
|
|
|
PyMac_PRECHECK(GetMenuCommandMark);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, "l",
|
|
|
|
&inCommandID))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = GetMenuCommandMark(_self->ob_itself,
|
|
|
|
inCommandID,
|
|
|
|
&outMark);
|
2001-08-23 11:02:09 -03:00
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
2001-12-16 16:18:40 -04:00
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
outMark);
|
2001-08-23 11:02:09 -03:00
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_GetMenuCommandPropertySize(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
OSStatus _err;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
OSType inPropertyCreator;
|
|
|
|
OSType inPropertyTag;
|
|
|
|
ByteCount outSize;
|
|
|
|
#ifndef GetMenuCommandPropertySize
|
|
|
|
PyMac_PRECHECK(GetMenuCommandPropertySize);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, "lO&O&",
|
|
|
|
&inCommandID,
|
|
|
|
PyMac_GetOSType, &inPropertyCreator,
|
|
|
|
PyMac_GetOSType, &inPropertyTag))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = GetMenuCommandPropertySize(_self->ob_itself,
|
|
|
|
inCommandID,
|
|
|
|
inPropertyCreator,
|
|
|
|
inPropertyTag,
|
|
|
|
&outSize);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outSize);
|
2001-08-23 11:02:09 -03:00
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_RemoveMenuCommandProperty(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
OSStatus _err;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
OSType inPropertyCreator;
|
|
|
|
OSType inPropertyTag;
|
|
|
|
#ifndef RemoveMenuCommandProperty
|
|
|
|
PyMac_PRECHECK(RemoveMenuCommandProperty);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, "lO&O&",
|
|
|
|
&inCommandID,
|
|
|
|
PyMac_GetOSType, &inPropertyCreator,
|
|
|
|
PyMac_GetOSType, &inPropertyTag))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = RemoveMenuCommandProperty(_self->ob_itself,
|
|
|
|
inCommandID,
|
|
|
|
inPropertyCreator,
|
|
|
|
inPropertyTag);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
2001-08-23 11:02:09 -03:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_IsMenuItemInvalid(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
2003-12-05 20:00:17 -04:00
|
|
|
MenuItemIndex inItem;
|
2001-12-16 16:18:40 -04:00
|
|
|
#ifndef IsMenuItemInvalid
|
|
|
|
PyMac_PRECHECK(IsMenuItemInvalid);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
2003-12-05 20:00:17 -04:00
|
|
|
&inItem))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_rv = IsMenuItemInvalid(_self->ob_itself,
|
2003-12-05 20:00:17 -04:00
|
|
|
inItem);
|
2001-08-23 11:02:09 -03:00
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_InvalidateMenuItems(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2003-12-05 20:00:17 -04:00
|
|
|
MenuItemIndex inFirstItem;
|
|
|
|
ItemCount inNumItems;
|
2001-12-16 16:18:40 -04:00
|
|
|
#ifndef InvalidateMenuItems
|
|
|
|
PyMac_PRECHECK(InvalidateMenuItems);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
2003-12-05 20:00:17 -04:00
|
|
|
&inFirstItem,
|
|
|
|
&inNumItems))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = InvalidateMenuItems(_self->ob_itself,
|
2003-12-05 20:00:17 -04:00
|
|
|
inFirstItem,
|
|
|
|
inNumItems);
|
2001-08-23 11:02:09 -03:00
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
2001-12-16 16:18:40 -04:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
2001-08-23 11:02:09 -03:00
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *MenuObj_UpdateInvalidMenuItems(MenuObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2001-12-16 16:18:40 -04:00
|
|
|
#ifndef UpdateInvalidMenuItems
|
|
|
|
PyMac_PRECHECK(UpdateInvalidMenuItems);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-12-16 16:18:40 -04:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = UpdateInvalidMenuItems(_self->ob_itself);
|
2001-08-23 11:02:09 -03:00
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_CreateStandardFontMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex afterItem;
|
|
|
|
MenuID firstHierMenuID;
|
|
|
|
OptionBits options;
|
|
|
|
ItemCount outHierMenuCount;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef CreateStandardFontMenu
|
|
|
|
PyMac_PRECHECK(CreateStandardFontMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hhl",
|
|
|
|
&afterItem,
|
|
|
|
&firstHierMenuID,
|
|
|
|
&options))
|
|
|
|
return NULL;
|
|
|
|
_err = CreateStandardFontMenu(_self->ob_itself,
|
|
|
|
afterItem,
|
|
|
|
firstHierMenuID,
|
|
|
|
options,
|
|
|
|
&outHierMenuCount);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outHierMenuCount);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_UpdateStandardFontMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
ItemCount outHierMenuCount;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef UpdateStandardFontMenu
|
|
|
|
PyMac_PRECHECK(UpdateStandardFontMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = UpdateStandardFontMenu(_self->ob_itself,
|
|
|
|
&outHierMenuCount);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outHierMenuCount);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetFontFamilyFromMenuSelection(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuItemIndex item;
|
|
|
|
FMFontFamily outFontFamily;
|
|
|
|
FMFontStyle outStyle;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetFontFamilyFromMenuSelection
|
|
|
|
PyMac_PRECHECK(GetFontFamilyFromMenuSelection);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
_err = GetFontFamilyFromMenuSelection(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
&outFontFamily,
|
|
|
|
&outStyle);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("hh",
|
|
|
|
outFontFamily,
|
|
|
|
outStyle);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuID
|
|
|
|
PyMac_PRECHECK(GetMenuID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuID(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuWidth(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
SInt16 _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuWidth
|
|
|
|
PyMac_PRECHECK(GetMenuWidth);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuWidth(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_GetMenuHeight(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
SInt16 _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuHeight
|
|
|
|
PyMac_PRECHECK(GetMenuHeight);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuHeight(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuID(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID menuID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuID
|
|
|
|
PyMac_PRECHECK(SetMenuID);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuID))
|
|
|
|
return NULL;
|
|
|
|
SetMenuID(_self->ob_itself,
|
|
|
|
menuID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuWidth(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
SInt16 width;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuWidth
|
|
|
|
PyMac_PRECHECK(SetMenuWidth);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&width))
|
|
|
|
return NULL;
|
|
|
|
SetMenuWidth(_self->ob_itself,
|
|
|
|
width);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_SetMenuHeight(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
SInt16 height;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuHeight
|
|
|
|
PyMac_PRECHECK(SetMenuHeight);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&height))
|
|
|
|
return NULL;
|
|
|
|
SetMenuHeight(_self->ob_itself,
|
|
|
|
height);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_as_Resource(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Handle _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef as_Resource
|
|
|
|
PyMac_PRECHECK(as_Resource);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = as_Resource(_self->ob_itself);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
ResObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_AppendMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Str255 data;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef AppendMenu
|
|
|
|
PyMac_PRECHECK(AppendMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetStr255, data))
|
|
|
|
return NULL;
|
|
|
|
AppendMenu(_self->ob_itself,
|
|
|
|
data);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertMenu(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short beforeID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InsertMenu
|
|
|
|
PyMac_PRECHECK(InsertMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&beforeID))
|
|
|
|
return NULL;
|
|
|
|
InsertMenu(_self->ob_itself,
|
|
|
|
beforeID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_InsertMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Str255 itemString;
|
|
|
|
short afterItem;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InsertMenuItem
|
|
|
|
PyMac_PRECHECK(InsertMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&h",
|
|
|
|
PyMac_GetStr255, itemString,
|
|
|
|
&afterItem))
|
|
|
|
return NULL;
|
|
|
|
InsertMenuItem(_self->ob_itself,
|
|
|
|
itemString,
|
|
|
|
afterItem);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_EnableMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
UInt16 item;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef EnableMenuItem
|
|
|
|
PyMac_PRECHECK(EnableMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "H",
|
|
|
|
&item))
|
|
|
|
return NULL;
|
|
|
|
EnableMenuItem(_self->ob_itself,
|
|
|
|
item);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *MenuObj_CheckMenuItem(MenuObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short item;
|
|
|
|
Boolean checked;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef CheckMenuItem
|
|
|
|
PyMac_PRECHECK(CheckMenuItem);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hb",
|
|
|
|
&item,
|
|
|
|
&checked))
|
|
|
|
return NULL;
|
|
|
|
CheckMenuItem(_self->ob_itself,
|
|
|
|
item,
|
|
|
|
checked);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyMethodDef MenuObj_methods[] = {
|
|
|
|
{"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1,
|
2003-12-05 20:00:17 -04:00
|
|
|
PyDoc_STR("() -> (UInt16 _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inFontID, UInt16 inFontSize) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuExcludesMarkColumn", (PyCFunction)MenuObj_GetMenuExcludesMarkColumn, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Boolean _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuExcludesMarkColumn", (PyCFunction)MenuObj_SetMenuExcludesMarkColumn, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Boolean excludesMark) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"IsValidMenu", (PyCFunction)MenuObj_IsValidMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Boolean _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"GetMenuRetainCount", (PyCFunction)MenuObj_GetMenuRetainCount, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (ItemCount _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"RetainMenu", (PyCFunction)MenuObj_RetainMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"ReleaseMenu", (PyCFunction)MenuObj_ReleaseMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"DuplicateMenu", (PyCFunction)MenuObj_DuplicateMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (MenuHandle outMenu)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"CopyMenuTitleAsCFString", (PyCFunction)MenuObj_CopyMenuTitleAsCFString, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (CFStringRef outString)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuTitleWithCFString", (PyCFunction)MenuObj_SetMenuTitleWithCFString, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(CFStringRef inString) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"InvalidateMenuSize", (PyCFunction)MenuObj_InvalidateMenuSize, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"IsMenuSizeInvalid", (PyCFunction)MenuObj_IsMenuSizeInvalid, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Boolean _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacAppendMenu", (PyCFunction)MenuObj_MacAppendMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Str255 data) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(ResType theType, short afterItem) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(ResType theType) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacInsertMenuItem", (PyCFunction)MenuObj_MacInsertMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short afterItem, short scriptFilter) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(ResType theType, short afterItem, short scriptFilter) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Str255 inString) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Str255 inString, MenuItemIndex afterItem) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"CopyMenuItems", (PyCFunction)MenuObj_CopyMenuItems, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems, MenuHandle inDestMenu, MenuItemIndex inInsertAfter) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"DeleteMenuItems", (PyCFunction)MenuObj_DeleteMenuItems, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"AppendMenuItemTextWithCFString", (PyCFunction)MenuObj_AppendMenuItemTextWithCFString, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(CFStringRef inString, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> (MenuItemIndex outNewItem)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"InsertMenuItemTextWithCFString", (PyCFunction)MenuObj_InsertMenuItemTextWithCFString, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(CFStringRef inString, MenuItemIndex inAfterItem, MenuItemAttributes inAttributes, MenuCommand inCommandID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short top, short left, short popUpItem) -> (long _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"InvalidateMenuEnabling", (PyCFunction)MenuObj_InvalidateMenuEnabling, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"IsMenuBarInvalid", (PyCFunction)MenuObj_IsMenuBarInvalid, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Boolean _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID beforeID) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetRootMenu", (PyCFunction)MenuObj_SetRootMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"MacCheckMenuItem", (PyCFunction)MenuObj_MacCheckMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, Boolean checked) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, Str255 itemString) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item) -> (Str255 itemString)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetItemMark", (PyCFunction)MenuObj_SetItemMark, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, CharParameter markChar) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetItemMark", (PyCFunction)MenuObj_GetItemMark, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item) -> (CharParameter markChar)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetItemCmd", (PyCFunction)MenuObj_SetItemCmd, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, CharParameter cmdChar) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetItemCmd", (PyCFunction)MenuObj_GetItemCmd, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item) -> (CharParameter cmdChar)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetItemIcon", (PyCFunction)MenuObj_SetItemIcon, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, short iconIndex) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetItemIcon", (PyCFunction)MenuObj_GetItemIcon, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item) -> (short iconIndex)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetItemStyle", (PyCFunction)MenuObj_SetItemStyle, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, StyleParameter chStyle) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item) -> (Style chStyle)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, MenuCommand inCommandID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (MenuCommand outCommandID)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemModifiers", (PyCFunction)MenuObj_SetMenuItemModifiers, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, UInt8 inModifiers) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemModifiers", (PyCFunction)MenuObj_GetMenuItemModifiers, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (UInt8 outModifiers)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemIconHandle", (PyCFunction)MenuObj_SetMenuItemIconHandle, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, UInt8 inIconType, Handle inIconHandle) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemIconHandle", (PyCFunction)MenuObj_GetMenuItemIconHandle, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (UInt8 outIconType, Handle outIconHandle)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemTextEncoding", (PyCFunction)MenuObj_SetMenuItemTextEncoding, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, TextEncoding inScriptID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemTextEncoding", (PyCFunction)MenuObj_GetMenuItemTextEncoding, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (TextEncoding outScriptID)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemHierarchicalID", (PyCFunction)MenuObj_SetMenuItemHierarchicalID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, MenuID inHierID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (MenuID outHierID)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemFontID", (PyCFunction)MenuObj_SetMenuItemFontID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, SInt16 inFontID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemFontID", (PyCFunction)MenuObj_GetMenuItemFontID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (SInt16 outFontID)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemRefCon", (PyCFunction)MenuObj_SetMenuItemRefCon, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, UInt32 inRefCon) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemRefCon", (PyCFunction)MenuObj_GetMenuItemRefCon, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (UInt32 outRefCon)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuItemKeyGlyph", (PyCFunction)MenuObj_SetMenuItemKeyGlyph, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem, SInt16 inGlyph) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 inItem) -> (SInt16 outGlyph)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_SetMenuItemHierarchicalMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem, MenuHandle inHierMenu) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"GetMenuItemHierarchicalMenu", (PyCFunction)MenuObj_GetMenuItemHierarchicalMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem) -> (MenuHandle outHierMenu)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"CopyMenuItemTextAsCFString", (PyCFunction)MenuObj_CopyMenuItemTextAsCFString, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem) -> (CFStringRef outString)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuItemTextWithCFString", (PyCFunction)MenuObj_SetMenuItemTextWithCFString, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem, CFStringRef inString) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"GetMenuItemIndent", (PyCFunction)MenuObj_GetMenuItemIndent, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem) -> (UInt32 outIndent)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuItemIndent", (PyCFunction)MenuObj_SetMenuItemIndent, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem, UInt32 inIndent) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"GetMenuItemCommandKey", (PyCFunction)MenuObj_GetMenuItemCommandKey, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem, Boolean inGetVirtualKey) -> (UInt16 outKey)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuItemCommandKey", (PyCFunction)MenuObj_SetMenuItemCommandKey, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem, Boolean inSetVirtualKey, UInt16 inKey) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemPropertyAttributes", (PyCFunction)MenuObj_GetMenuItemPropertyAttributes, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"ChangeMenuItemPropertyAttributes", (PyCFunction)MenuObj_ChangeMenuItemPropertyAttributes, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuAttributes", (PyCFunction)MenuObj_GetMenuAttributes, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (MenuAttributes outAttributes)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"ChangeMenuAttributes", (PyCFunction)MenuObj_ChangeMenuAttributes, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuItemAttributes", (PyCFunction)MenuObj_GetMenuItemAttributes, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> (MenuItemAttributes outAttributes)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"ChangeMenuItemAttributes", (PyCFunction)MenuObj_ChangeMenuItemAttributes, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DisableAllMenuItems", (PyCFunction)MenuObj_DisableAllMenuItems, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"EnableAllMenuItems", (PyCFunction)MenuObj_EnableAllMenuItems, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MenuHasEnabledItems", (PyCFunction)MenuObj_MenuHasEnabledItems, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Boolean _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"GetMenuType", (PyCFunction)MenuObj_GetMenuType, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (UInt16 outType)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"CountMenuItemsWithCommandID", (PyCFunction)MenuObj_CountMenuItemsWithCommandID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID) -> (ItemCount _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetIndMenuItemWithCommandID", (PyCFunction)MenuObj_GetIndMenuItemWithCommandID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"EnableMenuCommand", (PyCFunction)MenuObj_EnableMenuCommand, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DisableMenuCommand", (PyCFunction)MenuObj_DisableMenuCommand, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"IsMenuCommandEnabled", (PyCFunction)MenuObj_IsMenuCommandEnabled, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID) -> (Boolean _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuCommandMark", (PyCFunction)MenuObj_SetMenuCommandMark, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID, UniChar inMark) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"GetMenuCommandMark", (PyCFunction)MenuObj_GetMenuCommandMark, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID) -> (UniChar outMark)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuCommandPropertySize", (PyCFunction)MenuObj_GetMenuCommandPropertySize, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"RemoveMenuCommandProperty", (PyCFunction)MenuObj_RemoveMenuCommandProperty, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"IsMenuItemInvalid", (PyCFunction)MenuObj_IsMenuItemInvalid, 1,
|
2003-12-05 20:00:17 -04:00
|
|
|
PyDoc_STR("(MenuItemIndex inItem) -> (Boolean _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"InvalidateMenuItems", (PyCFunction)MenuObj_InvalidateMenuItems, 1,
|
2003-12-05 20:00:17 -04:00
|
|
|
PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"UpdateInvalidMenuItems", (PyCFunction)MenuObj_UpdateInvalidMenuItems, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"CreateStandardFontMenu", (PyCFunction)MenuObj_CreateStandardFontMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"UpdateStandardFontMenu", (PyCFunction)MenuObj_UpdateStandardFontMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (ItemCount outHierMenuCount)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetFontFamilyFromMenuSelection", (PyCFunction)MenuObj_GetFontFamilyFromMenuSelection, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuID", (PyCFunction)MenuObj_GetMenuID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (MenuID _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuWidth", (PyCFunction)MenuObj_GetMenuWidth, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (SInt16 _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuHeight", (PyCFunction)MenuObj_GetMenuHeight, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (SInt16 _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuID", (PyCFunction)MenuObj_SetMenuID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuWidth", (PyCFunction)MenuObj_SetMenuWidth, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 width) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuHeight", (PyCFunction)MenuObj_SetMenuHeight, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(SInt16 height) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Handle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Str255 data) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InsertMenu", (PyCFunction)MenuObj_InsertMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short beforeID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InsertMenuItem", (PyCFunction)MenuObj_InsertMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Str255 itemString, short afterItem) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"EnableMenuItem", (PyCFunction)MenuObj_EnableMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(UInt16 item) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"CheckMenuItem", (PyCFunction)MenuObj_CheckMenuItem, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short item, Boolean checked) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{NULL, NULL, 0}
|
|
|
|
};
|
|
|
|
|
2002-11-29 19:40:48 -04:00
|
|
|
#define MenuObj_getsetlist NULL
|
2001-08-23 11:02:09 -03:00
|
|
|
|
2002-12-03 19:40:22 -04:00
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
#define MenuObj_compare NULL
|
|
|
|
|
|
|
|
#define MenuObj_repr NULL
|
|
|
|
|
|
|
|
#define MenuObj_hash NULL
|
2002-12-03 19:40:22 -04:00
|
|
|
#define MenuObj_tp_init 0
|
|
|
|
|
|
|
|
#define MenuObj_tp_alloc PyType_GenericAlloc
|
|
|
|
|
2005-07-03 17:59:44 -03:00
|
|
|
static PyObject *MenuObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
|
2002-12-03 19:40:22 -04:00
|
|
|
{
|
2005-07-03 17:59:44 -03:00
|
|
|
PyObject *_self;
|
2002-12-03 19:40:22 -04:00
|
|
|
MenuHandle itself;
|
|
|
|
char *kw[] = {"itself", 0};
|
|
|
|
|
2005-07-03 17:59:44 -03:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, MenuObj_Convert, &itself)) return NULL;
|
|
|
|
if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
|
|
|
|
((MenuObject *)_self)->ob_itself = itself;
|
|
|
|
return _self;
|
2002-12-03 19:40:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define MenuObj_tp_free PyObject_Del
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
|
|
|
|
PyTypeObject Menu_Type = {
|
2001-11-30 10:16:36 -04:00
|
|
|
PyObject_HEAD_INIT(NULL)
|
2001-08-23 11:02:09 -03:00
|
|
|
0, /*ob_size*/
|
2001-12-08 14:02:58 -04:00
|
|
|
"_Menu.Menu", /*tp_name*/
|
2001-08-23 11:02:09 -03:00
|
|
|
sizeof(MenuObject), /*tp_basicsize*/
|
|
|
|
0, /*tp_itemsize*/
|
|
|
|
/* methods */
|
|
|
|
(destructor) MenuObj_dealloc, /*tp_dealloc*/
|
|
|
|
0, /*tp_print*/
|
2002-11-29 19:40:48 -04:00
|
|
|
(getattrfunc)0, /*tp_getattr*/
|
|
|
|
(setattrfunc)0, /*tp_setattr*/
|
2001-08-23 11:02:09 -03:00
|
|
|
(cmpfunc) MenuObj_compare, /*tp_compare*/
|
|
|
|
(reprfunc) MenuObj_repr, /*tp_repr*/
|
|
|
|
(PyNumberMethods *)0, /* tp_as_number */
|
|
|
|
(PySequenceMethods *)0, /* tp_as_sequence */
|
|
|
|
(PyMappingMethods *)0, /* tp_as_mapping */
|
|
|
|
(hashfunc) MenuObj_hash, /*tp_hash*/
|
2002-11-29 19:40:48 -04:00
|
|
|
0, /*tp_call*/
|
|
|
|
0, /*tp_str*/
|
|
|
|
PyObject_GenericGetAttr, /*tp_getattro*/
|
|
|
|
PyObject_GenericSetAttr, /*tp_setattro */
|
2002-12-03 19:40:22 -04:00
|
|
|
0, /*tp_as_buffer*/
|
|
|
|
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
|
|
|
|
0, /*tp_doc*/
|
|
|
|
0, /*tp_traverse*/
|
|
|
|
0, /*tp_clear*/
|
|
|
|
0, /*tp_richcompare*/
|
|
|
|
0, /*tp_weaklistoffset*/
|
|
|
|
0, /*tp_iter*/
|
|
|
|
0, /*tp_iternext*/
|
2002-11-29 19:40:48 -04:00
|
|
|
MenuObj_methods, /* tp_methods */
|
2002-12-03 19:40:22 -04:00
|
|
|
0, /*tp_members*/
|
2002-11-29 19:40:48 -04:00
|
|
|
MenuObj_getsetlist, /*tp_getset*/
|
2002-12-03 19:40:22 -04:00
|
|
|
0, /*tp_base*/
|
|
|
|
0, /*tp_dict*/
|
|
|
|
0, /*tp_descr_get*/
|
|
|
|
0, /*tp_descr_set*/
|
|
|
|
0, /*tp_dictoffset*/
|
|
|
|
MenuObj_tp_init, /* tp_init */
|
|
|
|
MenuObj_tp_alloc, /* tp_alloc */
|
|
|
|
MenuObj_tp_new, /* tp_new */
|
|
|
|
MenuObj_tp_free, /* tp_free */
|
2001-08-23 11:02:09 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ---------------------- End object type Menu ---------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject *Menu_NewMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle _rv;
|
|
|
|
MenuID menuID;
|
|
|
|
Str255 menuTitle;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef NewMenu
|
|
|
|
PyMac_PRECHECK(NewMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hO&",
|
|
|
|
&menuID,
|
|
|
|
PyMac_GetStr255, menuTitle))
|
|
|
|
return NULL;
|
|
|
|
_rv = NewMenu(menuID,
|
|
|
|
menuTitle);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MacGetMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle _rv;
|
|
|
|
short resourceID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacGetMenu
|
|
|
|
PyMac_PRECHECK(MacGetMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&resourceID))
|
|
|
|
return NULL;
|
|
|
|
_rv = MacGetMenu(resourceID);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_CreateNewMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2001-12-16 16:18:40 -04:00
|
|
|
MenuID inMenuID;
|
|
|
|
MenuAttributes inMenuAttributes;
|
2001-08-23 11:02:09 -03:00
|
|
|
MenuHandle outMenuRef;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef CreateNewMenu
|
|
|
|
PyMac_PRECHECK(CreateNewMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hl",
|
2001-12-16 16:18:40 -04:00
|
|
|
&inMenuID,
|
|
|
|
&inMenuAttributes))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = CreateNewMenu(inMenuID,
|
|
|
|
inMenuAttributes,
|
2001-08-23 11:02:09 -03:00
|
|
|
&outMenuRef);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, outMenuRef);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MenuKey(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
long _rv;
|
|
|
|
CharParameter ch;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MenuKey
|
|
|
|
PyMac_PRECHECK(MenuKey);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&ch))
|
|
|
|
return NULL;
|
|
|
|
_rv = MenuKey(ch);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MenuSelect(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
long _rv;
|
|
|
|
Point startPt;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MenuSelect
|
|
|
|
PyMac_PRECHECK(MenuSelect);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetPoint, &startPt))
|
|
|
|
return NULL;
|
|
|
|
_rv = MenuSelect(startPt);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MenuChoice(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
long _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MenuChoice
|
|
|
|
PyMac_PRECHECK(MenuChoice);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = MenuChoice();
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MenuEvent(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
UInt32 _rv;
|
|
|
|
EventRecord inEvent;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MenuEvent
|
|
|
|
PyMac_PRECHECK(MenuEvent);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetEventRecord, &inEvent))
|
|
|
|
return NULL;
|
|
|
|
_rv = MenuEvent(&inEvent);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetMBarHeight(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMBarHeight
|
|
|
|
PyMac_PRECHECK(GetMBarHeight);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMBarHeight();
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MacDrawMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacDrawMenuBar
|
|
|
|
PyMac_PRECHECK(MacDrawMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
MacDrawMenuBar();
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_InvalMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InvalMenuBar
|
|
|
|
PyMac_PRECHECK(InvalMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
InvalMenuBar();
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_HiliteMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID menuID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef HiliteMenu
|
|
|
|
PyMac_PRECHECK(HiliteMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuID))
|
|
|
|
return NULL;
|
|
|
|
HiliteMenu(menuID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetNewMBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuBarHandle _rv;
|
|
|
|
short menuBarID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetNewMBar
|
|
|
|
PyMac_PRECHECK(GetNewMBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuBarID))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetNewMBar(menuBarID);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
ResObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuBarHandle _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuBar
|
|
|
|
PyMac_PRECHECK(GetMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuBar();
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
ResObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_SetMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuBarHandle mbar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef SetMenuBar
|
|
|
|
PyMac_PRECHECK(SetMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
ResObj_Convert, &mbar))
|
|
|
|
return NULL;
|
|
|
|
SetMenuBar(mbar);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_DuplicateMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2001-12-16 16:18:40 -04:00
|
|
|
MenuBarHandle inMbar;
|
|
|
|
MenuBarHandle outMbar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DuplicateMenuBar
|
|
|
|
PyMac_PRECHECK(DuplicateMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
2001-12-16 16:18:40 -04:00
|
|
|
ResObj_Convert, &inMbar))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = DuplicateMenuBar(inMbar,
|
|
|
|
&outMbar);
|
2001-08-23 11:02:09 -03:00
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&",
|
2001-12-16 16:18:40 -04:00
|
|
|
ResObj_New, outMbar);
|
2001-08-23 11:02:09 -03:00
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_DisposeMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2001-12-16 16:18:40 -04:00
|
|
|
MenuBarHandle inMbar;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DisposeMenuBar
|
|
|
|
PyMac_PRECHECK(DisposeMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
2001-12-16 16:18:40 -04:00
|
|
|
ResObj_Convert, &inMbar))
|
2001-08-23 11:02:09 -03:00
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
_err = DisposeMenuBar(inMbar);
|
2001-08-23 11:02:09 -03:00
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetMenuHandle(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle _rv;
|
|
|
|
MenuID menuID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenuHandle
|
|
|
|
PyMac_PRECHECK(GetMenuHandle);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuID))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenuHandle(menuID);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_MacDeleteMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID menuID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef MacDeleteMenu
|
|
|
|
PyMac_PRECHECK(MacDeleteMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuID))
|
|
|
|
return NULL;
|
|
|
|
MacDeleteMenu(menuID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_ClearMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef ClearMenuBar
|
|
|
|
PyMac_PRECHECK(ClearMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
ClearMenuBar();
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *Menu_SetMenuFlashCount(PyObject *_self, PyObject *_args)
|
2001-08-23 11:02:09 -03:00
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short count;
|
2001-12-16 16:18:40 -04:00
|
|
|
#ifndef SetMenuFlashCount
|
|
|
|
PyMac_PRECHECK(SetMenuFlashCount);
|
2001-11-30 10:16:36 -04:00
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&count))
|
|
|
|
return NULL;
|
2001-12-16 16:18:40 -04:00
|
|
|
SetMenuFlashCount(count);
|
2001-08-23 11:02:09 -03:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_FlashMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID menuID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef FlashMenuBar
|
|
|
|
PyMac_PRECHECK(FlashMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuID))
|
|
|
|
return NULL;
|
|
|
|
FlashMenuBar(menuID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_IsMenuBarVisible(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef IsMenuBarVisible
|
|
|
|
PyMac_PRECHECK(IsMenuBarVisible);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuBarVisible();
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_ShowMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef ShowMenuBar
|
|
|
|
PyMac_PRECHECK(ShowMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
ShowMenuBar();
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_HideMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef HideMenuBar
|
|
|
|
PyMac_PRECHECK(HideMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
HideMenuBar();
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *Menu_AcquireRootMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle _rv;
|
|
|
|
#ifndef AcquireRootMenu
|
|
|
|
PyMac_PRECHECK(AcquireRootMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = AcquireRootMenu();
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *Menu_DeleteMCEntries(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuID menuID;
|
|
|
|
short menuItem;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DeleteMCEntries
|
|
|
|
PyMac_PRECHECK(DeleteMCEntries);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "hh",
|
|
|
|
&menuID,
|
|
|
|
&menuItem))
|
|
|
|
return NULL;
|
|
|
|
DeleteMCEntries(menuID,
|
|
|
|
menuItem);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_InitContextualMenus(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef InitContextualMenus
|
|
|
|
PyMac_PRECHECK(InitContextualMenus);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_err = InitContextualMenus();
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_IsShowContextualMenuClick(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
EventRecord inEvent;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef IsShowContextualMenuClick
|
|
|
|
PyMac_PRECHECK(IsShowContextualMenuClick);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
PyMac_GetEventRecord, &inEvent))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsShowContextualMenuClick(&inEvent);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-12-16 16:18:40 -04:00
|
|
|
static PyObject *Menu_LMGetTheMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
SInt16 _rv;
|
|
|
|
#ifndef LMGetTheMenu
|
|
|
|
PyMac_PRECHECK(LMGetTheMenu);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
_rv = LMGetTheMenu();
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyObject *Menu_as_Menu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle _rv;
|
|
|
|
Handle h;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef as_Menu
|
|
|
|
PyMac_PRECHECK(as_Menu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "O&",
|
|
|
|
ResObj_Convert, &h))
|
|
|
|
return NULL;
|
|
|
|
_rv = as_Menu(h);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle _rv;
|
|
|
|
short resourceID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef GetMenu
|
|
|
|
PyMac_PRECHECK(GetMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&resourceID))
|
|
|
|
return NULL;
|
|
|
|
_rv = GetMenu(resourceID);
|
|
|
|
_res = Py_BuildValue("O&",
|
|
|
|
MenuObj_New, _rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_DeleteMenu(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
short menuID;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DeleteMenu
|
|
|
|
PyMac_PRECHECK(DeleteMenu);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, "h",
|
|
|
|
&menuID))
|
|
|
|
return NULL;
|
|
|
|
DeleteMenu(menuID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_DrawMenuBar(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
2001-11-30 10:16:36 -04:00
|
|
|
#ifndef DrawMenuBar
|
|
|
|
PyMac_PRECHECK(DrawMenuBar);
|
|
|
|
#endif
|
2001-08-23 11:02:09 -03:00
|
|
|
if (!PyArg_ParseTuple(_args, ""))
|
|
|
|
return NULL;
|
|
|
|
DrawMenuBar();
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2002-01-02 10:48:36 -04:00
|
|
|
static PyObject *Menu_CountMenuItemsWithCommandID(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
ItemCount _rv;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef CountMenuItemsWithCommandID
|
|
|
|
PyMac_PRECHECK(CountMenuItemsWithCommandID);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&l",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_rv = CountMenuItemsWithCommandID(inMenu,
|
|
|
|
inCommandID);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetIndMenuItemWithCommandID(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
UInt32 inItemIndex;
|
|
|
|
MenuHandle outMenu;
|
|
|
|
MenuItemIndex outIndex;
|
|
|
|
#ifndef GetIndMenuItemWithCommandID
|
|
|
|
PyMac_PRECHECK(GetIndMenuItemWithCommandID);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&ll",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID,
|
|
|
|
&inItemIndex))
|
|
|
|
return NULL;
|
|
|
|
_err = GetIndMenuItemWithCommandID(inMenu,
|
|
|
|
inCommandID,
|
|
|
|
inItemIndex,
|
|
|
|
&outMenu,
|
|
|
|
&outIndex);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("O&h",
|
|
|
|
MenuObj_New, outMenu,
|
|
|
|
outIndex);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_EnableMenuCommand(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef EnableMenuCommand
|
|
|
|
PyMac_PRECHECK(EnableMenuCommand);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&l",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
EnableMenuCommand(inMenu,
|
|
|
|
inCommandID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_DisableMenuCommand(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef DisableMenuCommand
|
|
|
|
PyMac_PRECHECK(DisableMenuCommand);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&l",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
DisableMenuCommand(inMenu,
|
|
|
|
inCommandID);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_IsMenuCommandEnabled(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
Boolean _rv;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
#ifndef IsMenuCommandEnabled
|
|
|
|
PyMac_PRECHECK(IsMenuCommandEnabled);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&l",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_rv = IsMenuCommandEnabled(inMenu,
|
|
|
|
inCommandID);
|
|
|
|
_res = Py_BuildValue("b",
|
|
|
|
_rv);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_SetMenuCommandMark(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
UniChar inMark;
|
|
|
|
#ifndef SetMenuCommandMark
|
|
|
|
PyMac_PRECHECK(SetMenuCommandMark);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&lh",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID,
|
|
|
|
&inMark))
|
|
|
|
return NULL;
|
|
|
|
_err = SetMenuCommandMark(inMenu,
|
|
|
|
inCommandID,
|
|
|
|
inMark);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetMenuCommandMark(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
UniChar outMark;
|
|
|
|
#ifndef GetMenuCommandMark
|
|
|
|
PyMac_PRECHECK(GetMenuCommandMark);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&l",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuCommandMark(inMenu,
|
|
|
|
inCommandID,
|
|
|
|
&outMark);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("h",
|
|
|
|
outMark);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_GetMenuCommandPropertySize(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
OSType inPropertyCreator;
|
|
|
|
OSType inPropertyTag;
|
|
|
|
ByteCount outSize;
|
|
|
|
#ifndef GetMenuCommandPropertySize
|
|
|
|
PyMac_PRECHECK(GetMenuCommandPropertySize);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&lO&O&",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID,
|
|
|
|
PyMac_GetOSType, &inPropertyCreator,
|
|
|
|
PyMac_GetOSType, &inPropertyTag))
|
|
|
|
return NULL;
|
|
|
|
_err = GetMenuCommandPropertySize(inMenu,
|
|
|
|
inCommandID,
|
|
|
|
inPropertyCreator,
|
|
|
|
inPropertyTag,
|
|
|
|
&outSize);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
_res = Py_BuildValue("l",
|
|
|
|
outSize);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *Menu_RemoveMenuCommandProperty(PyObject *_self, PyObject *_args)
|
|
|
|
{
|
|
|
|
PyObject *_res = NULL;
|
|
|
|
OSStatus _err;
|
|
|
|
MenuHandle inMenu;
|
|
|
|
MenuCommand inCommandID;
|
|
|
|
OSType inPropertyCreator;
|
|
|
|
OSType inPropertyTag;
|
|
|
|
#ifndef RemoveMenuCommandProperty
|
|
|
|
PyMac_PRECHECK(RemoveMenuCommandProperty);
|
|
|
|
#endif
|
|
|
|
if (!PyArg_ParseTuple(_args, "O&lO&O&",
|
|
|
|
OptMenuObj_Convert, &inMenu,
|
|
|
|
&inCommandID,
|
|
|
|
PyMac_GetOSType, &inPropertyCreator,
|
|
|
|
PyMac_GetOSType, &inPropertyTag))
|
|
|
|
return NULL;
|
|
|
|
_err = RemoveMenuCommandProperty(inMenu,
|
|
|
|
inCommandID,
|
|
|
|
inPropertyCreator,
|
|
|
|
inPropertyTag);
|
|
|
|
if (_err != noErr) return PyMac_Error(_err);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
_res = Py_None;
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2001-08-23 11:02:09 -03:00
|
|
|
static PyMethodDef Menu_methods[] = {
|
|
|
|
{"NewMenu", (PyCFunction)Menu_NewMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"CreateNewMenu", (PyCFunction)Menu_CreateNewMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID inMenuID, MenuAttributes inMenuAttributes) -> (MenuHandle outMenuRef)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MenuKey", (PyCFunction)Menu_MenuKey, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(CharParameter ch) -> (long _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Point startPt) -> (long _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MenuChoice", (PyCFunction)Menu_MenuChoice, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (long _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MenuEvent", (PyCFunction)Menu_MenuEvent, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(EventRecord inEvent) -> (UInt32 _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (short _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacDrawMenuBar", (PyCFunction)Menu_MacDrawMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short menuBarID) -> (MenuBarHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (MenuBarHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuBarHandle mbar) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DuplicateMenuBar", (PyCFunction)Menu_DuplicateMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuBarHandle inMbar) -> (MenuBarHandle outMbar)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DisposeMenuBar", (PyCFunction)Menu_DisposeMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuBarHandle inMbar) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID) -> (MenuHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"SetMenuFlashCount", (PyCFunction)Menu_SetMenuFlashCount, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short count) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (Boolean _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"AcquireRootMenu", (PyCFunction)Menu_AcquireRootMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (MenuHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuID menuID, short menuItem) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(EventRecord inEvent) -> (Boolean _rv)")},
|
2001-12-16 16:18:40 -04:00
|
|
|
{"LMGetTheMenu", (PyCFunction)Menu_LMGetTheMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> (SInt16 _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"as_Menu", (PyCFunction)Menu_as_Menu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(Handle h) -> (MenuHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"GetMenu", (PyCFunction)Menu_GetMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short resourceID) -> (MenuHandle _rv)")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DeleteMenu", (PyCFunction)Menu_DeleteMenu, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(short menuID) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{"DrawMenuBar", (PyCFunction)Menu_DrawMenuBar, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("() -> None")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"CountMenuItemsWithCommandID", (PyCFunction)Menu_CountMenuItemsWithCommandID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (ItemCount _rv)")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"GetIndMenuItemWithCommandID", (PyCFunction)Menu_GetIndMenuItemWithCommandID, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UInt32 inItemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"EnableMenuCommand", (PyCFunction)Menu_EnableMenuCommand, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"DisableMenuCommand", (PyCFunction)Menu_DisableMenuCommand, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> None")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"IsMenuCommandEnabled", (PyCFunction)Menu_IsMenuCommandEnabled, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (Boolean _rv)")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"SetMenuCommandMark", (PyCFunction)Menu_SetMenuCommandMark, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, UniChar inMark) -> None")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"GetMenuCommandMark", (PyCFunction)Menu_GetMenuCommandMark, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID) -> (UniChar outMark)")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"GetMenuCommandPropertySize", (PyCFunction)Menu_GetMenuCommandPropertySize, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
|
2002-01-02 10:48:36 -04:00
|
|
|
{"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1,
|
2002-08-16 06:09:31 -03:00
|
|
|
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
|
2001-08-23 11:02:09 -03:00
|
|
|
{NULL, NULL, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void init_Menu(void)
|
|
|
|
{
|
|
|
|
PyObject *m;
|
|
|
|
PyObject *d;
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-03 17:59:44 -03:00
|
|
|
PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New);
|
|
|
|
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
|
2001-08-23 11:02:09 -03:00
|
|
|
|
|
|
|
|
|
|
|
m = Py_InitModule("_Menu", Menu_methods);
|
|
|
|
d = PyModule_GetDict(m);
|
|
|
|
Menu_Error = PyMac_GetOSErrException();
|
|
|
|
if (Menu_Error == NULL ||
|
|
|
|
PyDict_SetItemString(d, "Error", Menu_Error) != 0)
|
|
|
|
return;
|
|
|
|
Menu_Type.ob_type = &PyType_Type;
|
2002-12-23 19:16:25 -04:00
|
|
|
if (PyType_Ready(&Menu_Type) < 0) return;
|
2001-08-23 11:02:09 -03:00
|
|
|
Py_INCREF(&Menu_Type);
|
2002-12-03 19:40:22 -04:00
|
|
|
PyModule_AddObject(m, "Menu", (PyObject *)&Menu_Type);
|
|
|
|
/* Backward-compatible name */
|
|
|
|
Py_INCREF(&Menu_Type);
|
|
|
|
PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type);
|
2001-08-23 11:02:09 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ======================== End module _Menu ======================== */
|
|
|
|
|