[Python-checkins] CVS: python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.9,1.10 ctlscan.py,1.23,1.24 ctlsupport.py,1.45,1.46
Just van Rossum
jvr@users.sourceforge.net
Tue, 18 Dec 2001 04:47:50 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl
In directory usw-pr-cvs1:/tmp/cvs-serv4085
Modified Files:
_Ctlmodule.c ctlscan.py ctlsupport.py
Log Message:
Added support for tab controls and initial (incomplete) support
for DataBrowser controls.
Index: _Ctlmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** _Ctlmodule.c 2001/12/14 22:47:13 1.9
--- _Ctlmodule.c 2001/12/18 12:47:47 1.10
***************
*** 42,45 ****
--- 42,46 ----
#endif
+ #define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */
/*
** Parse/generate ControlFontStyleRec records
***************
*** 59,63 ****
ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
{
! return PyArg_ParseTuple(v, "hhhhhhO&O&", &itself->flags,
&itself->font, &itself->size, &itself->style, &itself->mode,
&itself->just, QdRGB_Convert, &itself->foreColor,
--- 60,64 ----
ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
{
! return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
&itself->font, &itself->size, &itself->style, &itself->mode,
&itself->just, QdRGB_Convert, &itself->foreColor,
***************
*** 78,85 ****
PyControlID_Convert(PyObject *v, ControlID *itself)
{
! return PyArg_ParseTuple(v, "O&l", PyMac_GetOSType, &itself->signature, &itself->id);
}
/* TrackControl and HandleControlClick callback support */
static PyObject *tracker;
--- 79,127 ----
PyControlID_Convert(PyObject *v, ControlID *itself)
{
! return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
! }
!
! /*
! ** generate DataBrowserListViewColumnDesc records
! */
! static int
! DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
! {
! return PyArg_Parse(v, "(lO&l)",
! &itself->propertyID,
! PyMac_GetOSType, &itself->propertyType,
! &itself->propertyFlags);
! }
!
! static int
! ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
! {
! return PyArg_Parse(v, "(hO&)",
! &itself->contentType,
! OptResObj_Convert, &itself->u.iconSuite);
}
+ static int
+ DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
+ {
+ itself->version = kDataBrowserListViewLatestHeaderDesc;
+ return PyArg_Parse(v, "(HHhO&HO&O&)",
+ &itself->minimumWidth,
+ &itself->maximumWidth,
+ &itself->titleOffset,
+ CFStringRefObj_Convert, &itself->titleString,
+ &itself->initialOrder,
+ ControlFontStyle_Convert, &itself->btnFontStyle,
+ ControlButtonContentInfo_Convert, &itself->btnContentInfo);
+ }
+ static int
+ DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
+ {
+ return PyArg_Parse(v, "(O&O&)",
+ DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
+ DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
+ }
+
/* TrackControl and HandleControlClick callback support */
static PyObject *tracker;
***************
*** 1665,1668 ****
--- 1707,1732 ----
}
+ #if TARGET_API_MAC_CARBON
+
+ static PyObject *CtlObj_SetBevelButtonContentInfo(ControlObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlButtonContentInfo inContent;
+ #ifndef SetBevelButtonContentInfo
+ PyMac_PRECHECK(SetBevelButtonContentInfo);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ControlButtonContentInfo_Convert, &inContent))
+ return NULL;
+ _err = SetBevelButtonContentInfo(_self->ob_itself,
+ &inContent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+ }
+ #endif
+
static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args)
{
***************
*** 1743,1746 ****
--- 1807,1832 ----
}
+ #if TARGET_API_MAC_CARBON
+
+ static PyObject *CtlObj_SetImageWellContentInfo(ControlObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlButtonContentInfo inContent;
+ #ifndef SetImageWellContentInfo
+ PyMac_PRECHECK(SetImageWellContentInfo);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ControlButtonContentInfo_Convert, &inContent))
+ return NULL;
+ _err = SetImageWellContentInfo(_self->ob_itself,
+ &inContent);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+ }
+ #endif
+
static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args)
{
***************
*** 3113,3116 ****
--- 3199,3227 ----
#if TARGET_API_MAC_CARBON
+ static PyObject *CtlObj_AddDataBrowserListViewColumn(ControlObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ DataBrowserListViewColumnDesc columnDesc;
+ UInt32 position;
+ #ifndef AddDataBrowserListViewColumn
+ PyMac_PRECHECK(AddDataBrowserListViewColumn);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&l",
+ DataBrowserListViewColumnDesc_Convert, &columnDesc,
+ &position))
+ return NULL;
+ _err = AddDataBrowserListViewColumn(_self->ob_itself,
+ &columnDesc,
+ position);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
static PyObject *CtlObj_SetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args)
{
***************
*** 3909,3912 ****
--- 4020,4028 ----
{"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1,
"() -> (MenuHandle outHandle)"},
+
+ #if TARGET_API_MAC_CARBON
+ {"SetBevelButtonContentInfo", (PyCFunction)CtlObj_SetBevelButtonContentInfo, 1,
+ "(ControlButtonContentInfo inContent) -> None"},
+ #endif
{"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1,
"(IconTransformType transform) -> None"},
***************
*** 3917,3920 ****
--- 4033,4041 ----
{"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1,
"(SInt16 inTabToHilite, Boolean inEnabled) -> None"},
+
+ #if TARGET_API_MAC_CARBON
+ {"SetImageWellContentInfo", (PyCFunction)CtlObj_SetImageWellContentInfo, 1,
+ "(ControlButtonContentInfo inContent) -> None"},
+ #endif
{"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1,
"(IconTransformType inTransform) -> None"},
***************
*** 4211,4214 ****
--- 4332,4340 ----
#if TARGET_API_MAC_CARBON
+ {"AddDataBrowserListViewColumn", (PyCFunction)CtlObj_AddDataBrowserListViewColumn, 1,
+ "(DataBrowserListViewColumnDesc columnDesc, UInt32 position) -> None"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
{"SetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_SetDataBrowserListViewHeaderBtnHeight, 1,
"(UInt16 height) -> None"},
***************
*** 4718,4721 ****
--- 4844,4894 ----
#if TARGET_API_MAC_CARBON
+ static PyObject *Ctl_CreateBevelButtonControl(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ UInt16 thickness;
+ UInt16 behavior;
+ ControlButtonContentInfo info;
+ SInt16 menuID;
+ UInt16 menuBehavior;
+ UInt16 menuPlacement;
+ ControlHandle outControl;
+ #ifndef CreateBevelButtonControl
+ PyMac_PRECHECK(CreateBevelButtonControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&HHO&hHH",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ &thickness,
+ &behavior,
+ ControlButtonContentInfo_Convert, &info,
+ &menuID,
+ &menuBehavior,
+ &menuPlacement))
+ return NULL;
+ _err = CreateBevelButtonControl(window,
+ &boundsRect,
+ title,
+ thickness,
+ behavior,
+ &info,
+ menuID,
+ menuBehavior,
+ menuPlacement,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
static PyObject *Ctl_CreateDisclosureTriangleControl(PyObject *_self, PyObject *_args)
{
***************
*** 5004,5007 ****
--- 5177,5209 ----
#if TARGET_API_MAC_CARBON
+ static PyObject *Ctl_CreateImageWellControl(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlButtonContentInfo info;
+ ControlHandle outControl;
+ #ifndef CreateImageWellControl
+ PyMac_PRECHECK(CreateImageWellControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ ControlButtonContentInfo_Convert, &info))
+ return NULL;
+ _err = CreateImageWellControl(window,
+ &boundsRect,
+ &info,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
static PyObject *Ctl_CreatePopupArrowControl(PyObject *_self, PyObject *_args)
{
***************
*** 5193,5196 ****
--- 5395,5462 ----
#if TARGET_API_MAC_CARBON
+ static PyObject *Ctl_CreatePictureControl(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlButtonContentInfo content;
+ Boolean dontTrack;
+ ControlHandle outControl;
+ #ifndef CreatePictureControl
+ PyMac_PRECHECK(CreatePictureControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&b",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ ControlButtonContentInfo_Convert, &content,
+ &dontTrack))
+ return NULL;
+ _err = CreatePictureControl(window,
+ &boundsRect,
+ &content,
+ dontTrack,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
+ static PyObject *Ctl_CreateIconControl(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ ControlButtonContentInfo icon;
+ Boolean dontTrack;
+ ControlHandle outControl;
+ #ifndef CreateIconControl
+ PyMac_PRECHECK(CreateIconControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&b",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ ControlButtonContentInfo_Convert, &icon,
+ &dontTrack))
+ return NULL;
+ _err = CreateIconControl(window,
+ &boundsRect,
+ &icon,
+ dontTrack,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
static PyObject *Ctl_CreateWindowHeaderControl(PyObject *_self, PyObject *_args)
{
***************
*** 5251,5254 ****
--- 5517,5555 ----
#if TARGET_API_MAC_CARBON
+ static PyObject *Ctl_CreatePushButtonWithIconControl(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef title;
+ ControlButtonContentInfo icon;
+ UInt16 iconAlignment;
+ ControlHandle outControl;
+ #ifndef CreatePushButtonWithIconControl
+ PyMac_PRECHECK(CreatePushButtonWithIconControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&H",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &title,
+ ControlButtonContentInfo_Convert, &icon,
+ &iconAlignment))
+ return NULL;
+ _err = CreatePushButtonWithIconControl(window,
+ &boundsRect,
+ title,
+ &icon,
+ iconAlignment,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
static PyObject *Ctl_CreateRadioButtonControl(PyObject *_self, PyObject *_args)
{
***************
*** 5499,5502 ****
--- 5800,5864 ----
}
+ #if TARGET_API_MAC_CARBON
+
+ static PyObject *Ctl_CreateTabsControl(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ UInt16 size;
+ UInt16 direction;
+ int i;
+ UInt16 numTabs;
+ ControlTabEntry tabArray[MAXTABS];
+ ControlHandle outControl;
+ PyObject *tabArrayObj, *tabEntry;
+
+ #ifndef CreateTabsControl
+ PyMac_PRECHECK(CreateTabsControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&HHO",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &size,
+ &direction,
+ &tabArrayObj))
+ return NULL;
+
+ i = PySequence_Length(tabArrayObj);
+ if (i == -1)
+ return NULL;
+ if (i > MAXTABS) {
+ PyErr_SetString(Ctl_Error, "Too many tabs");
+ return NULL;
+ }
+ numTabs = i;
+ for (i=0; i<numTabs; i++) {
+ tabEntry = PySequence_GetItem(tabArrayObj, i);
+ if (tabEntry == NULL)
+ return NULL;
+ if (!PyArg_Parse(tabEntry, "(O&O&B)",
+ ControlButtonContentInfo_Convert, &tabArray[i].icon,
+ CFStringRefObj_Convert, &tabArray[i].name,
+ &tabArray[i].enabled
+ ))
+ return NULL;
+ }
+
+ _err = CreateTabsControl(window,
+ &boundsRect,
+ size,
+ direction,
+ numTabs,
+ tabArray,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+ }
+ #endif
+
static PyMethodDef Ctl_methods[] = {
{"NewControl", (PyCFunction)Ctl_NewControl, 1,
***************
*** 5545,5548 ****
--- 5907,5915 ----
#if TARGET_API_MAC_CARBON
+ {"CreateBevelButtonControl", (PyCFunction)Ctl_CreateBevelButtonControl, 1,
+ "(WindowPtr window, Rect boundsRect, CFStringRef title, UInt16 thickness, UInt16 behavior, ControlButtonContentInfo info, SInt16 menuID, UInt16 menuBehavior, UInt16 menuPlacement) -> (ControlHandle outControl)"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
{"CreateDisclosureTriangleControl", (PyCFunction)Ctl_CreateDisclosureTriangleControl, 1,
"(WindowPtr window, Rect boundsRect, UInt16 orientation, CFStringRef title, SInt32 initialValue, Boolean drawTitle, Boolean autoToggles) -> (ControlHandle outControl)"},
***************
*** 5585,5588 ****
--- 5952,5960 ----
#if TARGET_API_MAC_CARBON
+ {"CreateImageWellControl", (PyCFunction)Ctl_CreateImageWellControl, 1,
+ "(WindowPtr window, Rect boundsRect, ControlButtonContentInfo info) -> (ControlHandle outControl)"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
{"CreatePopupArrowControl", (PyCFunction)Ctl_CreatePopupArrowControl, 1,
"(WindowPtr window, Rect boundsRect, UInt16 orientation, UInt16 size) -> (ControlHandle outControl)"},
***************
*** 5615,5618 ****
--- 5987,6000 ----
#if TARGET_API_MAC_CARBON
+ {"CreatePictureControl", (PyCFunction)Ctl_CreatePictureControl, 1,
+ "(WindowPtr window, Rect boundsRect, ControlButtonContentInfo content, Boolean dontTrack) -> (ControlHandle outControl)"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+ {"CreateIconControl", (PyCFunction)Ctl_CreateIconControl, 1,
+ "(WindowPtr window, Rect boundsRect, ControlButtonContentInfo icon, Boolean dontTrack) -> (ControlHandle outControl)"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
{"CreateWindowHeaderControl", (PyCFunction)Ctl_CreateWindowHeaderControl, 1,
"(WindowPtr window, Rect boundsRect, Boolean isListHeader) -> (ControlHandle outControl)"},
***************
*** 5625,5628 ****
--- 6007,6015 ----
#if TARGET_API_MAC_CARBON
+ {"CreatePushButtonWithIconControl", (PyCFunction)Ctl_CreatePushButtonWithIconControl, 1,
+ "(WindowPtr window, Rect boundsRect, CFStringRef title, ControlButtonContentInfo icon, UInt16 iconAlignment) -> (ControlHandle outControl)"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
{"CreateRadioButtonControl", (PyCFunction)Ctl_CreateRadioButtonControl, 1,
"(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)"},
***************
*** 5657,5660 ****
--- 6044,6052 ----
{"as_Control", (PyCFunction)Ctl_as_Control, 1,
"(Handle h) -> (ControlHandle _rv)"},
+
+ #if TARGET_API_MAC_CARBON
+ {"CreateTabsControl", (PyCFunction)Ctl_CreateTabsControl, 1,
+ NULL},
+ #endif
{NULL, NULL, 0}
};
Index: ctlscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** ctlscan.py 2001/12/14 22:47:19 1.23
--- ctlscan.py 2001/12/18 12:47:47 1.24
***************
*** 88,92 ****
'GetControlPropertySize',
'SendControlMessage', # Parameter changed from long to void* from UH3.3 to UH3.4
! # unavailable in Just's CW6 + UH 3.4 libs
'CreateDisclosureButtonControl',
'CreateRelevanceBarControl',
--- 88,94 ----
'GetControlPropertySize',
'SendControlMessage', # Parameter changed from long to void* from UH3.3 to UH3.4
! 'CreateTabsControl', # wrote manually
! # these are part of Carbon, yet not in CarbonLib; OSX-only
! 'CreateRoundButtonControl',
'CreateDisclosureButtonControl',
'CreateRelevanceBarControl',
***************
*** 96,99 ****
--- 98,105 ----
'CreateEditUnicodeTextControl',
'CopyDataBrowserEditText',
+
+ # too lazy for now
+ 'GetImageWellContentInfo',
+ 'GetBevelButtonContentInfo',
]
***************
*** 128,131 ****
--- 134,147 ----
'GetControlClickActivation',
'HandleControlContextualMenuClick',
+
+ "CreateBevelButtonControl",
+ "CreateImageWellControl",
+ "CreatePictureControl",
+ "CreateIconControl",
+ "CreatePushButtonWithIconControl",
+ "SetBevelButtonContentInfo",
+ "SetImageWellContentInfo",
+ "AddDataBrowserListViewColumn",
+
"CreateDataBrowserControl",
"CreateScrollingTextBoxControl",
***************
*** 243,247 ****
'ProcPtr',
'ControlActionUPP',
- 'ControlButtonContentInfoPtr',
'Ptr',
'ControlDefSpec', # Don't know how to do this yet
--- 259,262 ----
***************
*** 251,257 ****
'ControlColorUPP',
'ControlKind', # XXX easy: 2-tuple containing 2 OSType's
! 'ControlTabEntry_ptr', # XXX needed for tabs
! 'ControlButtonContentInfo', # XXX ugh: a union
! 'ControlButtonContentInfo_ptr', # XXX ugh: a union
'ListDefSpec_ptr', # XXX see _Listmodule.c, tricky but possible
'DataBrowserItemID_ptr', # XXX array of UInt32, for BrowserView
--- 266,273 ----
'ControlColorUPP',
'ControlKind', # XXX easy: 2-tuple containing 2 OSType's
! # 'ControlTabEntry_ptr', # XXX needed for tabs
! # 'ControlButtonContentInfoPtr',
! # 'ControlButtonContentInfo', # XXX ugh: a union
! # 'ControlButtonContentInfo_ptr', # XXX ugh: a union
'ListDefSpec_ptr', # XXX see _Listmodule.c, tricky but possible
'DataBrowserItemID_ptr', # XXX array of UInt32, for BrowserView
***************
*** 262,267 ****
'DataBrowserCustomCallbacks',
'DataBrowserCustomCallbacks_ptr',
! 'DataBrowserTableViewColumnDesc',
! 'DataBrowserListViewColumnDesc',
'CFDataRef',
]
--- 278,283 ----
'DataBrowserCustomCallbacks',
'DataBrowserCustomCallbacks_ptr',
! ## 'DataBrowserTableViewColumnDesc',
! ## 'DataBrowserListViewColumnDesc',
'CFDataRef',
]
***************
*** 293,296 ****
--- 309,321 ----
([("Rect_ptr", "*", "ReturnMode")], # GetControlBounds
[("void", "*", "ReturnMode")]),
+
+ ([("DataBrowserListViewColumnDesc", "*", "OutMode")],
+ [("DataBrowserListViewColumnDesc", "*", "InMode")]),
+
+ ([("ControlButtonContentInfoPtr", 'outContent', "InMode")],
+ [("ControlButtonContentInfoPtr", '*', "OutMode")]),
+
+ ([("ControlButtonContentInfo", '*', "OutMode")],
+ [("ControlButtonContentInfo", '*', "InMode")]),
]
Index: ctlsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlsupport.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** ctlsupport.py 2001/12/12 22:51:39 1.45
--- ctlsupport.py 2001/12/18 12:47:47 1.46
***************
*** 79,84 ****
--- 79,98 ----
ControlDisclosureTriangleOrientation = UInt16
+ DataBrowserTableViewColumnDesc = OpaqueType("DataBrowserTableViewColumnDesc",
+ "DataBrowserTableViewColumnDesc")
+ DataBrowserListViewColumnDesc = OpaqueType("DataBrowserListViewColumnDesc",
+ "DataBrowserListViewColumnDesc")
+ ControlButtonContentInfo = OpaqueType("ControlButtonContentInfo",
+ "ControlButtonContentInfo")
+ ControlButtonContentInfoPtr = ControlButtonContentInfo_ptr = ControlButtonContentInfo
+ ControlTabEntry_ptr = OpaqueType("ControlTabEntry", "ControlTabEntry")
+ ControlBevelThickness = UInt16
+ ControlBevelButtonBehavior = UInt16
+ ControlBevelButtonMenuBehavior = UInt16
+ ControlBevelButtonMenuPlacement = UInt16
+ ControlPushButtonIconAlignment = UInt16
+
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS
***************
*** 107,110 ****
--- 121,125 ----
#endif
+ #define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */
/*
** Parse/generate ControlFontStyleRec records
***************
*** 124,128 ****
ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
{
! return PyArg_ParseTuple(v, "hhhhhhO&O&", &itself->flags,
&itself->font, &itself->size, &itself->style, &itself->mode,
&itself->just, QdRGB_Convert, &itself->foreColor,
--- 139,143 ----
ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
{
! return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
&itself->font, &itself->size, &itself->style, &itself->mode,
&itself->just, QdRGB_Convert, &itself->foreColor,
***************
*** 143,149 ****
PyControlID_Convert(PyObject *v, ControlID *itself)
{
! return PyArg_ParseTuple(v, "O&l", PyMac_GetOSType, &itself->signature, &itself->id);
}
/* TrackControl and HandleControlClick callback support */
--- 158,205 ----
PyControlID_Convert(PyObject *v, ControlID *itself)
{
! return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
}
+ /*
+ ** generate DataBrowserListViewColumnDesc records
+ */
+ static int
+ DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
+ {
+ return PyArg_Parse(v, "(lO&l)",
+ &itself->propertyID,
+ PyMac_GetOSType, &itself->propertyType,
+ &itself->propertyFlags);
+ }
+
+ static int
+ ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
+ {
+ return PyArg_Parse(v, "(hO&)",
+ &itself->contentType,
+ OptResObj_Convert, &itself->u.iconSuite);
+ }
+
+ static int
+ DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
+ {
+ itself->version = kDataBrowserListViewLatestHeaderDesc;
+ return PyArg_Parse(v, "(HHhO&HO&O&)",
+ &itself->minimumWidth,
+ &itself->maximumWidth,
+ &itself->titleOffset,
+ CFStringRefObj_Convert, &itself->titleString,
+ &itself->initialOrder,
+ ControlFontStyle_Convert, &itself->btnFontStyle,
+ ControlButtonContentInfo_Convert, &itself->btnContentInfo);
+ }
+
+ static int
+ DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
+ {
+ return PyArg_Parse(v, "(O&O&)",
+ DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
+ DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
+ }
/* TrackControl and HandleControlClick callback support */
***************
*** 665,668 ****
--- 721,782 ----
object.add(f)
+
+ createtabscontrol_body = """\
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ UInt16 size;
+ UInt16 direction;
+ int i;
+ UInt16 numTabs;
+ ControlTabEntry tabArray[MAXTABS];
+ ControlHandle outControl;
+ PyObject *tabArrayObj, *tabEntry;
+
+ #ifndef CreateTabsControl
+ PyMac_PRECHECK(CreateTabsControl);
+ #endif
+ if (!PyArg_ParseTuple(_args, "O&O&HHO",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &size,
+ &direction,
+ &tabArrayObj))
+ return NULL;
+
+ i = PySequence_Length(tabArrayObj);
+ if (i == -1)
+ return NULL;
+ if (i > MAXTABS) {
+ PyErr_SetString(Ctl_Error, "Too many tabs");
+ return NULL;
+ }
+ numTabs = i;
+ for (i=0; i<numTabs; i++) {
+ tabEntry = PySequence_GetItem(tabArrayObj, i);
+ if (tabEntry == NULL)
+ return NULL;
+ if (!PyArg_Parse(tabEntry, "(O&O&B)",
+ ControlButtonContentInfo_Convert, &tabArray[i].icon,
+ CFStringRefObj_Convert, &tabArray[i].name,
+ &tabArray[i].enabled
+ ))
+ return NULL;
+ }
+
+ _err = CreateTabsControl(window,
+ &boundsRect,
+ size,
+ direction,
+ numTabs,
+ tabArray,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;"""
+
+ f = ManualGenerator("CreateTabsControl", createtabscontrol_body, condition="#if TARGET_API_MAC_CARBON")
+ module.add(f)
# generate output (open the output file as late as possible)