2 /* ========================== Module List =========================== */
9 #include "pymactoolbox.h"
11 #ifdef WITHOUT_FRAMEWORKS
14 #include <Carbon/Carbon.h>
17 #ifdef USE_TOOLBOX_OBJECT_GLUE
18 extern PyObject
*_ListObj_New(ListHandle
);
19 extern int _ListObj_Convert(PyObject
*, ListHandle
*);
21 #define ListObj_New _ListObj_New
22 #define ListObj_Convert _ListObj_Convert
25 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
26 #define GetListPort(list) ((CGrafPtr)(*(list))->port)
27 #define GetListVerticalScrollBar(list) ((*(list))->vScroll)
28 #define GetListHorizontalScrollBar(list) ((*(list))->hScroll)
29 #define GetListActive(list) ((*(list))->lActive)
30 #define GetListClickTime(list) ((*(list))->clikTime)
31 #define GetListRefCon(list) ((*(list))->refCon)
32 #define GetListDefinition(list) ((*(list))->listDefProc) /* XXX Is this indeed the same? */
33 #define GetListUserHandle(list) ((*(list))->userHandle)
34 #define GetListDataHandle(list) ((*(list))->cells)
35 #define GetListFlags(list) ((*(list))->listFlags)
36 #define GetListSelectionFlags(list) ((*(list))->selFlags)
37 #define SetListViewBounds(list, bounds) (((*(list))->rView) = *(bounds))
39 #define SetListPort(list, port) (((*(list))->port) = (GrafPtr)(port))
40 #define SetListCellIndent(list, ind) (((*(list))->indent) = *(ind))
41 #define SetListClickTime(list, time) (((*(list))->clikTime) = (time))
42 #define SetListLastClick(list, click) (((*(list)->lastClick) = *(click))
43 #define SetListRefCon(list, refcon) (((*(list))->refCon) = (refcon))
44 #define SetListUserHandle(list, handle) (((*(list))->userHandle) = (handle))
45 #define SetListFlags(list, flags) (((*(list))->listFlags) = (flags))
46 #define SetListSelectionFlags(list, flags) (((*(list))->selFlags) = (flags))
50 #define as_List(x) ((ListHandle)x)
51 #define as_Resource(lh) ((Handle)lh)
53 static PyObject
*List_Error
;
55 /* ------------------------ Object type List ------------------------ */
57 PyTypeObject List_Type
;
59 #define ListObj_Check(x) ((x)->ob_type == &List_Type)
61 typedef struct ListObject
{
64 int ob_must_be_disposed
;
67 PyObject
*ListObj_New(ListHandle itself
)
71 PyErr_SetString(List_Error
,"Cannot create null List");
74 it
= PyObject_NEW(ListObject
, &List_Type
);
75 if (it
== NULL
) return NULL
;
76 it
->ob_itself
= itself
;
77 it
->ob_must_be_disposed
= 1;
78 return (PyObject
*)it
;
80 ListObj_Convert(PyObject
*v
, ListHandle
*p_itself
)
82 if (!ListObj_Check(v
))
84 PyErr_SetString(PyExc_TypeError
, "List required");
87 *p_itself
= ((ListObject
*)v
)->ob_itself
;
91 static void ListObj_dealloc(ListObject
*self
)
93 if (self
->ob_must_be_disposed
&& self
->ob_itself
) LDispose(self
->ob_itself
);
97 static PyObject
*ListObj_LAddColumn(ListObject
*_self
, PyObject
*_args
)
99 PyObject
*_res
= NULL
;
103 if (!PyArg_ParseTuple(_args
, "hh",
107 _rv
= LAddColumn(count
,
110 _res
= Py_BuildValue("h",
115 static PyObject
*ListObj_LAddRow(ListObject
*_self
, PyObject
*_args
)
117 PyObject
*_res
= NULL
;
121 if (!PyArg_ParseTuple(_args
, "hh",
128 _res
= Py_BuildValue("h",
133 static PyObject
*ListObj_LDelColumn(ListObject
*_self
, PyObject
*_args
)
135 PyObject
*_res
= NULL
;
138 if (!PyArg_ParseTuple(_args
, "hh",
150 static PyObject
*ListObj_LDelRow(ListObject
*_self
, PyObject
*_args
)
152 PyObject
*_res
= NULL
;
155 if (!PyArg_ParseTuple(_args
, "hh",
167 static PyObject
*ListObj_LGetSelect(ListObject
*_self
, PyObject
*_args
)
169 PyObject
*_res
= NULL
;
173 if (!PyArg_ParseTuple(_args
, "bO&",
175 PyMac_GetPoint
, &theCell
))
177 _rv
= LGetSelect(next
,
180 _res
= Py_BuildValue("bO&",
182 PyMac_BuildPoint
, theCell
);
186 static PyObject
*ListObj_LLastClick(ListObject
*_self
, PyObject
*_args
)
188 PyObject
*_res
= NULL
;
190 if (!PyArg_ParseTuple(_args
, ""))
192 _rv
= LLastClick(_self
->ob_itself
);
193 _res
= Py_BuildValue("O&",
194 PyMac_BuildPoint
, _rv
);
198 static PyObject
*ListObj_LNextCell(ListObject
*_self
, PyObject
*_args
)
200 PyObject
*_res
= NULL
;
205 if (!PyArg_ParseTuple(_args
, "bbO&",
208 PyMac_GetPoint
, &theCell
))
210 _rv
= LNextCell(hNext
,
214 _res
= Py_BuildValue("bO&",
216 PyMac_BuildPoint
, theCell
);
220 static PyObject
*ListObj_LSize(ListObject
*_self
, PyObject
*_args
)
222 PyObject
*_res
= NULL
;
225 if (!PyArg_ParseTuple(_args
, "hh",
237 static PyObject
*ListObj_LSetDrawingMode(ListObject
*_self
, PyObject
*_args
)
239 PyObject
*_res
= NULL
;
241 if (!PyArg_ParseTuple(_args
, "b",
244 LSetDrawingMode(drawIt
,
251 static PyObject
*ListObj_LScroll(ListObject
*_self
, PyObject
*_args
)
253 PyObject
*_res
= NULL
;
256 if (!PyArg_ParseTuple(_args
, "hh",
268 static PyObject
*ListObj_LAutoScroll(ListObject
*_self
, PyObject
*_args
)
270 PyObject
*_res
= NULL
;
271 if (!PyArg_ParseTuple(_args
, ""))
273 LAutoScroll(_self
->ob_itself
);
279 static PyObject
*ListObj_LUpdate(ListObject
*_self
, PyObject
*_args
)
281 PyObject
*_res
= NULL
;
283 if (!PyArg_ParseTuple(_args
, "O&",
284 ResObj_Convert
, &theRgn
))
293 static PyObject
*ListObj_LActivate(ListObject
*_self
, PyObject
*_args
)
295 PyObject
*_res
= NULL
;
297 if (!PyArg_ParseTuple(_args
, "b",
307 static PyObject
*ListObj_LCellSize(ListObject
*_self
, PyObject
*_args
)
309 PyObject
*_res
= NULL
;
311 if (!PyArg_ParseTuple(_args
, "O&",
312 PyMac_GetPoint
, &cSize
))
321 static PyObject
*ListObj_LClick(ListObject
*_self
, PyObject
*_args
)
323 PyObject
*_res
= NULL
;
327 if (!PyArg_ParseTuple(_args
, "O&h",
334 _res
= Py_BuildValue("b",
339 static PyObject
*ListObj_LAddToCell(ListObject
*_self
, PyObject
*_args
)
341 PyObject
*_res
= NULL
;
343 short dataPtr__len__
;
344 int dataPtr__in_len__
;
346 if (!PyArg_ParseTuple(_args
, "s#O&",
347 &dataPtr__in__
, &dataPtr__in_len__
,
348 PyMac_GetPoint
, &theCell
))
350 dataPtr__len__
= dataPtr__in_len__
;
351 LAddToCell(dataPtr__in__
, dataPtr__len__
,
360 static PyObject
*ListObj_LClrCell(ListObject
*_self
, PyObject
*_args
)
362 PyObject
*_res
= NULL
;
364 if (!PyArg_ParseTuple(_args
, "O&",
365 PyMac_GetPoint
, &theCell
))
374 static PyObject
*ListObj_LGetCell(ListObject
*_self
, PyObject
*_args
)
376 PyObject
*_res
= NULL
;
377 char *dataPtr__out__
;
378 short dataPtr__len__
;
379 int dataPtr__in_len__
;
381 if (!PyArg_ParseTuple(_args
, "iO&",
383 PyMac_GetPoint
, &theCell
))
385 if ((dataPtr__out__
= malloc(dataPtr__in_len__
)) == NULL
)
388 goto dataPtr__error__
;
390 dataPtr__len__
= dataPtr__in_len__
;
391 LGetCell(dataPtr__out__
, &dataPtr__len__
,
394 _res
= Py_BuildValue("s#",
395 dataPtr__out__
, (int)dataPtr__len__
);
396 free(dataPtr__out__
);
401 static PyObject
*ListObj_LRect(ListObject
*_self
, PyObject
*_args
)
403 PyObject
*_res
= NULL
;
406 if (!PyArg_ParseTuple(_args
, "O&",
407 PyMac_GetPoint
, &theCell
))
412 _res
= Py_BuildValue("O&",
413 PyMac_BuildRect
, &cellRect
);
417 static PyObject
*ListObj_LSetCell(ListObject
*_self
, PyObject
*_args
)
419 PyObject
*_res
= NULL
;
421 short dataPtr__len__
;
422 int dataPtr__in_len__
;
424 if (!PyArg_ParseTuple(_args
, "s#O&",
425 &dataPtr__in__
, &dataPtr__in_len__
,
426 PyMac_GetPoint
, &theCell
))
428 dataPtr__len__
= dataPtr__in_len__
;
429 LSetCell(dataPtr__in__
, dataPtr__len__
,
438 static PyObject
*ListObj_LSetSelect(ListObject
*_self
, PyObject
*_args
)
440 PyObject
*_res
= NULL
;
443 if (!PyArg_ParseTuple(_args
, "bO&",
445 PyMac_GetPoint
, &theCell
))
455 static PyObject
*ListObj_LDraw(ListObject
*_self
, PyObject
*_args
)
457 PyObject
*_res
= NULL
;
459 if (!PyArg_ParseTuple(_args
, "O&",
460 PyMac_GetPoint
, &theCell
))
469 static PyObject
*ListObj_as_Resource(ListObject
*_self
, PyObject
*_args
)
471 PyObject
*_res
= NULL
;
473 if (!PyArg_ParseTuple(_args
, ""))
475 _rv
= as_Resource(_self
->ob_itself
);
476 _res
= Py_BuildValue("O&",
481 static PyMethodDef ListObj_methods
[] = {
482 {"LAddColumn", (PyCFunction
)ListObj_LAddColumn
, 1,
483 "(short count, short colNum) -> (short _rv)"},
484 {"LAddRow", (PyCFunction
)ListObj_LAddRow
, 1,
485 "(short count, short rowNum) -> (short _rv)"},
486 {"LDelColumn", (PyCFunction
)ListObj_LDelColumn
, 1,
487 "(short count, short colNum) -> None"},
488 {"LDelRow", (PyCFunction
)ListObj_LDelRow
, 1,
489 "(short count, short rowNum) -> None"},
490 {"LGetSelect", (PyCFunction
)ListObj_LGetSelect
, 1,
491 "(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)"},
492 {"LLastClick", (PyCFunction
)ListObj_LLastClick
, 1,
493 "() -> (Point _rv)"},
494 {"LNextCell", (PyCFunction
)ListObj_LNextCell
, 1,
495 "(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)"},
496 {"LSize", (PyCFunction
)ListObj_LSize
, 1,
497 "(short listWidth, short listHeight) -> None"},
498 {"LSetDrawingMode", (PyCFunction
)ListObj_LSetDrawingMode
, 1,
499 "(Boolean drawIt) -> None"},
500 {"LScroll", (PyCFunction
)ListObj_LScroll
, 1,
501 "(short dCols, short dRows) -> None"},
502 {"LAutoScroll", (PyCFunction
)ListObj_LAutoScroll
, 1,
504 {"LUpdate", (PyCFunction
)ListObj_LUpdate
, 1,
505 "(RgnHandle theRgn) -> None"},
506 {"LActivate", (PyCFunction
)ListObj_LActivate
, 1,
507 "(Boolean act) -> None"},
508 {"LCellSize", (PyCFunction
)ListObj_LCellSize
, 1,
509 "(Point cSize) -> None"},
510 {"LClick", (PyCFunction
)ListObj_LClick
, 1,
511 "(Point pt, short modifiers) -> (Boolean _rv)"},
512 {"LAddToCell", (PyCFunction
)ListObj_LAddToCell
, 1,
513 "(Buffer dataPtr, Point theCell) -> None"},
514 {"LClrCell", (PyCFunction
)ListObj_LClrCell
, 1,
515 "(Point theCell) -> None"},
516 {"LGetCell", (PyCFunction
)ListObj_LGetCell
, 1,
517 "(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)"},
518 {"LRect", (PyCFunction
)ListObj_LRect
, 1,
519 "(Point theCell) -> (Rect cellRect)"},
520 {"LSetCell", (PyCFunction
)ListObj_LSetCell
, 1,
521 "(Buffer dataPtr, Point theCell) -> None"},
522 {"LSetSelect", (PyCFunction
)ListObj_LSetSelect
, 1,
523 "(Boolean setIt, Point theCell) -> None"},
524 {"LDraw", (PyCFunction
)ListObj_LDraw
, 1,
525 "(Point theCell) -> None"},
526 {"as_Resource", (PyCFunction
)ListObj_as_Resource
, 1,
527 "() -> (Handle _rv)"},
531 PyMethodChain ListObj_chain
= { ListObj_methods
, NULL
};
533 static PyObject
*ListObj_getattr(ListObject
*self
, char *name
)
536 /* XXXX Should we HLock() here?? */
537 if ( strcmp(name
, "listFlags") == 0 )
538 return Py_BuildValue("l", (long)(*self
->ob_itself
)->listFlags
& 0xff);
539 if ( strcmp(name
, "selFlags") == 0 )
540 return Py_BuildValue("l", (long)(*self
->ob_itself
)->selFlags
& 0xff);
542 return Py_FindMethodInChain(&ListObj_chain
, (PyObject
*)self
, name
);
546 ListObj_setattr(ListObject
*self
, char *name
, PyObject
*value
)
550 if ( value
== NULL
|| !PyInt_Check(value
) )
552 intval
= PyInt_AsLong(value
);
553 if (strcmp(name
, "listFlags") == 0 ) {
554 /* XXXX Should we HLock the handle here?? */
555 (*self
->ob_itself
)->listFlags
= intval
;
558 if (strcmp(name
, "selFlags") == 0 ) {
559 (*self
->ob_itself
)->selFlags
= intval
;
566 #define ListObj_compare NULL
568 #define ListObj_repr NULL
570 #define ListObj_hash NULL
572 PyTypeObject List_Type
= {
573 PyObject_HEAD_INIT(&PyType_Type
)
576 sizeof(ListObject
), /*tp_basicsize*/
579 (destructor
) ListObj_dealloc
, /*tp_dealloc*/
581 (getattrfunc
) ListObj_getattr
, /*tp_getattr*/
582 (setattrfunc
) ListObj_setattr
, /*tp_setattr*/
583 (cmpfunc
) ListObj_compare
, /*tp_compare*/
584 (reprfunc
) ListObj_repr
, /*tp_repr*/
585 (PyNumberMethods
*)0, /* tp_as_number */
586 (PySequenceMethods
*)0, /* tp_as_sequence */
587 (PyMappingMethods
*)0, /* tp_as_mapping */
588 (hashfunc
) ListObj_hash
, /*tp_hash*/
591 /* ---------------------- End object type List ---------------------- */
594 static PyObject
*List_LNew(PyObject
*_self
, PyObject
*_args
)
596 PyObject
*_res
= NULL
;
607 if (!PyArg_ParseTuple(_args
, "O&O&O&hO&bbbb",
608 PyMac_GetRect
, &rView
,
609 PyMac_GetRect
, &dataBounds
,
610 PyMac_GetPoint
, &cSize
,
612 WinObj_Convert
, &theWindow
,
627 _res
= Py_BuildValue("O&",
632 static PyObject
*List_GetListPort(PyObject
*_self
, PyObject
*_args
)
634 PyObject
*_res
= NULL
;
637 if (!PyArg_ParseTuple(_args
, "O&",
638 ListObj_Convert
, &list
))
640 _rv
= GetListPort(list
);
641 _res
= Py_BuildValue("O&",
646 static PyObject
*List_GetListVerticalScrollBar(PyObject
*_self
, PyObject
*_args
)
648 PyObject
*_res
= NULL
;
651 if (!PyArg_ParseTuple(_args
, "O&",
652 ListObj_Convert
, &list
))
654 _rv
= GetListVerticalScrollBar(list
);
655 _res
= Py_BuildValue("O&",
660 static PyObject
*List_GetListHorizontalScrollBar(PyObject
*_self
, PyObject
*_args
)
662 PyObject
*_res
= NULL
;
665 if (!PyArg_ParseTuple(_args
, "O&",
666 ListObj_Convert
, &list
))
668 _rv
= GetListHorizontalScrollBar(list
);
669 _res
= Py_BuildValue("O&",
674 static PyObject
*List_GetListActive(PyObject
*_self
, PyObject
*_args
)
676 PyObject
*_res
= NULL
;
679 if (!PyArg_ParseTuple(_args
, "O&",
680 ListObj_Convert
, &list
))
682 _rv
= GetListActive(list
);
683 _res
= Py_BuildValue("b",
688 static PyObject
*List_GetListClickTime(PyObject
*_self
, PyObject
*_args
)
690 PyObject
*_res
= NULL
;
693 if (!PyArg_ParseTuple(_args
, "O&",
694 ListObj_Convert
, &list
))
696 _rv
= GetListClickTime(list
);
697 _res
= Py_BuildValue("l",
702 static PyObject
*List_GetListRefCon(PyObject
*_self
, PyObject
*_args
)
704 PyObject
*_res
= NULL
;
707 if (!PyArg_ParseTuple(_args
, "O&",
708 ListObj_Convert
, &list
))
710 _rv
= GetListRefCon(list
);
711 _res
= Py_BuildValue("l",
716 static PyObject
*List_GetListDefinition(PyObject
*_self
, PyObject
*_args
)
718 PyObject
*_res
= NULL
;
721 if (!PyArg_ParseTuple(_args
, "O&",
722 ListObj_Convert
, &list
))
724 _rv
= GetListDefinition(list
);
725 _res
= Py_BuildValue("O&",
730 static PyObject
*List_GetListUserHandle(PyObject
*_self
, PyObject
*_args
)
732 PyObject
*_res
= NULL
;
735 if (!PyArg_ParseTuple(_args
, "O&",
736 ListObj_Convert
, &list
))
738 _rv
= GetListUserHandle(list
);
739 _res
= Py_BuildValue("O&",
744 static PyObject
*List_GetListDataHandle(PyObject
*_self
, PyObject
*_args
)
746 PyObject
*_res
= NULL
;
749 if (!PyArg_ParseTuple(_args
, "O&",
750 ListObj_Convert
, &list
))
752 _rv
= GetListDataHandle(list
);
753 _res
= Py_BuildValue("O&",
758 static PyObject
*List_GetListFlags(PyObject
*_self
, PyObject
*_args
)
760 PyObject
*_res
= NULL
;
763 if (!PyArg_ParseTuple(_args
, "O&",
764 ListObj_Convert
, &list
))
766 _rv
= GetListFlags(list
);
767 _res
= Py_BuildValue("l",
772 static PyObject
*List_GetListSelectionFlags(PyObject
*_self
, PyObject
*_args
)
774 PyObject
*_res
= NULL
;
777 if (!PyArg_ParseTuple(_args
, "O&",
778 ListObj_Convert
, &list
))
780 _rv
= GetListSelectionFlags(list
);
781 _res
= Py_BuildValue("l",
786 static PyObject
*List_SetListViewBounds(PyObject
*_self
, PyObject
*_args
)
788 PyObject
*_res
= NULL
;
791 if (!PyArg_ParseTuple(_args
, "O&O&",
792 ListObj_Convert
, &list
,
793 PyMac_GetRect
, &view
))
795 SetListViewBounds(list
,
802 static PyObject
*List_SetListPort(PyObject
*_self
, PyObject
*_args
)
804 PyObject
*_res
= NULL
;
807 if (!PyArg_ParseTuple(_args
, "O&O&",
808 ListObj_Convert
, &list
,
809 GrafObj_Convert
, &port
))
818 static PyObject
*List_SetListCellIndent(PyObject
*_self
, PyObject
*_args
)
820 PyObject
*_res
= NULL
;
823 if (!PyArg_ParseTuple(_args
, "O&O&",
824 ListObj_Convert
, &list
,
825 PyMac_GetPoint
, &indent
))
827 SetListCellIndent(list
,
834 static PyObject
*List_SetListClickTime(PyObject
*_self
, PyObject
*_args
)
836 PyObject
*_res
= NULL
;
839 if (!PyArg_ParseTuple(_args
, "O&l",
840 ListObj_Convert
, &list
,
843 SetListClickTime(list
,
850 static PyObject
*List_SetListRefCon(PyObject
*_self
, PyObject
*_args
)
852 PyObject
*_res
= NULL
;
855 if (!PyArg_ParseTuple(_args
, "O&l",
856 ListObj_Convert
, &list
,
866 static PyObject
*List_SetListUserHandle(PyObject
*_self
, PyObject
*_args
)
868 PyObject
*_res
= NULL
;
871 if (!PyArg_ParseTuple(_args
, "O&O&",
872 ListObj_Convert
, &list
,
873 ResObj_Convert
, &userHandle
))
875 SetListUserHandle(list
,
882 static PyObject
*List_SetListFlags(PyObject
*_self
, PyObject
*_args
)
884 PyObject
*_res
= NULL
;
886 OptionBits listFlags
;
887 if (!PyArg_ParseTuple(_args
, "O&l",
888 ListObj_Convert
, &list
,
898 static PyObject
*List_SetListSelectionFlags(PyObject
*_self
, PyObject
*_args
)
900 PyObject
*_res
= NULL
;
902 OptionBits selectionFlags
;
903 if (!PyArg_ParseTuple(_args
, "O&l",
904 ListObj_Convert
, &list
,
907 SetListSelectionFlags(list
,
914 static PyObject
*List_as_List(PyObject
*_self
, PyObject
*_args
)
916 PyObject
*_res
= NULL
;
920 if (!PyArg_ParseTuple(_args
, "O&", ResObj_Convert
, &h
))
922 l
= (ListObject
*)ListObj_New(as_List(h
));
923 l
->ob_must_be_disposed
= 0;
924 return Py_BuildValue("O", l
);
928 static PyMethodDef List_methods
[] = {
929 {"LNew", (PyCFunction
)List_LNew
, 1,
930 "(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)"},
931 {"GetListPort", (PyCFunction
)List_GetListPort
, 1,
932 "(ListHandle list) -> (CGrafPtr _rv)"},
933 {"GetListVerticalScrollBar", (PyCFunction
)List_GetListVerticalScrollBar
, 1,
934 "(ListHandle list) -> (ControlHandle _rv)"},
935 {"GetListHorizontalScrollBar", (PyCFunction
)List_GetListHorizontalScrollBar
, 1,
936 "(ListHandle list) -> (ControlHandle _rv)"},
937 {"GetListActive", (PyCFunction
)List_GetListActive
, 1,
938 "(ListHandle list) -> (Boolean _rv)"},
939 {"GetListClickTime", (PyCFunction
)List_GetListClickTime
, 1,
940 "(ListHandle list) -> (SInt32 _rv)"},
941 {"GetListRefCon", (PyCFunction
)List_GetListRefCon
, 1,
942 "(ListHandle list) -> (SInt32 _rv)"},
943 {"GetListDefinition", (PyCFunction
)List_GetListDefinition
, 1,
944 "(ListHandle list) -> (Handle _rv)"},
945 {"GetListUserHandle", (PyCFunction
)List_GetListUserHandle
, 1,
946 "(ListHandle list) -> (Handle _rv)"},
947 {"GetListDataHandle", (PyCFunction
)List_GetListDataHandle
, 1,
948 "(ListHandle list) -> (DataHandle _rv)"},
949 {"GetListFlags", (PyCFunction
)List_GetListFlags
, 1,
950 "(ListHandle list) -> (OptionBits _rv)"},
951 {"GetListSelectionFlags", (PyCFunction
)List_GetListSelectionFlags
, 1,
952 "(ListHandle list) -> (OptionBits _rv)"},
953 {"SetListViewBounds", (PyCFunction
)List_SetListViewBounds
, 1,
954 "(ListHandle list, Rect view) -> None"},
955 {"SetListPort", (PyCFunction
)List_SetListPort
, 1,
956 "(ListHandle list, CGrafPtr port) -> None"},
957 {"SetListCellIndent", (PyCFunction
)List_SetListCellIndent
, 1,
958 "(ListHandle list, Point indent) -> None"},
959 {"SetListClickTime", (PyCFunction
)List_SetListClickTime
, 1,
960 "(ListHandle list, SInt32 time) -> None"},
961 {"SetListRefCon", (PyCFunction
)List_SetListRefCon
, 1,
962 "(ListHandle list, SInt32 refCon) -> None"},
963 {"SetListUserHandle", (PyCFunction
)List_SetListUserHandle
, 1,
964 "(ListHandle list, Handle userHandle) -> None"},
965 {"SetListFlags", (PyCFunction
)List_SetListFlags
, 1,
966 "(ListHandle list, OptionBits listFlags) -> None"},
967 {"SetListSelectionFlags", (PyCFunction
)List_SetListSelectionFlags
, 1,
968 "(ListHandle list, OptionBits selectionFlags) -> None"},
969 {"as_List", (PyCFunction
)List_as_List
, 1,
970 "(Resource)->List.\nReturns List object (which is not auto-freed!)"},
984 PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle
, ListObj_New
);
985 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle
, ListObj_Convert
);
988 m
= Py_InitModule("List", List_methods
);
989 d
= PyModule_GetDict(m
);
990 List_Error
= PyMac_GetOSErrException();
991 if (List_Error
== NULL
||
992 PyDict_SetItemString(d
, "Error", List_Error
) != 0)
994 List_Type
.ob_type
= &PyType_Type
;
995 Py_INCREF(&List_Type
);
996 if (PyDict_SetItemString(d
, "ListType", (PyObject
*)&List_Type
) != 0)
997 Py_FatalError("can't initialize ListType");
1000 /* ======================== End module List ========================= */