[Python-checkins] CVS: python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.12,1.13 ctlscan.py,1.24,1.25

Just van Rossum jvr@users.sourceforge.net
Tue, 18 Dec 2001 12:15:29 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl
In directory usw-pr-cvs1:/tmp/cvs-serv1598

Modified Files:
	_Ctlmodule.c ctlscan.py 
Log Message:
Moved a bunch of routines from "blacklisted" to "graylisted", as they _are_
available in OSX (mach-o) but not in CarbonLib (neither on OSX or OS9).

Index: _Ctlmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** _Ctlmodule.c	2001/12/18 15:38:11	1.12
--- _Ctlmodule.c	2001/12/18 20:15:26	1.13
***************
*** 312,315 ****
--- 312,371 ----
  }
  
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	Boolean _rv;
+ #ifndef IsControlEnabled
+ 	PyMac_PRECHECK(IsControlEnabled);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = IsControlEnabled(_self->ob_itself);
+ 	_res = Py_BuildValue("b",
+ 	                     _rv);
+ 	return _res;
+ }
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ #ifndef EnableControl
+ 	PyMac_PRECHECK(EnableControl);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_err = EnableControl(_self->ob_itself);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	Py_INCREF(Py_None);
+ 	_res = Py_None;
+ 	return _res;
+ }
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ #ifndef DisableControl
+ 	PyMac_PRECHECK(DisableControl);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_err = DisableControl(_self->ob_itself);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	Py_INCREF(Py_None);
+ 	_res = Py_None;
+ 	return _res;
+ }
+ #endif
+ 
  static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
  {
***************
*** 2616,2619 ****
--- 2672,2696 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	CFStringRef text;
+ #ifndef CopyDataBrowserEditText
+ 	PyMac_PRECHECK(CopyDataBrowserEditText);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_err = CopyDataBrowserEditText(_self->ob_itself,
+ 	                               &text);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CFStringRefObj_New, text);
+ 	return _res;
+ }
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
  
***************
*** 3796,3799 ****
--- 3873,3891 ----
  	{"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1,
  	 "(Boolean inIsVisible, Boolean inDoDraw) -> None"},
+ 
+ #if TARGET_API_MAC_OSX
+ 	{"IsControlEnabled", (PyCFunction)CtlObj_IsControlEnabled, 1,
+ 	 "() -> (Boolean _rv)"},
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 	{"EnableControl", (PyCFunction)CtlObj_EnableControl, 1,
+ 	 "() -> None"},
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 	{"DisableControl", (PyCFunction)CtlObj_DisableControl, 1,
+ 	 "() -> None"},
+ #endif
  	{"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1,
  	 "() -> None"},
***************
*** 4210,4213 ****
--- 4302,4310 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 	{"CopyDataBrowserEditText", (PyCFunction)CtlObj_CopyDataBrowserEditText, 1,
+ 	 "() -> (CFStringRef text)"},
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
  	{"GetDataBrowserEditText", (PyCFunction)CtlObj_GetDataBrowserEditText, 1,
***************
*** 4972,4975 ****
--- 5069,5107 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	WindowPtr window;
+ 	Rect boundsRect;
+ 	SInt32 value;
+ 	SInt32 minimum;
+ 	SInt32 maximum;
+ 	ControlHandle outControl;
+ #ifndef CreateRelevanceBarControl
+ 	PyMac_PRECHECK(CreateRelevanceBarControl);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "O&O&lll",
+ 	                      WinObj_Convert, &window,
+ 	                      PyMac_GetRect, &boundsRect,
+ 	                      &value,
+ 	                      &minimum,
+ 	                      &maximum))
+ 		return NULL;
+ 	_err = CreateRelevanceBarControl(window,
+ 	                                 &boundsRect,
+ 	                                 value,
+ 	                                 minimum,
+ 	                                 maximum,
+ 	                                 &outControl);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CtlObj_New, outControl);
+ 	return _res;
+ }
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
  
***************
*** 5735,5738 ****
--- 5867,5934 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	WindowPtr inWindow;
+ 	Rect inBoundsRect;
+ 	SInt32 inValue;
+ 	Boolean inAutoToggles;
+ 	ControlHandle outControl;
+ #ifndef CreateDisclosureButtonControl
+ 	PyMac_PRECHECK(CreateDisclosureButtonControl);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "O&O&lb",
+ 	                      WinObj_Convert, &inWindow,
+ 	                      PyMac_GetRect, &inBoundsRect,
+ 	                      &inValue,
+ 	                      &inAutoToggles))
+ 		return NULL;
+ 	_err = CreateDisclosureButtonControl(inWindow,
+ 	                                     &inBoundsRect,
+ 	                                     inValue,
+ 	                                     inAutoToggles,
+ 	                                     &outControl);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CtlObj_New, outControl);
+ 	return _res;
+ }
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	WindowPtr inWindow;
+ 	Rect inBoundsRect;
+ 	SInt16 inSize;
+ 	ControlButtonContentInfo inContent;
+ 	ControlHandle outControl;
+ #ifndef CreateRoundButtonControl
+ 	PyMac_PRECHECK(CreateRoundButtonControl);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ 	                      WinObj_Convert, &inWindow,
+ 	                      PyMac_GetRect, &inBoundsRect,
+ 	                      &inSize,
+ 	                      ControlButtonContentInfo_Convert, &inContent))
+ 		return NULL;
+ 	_err = CreateRoundButtonControl(inWindow,
+ 	                                &inBoundsRect,
+ 	                                inSize,
+ 	                                &inContent,
+ 	                                &outControl);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CtlObj_New, outControl);
+ 	return _res;
+ }
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
  
***************
*** 5764,5767 ****
--- 5960,5998 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 
+ static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	WindowPtr window;
+ 	Rect boundsRect;
+ 	CFStringRef text;
+ 	Boolean isPassword;
+ 	ControlFontStyleRec style;
+ 	ControlHandle outControl;
+ #ifndef CreateEditUnicodeTextControl
+ 	PyMac_PRECHECK(CreateEditUnicodeTextControl);
+ #endif
+ 	if (!PyArg_ParseTuple(_args, "O&O&O&bO&",
+ 	                      WinObj_Convert, &window,
+ 	                      PyMac_GetRect, &boundsRect,
+ 	                      CFStringRefObj_Convert, &text,
+ 	                      &isPassword,
+ 	                      ControlFontStyle_Convert, &style))
+ 		return NULL;
+ 	_err = CreateEditUnicodeTextControl(window,
+ 	                                    &boundsRect,
+ 	                                    text,
+ 	                                    isPassword,
+ 	                                    &style,
+ 	                                    &outControl);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     CtlObj_New, outControl);
+ 	return _res;
+ }
+ #endif
+ 
  static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
  {
***************
*** 5925,5928 ****
--- 6156,6164 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 	{"CreateRelevanceBarControl", (PyCFunction)Ctl_CreateRelevanceBarControl, 1,
+ 	 "(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum) -> (ControlHandle outControl)"},
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
  	{"CreateLittleArrowsControl", (PyCFunction)Ctl_CreateLittleArrowsControl, 1,
***************
*** 6040,6046 ****
--- 6276,6297 ----
  #endif
  
+ #if TARGET_API_MAC_OSX
+ 	{"CreateDisclosureButtonControl", (PyCFunction)Ctl_CreateDisclosureButtonControl, 1,
+ 	 "(WindowPtr inWindow, Rect inBoundsRect, SInt32 inValue, Boolean inAutoToggles) -> (ControlHandle outControl)"},
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 	{"CreateRoundButtonControl", (PyCFunction)Ctl_CreateRoundButtonControl, 1,
+ 	 "(WindowPtr inWindow, Rect inBoundsRect, SInt16 inSize, ControlButtonContentInfo inContent) -> (ControlHandle outControl)"},
+ #endif
+ 
  #if TARGET_API_MAC_CARBON
  	{"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1,
  	 "(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)"},
+ #endif
+ 
+ #if TARGET_API_MAC_OSX
+ 	{"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1,
+ 	 "(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)"},
  #endif
  	{"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,

Index: ctlscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** ctlscan.py	2001/12/18 12:47:47	1.24
--- ctlscan.py	2001/12/18 20:15:27	1.25
***************
*** 89,101 ****
  			'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',
- 			'DisableControl',
- 			'EnableControl',
- 			'IsControlEnabled',
- 			'CreateEditUnicodeTextControl',
- 			'CopyDataBrowserEditText',
  			
  			# too lazy for now
--- 89,92 ----
***************
*** 253,257 ****
  				'SetControlPopupMenuHandle',
  				'SetControlPopupMenuID',
! 			])]
  			
  	def makeblacklisttypes(self):
--- 244,259 ----
  				'SetControlPopupMenuHandle',
  				'SetControlPopupMenuID',
! 			]),
! 			('#if TARGET_API_MAC_OSX', [
! 				'CreateRoundButtonControl',
! 				'CreateDisclosureButtonControl',
! 				'CreateRelevanceBarControl',
! 				'DisableControl',
! 				'EnableControl',
! 				'IsControlEnabled',
! 				'CreateEditUnicodeTextControl',
! 				'CopyDataBrowserEditText',
! 			]),
! 			]
  			
  	def makeblacklisttypes(self):