2 /* ========================== Module _Help ========================== */
9 #include "pywintoolbox.h"
12 #include "pymactoolbox.h"
15 /* Macro to test whether a weak-loaded CFM function exists */
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
25 static PyObject
*Help_Error
;
27 static PyObject
*Help_HMGetHelpMenuHandle(PyObject
*_self
, PyObject
*_args
)
29 PyObject
*_res
= NULL
;
32 if (!PyArg_ParseTuple(_args
, ""))
34 _err
= HMGetHelpMenuHandle(&mh
);
35 if (_err
!= noErr
) return PyMac_Error(_err
);
36 _res
= Py_BuildValue("O&",
41 static PyObject
*Help_HMRemoveBalloon(PyObject
*_self
, PyObject
*_args
)
43 PyObject
*_res
= NULL
;
45 if (!PyArg_ParseTuple(_args
, ""))
47 _err
= HMRemoveBalloon();
48 if (_err
!= noErr
) return PyMac_Error(_err
);
54 static PyObject
*Help_HMIsBalloon(PyObject
*_self
, PyObject
*_args
)
56 PyObject
*_res
= NULL
;
58 if (!PyArg_ParseTuple(_args
, ""))
61 _res
= Py_BuildValue("b",
66 static PyObject
*Help_HMGetBalloons(PyObject
*_self
, PyObject
*_args
)
68 PyObject
*_res
= NULL
;
70 if (!PyArg_ParseTuple(_args
, ""))
72 _rv
= HMGetBalloons();
73 _res
= Py_BuildValue("b",
78 static PyObject
*Help_HMSetBalloons(PyObject
*_self
, PyObject
*_args
)
80 PyObject
*_res
= NULL
;
83 if (!PyArg_ParseTuple(_args
, "b",
86 _err
= HMSetBalloons(flag
);
87 if (_err
!= noErr
) return PyMac_Error(_err
);
93 static PyObject
*Help_HMSetFont(PyObject
*_self
, PyObject
*_args
)
95 PyObject
*_res
= NULL
;
98 if (!PyArg_ParseTuple(_args
, "h",
101 _err
= HMSetFont(font
);
102 if (_err
!= noErr
) return PyMac_Error(_err
);
108 static PyObject
*Help_HMSetFontSize(PyObject
*_self
, PyObject
*_args
)
110 PyObject
*_res
= NULL
;
113 if (!PyArg_ParseTuple(_args
, "H",
116 _err
= HMSetFontSize(fontSize
);
117 if (_err
!= noErr
) return PyMac_Error(_err
);
123 static PyObject
*Help_HMGetFont(PyObject
*_self
, PyObject
*_args
)
125 PyObject
*_res
= NULL
;
128 if (!PyArg_ParseTuple(_args
, ""))
130 _err
= HMGetFont(&font
);
131 if (_err
!= noErr
) return PyMac_Error(_err
);
132 _res
= Py_BuildValue("h",
137 static PyObject
*Help_HMGetFontSize(PyObject
*_self
, PyObject
*_args
)
139 PyObject
*_res
= NULL
;
142 if (!PyArg_ParseTuple(_args
, ""))
144 _err
= HMGetFontSize(&fontSize
);
145 if (_err
!= noErr
) return PyMac_Error(_err
);
146 _res
= Py_BuildValue("H",
151 static PyObject
*Help_HMSetDialogResID(PyObject
*_self
, PyObject
*_args
)
153 PyObject
*_res
= NULL
;
156 if (!PyArg_ParseTuple(_args
, "h",
159 _err
= HMSetDialogResID(resID
);
160 if (_err
!= noErr
) return PyMac_Error(_err
);
166 static PyObject
*Help_HMSetMenuResID(PyObject
*_self
, PyObject
*_args
)
168 PyObject
*_res
= NULL
;
172 if (!PyArg_ParseTuple(_args
, "hh",
176 _err
= HMSetMenuResID(menuID
,
178 if (_err
!= noErr
) return PyMac_Error(_err
);
184 static PyObject
*Help_HMScanTemplateItems(PyObject
*_self
, PyObject
*_args
)
186 PyObject
*_res
= NULL
;
191 if (!PyArg_ParseTuple(_args
, "hhO&",
194 PyMac_GetOSType
, &whichType
))
196 _err
= HMScanTemplateItems(whichID
,
199 if (_err
!= noErr
) return PyMac_Error(_err
);
205 static PyObject
*Help_HMGetDialogResID(PyObject
*_self
, PyObject
*_args
)
207 PyObject
*_res
= NULL
;
210 if (!PyArg_ParseTuple(_args
, ""))
212 _err
= HMGetDialogResID(&resID
);
213 if (_err
!= noErr
) return PyMac_Error(_err
);
214 _res
= Py_BuildValue("h",
219 static PyObject
*Help_HMGetMenuResID(PyObject
*_self
, PyObject
*_args
)
221 PyObject
*_res
= NULL
;
225 if (!PyArg_ParseTuple(_args
, "h",
228 _err
= HMGetMenuResID(menuID
,
230 if (_err
!= noErr
) return PyMac_Error(_err
);
231 _res
= Py_BuildValue("h",
236 static PyObject
*Help_HMGetBalloonWindow(PyObject
*_self
, PyObject
*_args
)
238 PyObject
*_res
= NULL
;
241 if (!PyArg_ParseTuple(_args
, ""))
243 _err
= HMGetBalloonWindow(&window
);
244 if (_err
!= noErr
) return PyMac_Error(_err
);
245 _res
= Py_BuildValue("O&",
250 static PyMethodDef Help_methods
[] = {
251 {"HMGetHelpMenuHandle", (PyCFunction
)Help_HMGetHelpMenuHandle
, 1,
252 "() -> (MenuRef mh)"},
253 {"HMRemoveBalloon", (PyCFunction
)Help_HMRemoveBalloon
, 1,
255 {"HMIsBalloon", (PyCFunction
)Help_HMIsBalloon
, 1,
256 "() -> (Boolean _rv)"},
257 {"HMGetBalloons", (PyCFunction
)Help_HMGetBalloons
, 1,
258 "() -> (Boolean _rv)"},
259 {"HMSetBalloons", (PyCFunction
)Help_HMSetBalloons
, 1,
260 "(Boolean flag) -> None"},
261 {"HMSetFont", (PyCFunction
)Help_HMSetFont
, 1,
262 "(SInt16 font) -> None"},
263 {"HMSetFontSize", (PyCFunction
)Help_HMSetFontSize
, 1,
264 "(UInt16 fontSize) -> None"},
265 {"HMGetFont", (PyCFunction
)Help_HMGetFont
, 1,
266 "() -> (SInt16 font)"},
267 {"HMGetFontSize", (PyCFunction
)Help_HMGetFontSize
, 1,
268 "() -> (UInt16 fontSize)"},
269 {"HMSetDialogResID", (PyCFunction
)Help_HMSetDialogResID
, 1,
270 "(SInt16 resID) -> None"},
271 {"HMSetMenuResID", (PyCFunction
)Help_HMSetMenuResID
, 1,
272 "(SInt16 menuID, SInt16 resID) -> None"},
273 {"HMScanTemplateItems", (PyCFunction
)Help_HMScanTemplateItems
, 1,
274 "(SInt16 whichID, SInt16 whichResFile, ResType whichType) -> None"},
275 {"HMGetDialogResID", (PyCFunction
)Help_HMGetDialogResID
, 1,
276 "() -> (SInt16 resID)"},
277 {"HMGetMenuResID", (PyCFunction
)Help_HMGetMenuResID
, 1,
278 "(SInt16 menuID) -> (SInt16 resID)"},
279 {"HMGetBalloonWindow", (PyCFunction
)Help_HMGetBalloonWindow
, 1,
280 "() -> (WindowPtr window)"},
295 m
= Py_InitModule("_Help", Help_methods
);
296 d
= PyModule_GetDict(m
);
297 Help_Error
= PyMac_GetOSErrException();
298 if (Help_Error
== NULL
||
299 PyDict_SetItemString(d
, "Error", Help_Error
) != 0)
303 /* ======================== End module _Help ======================== */