2 /* ========================== Module Help =========================== */
8 #define SystemSevenOrLater 1
16 extern PyObject
*ResObj_New(Handle
);
17 extern int ResObj_Convert(PyObject
*, Handle
*);
18 extern PyObject
*OptResObj_New(Handle
);
19 extern int OptResObj_Convert(PyObject
*, Handle
*);
21 extern PyObject
*WinObj_New(WindowPtr
);
22 extern int WinObj_Convert(PyObject
*, WindowPtr
*);
23 extern PyTypeObject Window_Type
;
24 #define WinObj_Check(x) ((x)->ob_type == &Window_Type)
26 extern PyObject
*DlgObj_New(DialogPtr
);
27 extern int DlgObj_Convert(PyObject
*, DialogPtr
*);
28 extern PyTypeObject Dialog_Type
;
29 #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
31 extern PyObject
*MenuObj_New(MenuHandle
);
32 extern int MenuObj_Convert(PyObject
*, MenuHandle
*);
34 extern PyObject
*CtlObj_New(ControlHandle
);
35 extern int CtlObj_Convert(PyObject
*, ControlHandle
*);
37 extern PyObject
*GrafObj_New(GrafPtr
);
38 extern int GrafObj_Convert(PyObject
*, GrafPtr
*);
40 extern PyObject
*BMObj_New(BitMapPtr
);
41 extern int BMObj_Convert(PyObject
*, BitMapPtr
*);
43 extern PyObject
*WinObj_WhichWindow(WindowPtr
);
47 #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
49 static PyObject
*Help_Error
;
51 static PyObject
*Help_HMGetHelpMenuHandle(_self
, _args
)
55 PyObject
*_res
= NULL
;
58 if (!PyArg_ParseTuple(_args
, ""))
60 _err
= HMGetHelpMenuHandle(&mh
);
61 if (_err
!= noErr
) return PyMac_Error(_err
);
62 _res
= Py_BuildValue("O&",
67 static PyObject
*Help_HMRemoveBalloon(_self
, _args
)
71 PyObject
*_res
= NULL
;
73 if (!PyArg_ParseTuple(_args
, ""))
75 _err
= HMRemoveBalloon();
76 if (_err
!= noErr
) return PyMac_Error(_err
);
82 static PyObject
*Help_HMIsBalloon(_self
, _args
)
86 PyObject
*_res
= NULL
;
88 if (!PyArg_ParseTuple(_args
, ""))
91 _res
= Py_BuildValue("b",
96 static PyObject
*Help_HMGetBalloons(_self
, _args
)
100 PyObject
*_res
= NULL
;
102 if (!PyArg_ParseTuple(_args
, ""))
104 _rv
= HMGetBalloons();
105 _res
= Py_BuildValue("b",
110 static PyObject
*Help_HMSetBalloons(_self
, _args
)
114 PyObject
*_res
= NULL
;
117 if (!PyArg_ParseTuple(_args
, "b",
120 _err
= HMSetBalloons(flag
);
121 if (_err
!= noErr
) return PyMac_Error(_err
);
127 static PyObject
*Help_HMSetFont(_self
, _args
)
131 PyObject
*_res
= NULL
;
134 if (!PyArg_ParseTuple(_args
, "h",
137 _err
= HMSetFont(font
);
138 if (_err
!= noErr
) return PyMac_Error(_err
);
144 static PyObject
*Help_HMSetFontSize(_self
, _args
)
148 PyObject
*_res
= NULL
;
151 if (!PyArg_ParseTuple(_args
, "h",
154 _err
= HMSetFontSize(fontSize
);
155 if (_err
!= noErr
) return PyMac_Error(_err
);
161 static PyObject
*Help_HMGetFont(_self
, _args
)
165 PyObject
*_res
= NULL
;
168 if (!PyArg_ParseTuple(_args
, ""))
170 _err
= HMGetFont(&font
);
171 if (_err
!= noErr
) return PyMac_Error(_err
);
172 _res
= Py_BuildValue("h",
177 static PyObject
*Help_HMGetFontSize(_self
, _args
)
181 PyObject
*_res
= NULL
;
184 if (!PyArg_ParseTuple(_args
, ""))
186 _err
= HMGetFontSize(&fontSize
);
187 if (_err
!= noErr
) return PyMac_Error(_err
);
188 _res
= Py_BuildValue("h",
193 static PyObject
*Help_HMSetDialogResID(_self
, _args
)
197 PyObject
*_res
= NULL
;
200 if (!PyArg_ParseTuple(_args
, "h",
203 _err
= HMSetDialogResID(resID
);
204 if (_err
!= noErr
) return PyMac_Error(_err
);
210 static PyObject
*Help_HMSetMenuResID(_self
, _args
)
214 PyObject
*_res
= NULL
;
218 if (!PyArg_ParseTuple(_args
, "hh",
222 _err
= HMSetMenuResID(menuID
,
224 if (_err
!= noErr
) return PyMac_Error(_err
);
230 static PyObject
*Help_HMScanTemplateItems(_self
, _args
)
234 PyObject
*_res
= NULL
;
239 if (!PyArg_ParseTuple(_args
, "hhO&",
242 PyMac_GetOSType
, &whichType
))
244 _err
= HMScanTemplateItems(whichID
,
247 if (_err
!= noErr
) return PyMac_Error(_err
);
253 static PyObject
*Help_HMGetDialogResID(_self
, _args
)
257 PyObject
*_res
= NULL
;
260 if (!PyArg_ParseTuple(_args
, ""))
262 _err
= HMGetDialogResID(&resID
);
263 if (_err
!= noErr
) return PyMac_Error(_err
);
264 _res
= Py_BuildValue("h",
269 static PyObject
*Help_HMGetMenuResID(_self
, _args
)
273 PyObject
*_res
= NULL
;
277 if (!PyArg_ParseTuple(_args
, "h",
280 _err
= HMGetMenuResID(menuID
,
282 if (_err
!= noErr
) return PyMac_Error(_err
);
283 _res
= Py_BuildValue("h",
288 static PyObject
*Help_HMGetBalloonWindow(_self
, _args
)
292 PyObject
*_res
= NULL
;
295 if (!PyArg_ParseTuple(_args
, ""))
297 _err
= HMGetBalloonWindow(&window
);
298 if (_err
!= noErr
) return PyMac_Error(_err
);
299 _res
= Py_BuildValue("O&",
304 static PyMethodDef Help_methods
[] = {
305 {"HMGetHelpMenuHandle", (PyCFunction
)Help_HMGetHelpMenuHandle
, 1,
306 "() -> (MenuHandle mh)"},
307 {"HMRemoveBalloon", (PyCFunction
)Help_HMRemoveBalloon
, 1,
309 {"HMIsBalloon", (PyCFunction
)Help_HMIsBalloon
, 1,
310 "() -> (Boolean _rv)"},
311 {"HMGetBalloons", (PyCFunction
)Help_HMGetBalloons
, 1,
312 "() -> (Boolean _rv)"},
313 {"HMSetBalloons", (PyCFunction
)Help_HMSetBalloons
, 1,
314 "(Boolean flag) -> None"},
315 {"HMSetFont", (PyCFunction
)Help_HMSetFont
, 1,
316 "(SInt16 font) -> None"},
317 {"HMSetFontSize", (PyCFunction
)Help_HMSetFontSize
, 1,
318 "(UInt16 fontSize) -> None"},
319 {"HMGetFont", (PyCFunction
)Help_HMGetFont
, 1,
320 "() -> (SInt16 font)"},
321 {"HMGetFontSize", (PyCFunction
)Help_HMGetFontSize
, 1,
322 "() -> (UInt16 fontSize)"},
323 {"HMSetDialogResID", (PyCFunction
)Help_HMSetDialogResID
, 1,
324 "(SInt16 resID) -> None"},
325 {"HMSetMenuResID", (PyCFunction
)Help_HMSetMenuResID
, 1,
326 "(SInt16 menuID, SInt16 resID) -> None"},
327 {"HMScanTemplateItems", (PyCFunction
)Help_HMScanTemplateItems
, 1,
328 "(SInt16 whichID, SInt16 whichResFile, ResType whichType) -> None"},
329 {"HMGetDialogResID", (PyCFunction
)Help_HMGetDialogResID
, 1,
330 "() -> (SInt16 resID)"},
331 {"HMGetMenuResID", (PyCFunction
)Help_HMGetMenuResID
, 1,
332 "(SInt16 menuID) -> (SInt16 resID)"},
333 {"HMGetBalloonWindow", (PyCFunction
)Help_HMGetBalloonWindow
, 1,
334 "() -> (WindowPtr window)"},
349 m
= Py_InitModule("Help", Help_methods
);
350 d
= PyModule_GetDict(m
);
351 Help_Error
= PyMac_GetOSErrException();
352 if (Help_Error
== NULL
||
353 PyDict_SetItemString(d
, "Error", Help_Error
) != 0)
354 Py_FatalError("can't initialize Help.Error");
357 /* ======================== End module Help ========================= */