2 /* ========================== Module _Help ========================== */
9 #include "pymactoolbox.h"
11 /* Macro to test whether a weak-loaded CFM function exists */
12 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
13 PyErr_SetString(PyExc_NotImplementedError, \
14 "Not available in this shared library/OS version"); \
19 #include <Carbon/Carbon.h>
21 static PyObject
*Help_Error
;
23 static PyObject
*Help_HMGetHelpMenu(PyObject
*_self
, PyObject
*_args
)
25 PyObject
*_res
= NULL
;
28 MenuItemIndex outFirstCustomItemIndex
;
29 if (!PyArg_ParseTuple(_args
, ""))
31 _err
= HMGetHelpMenu(&outHelpMenu
,
32 &outFirstCustomItemIndex
);
33 if (_err
!= noErr
) return PyMac_Error(_err
);
34 _res
= Py_BuildValue("O&H",
35 MenuObj_New
, outHelpMenu
,
36 outFirstCustomItemIndex
);
40 static PyObject
*Help_HMAreHelpTagsDisplayed(PyObject
*_self
, PyObject
*_args
)
42 PyObject
*_res
= NULL
;
44 if (!PyArg_ParseTuple(_args
, ""))
46 _rv
= HMAreHelpTagsDisplayed();
47 _res
= Py_BuildValue("b",
52 static PyObject
*Help_HMSetHelpTagsDisplayed(PyObject
*_self
, PyObject
*_args
)
54 PyObject
*_res
= NULL
;
56 Boolean inDisplayTags
;
57 if (!PyArg_ParseTuple(_args
, "b",
60 _err
= HMSetHelpTagsDisplayed(inDisplayTags
);
61 if (_err
!= noErr
) return PyMac_Error(_err
);
67 static PyObject
*Help_HMSetTagDelay(PyObject
*_self
, PyObject
*_args
)
69 PyObject
*_res
= NULL
;
72 if (!PyArg_ParseTuple(_args
, "l",
75 _err
= HMSetTagDelay(inDelay
);
76 if (_err
!= noErr
) return PyMac_Error(_err
);
82 static PyObject
*Help_HMGetTagDelay(PyObject
*_self
, PyObject
*_args
)
84 PyObject
*_res
= NULL
;
87 if (!PyArg_ParseTuple(_args
, ""))
89 _err
= HMGetTagDelay(&outDelay
);
90 if (_err
!= noErr
) return PyMac_Error(_err
);
91 _res
= Py_BuildValue("l",
96 static PyObject
*Help_HMSetMenuHelpFromBalloonRsrc(PyObject
*_self
, PyObject
*_args
)
98 PyObject
*_res
= NULL
;
102 if (!PyArg_ParseTuple(_args
, "O&h",
103 MenuObj_Convert
, &inMenu
,
106 _err
= HMSetMenuHelpFromBalloonRsrc(inMenu
,
108 if (_err
!= noErr
) return PyMac_Error(_err
);
114 static PyObject
*Help_HMSetDialogHelpFromBalloonRsrc(PyObject
*_self
, PyObject
*_args
)
116 PyObject
*_res
= NULL
;
121 if (!PyArg_ParseTuple(_args
, "O&hh",
122 DlgObj_Convert
, &inDialog
,
126 _err
= HMSetDialogHelpFromBalloonRsrc(inDialog
,
129 if (_err
!= noErr
) return PyMac_Error(_err
);
135 static PyObject
*Help_HMHideTag(PyObject
*_self
, PyObject
*_args
)
137 PyObject
*_res
= NULL
;
139 if (!PyArg_ParseTuple(_args
, ""))
142 if (_err
!= noErr
) return PyMac_Error(_err
);
148 #endif /* __LP64__ */
150 static PyMethodDef Help_methods
[] = {
152 {"HMGetHelpMenu", (PyCFunction
)Help_HMGetHelpMenu
, 1,
153 PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")},
154 {"HMAreHelpTagsDisplayed", (PyCFunction
)Help_HMAreHelpTagsDisplayed
, 1,
155 PyDoc_STR("() -> (Boolean _rv)")},
156 {"HMSetHelpTagsDisplayed", (PyCFunction
)Help_HMSetHelpTagsDisplayed
, 1,
157 PyDoc_STR("(Boolean inDisplayTags) -> None")},
158 {"HMSetTagDelay", (PyCFunction
)Help_HMSetTagDelay
, 1,
159 PyDoc_STR("(Duration inDelay) -> None")},
160 {"HMGetTagDelay", (PyCFunction
)Help_HMGetTagDelay
, 1,
161 PyDoc_STR("() -> (Duration outDelay)")},
162 {"HMSetMenuHelpFromBalloonRsrc", (PyCFunction
)Help_HMSetMenuHelpFromBalloonRsrc
, 1,
163 PyDoc_STR("(MenuRef inMenu, SInt16 inHmnuRsrcID) -> None")},
164 {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction
)Help_HMSetDialogHelpFromBalloonRsrc
, 1,
165 PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")},
166 {"HMHideTag", (PyCFunction
)Help_HMHideTag
, 1,
167 PyDoc_STR("() -> None")},
168 #endif /* __LP64__ */
180 #endif /* __LP64__ */
185 m
= Py_InitModule("_Help", Help_methods
);
187 d
= PyModule_GetDict(m
);
188 Help_Error
= PyMac_GetOSErrException();
189 if (Help_Error
== NULL
||
190 PyDict_SetItemString(d
, "Error", Help_Error
) != 0)
192 #endif /* __LP64__ */
195 /* ======================== End module _Help ======================== */