1 # This script generates a Python interface for an Apple Macintosh Manager.
2 # It uses the "bgen" package to generate C code.
3 # The function specifications are generated by scanning the mamager's header file,
4 # using the "scantools" package (customized for this particular manager).
8 # Declarations that change for each manager
9 MACHEADERFILE
= 'Controls.h' # The Apple header file
10 MODNAME
= '_Ctl' # The name of the module
11 OBJECTNAME
= 'Control' # The basic name of the objects used here
13 # The following is *usually* unchanged but may still require tuning
14 MODPREFIX
= 'Ctl' # The prefix for module-wide routines
15 OBJECTTYPE
= OBJECTNAME
+ 'Handle' # The C type used to represent them
16 OBJECTPREFIX
= MODPREFIX
+ 'Obj' # The prefix for object methods
17 INPUTFILE
= string
.lower(MODPREFIX
) + 'gen.py' # The file generated by the scanner
18 OUTPUTFILE
= MODNAME
+ "module.c" # The file generated by this program
20 from macsupport
import *
22 # Create the type objects
24 ControlHandle
= OpaqueByValueType(OBJECTTYPE
, OBJECTPREFIX
)
25 ControlRef
= ControlHandle
26 ExistingControlHandle
= OpaqueByValueType(OBJECTTYPE
, "CtlObj_WhichControl", "BUG")
28 RgnHandle
= OpaqueByValueType("RgnHandle", "ResObj")
29 CCTabHandle
= OpaqueByValueType("CCTabHandle", "ResObj")
30 AuxCtlHandle
= OpaqueByValueType("AuxCtlHandle", "ResObj")
31 ControlPartCode
= Type("ControlPartCode", "h")
32 DragConstraint
= Type("DragConstraint", "H")
33 ControlVariant
= Type("ControlVariant", "h")
34 IconTransformType
= Type("IconTransformType", "h")
35 EventModifiers
= Type("EventModifiers", "H")
36 ClickActivationResult
= Type("ClickActivationResult", "l")
37 ControlButtonGraphicAlignment
= Type("ControlButtonGraphicAlignment", "h")
38 ControlButtonTextAlignment
= Type("ControlButtonTextAlignment", "h")
39 ControlButtonTextPlacement
= Type("ControlButtonTextPlacement", "h")
40 ControlContentType
= Type("ControlContentType", "h")
41 ControlFocusPart
= Type("ControlFocusPart", "h")
43 ControlFontStyleRec
= OpaqueType('ControlFontStyleRec', 'ControlFontStyle')
44 ControlFontStyleRec_ptr
= ControlFontStyleRec
45 ControlID
= OpaqueType('ControlID', 'PyControlID')
46 ControlID_ptr
= ControlID
48 DragTrackingMessage
= Type("DragTrackingMessage", "h")
49 DragReference
= OpaqueByValueType("DragReference", "DragObj")
51 CFStringRef
= OpaqueByValueType("CFStringRef", "CFStringRefObj")
52 CFMutableStringRef
= OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj")
53 CFDataRef
= OpaqueByValueType("CFDataRef", "CFDataRefObj")
55 ControlTabSize
= UInt16
56 ControlTabDirection
= UInt16
57 ControlPopupArrowOrientation
= UInt16
58 ControlPopupArrowSize
= UInt16
59 ControlClockType
= UInt16
60 ControlClockFlags
= UInt32
61 ControlRoundButtonSize
= SInt16
62 DataBrowserViewStyle
= OSType
63 DataBrowserItemID
= UInt32
64 DataBrowserEditCommand
= UInt32
65 DataBrowserSelectionAnchorDirection
= UInt32
66 DataBrowserItemState
= UInt32
67 DataBrowserPropertyID
= UInt32
68 DataBrowserRevealOptions
= UInt8
69 DataBrowserSortOrder
= UInt16
70 DataBrowserSelectionFlags
= UInt32
71 DataBrowserPropertyFlags
= UInt32
72 DataBrowserPropertyPart
= OSType
73 DataBrowserTableViewColumnID
= DataBrowserPropertyID
74 #DataBrowserTableViewColumnDesc = DataBrowserPropertyDesc
75 DataBrowserTableViewHiliteStyle
= UInt32
76 DataBrowserTableViewRowIndex
= UInt32
77 DataBrowserTableViewColumnIndex
= UInt32
78 DataBrowserPropertyType
= OSType
79 ControlDisclosureTriangleOrientation
= UInt16
81 DataBrowserTableViewColumnDesc
= OpaqueType("DataBrowserTableViewColumnDesc",
82 "DataBrowserTableViewColumnDesc")
83 DataBrowserListViewColumnDesc
= OpaqueType("DataBrowserListViewColumnDesc",
84 "DataBrowserListViewColumnDesc")
85 ControlButtonContentInfo
= OpaqueType("ControlButtonContentInfo",
86 "ControlButtonContentInfo")
87 ControlButtonContentInfoPtr
= ControlButtonContentInfo_ptr
= ControlButtonContentInfo
89 ControlTabEntry_ptr
= OpaqueType("ControlTabEntry", "ControlTabEntry")
91 ControlBevelThickness
= UInt16
92 ControlBevelButtonBehavior
= UInt16
93 ControlBevelButtonMenuBehavior
= UInt16
94 ControlBevelButtonMenuPlacement
= UInt16
95 ControlPushButtonIconAlignment
= UInt16
97 class ControlActionDefinition(Type
):
98 def declare(self
, name
):
99 Output("%s %s;", self
.typeName
, name
)
100 Output("UniversalProcPtr c_callback;")
101 def passInput(self
, name
):
102 return "myactionproc_upp"
103 def cleanup(self
, name
):
104 Output("setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback);")
106 class ControlActionDefinitionNewControl(ControlActionDefinition
):
107 def cleanup(self
, name
):
108 Output("setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback);")
110 ControlActionUPP
= ControlActionDefinition("PyObject*", "O")
111 ControlActionUPPNewControl
= ControlActionDefinitionNewControl("PyObject*", "O")
112 ControlSliderOrientation
= UInt16
115 includestuff
= includestuff
+ """
116 #ifdef WITHOUT_FRAMEWORKS
117 #include <Controls.h>
118 #include <ControlDefinitions.h>
120 #include <Carbon/Carbon.h>
123 #ifdef USE_TOOLBOX_OBJECT_GLUE
124 extern PyObject *_CtlObj_New(ControlHandle);
125 extern int _CtlObj_Convert(PyObject *, ControlHandle *);
127 #define CtlObj_New _CtlObj_New
128 #define CtlObj_Convert _CtlObj_Convert
131 static PyObject *CtlObj_WhichControl(ControlHandle);
133 #define as_Control(h) ((ControlHandle)h)
134 #define as_Resource(ctl) ((Handle)ctl)
135 #define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
137 #define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */
139 ** Parse/generate ControlFontStyleRec records
141 #if 0 /* Not needed */
143 ControlFontStyle_New(ControlFontStyleRec *itself)
146 return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
147 itself->size, itself->style, itself->mode, itself->just,
148 QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
153 ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
155 return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
156 &itself->font, &itself->size, &itself->style, &itself->mode,
157 &itself->just, QdRGB_Convert, &itself->foreColor,
158 QdRGB_Convert, &itself->backColor);
162 ** Parse/generate ControlID records
165 PyControlID_New(ControlID *itself)
168 return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
172 PyControlID_Convert(PyObject *v, ControlID *itself)
174 return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
178 ** generate DataBrowserListViewColumnDesc records
181 DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
183 return PyArg_Parse(v, "(lO&l)",
185 PyMac_GetOSType, &itself->propertyType,
186 &itself->propertyFlags);
190 ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
192 return PyArg_Parse(v, "(hO&)",
193 &itself->contentType,
194 OptResObj_Convert, &itself->u.iconSuite);
198 DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
200 itself->version = kDataBrowserListViewLatestHeaderDesc;
201 return PyArg_Parse(v, "(HHhO&HO&O&)",
202 &itself->minimumWidth,
203 &itself->maximumWidth,
204 &itself->titleOffset,
205 CFStringRefObj_Convert, &itself->titleString,
206 &itself->initialOrder,
207 ControlFontStyle_Convert, &itself->btnFontStyle,
208 ControlButtonContentInfo_Convert, &itself->btnContentInfo);
212 DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
214 return PyArg_Parse(v, "(O&O&)",
215 DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
216 DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
219 /* TrackControl and HandleControlClick callback support */
220 #define kMyControlActionProcTag 'ACTN' /* not an official tag, only for internal use */
221 static PyObject *tracker;
222 static ControlActionUPP mytracker_upp;
223 static ControlActionUPP myactionproc_upp;
224 static ControlUserPaneKeyDownUPP mykeydownproc_upp;
225 static ControlUserPaneFocusUPP myfocusproc_upp;
226 static ControlUserPaneDrawUPP mydrawproc_upp;
227 static ControlUserPaneIdleUPP myidleproc_upp;
228 static ControlUserPaneHitTestUPP myhittestproc_upp;
229 static ControlUserPaneTrackingUPP mytrackingproc_upp;
231 static int settrackfunc(PyObject *); /* forward */
232 static void clrtrackfunc(void); /* forward */
233 static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
236 finalstuff
= finalstuff
+ """
238 CtlObj_NewUnmanaged(ControlHandle itself)
241 if (itself == NULL) return PyMac_Error(resNotFound);
242 it = PyObject_NEW(ControlObject, &Control_Type);
243 if (it == NULL) return NULL;
244 it->ob_itself = itself;
245 it->ob_callbackdict = NULL;
246 return (PyObject *)it;
250 CtlObj_WhichControl(ControlHandle c)
257 it = (PyObject *) GetControlReference(c);
259 ** If the refcon is zero or doesn't point back to the Python object
260 ** the control is not ours. Return a temporary object.
262 if (it == NULL || ((ControlObject *)it)->ob_itself != c)
263 return CtlObj_NewUnmanaged(c);
270 settrackfunc(PyObject *obj)
273 PyErr_SetString(Ctl_Error, "Tracker function in use");
289 mytracker(ControlHandle ctl, short part)
291 PyObject *args, *rv=0;
293 args = Py_BuildValue("(O&i)", CtlObj_WhichControl, ctl, (int)part);
294 if (args && tracker) {
295 rv = PyEval_CallObject(tracker, args);
301 PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\\n");
307 setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp)
309 ControlObject *self = (ControlObject *)myself;
312 if ( which == kMyControlActionProcTag )
313 *uppp = (UniversalProcPtr)myactionproc_upp;
314 else if ( which == kControlUserPaneKeyDownProcTag )
315 *uppp = (UniversalProcPtr)mykeydownproc_upp;
316 else if ( which == kControlUserPaneFocusProcTag )
317 *uppp = (UniversalProcPtr)myfocusproc_upp;
318 else if ( which == kControlUserPaneDrawProcTag )
319 *uppp = (UniversalProcPtr)mydrawproc_upp;
320 else if ( which == kControlUserPaneIdleProcTag )
321 *uppp = (UniversalProcPtr)myidleproc_upp;
322 else if ( which == kControlUserPaneHitTestProcTag )
323 *uppp = (UniversalProcPtr)myhittestproc_upp;
324 else if ( which == kControlUserPaneTrackingProcTag )
325 *uppp = (UniversalProcPtr)mytrackingproc_upp;
328 /* Only now do we test for clearing of the callback: */
329 if ( callback == Py_None )
331 /* Create the dict if it doesn't exist yet (so we don't get such a dict for every control) */
332 if ( self->ob_callbackdict == NULL )
333 if ( (self->ob_callbackdict = PyDict_New()) == NULL )
335 /* And store the Python callback */
336 sprintf(keybuf, "%x", (unsigned)which);
337 if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0)
343 callcallback(ControlObject *self, OSType which, PyObject *arglist)
348 sprintf(keybuf, "%x", (unsigned)which);
349 if ( self->ob_callbackdict == NULL ||
350 (func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) {
351 PySys_WriteStderr("Control callback %x without callback object\\n", (unsigned)which);
354 rv = PyEval_CallObject(func, arglist);
356 PySys_WriteStderr("Exception in control callback %x handler\\n", (unsigned)which);
363 myactionproc(ControlHandle control, SInt16 part)
365 ControlObject *ctl_obj;
366 PyObject *arglist, *rv;
368 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
369 arglist = Py_BuildValue("Oh", ctl_obj, part);
370 rv = callcallback(ctl_obj, kMyControlActionProcTag, arglist);
375 static pascal ControlPartCode
376 mykeydownproc(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
378 ControlObject *ctl_obj;
379 PyObject *arglist, *rv;
382 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
383 arglist = Py_BuildValue("Ohhh", ctl_obj, keyCode, charCode, modifiers);
384 rv = callcallback(ctl_obj, kControlUserPaneKeyDownProcTag, arglist);
387 if (!PyArg_Parse(rv, "h", &c_rv))
390 return (ControlPartCode)c_rv;
393 static pascal ControlPartCode
394 myfocusproc(ControlHandle control, ControlPartCode part)
396 ControlObject *ctl_obj;
397 PyObject *arglist, *rv;
398 short c_rv = kControlFocusNoPart;
400 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
401 arglist = Py_BuildValue("Oh", ctl_obj, part);
402 rv = callcallback(ctl_obj, kControlUserPaneFocusProcTag, arglist);
405 if (!PyArg_Parse(rv, "h", &c_rv))
408 return (ControlPartCode)c_rv;
412 mydrawproc(ControlHandle control, SInt16 part)
414 ControlObject *ctl_obj;
415 PyObject *arglist, *rv;
417 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
418 arglist = Py_BuildValue("Oh", ctl_obj, part);
419 rv = callcallback(ctl_obj, kControlUserPaneDrawProcTag, arglist);
425 myidleproc(ControlHandle control)
427 ControlObject *ctl_obj;
428 PyObject *arglist, *rv;
430 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
431 arglist = Py_BuildValue("O", ctl_obj);
432 rv = callcallback(ctl_obj, kControlUserPaneIdleProcTag, arglist);
437 static pascal ControlPartCode
438 myhittestproc(ControlHandle control, Point where)
440 ControlObject *ctl_obj;
441 PyObject *arglist, *rv;
444 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
445 arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, where);
446 rv = callcallback(ctl_obj, kControlUserPaneHitTestProcTag, arglist);
448 /* Ignore errors, nothing we can do about them */
450 if (!PyArg_Parse(rv, "h", &c_rv))
453 return (ControlPartCode)c_rv;
456 static pascal ControlPartCode
457 mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc)
459 ControlObject *ctl_obj;
460 PyObject *arglist, *rv;
463 ctl_obj = (ControlObject *)CtlObj_WhichControl(control);
464 /* We cannot pass the actionProc without lots of work */
465 arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, startPt);
466 rv = callcallback(ctl_obj, kControlUserPaneTrackingProcTag, arglist);
469 if (!PyArg_Parse(rv, "h", &c_rv))
472 return (ControlPartCode)c_rv;
476 initstuff
= initstuff
+ """
477 mytracker_upp = NewControlActionUPP(mytracker);
478 myactionproc_upp = NewControlActionUPP(myactionproc);
479 mykeydownproc_upp = NewControlUserPaneKeyDownUPP(mykeydownproc);
480 myfocusproc_upp = NewControlUserPaneFocusUPP(myfocusproc);
481 mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc);
482 myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc);
483 myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc);
484 mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc);
485 PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
486 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
489 class MyObjectDefinition(PEP253Mixin
, ObjectIdentityMixin
, GlobalObjectDefinition
):
490 def outputStructMembers(self
):
491 GlobalObjectDefinition
.outputStructMembers(self
)
492 Output("PyObject *ob_callbackdict;")
493 def outputCheckNewArg(self
):
494 Output("if (itself == NULL) return PyMac_Error(resNotFound);")
495 def outputInitStructMembers(self
):
496 GlobalObjectDefinition
.outputInitStructMembers(self
)
497 Output("SetControlReference(itself, (long)it);")
498 Output("it->ob_callbackdict = NULL;")
499 def outputCleanupStructMembers(self
):
500 Output("Py_XDECREF(self->ob_callbackdict);")
501 Output("if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */")
503 # Create the generator groups and link them
504 module
= MacModule(MODNAME
, MODPREFIX
, includestuff
, finalstuff
, initstuff
)
505 object = MyObjectDefinition(OBJECTNAME
, OBJECTPREFIX
, OBJECTTYPE
)
506 module
.addobject(object)
508 # Create the generator classes used to populate the lists
509 Function
= OSErrWeakLinkFunctionGenerator
510 Method
= OSErrWeakLinkMethodGenerator
512 # Create and populate the lists
516 execfile('ctledit.py')
518 # add the populated lists to the generator groups
519 for f
in functions
: module
.add(f
)
520 for f
in methods
: object.add(f
)
522 # Manual generator for TrackControl, due to callback ideosyncracies
523 trackcontrol_body
= """
526 ControlActionUPP upp = 0;
527 PyObject *callback = 0;
529 if (!PyArg_ParseTuple(_args, "O&|O",
530 PyMac_GetPoint, &startPoint, &callback))
532 if (callback && callback != Py_None) {
533 if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
534 upp = (ControlActionUPP)-1;
536 settrackfunc(callback);
540 _rv = TrackControl(_self->ob_itself,
544 _res = Py_BuildValue("h",
549 f
= ManualGenerator("TrackControl", trackcontrol_body
);
550 f
.docstring
= lambda: "(Point startPoint [,trackercallback]) -> (ControlPartCode _rv)"
553 # CJW - added 5/12/99
554 # Manual generator for HandleControlClick, as for TrackControl
555 handlecontrolclick_body
= """
559 ControlActionUPP upp = 0;
560 PyObject *callback = 0;
562 if (!PyArg_ParseTuple(_args, "O&h|O",
563 PyMac_GetPoint, &startPoint,
567 if (callback && callback != Py_None) {
568 if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
569 upp = (ControlActionUPP)-1;
571 settrackfunc(callback);
575 _rv = HandleControlClick(_self->ob_itself,
580 _res = Py_BuildValue("h",
585 f
= ManualGenerator("HandleControlClick", handlecontrolclick_body
);
586 f
.docstring
= lambda: "(Point startPoint, Integer modifiers, [,trackercallback]) -> (ControlPartCode _rv)"
589 # Manual Generator for SetControlData
590 setcontroldata_body
= """
592 ControlPartCode inPart;
597 if (!PyArg_ParseTuple(_args, "hO&s#",
599 PyMac_GetOSType, &inTagName,
600 &buffer, &bufferSize))
603 _err = SetControlData(_self->ob_itself,
610 return PyMac_Error(_err);
615 f
= ManualGenerator("SetControlData", setcontroldata_body
);
616 f
.docstring
= lambda: "(stuff) -> None"
619 # Manual Generator for GetControlData
620 getcontroldata_body
= """
622 ControlPartCode inPart;
628 if (!PyArg_ParseTuple(_args, "hO&",
630 PyMac_GetOSType, &inTagName))
633 /* allocate a buffer for the data */
634 _err = GetControlDataSize(_self->ob_itself,
639 return PyMac_Error(_err);
640 buffer = PyMem_NEW(char, bufferSize);
642 return PyErr_NoMemory();
644 _err = GetControlData(_self->ob_itself,
653 return PyMac_Error(_err);
655 _res = Py_BuildValue("s#", buffer, outSize);
660 f
= ManualGenerator("GetControlData", getcontroldata_body
);
661 f
.docstring
= lambda: "(part, type) -> String"
664 # Manual Generator for SetControlData_Handle
665 setcontroldata_handle_body
= """
667 ControlPartCode inPart;
671 if (!PyArg_ParseTuple(_args, "hO&O&",
673 PyMac_GetOSType, &inTagName,
674 OptResObj_Convert, &buffer))
677 _err = SetControlData(_self->ob_itself,
684 return PyMac_Error(_err);
689 f
= ManualGenerator("SetControlData_Handle", setcontroldata_handle_body
);
690 f
.docstring
= lambda: "(ResObj) -> None"
693 # Manual Generator for GetControlData_Handle
694 getcontroldata_handle_body
= """
696 ControlPartCode inPart;
701 if (!PyArg_ParseTuple(_args, "hO&",
703 PyMac_GetOSType, &inTagName))
706 /* Check it is handle-sized */
707 _err = GetControlDataSize(_self->ob_itself,
712 return PyMac_Error(_err);
713 if (bufferSize != sizeof(Handle)) {
714 PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)");
718 _err = GetControlData(_self->ob_itself,
726 return PyMac_Error(_err);
728 _res = Py_BuildValue("O&", OptResObj_New, hdl);
732 f
= ManualGenerator("GetControlData_Handle", getcontroldata_handle_body
);
733 f
.docstring
= lambda: "(part, type) -> ResObj"
736 # Manual Generator for SetControlData_Callback
737 setcontroldata_callback_body
= """
739 ControlPartCode inPart;
742 UniversalProcPtr c_callback;
744 if (!PyArg_ParseTuple(_args, "hO&O",
746 PyMac_GetOSType, &inTagName,
750 if ( setcallback((PyObject *)_self, inTagName, callback, &c_callback) < 0 )
752 _err = SetControlData(_self->ob_itself,
759 return PyMac_Error(_err);
764 f
= ManualGenerator("SetControlData_Callback", setcontroldata_callback_body
);
765 f
.docstring
= lambda: "(callbackfunc) -> None"
770 createtabscontrol_body
= """\
778 ControlTabEntry tabArray[MAXTABS];
779 ControlHandle outControl;
780 PyObject *tabArrayObj, *tabEntry;
782 #ifndef CreateTabsControl
783 PyMac_PRECHECK(CreateTabsControl);
785 if (!PyArg_ParseTuple(_args, "O&O&HHO",
786 WinObj_Convert, &window,
787 PyMac_GetRect, &boundsRect,
793 i = PySequence_Length(tabArrayObj);
797 PyErr_SetString(Ctl_Error, "Too many tabs");
801 for (i=0; i<numTabs; i++) {
802 tabEntry = PySequence_GetItem(tabArrayObj, i);
803 if (tabEntry == NULL)
805 if (!PyArg_Parse(tabEntry, "(O&O&B)",
806 ControlButtonContentInfo_Convert, &tabArray[i].icon,
807 CFStringRefObj_Convert, &tabArray[i].name,
813 _err = CreateTabsControl(window,
820 if (_err != noErr) return PyMac_Error(_err);
821 _res = Py_BuildValue("O&",
822 CtlObj_New, outControl);
825 f
= ManualGenerator("CreateTabsControl", createtabscontrol_body
)
826 f
.docstring
= lambda: "(WindowPtr window, Rect boundsRect, UInt16 size, UInt16 direction, ControlTabEntry tabArray) -> (ControlHandle outControl)"
829 # generate output (open the output file as late as possible)
830 SetOutputFileName(OUTPUTFILE
)