[Python-checkins] CVS: python/dist/src/Mac/Modules/app _Appmodule.c,1.6,1.7 appscan.py,1.6,1.7 appsupport.py,1.10,1.11

Just van Rossum jvr@users.sourceforge.net
Sat, 05 Jan 2002 15:37:21 -0800


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

Modified Files:
	_Appmodule.c appscan.py appsupport.py 
Log Message:
Q&D support for ThemeDrawingState objects.

Index: _Appmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** _Appmodule.c	2002/01/02 15:11:44	1.6
--- _Appmodule.c	2002/01/05 23:37:19	1.7
***************
*** 30,33 ****
--- 30,141 ----
  static PyObject *App_Error;
  
+ /* ----------------- Object type ThemeDrawingState ------------------ */
+ 
+ PyTypeObject ThemeDrawingState_Type;
+ 
+ #define ThemeDrawingState_Check(x) ((x)->ob_type == &ThemeDrawingState_Type)
+ 
+ typedef struct ThemeDrawingStateObject {
+ 	PyObject_HEAD
+ 	ThemeDrawingState ob_itself;
+ } ThemeDrawingStateObject;
+ 
+ PyObject *ThemeDrawingState_New(ThemeDrawingState itself)
+ {
+ 	ThemeDrawingStateObject *it;
+ 	it = PyObject_NEW(ThemeDrawingStateObject, &ThemeDrawingState_Type);
+ 	if (it == NULL) return NULL;
+ 	it->ob_itself = itself;
+ 	return (PyObject *)it;
+ }
+ int ThemeDrawingState_Convert(PyObject *v, ThemeDrawingState *p_itself)
+ {
+ 	if (!ThemeDrawingState_Check(v))
+ 	{
+ 		PyErr_SetString(PyExc_TypeError, "ThemeDrawingState required");
+ 		return 0;
+ 	}
+ 	*p_itself = ((ThemeDrawingStateObject *)v)->ob_itself;
+ 	return 1;
+ }
+ 
+ static void ThemeDrawingState_dealloc(ThemeDrawingStateObject *self)
+ {
+ 	/* Cleanup of self->ob_itself goes here */
+ 	PyMem_DEL(self);
+ }
+ 
+ static PyObject *ThemeDrawingState_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _rv;
+ 	Boolean inDisposeNow;
+ 	if (!PyArg_ParseTuple(_args, "b",
+ 	                      &inDisposeNow))
+ 		return NULL;
+ 	_rv = SetThemeDrawingState(_self->ob_itself,
+ 	                           inDisposeNow);
+ 	_res = Py_BuildValue("l",
+ 	                     _rv);
+ 	return _res;
+ }
+ 
+ static PyObject *ThemeDrawingState_DisposeThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _rv;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_rv = DisposeThemeDrawingState(_self->ob_itself);
+ 	_res = Py_BuildValue("l",
+ 	                     _rv);
+ 	return _res;
+ }
+ 
+ static PyMethodDef ThemeDrawingState_methods[] = {
+ 	{"SetThemeDrawingState", (PyCFunction)ThemeDrawingState_SetThemeDrawingState, 1,
+ 	 "(Boolean inDisposeNow) -> (OSStatus _rv)"},
+ 	{"DisposeThemeDrawingState", (PyCFunction)ThemeDrawingState_DisposeThemeDrawingState, 1,
+ 	 "() -> (OSStatus _rv)"},
+ 	{NULL, NULL, 0}
+ };
+ 
+ PyMethodChain ThemeDrawingState_chain = { ThemeDrawingState_methods, NULL };
+ 
+ static PyObject *ThemeDrawingState_getattr(ThemeDrawingStateObject *self, char *name)
+ {
+ 	return Py_FindMethodInChain(&ThemeDrawingState_chain, (PyObject *)self, name);
+ }
+ 
+ #define ThemeDrawingState_setattr NULL
+ 
+ #define ThemeDrawingState_compare NULL
+ 
+ #define ThemeDrawingState_repr NULL
+ 
+ #define ThemeDrawingState_hash NULL
+ 
+ PyTypeObject ThemeDrawingState_Type = {
+ 	PyObject_HEAD_INIT(NULL)
+ 	0, /*ob_size*/
+ 	"_App.ThemeDrawingState", /*tp_name*/
+ 	sizeof(ThemeDrawingStateObject), /*tp_basicsize*/
+ 	0, /*tp_itemsize*/
+ 	/* methods */
+ 	(destructor) ThemeDrawingState_dealloc, /*tp_dealloc*/
+ 	0, /*tp_print*/
+ 	(getattrfunc) ThemeDrawingState_getattr, /*tp_getattr*/
+ 	(setattrfunc) ThemeDrawingState_setattr, /*tp_setattr*/
+ 	(cmpfunc) ThemeDrawingState_compare, /*tp_compare*/
+ 	(reprfunc) ThemeDrawingState_repr, /*tp_repr*/
+ 	(PyNumberMethods *)0, /* tp_as_number */
+ 	(PySequenceMethods *)0, /* tp_as_sequence */
+ 	(PyMappingMethods *)0, /* tp_as_mapping */
+ 	(hashfunc) ThemeDrawingState_hash, /*tp_hash*/
+ };
+ 
+ /* --------------- End object type ThemeDrawingState ---------------- */
+ 
+ 
  static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args)
  {
***************
*** 1034,1037 ****
--- 1142,1159 ----
  }
  
+ static PyObject *App_GetThemeDrawingState(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	ThemeDrawingState outState;
+ 	if (!PyArg_ParseTuple(_args, ""))
+ 		return NULL;
+ 	_err = GetThemeDrawingState(&outState);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&",
+ 	                     ThemeDrawingState_New, outState);
+ 	return _res;
+ }
+ 
  static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args)
  {
***************
*** 1282,1285 ****
--- 1404,1409 ----
  	{"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1,
  	 "() -> None"},
+ 	{"GetThemeDrawingState", (PyCFunction)App_GetThemeDrawingState, 1,
+ 	 "() -> (ThemeDrawingState outState)"},
  	{"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1,
  	 "(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None"},
***************
*** 1317,1320 ****
--- 1441,1448 ----
  	    PyDict_SetItemString(d, "Error", App_Error) != 0)
  		return;
+ 	ThemeDrawingState_Type.ob_type = &PyType_Type;
+ 	Py_INCREF(&ThemeDrawingState_Type);
+ 	if (PyDict_SetItemString(d, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type) != 0)
+ 		Py_FatalError("can't initialize ThemeDrawingStateType");
  }
  

Index: appscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appscan.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** appscan.py	2002/01/02 15:11:44	1.6
--- appscan.py	2002/01/05 23:37:19	1.7
***************
*** 10,14 ****
  LONG = "Appearance"
  SHORT = "app"
! OBJECT = "NOTUSED"
  
  def main():
--- 10,14 ----
  LONG = "Appearance"
  SHORT = "app"
! OBJECT = "ThemeDrawingState"
  
  def main():
***************
*** 74,78 ****
  			"ThemeButtonDrawInfo_ptr",	# ditto
  			"ThemeWindowMetrics_ptr",	# ditto
! 			"ThemeDrawingState",	# This is an opaque pointer, so it should be simple. Later.
  			"Collection",		# No interface to collection mgr yet.
  			"BytePtr",		# Not yet.
--- 74,78 ----
  			"ThemeButtonDrawInfo_ptr",	# ditto
  			"ThemeWindowMetrics_ptr",	# ditto
! #			"ThemeDrawingState",	# This is an opaque pointer, so it should be simple. Later.
  			"Collection",		# No interface to collection mgr yet.
  			"BytePtr",		# Not yet.

Index: appsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** appsupport.py	2002/01/02 15:11:44	1.10
--- appsupport.py	2002/01/05 23:37:19	1.11
***************
*** 9,14 ****
  MACHEADERFILE = 'Appearance.h'		# The Apple header file
  MODNAME = '_App'				# The name of the module
! OBJECTNAME = 'UNUSED'			# The basic name of the objects used here
! KIND = 'Record'				# Usually 'Ptr' or 'Handle'
  
  # The following is *usually* unchanged but may still require tuning
--- 9,14 ----
  MACHEADERFILE = 'Appearance.h'		# The Apple header file
  MODNAME = '_App'				# The name of the module
! OBJECTNAME = 'ThemeDrawingState'			# The basic name of the objects used here
! KIND = ''				# Usually 'Ptr' or 'Handle'
  
  # The following is *usually* unchanged but may still require tuning
***************
*** 83,87 ****
  """
  
! ## class MyObjectDefinition(GlobalObjectDefinition):
  ## 	def outputCheckNewArg(self):
  ## 		Output("if (itself == NULL) return PyMac_Error(resNotFound);")
--- 83,88 ----
  """
  
! class MyObjectDefinition(GlobalObjectDefinition):
! 	pass
  ## 	def outputCheckNewArg(self):
  ## 		Output("if (itself == NULL) return PyMac_Error(resNotFound);")
***************
*** 100,105 ****
  # Create the generator groups and link them
  module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
! ##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
! ##module.addobject(object)
  
  # Create the generator classes used to populate the lists
--- 101,110 ----
  # Create the generator groups and link them
  module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
! object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
! module.addobject(object)
! 
! ThemeDrawingState = OpaqueByValueType("ThemeDrawingState", "ThemeDrawingStateObj")
! Method = MethodGenerator
! 
  
  # Create the generator classes used to populate the lists
***************
*** 109,113 ****
  # Create and populate the lists
  functions = []
! ##methods = []
  execfile(INPUTFILE)
  
--- 114,118 ----
  # Create and populate the lists
  functions = []
! methods = []
  execfile(INPUTFILE)
  
***************
*** 115,119 ****
  # (in a different wordl the scan program would generate this)
  for f in functions: module.add(f)
! ##for f in methods: object.add(f)
  
  # generate output (open the output file as late as possible)
--- 120,124 ----
  # (in a different wordl the scan program would generate this)
  for f in functions: module.add(f)
! for f in methods: object.add(f)
  
  # generate output (open the output file as late as possible)