diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1999-12-12 21:41:51 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1999-12-12 21:41:51 (GMT) |
commit | a05ac607d720727bc0d3799b7bea7a81e02ea561 (patch) | |
tree | c000d84ecf27d68dcdcbfa954b2d03e0f3566800 /Mac/Modules | |
parent | 608b3fa801303332de71ef6bad696e9a8b7b00f3 (diff) | |
download | cpython-a05ac607d720727bc0d3799b7bea7a81e02ea561.zip cpython-a05ac607d720727bc0d3799b7bea7a81e02ea561.tar.gz cpython-a05ac607d720727bc0d3799b7bea7a81e02ea561.tar.bz2 |
Regenerated with CW Pro 5.2, which has MacOS 8.6 and Appearance 1.1 support.
Diffstat (limited to 'Mac/Modules')
29 files changed, 3137 insertions, 402 deletions
diff --git a/Mac/Modules/app/Appmodule.c b/Mac/Modules/app/Appmodule.c index 0379471..d047476 100644 --- a/Mac/Modules/app/Appmodule.c +++ b/Mac/Modules/app/Appmodule.c @@ -44,6 +44,10 @@ extern PyObject *WinObj_WhichWindow(WindowPtr); #include <Appearance.h> +/* Exported by Qdmodule.c: */ +extern PyObject *QdRGB_New(RGBColor *); +extern int QdRGB_Convert(PyObject *, RGBColor *); + #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ static PyObject *App_Error; diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py index 325cb37..a90aa52 100644 --- a/Mac/Modules/app/appsupport.py +++ b/Mac/Modules/app/appsupport.py @@ -70,6 +70,10 @@ RGBColor = OpaqueType("RGBColor", "QdRGB") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ +/* Exported by Qdmodule.c: */ +extern PyObject *QdRGB_New(RGBColor *); +extern int QdRGB_Convert(PyObject *, RGBColor *); + #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ """ diff --git a/Mac/Modules/cm/Cmmodule.c b/Mac/Modules/cm/Cmmodule.c index 4eb0be3..ab293d9 100644 --- a/Mac/Modules/cm/Cmmodule.c +++ b/Mac/Modules/cm/Cmmodule.c @@ -305,6 +305,12 @@ static PyObject *CmpInstObj_getattr(self, name) #define CmpInstObj_setattr NULL +#define CmpInstObj_compare NULL + +#define CmpInstObj_repr NULL + +#define CmpInstObj_hash NULL + PyTypeObject ComponentInstance_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -316,6 +322,12 @@ PyTypeObject ComponentInstance_Type = { 0, /*tp_print*/ (getattrfunc) CmpInstObj_getattr, /*tp_getattr*/ (setattrfunc) CmpInstObj_setattr, /*tp_setattr*/ + (cmpfunc) CmpInstObj_compare, /*tp_compare*/ + (reprfunc) CmpInstObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) CmpInstObj_hash, /*tp_hash*/ }; /* --------------- End object type ComponentInstance ---------------- */ @@ -654,6 +666,12 @@ static PyObject *CmpObj_getattr(self, name) #define CmpObj_setattr NULL +#define CmpObj_compare NULL + +#define CmpObj_repr NULL + +#define CmpObj_hash NULL + PyTypeObject Component_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -665,6 +683,12 @@ PyTypeObject Component_Type = { 0, /*tp_print*/ (getattrfunc) CmpObj_getattr, /*tp_getattr*/ (setattrfunc) CmpObj_setattr, /*tp_setattr*/ + (cmpfunc) CmpObj_compare, /*tp_compare*/ + (reprfunc) CmpObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) CmpObj_hash, /*tp_hash*/ }; /* ------------------- End object type Component -------------------- */ diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c index 627ca8f..071e140 100644 --- a/Mac/Modules/ctl/Ctlmodule.c +++ b/Mac/Modules/ctl/Ctlmodule.c @@ -337,6 +337,27 @@ static PyObject *CtlObj_SetUpControlBackground(_self, _args) return _res; } +static PyObject *CtlObj_SetUpControlTextColor(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 inDepth; + Boolean inIsColorDevice; + if (!PyArg_ParseTuple(_args, "hb", + &inDepth, + &inIsColorDevice)) + return NULL; + _err = SetUpControlTextColor(_self->ob_itself, + inDepth, + inIsColorDevice); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *CtlObj_DragControl(_self, _args) ControlObject *_self; PyObject *_args; @@ -561,6 +582,182 @@ static PyObject *CtlObj_SetControlMaximum(_self, _args) return _res; } +static PyObject *CtlObj_GetControlViewSize(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetControlViewSize(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *CtlObj_SetControlViewSize(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 newViewSize; + if (!PyArg_ParseTuple(_args, "l", + &newViewSize)) + return NULL; + SetControlViewSize(_self->ob_itself, + newViewSize); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *CtlObj_GetControl32BitValue(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetControl32BitValue(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *CtlObj_SetControl32BitValue(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 newValue; + if (!PyArg_ParseTuple(_args, "l", + &newValue)) + return NULL; + SetControl32BitValue(_self->ob_itself, + newValue); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *CtlObj_GetControl32BitMaximum(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetControl32BitMaximum(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *CtlObj_SetControl32BitMaximum(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 newMaximum; + if (!PyArg_ParseTuple(_args, "l", + &newMaximum)) + return NULL; + SetControl32BitMaximum(_self->ob_itself, + newMaximum); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *CtlObj_GetControl32BitMinimum(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetControl32BitMinimum(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *CtlObj_SetControl32BitMinimum(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + SInt32 newMinimum; + if (!PyArg_ParseTuple(_args, "l", + &newMinimum)) + return NULL; + SetControl32BitMinimum(_self->ob_itself, + newMinimum); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *CtlObj_IsValidControlHandle(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsValidControlHandle(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *CtlObj_RemoveControlProperty(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + OSType propertyCreator; + OSType propertyTag; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &propertyCreator, + PyMac_GetOSType, &propertyTag)) + return NULL; + _err = RemoveControlProperty(_self->ob_itself, + propertyCreator, + propertyTag); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *CtlObj_GetControlRegion(_self, _args) + ControlObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + ControlPartCode inPart; + RgnHandle outRegion; + if (!PyArg_ParseTuple(_args, "hO&", + &inPart, + ResObj_Convert, &outRegion)) + return NULL; + _err = GetControlRegion(_self->ob_itself, + inPart, + outRegion); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *CtlObj_GetControlVariant(_self, _args) ControlObject *_self; PyObject *_args; @@ -1051,6 +1248,8 @@ static PyMethodDef CtlObj_methods[] = { "() -> None"}, {"SetUpControlBackground", (PyCFunction)CtlObj_SetUpControlBackground, 1, "(SInt16 inDepth, Boolean inIsColorDevice) -> None"}, + {"SetUpControlTextColor", (PyCFunction)CtlObj_SetUpControlTextColor, 1, + "(SInt16 inDepth, Boolean inIsColorDevice) -> None"}, {"DragControl", (PyCFunction)CtlObj_DragControl, 1, "(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None"}, {"TestControl", (PyCFunction)CtlObj_TestControl, 1, @@ -1077,6 +1276,28 @@ static PyMethodDef CtlObj_methods[] = { "() -> (SInt16 _rv)"}, {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1, "(SInt16 newMaximum) -> None"}, + {"GetControlViewSize", (PyCFunction)CtlObj_GetControlViewSize, 1, + "() -> (SInt32 _rv)"}, + {"SetControlViewSize", (PyCFunction)CtlObj_SetControlViewSize, 1, + "(SInt32 newViewSize) -> None"}, + {"GetControl32BitValue", (PyCFunction)CtlObj_GetControl32BitValue, 1, + "() -> (SInt32 _rv)"}, + {"SetControl32BitValue", (PyCFunction)CtlObj_SetControl32BitValue, 1, + "(SInt32 newValue) -> None"}, + {"GetControl32BitMaximum", (PyCFunction)CtlObj_GetControl32BitMaximum, 1, + "() -> (SInt32 _rv)"}, + {"SetControl32BitMaximum", (PyCFunction)CtlObj_SetControl32BitMaximum, 1, + "(SInt32 newMaximum) -> None"}, + {"GetControl32BitMinimum", (PyCFunction)CtlObj_GetControl32BitMinimum, 1, + "() -> (SInt32 _rv)"}, + {"SetControl32BitMinimum", (PyCFunction)CtlObj_SetControl32BitMinimum, 1, + "(SInt32 newMinimum) -> None"}, + {"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1, + "() -> (Boolean _rv)"}, + {"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1, + "(OSType propertyCreator, OSType propertyTag) -> None"}, + {"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1, + "(ControlPartCode inPart, RgnHandle outRegion) -> None"}, {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1, "() -> (ControlVariant _rv)"}, {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1, diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py index dc954cf..63d32f3 100644 --- a/Mac/Modules/ctl/ctlscan.py +++ b/Mac/Modules/ctl/ctlscan.py @@ -59,20 +59,20 @@ class MyScanner(Scanner): 'GetTabContentRect', 'SetTabEnabled', 'SetDisclosureTriangleLastValue', - # Unavailable in CW Pro 3 libraries - 'SetUpControlTextColor', - # Unavailable in Jack's CW Pro 5.1 libraries - 'GetControlRegion', - 'RemoveControlProperty', - 'IsValidControlHandle', - 'SetControl32BitMinimum', - 'GetControl32BitMinimum', - 'SetControl32BitMaximum', - 'GetControl32BitMaximum', - 'SetControl32BitValue', - 'GetControl32BitValue', - 'SetControlViewSize', - 'GetControlViewSize', +## # Unavailable in CW Pro 3 libraries +## 'SetUpControlTextColor', +## # Unavailable in Jack's CW Pro 5.1 libraries +## 'GetControlRegion', +## 'RemoveControlProperty', +## 'IsValidControlHandle', +## 'SetControl32BitMinimum', +## 'GetControl32BitMinimum', +## 'SetControl32BitMaximum', +## 'GetControl32BitMaximum', +## 'SetControl32BitValue', +## 'GetControl32BitValue', +## 'SetControlViewSize', +## 'GetControlViewSize', # Generally Bad News 'GetControlProperty', 'SetControlProperty', diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c index 2abd785..fbbadd8 100644 --- a/Mac/Modules/dlg/Dlgmodule.c +++ b/Mac/Modules/dlg/Dlgmodule.c @@ -587,6 +587,106 @@ static PyObject *DlgObj_SizeDialogItem(_self, _args) return _res; } +static PyObject *DlgObj_AppendDialogItemList(_self, _args) + DialogObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 ditlID; + DITLMethod method; + if (!PyArg_ParseTuple(_args, "hh", + &ditlID, + &method)) + return NULL; + _err = AppendDialogItemList(_self->ob_itself, + ditlID, + method); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *DlgObj_SetDialogTimeout(_self, _args) + DialogObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + SInt16 inButtonToPress; + UInt32 inSecondsToWait; + if (!PyArg_ParseTuple(_args, "hl", + &inButtonToPress, + &inSecondsToWait)) + return NULL; + _err = SetDialogTimeout(_self->ob_itself, + inButtonToPress, + inSecondsToWait); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *DlgObj_GetDialogTimeout(_self, _args) + DialogObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + SInt16 outButtonToPress; + UInt32 outSecondsToWait; + UInt32 outSecondsRemaining; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetDialogTimeout(_self->ob_itself, + &outButtonToPress, + &outSecondsToWait, + &outSecondsRemaining); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("hll", + outButtonToPress, + outSecondsToWait, + outSecondsRemaining); + return _res; +} + +static PyObject *DlgObj_SetModalDialogEventMask(_self, _args) + DialogObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + EventMask inMask; + if (!PyArg_ParseTuple(_args, "h", + &inMask)) + return NULL; + _err = SetModalDialogEventMask(_self->ob_itself, + inMask); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *DlgObj_GetModalDialogEventMask(_self, _args) + DialogObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + EventMask outMask; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetModalDialogEventMask(_self->ob_itself, + &outMask); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("h", + outMask); + return _res; +} + static PyObject *DlgObj_GetDialogWindow(_self, _args) DialogObject *_self; PyObject *_args; @@ -703,6 +803,16 @@ static PyMethodDef DlgObj_methods[] = { "(SInt16 inItemNo, SInt16 inHoriz, SInt16 inVert) -> None"}, {"SizeDialogItem", (PyCFunction)DlgObj_SizeDialogItem, 1, "(SInt16 inItemNo, SInt16 inWidth, SInt16 inHeight) -> None"}, + {"AppendDialogItemList", (PyCFunction)DlgObj_AppendDialogItemList, 1, + "(SInt16 ditlID, DITLMethod method) -> None"}, + {"SetDialogTimeout", (PyCFunction)DlgObj_SetDialogTimeout, 1, + "(SInt16 inButtonToPress, UInt32 inSecondsToWait) -> None"}, + {"GetDialogTimeout", (PyCFunction)DlgObj_GetDialogTimeout, 1, + "() -> (SInt16 outButtonToPress, UInt32 outSecondsToWait, UInt32 outSecondsRemaining)"}, + {"SetModalDialogEventMask", (PyCFunction)DlgObj_SetModalDialogEventMask, 1, + "(EventMask inMask) -> None"}, + {"GetModalDialogEventMask", (PyCFunction)DlgObj_GetModalDialogEventMask, 1, + "() -> (EventMask outMask)"}, {"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1, "() -> (DialogPtr _rv)"}, {"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1, @@ -727,6 +837,12 @@ static PyObject *DlgObj_getattr(self, name) #define DlgObj_setattr NULL +#define DlgObj_compare NULL + +#define DlgObj_repr NULL + +#define DlgObj_hash NULL + PyTypeObject Dialog_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -738,6 +854,12 @@ PyTypeObject Dialog_Type = { 0, /*tp_print*/ (getattrfunc) DlgObj_getattr, /*tp_getattr*/ (setattrfunc) DlgObj_setattr, /*tp_setattr*/ + (cmpfunc) DlgObj_compare, /*tp_compare*/ + (reprfunc) DlgObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) DlgObj_hash, /*tp_hash*/ }; /* --------------------- End object type Dialog --------------------- */ @@ -1048,11 +1170,11 @@ static PyObject *Dlg_SetDialogFont(_self, _args) PyObject *_args; { PyObject *_res = NULL; - SInt16 value; + SInt16 fontNum; if (!PyArg_ParseTuple(_args, "h", - &value)) + &fontNum)) return NULL; - SetDialogFont(value); + SetDialogFont(fontNum); Py_INCREF(Py_None); _res = Py_None; return _res; @@ -1173,7 +1295,7 @@ static PyMethodDef Dlg_methods[] = { {"GetAlertStage", (PyCFunction)Dlg_GetAlertStage, 1, "() -> (SInt16 _rv)"}, {"SetDialogFont", (PyCFunction)Dlg_SetDialogFont, 1, - "(SInt16 value) -> None"}, + "(SInt16 fontNum) -> None"}, {"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1, "() -> None"}, {"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1, diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py index 6ef502a..eb5bbfe 100644 --- a/Mac/Modules/dlg/dlgscan.py +++ b/Mac/Modules/dlg/dlgscan.py @@ -50,7 +50,7 @@ class MyScanner(Scanner): 'FreeDialog', 'GetStdFilterProc', 'GetDialogParent', - # Can't find these in the CW Pro 3 libraries +## # Can't find these in the CW Pro 3 libraries 'SetDialogMovableModal', 'GetDialogControlNotificationProc', ] @@ -87,5 +87,9 @@ class MyScanner(Scanner): [("ExistingDialogPtr", "*", "*")]), ] + def writeinitialdefs(self): + self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") + + if __name__ == "__main__": main() diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py index 526bfa4..4c44722 100644 --- a/Mac/Modules/dlg/dlgsupport.py +++ b/Mac/Modules/dlg/dlgsupport.py @@ -26,6 +26,7 @@ DialogItemType = Type("DialogItemType", "h") DialogItemIndexZeroBased = Type("DialogItemIndexZeroBased", "h") AlertType = Type("AlertType", "h") StringPtr = Str255 +EventMask = Type("EventMask", "h") includestuff = includestuff + """ #include <Dialogs.h> diff --git a/Mac/Modules/fm/Fmmodule.c b/Mac/Modules/fm/Fmmodule.c index 469e8d1..1d84a31 100644 --- a/Mac/Modules/fm/Fmmodule.c +++ b/Mac/Modules/fm/Fmmodule.c @@ -336,6 +336,42 @@ static PyObject *Fm_GetAppFont(_self, _args) return _res; } +static PyObject *Fm_SetAntiAliasedTextEnabled(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Boolean inEnable; + SInt16 inMinFontSize; + if (!PyArg_ParseTuple(_args, "bh", + &inEnable, + &inMinFontSize)) + return NULL; + _err = SetAntiAliasedTextEnabled(inEnable, + inMinFontSize); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Fm_IsAntiAliasedTextEnabled(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + SInt16 outMinFontSize; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsAntiAliasedTextEnabled(&outMinFontSize); + _res = Py_BuildValue("bh", + _rv, + outMinFontSize); + return _res; +} + static PyMethodDef Fm_methods[] = { {"InitFonts", (PyCFunction)Fm_InitFonts, 1, "() -> None"}, @@ -371,6 +407,10 @@ static PyMethodDef Fm_methods[] = { "() -> (short _rv)"}, {"GetAppFont", (PyCFunction)Fm_GetAppFont, 1, "() -> (short _rv)"}, + {"SetAntiAliasedTextEnabled", (PyCFunction)Fm_SetAntiAliasedTextEnabled, 1, + "(Boolean inEnable, SInt16 inMinFontSize) -> None"}, + {"IsAntiAliasedTextEnabled", (PyCFunction)Fm_IsAntiAliasedTextEnabled, 1, + "() -> (Boolean _rv, SInt16 outMinFontSize)"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/fm/fmscan.py b/Mac/Modules/fm/fmscan.py index d111964..b06e9cb 100644 --- a/Mac/Modules/fm/fmscan.py +++ b/Mac/Modules/fm/fmscan.py @@ -42,6 +42,8 @@ class MyScanner(Scanner): return [ "FMInput_ptr", # Not needed for now "FMOutPtr", # Ditto + "void_ptr", # Don't know how to do this right now + "FontInfo", # Ditto ] def makerepairinstructions(self): diff --git a/Mac/Modules/icn/Icnmodule.c b/Mac/Modules/icn/Icnmodule.c index 03e6203..9420d37 100644 --- a/Mac/Modules/icn/Icnmodule.c +++ b/Mac/Modules/icn/Icnmodule.c @@ -604,6 +604,687 @@ static PyObject *Icn_PlotCIconHandle(_self, _args) return _res; } +static PyObject *Icn_IconServicesTerminate(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + IconServicesTerminate(); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_IconRefToIconFamily(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + IconSelectorValue whichIcons; + IconFamilyHandle iconFamily; + if (!PyArg_ParseTuple(_args, "O&l", + ResObj_Convert, &theIconRef, + &whichIcons)) + return NULL; + _err = IconRefToIconFamily(theIconRef, + whichIcons, + &iconFamily); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, iconFamily); + return _res; +} + +static PyObject *Icn_IconFamilyToIconSuite(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconFamilyHandle iconFamily; + IconSelectorValue whichIcons; + IconSuiteRef iconSuite; + if (!PyArg_ParseTuple(_args, "O&l", + ResObj_Convert, &iconFamily, + &whichIcons)) + return NULL; + _err = IconFamilyToIconSuite(iconFamily, + whichIcons, + &iconSuite); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, iconSuite); + return _res; +} + +static PyObject *Icn_IconSuiteToIconFamily(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconSuiteRef iconSuite; + IconSelectorValue whichIcons; + IconFamilyHandle iconFamily; + if (!PyArg_ParseTuple(_args, "O&l", + ResObj_Convert, &iconSuite, + &whichIcons)) + return NULL; + _err = IconSuiteToIconFamily(iconSuite, + whichIcons, + &iconFamily); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, iconFamily); + return _res; +} + +static PyObject *Icn_SetIconFamilyData(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconFamilyHandle iconFamily; + OSType iconType; + Handle h; + if (!PyArg_ParseTuple(_args, "O&O&O&", + ResObj_Convert, &iconFamily, + PyMac_GetOSType, &iconType, + ResObj_Convert, &h)) + return NULL; + _err = SetIconFamilyData(iconFamily, + iconType, + h); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_GetIconFamilyData(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconFamilyHandle iconFamily; + OSType iconType; + Handle h; + if (!PyArg_ParseTuple(_args, "O&O&O&", + ResObj_Convert, &iconFamily, + PyMac_GetOSType, &iconType, + ResObj_Convert, &h)) + return NULL; + _err = GetIconFamilyData(iconFamily, + iconType, + h); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_GetIconRefOwners(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + UInt16 owners; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &theIconRef)) + return NULL; + _err = GetIconRefOwners(theIconRef, + &owners); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("h", + owners); + return _res; +} + +static PyObject *Icn_AcquireIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &theIconRef)) + return NULL; + _err = AcquireIconRef(theIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_ReleaseIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &theIconRef)) + return NULL; + _err = ReleaseIconRef(theIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_GetIconRefFromFile(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + FSSpec theFile; + IconRef theIconRef; + SInt16 theLabel; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetFSSpec, &theFile)) + return NULL; + _err = GetIconRefFromFile(&theFile, + &theIconRef, + &theLabel); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&h", + ResObj_New, theIconRef, + theLabel); + return _res; +} + +static PyObject *Icn_GetIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 vRefNum; + OSType creator; + OSType iconType; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "hO&O&", + &vRefNum, + PyMac_GetOSType, &creator, + PyMac_GetOSType, &iconType)) + return NULL; + _err = GetIconRef(vRefNum, + creator, + iconType, + &theIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, theIconRef); + return _res; +} + +static PyObject *Icn_GetIconRefFromFolder(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 vRefNum; + SInt32 parentFolderID; + SInt32 folderID; + SInt8 attributes; + SInt8 accessPrivileges; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "hllbb", + &vRefNum, + &parentFolderID, + &folderID, + &attributes, + &accessPrivileges)) + return NULL; + _err = GetIconRefFromFolder(vRefNum, + parentFolderID, + folderID, + attributes, + accessPrivileges, + &theIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, theIconRef); + return _res; +} + +static PyObject *Icn_RegisterIconRefFromIconFamily(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType creator; + OSType iconType; + IconFamilyHandle iconFamily; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&O&O&", + PyMac_GetOSType, &creator, + PyMac_GetOSType, &iconType, + ResObj_Convert, &iconFamily)) + return NULL; + _err = RegisterIconRefFromIconFamily(creator, + iconType, + iconFamily, + &theIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, theIconRef); + return _res; +} + +static PyObject *Icn_RegisterIconRefFromResource(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType creator; + OSType iconType; + FSSpec resourceFile; + SInt16 resourceID; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&O&O&h", + PyMac_GetOSType, &creator, + PyMac_GetOSType, &iconType, + PyMac_GetFSSpec, &resourceFile, + &resourceID)) + return NULL; + _err = RegisterIconRefFromResource(creator, + iconType, + &resourceFile, + resourceID, + &theIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, theIconRef); + return _res; +} + +static PyObject *Icn_UnregisterIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType creator; + OSType iconType; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &creator, + PyMac_GetOSType, &iconType)) + return NULL; + _err = UnregisterIconRef(creator, + iconType); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_UpdateIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &theIconRef)) + return NULL; + _err = UpdateIconRef(theIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_OverrideIconRefFromResource(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + FSSpec resourceFile; + SInt16 resourceID; + if (!PyArg_ParseTuple(_args, "O&O&h", + ResObj_Convert, &theIconRef, + PyMac_GetFSSpec, &resourceFile, + &resourceID)) + return NULL; + _err = OverrideIconRefFromResource(theIconRef, + &resourceFile, + resourceID); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_OverrideIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef oldIconRef; + IconRef newIconRef; + if (!PyArg_ParseTuple(_args, "O&O&", + ResObj_Convert, &oldIconRef, + ResObj_Convert, &newIconRef)) + return NULL; + _err = OverrideIconRef(oldIconRef, + newIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_RemoveIconRefOverride(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &theIconRef)) + return NULL; + _err = RemoveIconRefOverride(theIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_CompositeIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef backgroundIconRef; + IconRef foregroundIconRef; + IconRef compositeIconRef; + if (!PyArg_ParseTuple(_args, "O&O&", + ResObj_Convert, &backgroundIconRef, + ResObj_Convert, &foregroundIconRef)) + return NULL; + _err = CompositeIconRef(backgroundIconRef, + foregroundIconRef, + &compositeIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, compositeIconRef); + return _res; +} + +static PyObject *Icn_IsIconRefComposite(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconRef compositeIconRef; + IconRef backgroundIconRef; + IconRef foregroundIconRef; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &compositeIconRef)) + return NULL; + _err = IsIconRefComposite(compositeIconRef, + &backgroundIconRef, + &foregroundIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&O&", + ResObj_New, backgroundIconRef, + ResObj_New, foregroundIconRef); + return _res; +} + +static PyObject *Icn_IsValidIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &theIconRef)) + return NULL; + _rv = IsValidIconRef(theIconRef); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Icn_PlotIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + Rect theRect; + IconAlignmentType align; + IconTransformType transform; + IconServicesUsageFlags theIconServicesUsageFlags; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&hhlO&", + PyMac_GetRect, &theRect, + &align, + &transform, + &theIconServicesUsageFlags, + ResObj_Convert, &theIconRef)) + return NULL; + _err = PlotIconRef(&theRect, + align, + transform, + theIconServicesUsageFlags, + theIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_PtInIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + Point testPt; + Rect iconRect; + IconAlignmentType align; + IconServicesUsageFlags theIconServicesUsageFlags; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&O&hlO&", + PyMac_GetPoint, &testPt, + PyMac_GetRect, &iconRect, + &align, + &theIconServicesUsageFlags, + ResObj_Convert, &theIconRef)) + return NULL; + _rv = PtInIconRef(&testPt, + &iconRect, + align, + theIconServicesUsageFlags, + theIconRef); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Icn_RectInIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + Rect testRect; + Rect iconRect; + IconAlignmentType align; + IconServicesUsageFlags iconServicesUsageFlags; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&O&hlO&", + PyMac_GetRect, &testRect, + PyMac_GetRect, &iconRect, + &align, + &iconServicesUsageFlags, + ResObj_Convert, &theIconRef)) + return NULL; + _rv = RectInIconRef(&testRect, + &iconRect, + align, + iconServicesUsageFlags, + theIconRef); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Icn_IconRefToRgn(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + RgnHandle theRgn; + Rect iconRect; + IconAlignmentType align; + IconServicesUsageFlags iconServicesUsageFlags; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "O&O&hlO&", + ResObj_Convert, &theRgn, + PyMac_GetRect, &iconRect, + &align, + &iconServicesUsageFlags, + ResObj_Convert, &theIconRef)) + return NULL; + _err = IconRefToRgn(theRgn, + &iconRect, + align, + iconServicesUsageFlags, + theIconRef); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_GetIconSizesFromIconRef(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + IconSelectorValue iconSelectorInput; + IconSelectorValue iconSelectorOutputPtr; + IconServicesUsageFlags iconServicesUsageFlags; + IconRef theIconRef; + if (!PyArg_ParseTuple(_args, "llO&", + &iconSelectorInput, + &iconServicesUsageFlags, + ResObj_Convert, &theIconRef)) + return NULL; + _err = GetIconSizesFromIconRef(iconSelectorInput, + &iconSelectorOutputPtr, + iconServicesUsageFlags, + theIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + iconSelectorOutputPtr); + return _res; +} + +static PyObject *Icn_FlushIconRefs(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType creator; + OSType iconType; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &creator, + PyMac_GetOSType, &iconType)) + return NULL; + _err = FlushIconRefs(creator, + iconType); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_FlushIconRefsByVolume(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 vRefNum; + if (!PyArg_ParseTuple(_args, "h", + &vRefNum)) + return NULL; + _err = FlushIconRefsByVolume(vRefNum); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_SetCustomIconsEnabled(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 vRefNum; + Boolean enableCustomIcons; + if (!PyArg_ParseTuple(_args, "hb", + &vRefNum, + &enableCustomIcons)) + return NULL; + _err = SetCustomIconsEnabled(vRefNum, + enableCustomIcons); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Icn_GetCustomIconsEnabled(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + SInt16 vRefNum; + Boolean customIconsEnabled; + if (!PyArg_ParseTuple(_args, "h", + &vRefNum)) + return NULL; + _err = GetCustomIconsEnabled(vRefNum, + &customIconsEnabled); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("b", + customIconsEnabled); + return _res; +} + static PyMethodDef Icn_methods[] = { {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1, "(SInt16 iconID) -> (CIconHandle _rv)"}, @@ -655,6 +1336,68 @@ static PyMethodDef Icn_methods[] = { "(Rect theRect, IconAlignmentType align, IconTransformType transform, Handle theSICN) -> None"}, {"PlotCIconHandle", (PyCFunction)Icn_PlotCIconHandle, 1, "(Rect theRect, IconAlignmentType align, IconTransformType transform, CIconHandle theCIcon) -> None"}, + {"IconServicesTerminate", (PyCFunction)Icn_IconServicesTerminate, 1, + "() -> None"}, + {"IconRefToIconFamily", (PyCFunction)Icn_IconRefToIconFamily, 1, + "(IconRef theIconRef, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"}, + {"IconFamilyToIconSuite", (PyCFunction)Icn_IconFamilyToIconSuite, 1, + "(IconFamilyHandle iconFamily, IconSelectorValue whichIcons) -> (IconSuiteRef iconSuite)"}, + {"IconSuiteToIconFamily", (PyCFunction)Icn_IconSuiteToIconFamily, 1, + "(IconSuiteRef iconSuite, IconSelectorValue whichIcons) -> (IconFamilyHandle iconFamily)"}, + {"SetIconFamilyData", (PyCFunction)Icn_SetIconFamilyData, 1, + "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"}, + {"GetIconFamilyData", (PyCFunction)Icn_GetIconFamilyData, 1, + "(IconFamilyHandle iconFamily, OSType iconType, Handle h) -> None"}, + {"GetIconRefOwners", (PyCFunction)Icn_GetIconRefOwners, 1, + "(IconRef theIconRef) -> (UInt16 owners)"}, + {"AcquireIconRef", (PyCFunction)Icn_AcquireIconRef, 1, + "(IconRef theIconRef) -> None"}, + {"ReleaseIconRef", (PyCFunction)Icn_ReleaseIconRef, 1, + "(IconRef theIconRef) -> None"}, + {"GetIconRefFromFile", (PyCFunction)Icn_GetIconRefFromFile, 1, + "(FSSpec theFile) -> (IconRef theIconRef, SInt16 theLabel)"}, + {"GetIconRef", (PyCFunction)Icn_GetIconRef, 1, + "(SInt16 vRefNum, OSType creator, OSType iconType) -> (IconRef theIconRef)"}, + {"GetIconRefFromFolder", (PyCFunction)Icn_GetIconRefFromFolder, 1, + "(SInt16 vRefNum, SInt32 parentFolderID, SInt32 folderID, SInt8 attributes, SInt8 accessPrivileges) -> (IconRef theIconRef)"}, + {"RegisterIconRefFromIconFamily", (PyCFunction)Icn_RegisterIconRefFromIconFamily, 1, + "(OSType creator, OSType iconType, IconFamilyHandle iconFamily) -> (IconRef theIconRef)"}, + {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1, + "(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)"}, + {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1, + "(OSType creator, OSType iconType) -> None"}, + {"UpdateIconRef", (PyCFunction)Icn_UpdateIconRef, 1, + "(IconRef theIconRef) -> None"}, + {"OverrideIconRefFromResource", (PyCFunction)Icn_OverrideIconRefFromResource, 1, + "(IconRef theIconRef, FSSpec resourceFile, SInt16 resourceID) -> None"}, + {"OverrideIconRef", (PyCFunction)Icn_OverrideIconRef, 1, + "(IconRef oldIconRef, IconRef newIconRef) -> None"}, + {"RemoveIconRefOverride", (PyCFunction)Icn_RemoveIconRefOverride, 1, + "(IconRef theIconRef) -> None"}, + {"CompositeIconRef", (PyCFunction)Icn_CompositeIconRef, 1, + "(IconRef backgroundIconRef, IconRef foregroundIconRef) -> (IconRef compositeIconRef)"}, + {"IsIconRefComposite", (PyCFunction)Icn_IsIconRefComposite, 1, + "(IconRef compositeIconRef) -> (IconRef backgroundIconRef, IconRef foregroundIconRef)"}, + {"IsValidIconRef", (PyCFunction)Icn_IsValidIconRef, 1, + "(IconRef theIconRef) -> (Boolean _rv)"}, + {"PlotIconRef", (PyCFunction)Icn_PlotIconRef, 1, + "(Rect theRect, IconAlignmentType align, IconTransformType transform, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> None"}, + {"PtInIconRef", (PyCFunction)Icn_PtInIconRef, 1, + "(Point testPt, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags theIconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"}, + {"RectInIconRef", (PyCFunction)Icn_RectInIconRef, 1, + "(Rect testRect, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (Boolean _rv)"}, + {"IconRefToRgn", (PyCFunction)Icn_IconRefToRgn, 1, + "(RgnHandle theRgn, Rect iconRect, IconAlignmentType align, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> None"}, + {"GetIconSizesFromIconRef", (PyCFunction)Icn_GetIconSizesFromIconRef, 1, + "(IconSelectorValue iconSelectorInput, IconServicesUsageFlags iconServicesUsageFlags, IconRef theIconRef) -> (IconSelectorValue iconSelectorOutputPtr)"}, + {"FlushIconRefs", (PyCFunction)Icn_FlushIconRefs, 1, + "(OSType creator, OSType iconType) -> None"}, + {"FlushIconRefsByVolume", (PyCFunction)Icn_FlushIconRefsByVolume, 1, + "(SInt16 vRefNum) -> None"}, + {"SetCustomIconsEnabled", (PyCFunction)Icn_SetCustomIconsEnabled, 1, + "(SInt16 vRefNum, Boolean enableCustomIcons) -> None"}, + {"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1, + "(SInt16 vRefNum) -> (Boolean customIconsEnabled)"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/icn/icnscan.py b/Mac/Modules/icn/icnscan.py index 627834f..c8c2e6b 100644 --- a/Mac/Modules/icn/icnscan.py +++ b/Mac/Modules/icn/icnscan.py @@ -45,6 +45,7 @@ class MyScanner(Scanner): return [ "IconActionUPP", "IconGetterUPP", + "CFragInitBlockPtr", ] def makerepairinstructions(self): diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py index 791629e..9ce66be 100644 --- a/Mac/Modules/icn/icnsupport.py +++ b/Mac/Modules/icn/icnsupport.py @@ -24,10 +24,13 @@ from macsupport import * CIconHandle = OpaqueByValueType("CIconHandle", "ResObj") IconSuiteRef = OpaqueByValueType("IconSuiteRef", "ResObj") IconCacheRef = OpaqueByValueType("IconCacheRef", "ResObj") +IconRef = OpaqueByValueType("IconRef", "ResObj") +IconFamilyHandle = OpaqueByValueType("IconFamilyHandle", "ResObj") RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") IconAlignmentType = Type("IconAlignmentType", "h") IconTransformType = Type("IconTransformType", "h") IconSelectorValue = Type("IconSelectorValue", "l") +IconServicesUsageFlags = Type("IconServicesUsageFlags", "l") RGBColor = OpaqueType("RGBColor", "QdRGB") #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c index 42490ab..52308b7 100644 --- a/Mac/Modules/menu/Menumodule.c +++ b/Mac/Modules/menu/Menumodule.c @@ -104,6 +104,106 @@ static PyObject *MenuObj_DisposeMenu(_self, _args) return _res; } +static PyObject *MenuObj_CalcMenuSize(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + CalcMenuSize(_self->ob_itself); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_CountMItems(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = CountMItems(_self->ob_itself); + _res = Py_BuildValue("h", + _rv); + return _res; +} + +static PyObject *MenuObj_GetMenuFont(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + SInt16 outFontID; + UInt16 outFontSize; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetMenuFont(_self->ob_itself, + &outFontID, + &outFontSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("hh", + outFontID, + outFontSize); + return _res; +} + +static PyObject *MenuObj_SetMenuFont(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + SInt16 inFontID; + UInt16 inFontSize; + if (!PyArg_ParseTuple(_args, "hh", + &inFontID, + &inFontSize)) + return NULL; + _err = SetMenuFont(_self->ob_itself, + inFontID, + inFontSize); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_GetMenuExcludesMarkColumn(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetMenuExcludesMarkColumn(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *MenuObj_SetMenuExcludesMarkColumn(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Boolean excludesMark; + if (!PyArg_ParseTuple(_args, "b", + &excludesMark)) + return NULL; + _err = SetMenuExcludesMarkColumn(_self->ob_itself, + excludesMark); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *MenuObj_MacAppendMenu(_self, _args) MenuObject *_self; PyObject *_args; @@ -139,22 +239,6 @@ static PyObject *MenuObj_InsertResMenu(_self, _args) return _res; } -static PyObject *MenuObj_MacInsertMenu(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short beforeID; - if (!PyArg_ParseTuple(_args, "h", - &beforeID)) - return NULL; - MacInsertMenu(_self->ob_itself, - beforeID); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *MenuObj_AppendResMenu(_self, _args) MenuObject *_self; PyObject *_args; @@ -206,6 +290,144 @@ static PyObject *MenuObj_DeleteMenuItem(_self, _args) return _res; } +static PyObject *MenuObj_InsertFontResMenu(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short afterItem; + short scriptFilter; + if (!PyArg_ParseTuple(_args, "hh", + &afterItem, + &scriptFilter)) + return NULL; + InsertFontResMenu(_self->ob_itself, + afterItem, + scriptFilter); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_InsertIntlResMenu(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ResType theType; + short afterItem; + short scriptFilter; + if (!PyArg_ParseTuple(_args, "O&hh", + PyMac_GetOSType, &theType, + &afterItem, + &scriptFilter)) + return NULL; + InsertIntlResMenu(_self->ob_itself, + theType, + afterItem, + scriptFilter); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_AppendMenuItemText(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Str255 inString; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetStr255, inString)) + return NULL; + _err = AppendMenuItemText(_self->ob_itself, + inString); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_InsertMenuItemText(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Str255 inString; + UInt16 afterItem; + if (!PyArg_ParseTuple(_args, "O&h", + PyMac_GetStr255, inString, + &afterItem)) + return NULL; + _err = InsertMenuItemText(_self->ob_itself, + inString, + afterItem); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_PopUpMenuSelect(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long _rv; + short top; + short left; + short popUpItem; + if (!PyArg_ParseTuple(_args, "hhh", + &top, + &left, + &popUpItem)) + return NULL; + _rv = PopUpMenuSelect(_self->ob_itself, + top, + left, + popUpItem); + _res = Py_BuildValue("l", + _rv); + return _res; +} + +static PyObject *MenuObj_MacInsertMenu(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short beforeID; + if (!PyArg_ParseTuple(_args, "h", + &beforeID)) + return NULL; + MacInsertMenu(_self->ob_itself, + beforeID); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_CheckItem(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short item; + Boolean checked; + if (!PyArg_ParseTuple(_args, "hb", + &item, + &checked)) + return NULL; + CheckItem(_self->ob_itself, + item, + checked); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *MenuObj_SetMenuItemText(_self, _args) MenuObject *_self; PyObject *_args; @@ -391,19 +613,6 @@ static PyObject *MenuObj_GetItemStyle(_self, _args) return _res; } -static PyObject *MenuObj_CalcMenuSize(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - CalcMenuSize(_self->ob_itself); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *MenuObj_DisableItem(_self, _args) MenuObject *_self; PyObject *_args; @@ -436,103 +645,6 @@ static PyObject *MenuObj_EnableItem(_self, _args) return _res; } -static PyObject *MenuObj_PopUpMenuSelect(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - long _rv; - short top; - short left; - short popUpItem; - if (!PyArg_ParseTuple(_args, "hhh", - &top, - &left, - &popUpItem)) - return NULL; - _rv = PopUpMenuSelect(_self->ob_itself, - top, - left, - popUpItem); - _res = Py_BuildValue("l", - _rv); - return _res; -} - -static PyObject *MenuObj_CheckItem(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short item; - Boolean checked; - if (!PyArg_ParseTuple(_args, "hb", - &item, - &checked)) - return NULL; - CheckItem(_self->ob_itself, - item, - checked); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *MenuObj_CountMItems(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short _rv; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _rv = CountMItems(_self->ob_itself); - _res = Py_BuildValue("h", - _rv); - return _res; -} - -static PyObject *MenuObj_InsertFontResMenu(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short afterItem; - short scriptFilter; - if (!PyArg_ParseTuple(_args, "hh", - &afterItem, - &scriptFilter)) - return NULL; - InsertFontResMenu(_self->ob_itself, - afterItem, - scriptFilter); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *MenuObj_InsertIntlResMenu(_self, _args) - MenuObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - ResType theType; - short afterItem; - short scriptFilter; - if (!PyArg_ParseTuple(_args, "O&hh", - PyMac_GetOSType, &theType, - &afterItem, - &scriptFilter)) - return NULL; - InsertIntlResMenu(_self->ob_itself, - theType, - afterItem, - scriptFilter); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *MenuObj_SetMenuItemCommandID(_self, _args) MenuObject *_self; PyObject *_args; @@ -908,6 +1020,104 @@ static PyObject *MenuObj_GetMenuItemKeyGlyph(_self, _args) return _res; } +static PyObject *MenuObj_MacEnableMenuItem(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + UInt16 item; + if (!PyArg_ParseTuple(_args, "h", + &item)) + return NULL; + MacEnableMenuItem(_self->ob_itself, + item); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_DisableMenuItem(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + UInt16 item; + if (!PyArg_ParseTuple(_args, "h", + &item)) + return NULL; + DisableMenuItem(_self->ob_itself, + item); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_IsMenuItemEnabled(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + UInt16 item; + if (!PyArg_ParseTuple(_args, "h", + &item)) + return NULL; + _rv = IsMenuItemEnabled(_self->ob_itself, + item); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *MenuObj_EnableMenuItemIcon(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + UInt16 item; + if (!PyArg_ParseTuple(_args, "h", + &item)) + return NULL; + EnableMenuItemIcon(_self->ob_itself, + item); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_DisableMenuItemIcon(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + UInt16 item; + if (!PyArg_ParseTuple(_args, "h", + &item)) + return NULL; + DisableMenuItemIcon(_self->ob_itself, + item); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args) + MenuObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + UInt16 item; + if (!PyArg_ParseTuple(_args, "h", + &item)) + return NULL; + _rv = IsMenuItemIconEnabled(_self->ob_itself, + item); + _res = Py_BuildValue("b", + _rv); + return _res; +} + static PyObject *MenuObj_as_Resource(_self, _args) MenuObject *_self; PyObject *_args; @@ -972,18 +1182,42 @@ static PyObject *MenuObj_InsertMenuItem(_self, _args) static PyMethodDef MenuObj_methods[] = { {"DisposeMenu", (PyCFunction)MenuObj_DisposeMenu, 1, "() -> None"}, + {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, + "() -> None"}, + {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1, + "() -> (short _rv)"}, + {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1, + "() -> (SInt16 outFontID, UInt16 outFontSize)"}, + {"SetMenuFont", (PyCFunction)MenuObj_SetMenuFont, 1, + "(SInt16 inFontID, UInt16 inFontSize) -> None"}, + {"GetMenuExcludesMarkColumn", (PyCFunction)MenuObj_GetMenuExcludesMarkColumn, 1, + "() -> (Boolean _rv)"}, + {"SetMenuExcludesMarkColumn", (PyCFunction)MenuObj_SetMenuExcludesMarkColumn, 1, + "(Boolean excludesMark) -> None"}, {"MacAppendMenu", (PyCFunction)MenuObj_MacAppendMenu, 1, "(Str255 data) -> None"}, {"InsertResMenu", (PyCFunction)MenuObj_InsertResMenu, 1, "(ResType theType, short afterItem) -> None"}, - {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1, - "(short beforeID) -> None"}, {"AppendResMenu", (PyCFunction)MenuObj_AppendResMenu, 1, "(ResType theType) -> None"}, {"MacInsertMenuItem", (PyCFunction)MenuObj_MacInsertMenuItem, 1, "(Str255 itemString, short afterItem) -> None"}, {"DeleteMenuItem", (PyCFunction)MenuObj_DeleteMenuItem, 1, "(short item) -> None"}, + {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1, + "(short afterItem, short scriptFilter) -> None"}, + {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1, + "(ResType theType, short afterItem, short scriptFilter) -> None"}, + {"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1, + "(Str255 inString) -> None"}, + {"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1, + "(Str255 inString, UInt16 afterItem) -> None"}, + {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1, + "(short top, short left, short popUpItem) -> (long _rv)"}, + {"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1, + "(short beforeID) -> None"}, + {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1, + "(short item, Boolean checked) -> None"}, {"SetMenuItemText", (PyCFunction)MenuObj_SetMenuItemText, 1, "(short item, Str255 itemString) -> None"}, {"GetMenuItemText", (PyCFunction)MenuObj_GetMenuItemText, 1, @@ -1004,22 +1238,10 @@ static PyMethodDef MenuObj_methods[] = { "(short item, StyleParameter chStyle) -> None"}, {"GetItemStyle", (PyCFunction)MenuObj_GetItemStyle, 1, "(short item) -> (Style chStyle)"}, - {"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1, - "() -> None"}, {"DisableItem", (PyCFunction)MenuObj_DisableItem, 1, "(short item) -> None"}, {"EnableItem", (PyCFunction)MenuObj_EnableItem, 1, "(short item) -> None"}, - {"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1, - "(short top, short left, short popUpItem) -> (long _rv)"}, - {"CheckItem", (PyCFunction)MenuObj_CheckItem, 1, - "(short item, Boolean checked) -> None"}, - {"CountMItems", (PyCFunction)MenuObj_CountMItems, 1, - "() -> (short _rv)"}, - {"InsertFontResMenu", (PyCFunction)MenuObj_InsertFontResMenu, 1, - "(short afterItem, short scriptFilter) -> None"}, - {"InsertIntlResMenu", (PyCFunction)MenuObj_InsertIntlResMenu, 1, - "(ResType theType, short afterItem, short scriptFilter) -> None"}, {"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1, "(SInt16 inItem, UInt32 inCommandID) -> None"}, {"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1, @@ -1056,6 +1278,18 @@ static PyMethodDef MenuObj_methods[] = { "(SInt16 inItem, SInt16 inGlyph) -> None"}, {"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1, "(SInt16 inItem) -> (SInt16 outGlyph)"}, + {"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1, + "(UInt16 item) -> None"}, + {"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1, + "(UInt16 item) -> None"}, + {"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1, + "(UInt16 item) -> (Boolean _rv)"}, + {"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1, + "(UInt16 item) -> None"}, + {"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1, + "(UInt16 item) -> None"}, + {"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1, + "(UInt16 item) -> (Boolean _rv)"}, {"as_Resource", (PyCFunction)MenuObj_as_Resource, 1, "Return this Menu as a Resource"}, {"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1, @@ -1078,6 +1312,12 @@ static PyObject *MenuObj_getattr(self, name) #define MenuObj_setattr NULL +#define MenuObj_compare NULL + +#define MenuObj_repr NULL + +#define MenuObj_hash NULL + PyTypeObject Menu_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -1089,22 +1329,29 @@ PyTypeObject Menu_Type = { 0, /*tp_print*/ (getattrfunc) MenuObj_getattr, /*tp_getattr*/ (setattrfunc) MenuObj_setattr, /*tp_setattr*/ + (cmpfunc) MenuObj_compare, /*tp_compare*/ + (reprfunc) MenuObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) MenuObj_hash, /*tp_hash*/ }; /* ---------------------- End object type Menu ---------------------- */ -static PyObject *Menu_GetMBarHeight(_self, _args) +static PyObject *Menu_InitProcMenu(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - short _rv; - if (!PyArg_ParseTuple(_args, "")) + short resID; + if (!PyArg_ParseTuple(_args, "h", + &resID)) return NULL; - _rv = GetMBarHeight(); - _res = Py_BuildValue("h", - _rv); + InitProcMenu(resID); + Py_INCREF(Py_None); + _res = Py_None; return _res; } @@ -1156,21 +1403,6 @@ static PyObject *Menu_MacGetMenu(_self, _args) return _res; } -static PyObject *Menu_MacDeleteMenu(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short menuID; - if (!PyArg_ParseTuple(_args, "h", - &menuID)) - return NULL; - MacDeleteMenu(menuID); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *Menu_MenuKey(_self, _args) PyObject *_self; PyObject *_args; @@ -1187,122 +1419,120 @@ static PyObject *Menu_MenuKey(_self, _args) return _res; } -static PyObject *Menu_HiliteMenu(_self, _args) +static PyObject *Menu_MenuSelect(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - short menuID; - if (!PyArg_ParseTuple(_args, "h", - &menuID)) + long _rv; + Point startPt; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetPoint, &startPt)) return NULL; - HiliteMenu(menuID); - Py_INCREF(Py_None); - _res = Py_None; + _rv = MenuSelect(startPt); + _res = Py_BuildValue("l", + _rv); return _res; } -static PyObject *Menu_GetMenuHandle(_self, _args) +static PyObject *Menu_MenuChoice(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - MenuHandle _rv; - short menuID; - if (!PyArg_ParseTuple(_args, "h", - &menuID)) + long _rv; + if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = GetMenuHandle(menuID); - _res = Py_BuildValue("O&", - MenuObj_New, _rv); + _rv = MenuChoice(); + _res = Py_BuildValue("l", + _rv); return _res; } -static PyObject *Menu_FlashMenuBar(_self, _args) +static PyObject *Menu_MenuEvent(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - short menuID; - if (!PyArg_ParseTuple(_args, "h", - &menuID)) + UInt32 _rv; + EventRecord inEvent; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetEventRecord, &inEvent)) return NULL; - FlashMenuBar(menuID); - Py_INCREF(Py_None); - _res = Py_None; + _rv = MenuEvent(&inEvent); + _res = Py_BuildValue("l", + _rv); return _res; } -static PyObject *Menu_MenuChoice(_self, _args) +static PyObject *Menu_GetMBarHeight(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - long _rv; + short _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = MenuChoice(); - _res = Py_BuildValue("l", + _rv = GetMBarHeight(); + _res = Py_BuildValue("h", _rv); return _res; } -static PyObject *Menu_DeleteMCEntries(_self, _args) +static PyObject *Menu_MacDrawMenuBar(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - short menuID; - short menuItem; - if (!PyArg_ParseTuple(_args, "hh", - &menuID, - &menuItem)) + if (!PyArg_ParseTuple(_args, "")) return NULL; - DeleteMCEntries(menuID, - menuItem); + MacDrawMenuBar(); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *Menu_MacDrawMenuBar(_self, _args) +static PyObject *Menu_InvalMenuBar(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - MacDrawMenuBar(); + InvalMenuBar(); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *Menu_InvalMenuBar(_self, _args) +static PyObject *Menu_HiliteMenu(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - if (!PyArg_ParseTuple(_args, "")) + short menuID; + if (!PyArg_ParseTuple(_args, "h", + &menuID)) return NULL; - InvalMenuBar(); + HiliteMenu(menuID); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *Menu_InitProcMenu(_self, _args) +static PyObject *Menu_GetNewMBar(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - short resID; + Handle _rv; + short menuBarID; if (!PyArg_ParseTuple(_args, "h", - &resID)) + &menuBarID)) return NULL; - InitProcMenu(resID); - Py_INCREF(Py_None); - _res = Py_None; + _rv = GetNewMBar(menuBarID); + _res = Py_BuildValue("O&", + ResObj_New, _rv); return _res; } @@ -1335,6 +1565,80 @@ static PyObject *Menu_SetMenuBar(_self, _args) return _res; } +static PyObject *Menu_GetMenuHandle(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + MenuHandle _rv; + short menuID; + if (!PyArg_ParseTuple(_args, "h", + &menuID)) + return NULL; + _rv = GetMenuHandle(menuID); + _res = Py_BuildValue("O&", + MenuObj_New, _rv); + return _res; +} + +static PyObject *Menu_MacDeleteMenu(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short menuID; + if (!PyArg_ParseTuple(_args, "h", + &menuID)) + return NULL; + MacDeleteMenu(menuID); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Menu_ClearMenuBar(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + ClearMenuBar(); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Menu_SetMenuFlash(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short count; + if (!PyArg_ParseTuple(_args, "h", + &count)) + return NULL; + SetMenuFlash(count); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Menu_FlashMenuBar(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short menuID; + if (!PyArg_ParseTuple(_args, "h", + &menuID)) + return NULL; + FlashMenuBar(menuID); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Menu_SystemEdit(_self, _args) PyObject *_self; PyObject *_args; @@ -1366,78 +1670,91 @@ static PyObject *Menu_SystemMenu(_self, _args) return _res; } -static PyObject *Menu_GetNewMBar(_self, _args) +static PyObject *Menu_IsMenuBarVisible(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - Handle _rv; - short menuBarID; - if (!PyArg_ParseTuple(_args, "h", - &menuBarID)) + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = GetNewMBar(menuBarID); - _res = Py_BuildValue("O&", - ResObj_New, _rv); + _rv = IsMenuBarVisible(); + _res = Py_BuildValue("b", + _rv); return _res; } -static PyObject *Menu_ClearMenuBar(_self, _args) +static PyObject *Menu_ShowMenuBar(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; if (!PyArg_ParseTuple(_args, "")) return NULL; - ClearMenuBar(); + ShowMenuBar(); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *Menu_SetMenuFlash(_self, _args) +static PyObject *Menu_HideMenuBar(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - short count; - if (!PyArg_ParseTuple(_args, "h", - &count)) + if (!PyArg_ParseTuple(_args, "")) return NULL; - SetMenuFlash(count); + HideMenuBar(); Py_INCREF(Py_None); _res = Py_None; return _res; } -static PyObject *Menu_MenuSelect(_self, _args) +static PyObject *Menu_DeleteMCEntries(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - long _rv; - Point startPt; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetPoint, &startPt)) + short menuID; + short menuItem; + if (!PyArg_ParseTuple(_args, "hh", + &menuID, + &menuItem)) return NULL; - _rv = MenuSelect(startPt); - _res = Py_BuildValue("l", - _rv); + DeleteMCEntries(menuID, + menuItem); + Py_INCREF(Py_None); + _res = Py_None; return _res; } -static PyObject *Menu_MenuEvent(_self, _args) +static PyObject *Menu_InitContextualMenus(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - UInt32 _rv; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = InitContextualMenus(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Menu_IsShowContextualMenuClick(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; EventRecord inEvent; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetEventRecord, &inEvent)) return NULL; - _rv = MenuEvent(&inEvent); - _res = Py_BuildValue("l", + _rv = IsShowContextualMenuClick(&inEvent); + _res = Py_BuildValue("b", _rv); return _res; } @@ -1518,52 +1835,62 @@ static PyObject *Menu_DrawMenuBar(_self, _args) } static PyMethodDef Menu_methods[] = { - {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1, - "() -> (short _rv)"}, + {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1, + "(short resID) -> None"}, {"InitMenus", (PyCFunction)Menu_InitMenus, 1, "() -> None"}, {"NewMenu", (PyCFunction)Menu_NewMenu, 1, "(short menuID, Str255 menuTitle) -> (MenuHandle _rv)"}, {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1, "(short resourceID) -> (MenuHandle _rv)"}, - {"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1, - "(short menuID) -> None"}, {"MenuKey", (PyCFunction)Menu_MenuKey, 1, "(CharParameter ch) -> (long _rv)"}, - {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1, - "(short menuID) -> None"}, - {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1, - "(short menuID) -> (MenuHandle _rv)"}, - {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1, - "(short menuID) -> None"}, + {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1, + "(Point startPt) -> (long _rv)"}, {"MenuChoice", (PyCFunction)Menu_MenuChoice, 1, "() -> (long _rv)"}, - {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1, - "(short menuID, short menuItem) -> None"}, + {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1, + "(EventRecord inEvent) -> (UInt32 _rv)"}, + {"GetMBarHeight", (PyCFunction)Menu_GetMBarHeight, 1, + "() -> (short _rv)"}, {"MacDrawMenuBar", (PyCFunction)Menu_MacDrawMenuBar, 1, "() -> None"}, {"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1, "() -> None"}, - {"InitProcMenu", (PyCFunction)Menu_InitProcMenu, 1, - "(short resID) -> None"}, + {"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1, + "(short menuID) -> None"}, + {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1, + "(short menuBarID) -> (Handle _rv)"}, {"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1, "() -> (Handle _rv)"}, {"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1, "(Handle menuList) -> None"}, + {"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1, + "(short menuID) -> (MenuHandle _rv)"}, + {"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1, + "(short menuID) -> None"}, + {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1, + "() -> None"}, + {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1, + "(short count) -> None"}, + {"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1, + "(short menuID) -> None"}, {"SystemEdit", (PyCFunction)Menu_SystemEdit, 1, "(short editCmd) -> (Boolean _rv)"}, {"SystemMenu", (PyCFunction)Menu_SystemMenu, 1, "(long menuResult) -> None"}, - {"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1, - "(short menuBarID) -> (Handle _rv)"}, - {"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1, + {"IsMenuBarVisible", (PyCFunction)Menu_IsMenuBarVisible, 1, + "() -> (Boolean _rv)"}, + {"ShowMenuBar", (PyCFunction)Menu_ShowMenuBar, 1, "() -> None"}, - {"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1, - "(short count) -> None"}, - {"MenuSelect", (PyCFunction)Menu_MenuSelect, 1, - "(Point startPt) -> (long _rv)"}, - {"MenuEvent", (PyCFunction)Menu_MenuEvent, 1, - "(EventRecord inEvent) -> (UInt32 _rv)"}, + {"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1, + "() -> None"}, + {"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1, + "(short menuID, short menuItem) -> None"}, + {"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1, + "() -> None"}, + {"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1, + "(EventRecord inEvent) -> (Boolean _rv)"}, {"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1, "(Str255 name) -> None"}, {"as_Menu", (PyCFunction)Menu_as_Menu, 1, diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py index b332657..fa87ba3 100644 --- a/Mac/Modules/menu/menuscan.py +++ b/Mac/Modules/menu/menuscan.py @@ -32,8 +32,12 @@ class MyScanner(Scanner): def makeblacklistnames(self): return [ - "IsShowContextualMenuClick", # Can't find it in the library - "InitContextualMenus", # ditto +## "IsShowContextualMenuClick", # Can't find it in the library +## "InitContextualMenus", # ditto + "GetMenuItemProperty", # difficult for the moment + "GetMenuItemPropertySize", + "SetMenuItemProperty", + "RemoveMenuItemProperty", ] def makeblacklisttypes(self): diff --git a/Mac/Modules/qd/Qdmodule.c b/Mac/Modules/qd/Qdmodule.c index 13caf5f..f8dba7e 100644 --- a/Mac/Modules/qd/Qdmodule.c +++ b/Mac/Modules/qd/Qdmodule.c @@ -223,6 +223,12 @@ static PyObject *GrafObj_getattr(self, name) #define GrafObj_setattr NULL +#define GrafObj_compare NULL + +#define GrafObj_repr NULL + +#define GrafObj_hash NULL + PyTypeObject GrafPort_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -234,6 +240,12 @@ PyTypeObject GrafPort_Type = { 0, /*tp_print*/ (getattrfunc) GrafObj_getattr, /*tp_getattr*/ (setattrfunc) GrafObj_setattr, /*tp_setattr*/ + (cmpfunc) GrafObj_compare, /*tp_compare*/ + (reprfunc) GrafObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) GrafObj_hash, /*tp_hash*/ }; /* -------------------- End object type GrafPort -------------------- */ @@ -312,6 +324,12 @@ static PyObject *BMObj_getattr(self, name) #define BMObj_setattr NULL +#define BMObj_compare NULL + +#define BMObj_repr NULL + +#define BMObj_hash NULL + PyTypeObject BitMap_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -323,6 +341,12 @@ PyTypeObject BitMap_Type = { 0, /*tp_print*/ (getattrfunc) BMObj_getattr, /*tp_getattr*/ (setattrfunc) BMObj_setattr, /*tp_setattr*/ + (cmpfunc) BMObj_compare, /*tp_compare*/ + (reprfunc) BMObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) BMObj_hash, /*tp_hash*/ }; /* --------------------- End object type BitMap --------------------- */ @@ -387,6 +411,12 @@ static PyObject *QDGA_getattr(self, name) #define QDGA_setattr NULL +#define QDGA_compare NULL + +#define QDGA_repr NULL + +#define QDGA_hash NULL + staticforward PyTypeObject QDGlobalsAccess_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -398,6 +428,12 @@ staticforward PyTypeObject QDGlobalsAccess_Type = { 0, /*tp_print*/ (getattrfunc) QDGA_getattr, /*tp_getattr*/ (setattrfunc) QDGA_setattr, /*tp_setattr*/ + (cmpfunc) QDGA_compare, /*tp_compare*/ + (reprfunc) QDGA_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) QDGA_hash, /*tp_hash*/ }; /* ---------------- End object type QDGlobalsAccess ----------------- */ diff --git a/Mac/Modules/qdoffs/Qdoffsmodule.c b/Mac/Modules/qdoffs/Qdoffsmodule.c index fef251f..13ec478 100644 --- a/Mac/Modules/qdoffs/Qdoffsmodule.c +++ b/Mac/Modules/qdoffs/Qdoffsmodule.c @@ -137,6 +137,12 @@ static PyObject *GWorldObj_getattr(self, name) #define GWorldObj_setattr NULL +#define GWorldObj_compare NULL + +#define GWorldObj_repr NULL + +#define GWorldObj_hash NULL + PyTypeObject GWorld_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -148,6 +154,12 @@ PyTypeObject GWorld_Type = { 0, /*tp_print*/ (getattrfunc) GWorldObj_getattr, /*tp_getattr*/ (setattrfunc) GWorldObj_setattr, /*tp_setattr*/ + (cmpfunc) GWorldObj_compare, /*tp_compare*/ + (reprfunc) GWorldObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) GWorldObj_hash, /*tp_hash*/ }; /* --------------------- End object type GWorld --------------------- */ @@ -405,6 +417,22 @@ static PyObject *Qdoffs_SetPixelsState(_self, _args) return _res; } +static PyObject *Qdoffs_GetPixRowBytes(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + long _rv; + PixMapHandle pm; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &pm)) + return NULL; + _rv = GetPixRowBytes(pm); + _res = Py_BuildValue("l", + _rv); + return _res; +} + static PyObject *Qdoffs_NewScreenBuffer(_self, _args) PyObject *_self; PyObject *_args; @@ -545,6 +573,8 @@ static PyMethodDef Qdoffs_methods[] = { "(PixMapHandle pm) -> (GWorldFlags _rv)"}, {"SetPixelsState", (PyCFunction)Qdoffs_SetPixelsState, 1, "(PixMapHandle pm, GWorldFlags state) -> None"}, + {"GetPixRowBytes", (PyCFunction)Qdoffs_GetPixRowBytes, 1, + "(PixMapHandle pm) -> (long _rv)"}, {"NewScreenBuffer", (PyCFunction)Qdoffs_NewScreenBuffer, 1, "(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)"}, {"DisposeScreenBuffer", (PyCFunction)Qdoffs_DisposeScreenBuffer, 1, diff --git a/Mac/Modules/qdoffs/qdoffsscan.py b/Mac/Modules/qdoffs/qdoffsscan.py index 958da97..4f188a6 100644 --- a/Mac/Modules/qdoffs/qdoffsscan.py +++ b/Mac/Modules/qdoffs/qdoffsscan.py @@ -37,7 +37,7 @@ class MyScanner(Scanner): return [ 'DisposeGWorld', # Implied when the object is deleted 'NewGWorldFromHBITMAP', # Don't know what the args do - 'GetGDeviceAttributes', # Doesn't seem to exist + 'GetGDeviceAttributes', # Windows-only ] def makeblacklisttypes(self): diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c index 540915e..a1dc764 100644 --- a/Mac/Modules/qt/Qtmodule.c +++ b/Mac/Modules/qt/Qtmodule.c @@ -1021,6 +1021,12 @@ static PyObject *MovieCtlObj_getattr(self, name) #define MovieCtlObj_setattr NULL +#define MovieCtlObj_compare NULL + +#define MovieCtlObj_repr NULL + +#define MovieCtlObj_hash NULL + PyTypeObject MovieController_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -1032,6 +1038,12 @@ PyTypeObject MovieController_Type = { 0, /*tp_print*/ (getattrfunc) MovieCtlObj_getattr, /*tp_getattr*/ (setattrfunc) MovieCtlObj_setattr, /*tp_setattr*/ + (cmpfunc) MovieCtlObj_compare, /*tp_compare*/ + (reprfunc) MovieCtlObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) MovieCtlObj_hash, /*tp_hash*/ }; /* ---------------- End object type MovieController ----------------- */ @@ -1446,6 +1458,12 @@ static PyObject *TimeBaseObj_getattr(self, name) #define TimeBaseObj_setattr NULL +#define TimeBaseObj_compare NULL + +#define TimeBaseObj_repr NULL + +#define TimeBaseObj_hash NULL + PyTypeObject TimeBase_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -1457,6 +1475,12 @@ PyTypeObject TimeBase_Type = { 0, /*tp_print*/ (getattrfunc) TimeBaseObj_getattr, /*tp_getattr*/ (setattrfunc) TimeBaseObj_setattr, /*tp_setattr*/ + (cmpfunc) TimeBaseObj_compare, /*tp_compare*/ + (reprfunc) TimeBaseObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) TimeBaseObj_hash, /*tp_hash*/ }; /* -------------------- End object type TimeBase -------------------- */ @@ -1735,6 +1759,12 @@ static PyObject *UserDataObj_getattr(self, name) #define UserDataObj_setattr NULL +#define UserDataObj_compare NULL + +#define UserDataObj_repr NULL + +#define UserDataObj_hash NULL + PyTypeObject UserData_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -1746,6 +1776,12 @@ PyTypeObject UserData_Type = { 0, /*tp_print*/ (getattrfunc) UserDataObj_getattr, /*tp_getattr*/ (setattrfunc) UserDataObj_setattr, /*tp_setattr*/ + (cmpfunc) UserDataObj_compare, /*tp_compare*/ + (reprfunc) UserDataObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) UserDataObj_hash, /*tp_hash*/ }; /* -------------------- End object type UserData -------------------- */ @@ -2806,6 +2842,12 @@ static PyObject *MediaObj_getattr(self, name) #define MediaObj_setattr NULL +#define MediaObj_compare NULL + +#define MediaObj_repr NULL + +#define MediaObj_hash NULL + PyTypeObject Media_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -2817,6 +2859,12 @@ PyTypeObject Media_Type = { 0, /*tp_print*/ (getattrfunc) MediaObj_getattr, /*tp_getattr*/ (setattrfunc) MediaObj_setattr, /*tp_setattr*/ + (cmpfunc) MediaObj_compare, /*tp_compare*/ + (reprfunc) MediaObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) MediaObj_hash, /*tp_hash*/ }; /* --------------------- End object type Media ---------------------- */ @@ -3974,6 +4022,12 @@ static PyObject *TrackObj_getattr(self, name) #define TrackObj_setattr NULL +#define TrackObj_compare NULL + +#define TrackObj_repr NULL + +#define TrackObj_hash NULL + PyTypeObject Track_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -3985,6 +4039,12 @@ PyTypeObject Track_Type = { 0, /*tp_print*/ (getattrfunc) TrackObj_getattr, /*tp_getattr*/ (setattrfunc) TrackObj_setattr, /*tp_setattr*/ + (cmpfunc) TrackObj_compare, /*tp_compare*/ + (reprfunc) TrackObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) TrackObj_hash, /*tp_hash*/ }; /* --------------------- End object type Track ---------------------- */ @@ -6109,6 +6169,12 @@ static PyObject *MovieObj_getattr(self, name) #define MovieObj_setattr NULL +#define MovieObj_compare NULL + +#define MovieObj_repr NULL + +#define MovieObj_hash NULL + PyTypeObject Movie_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -6120,11 +6186,35 @@ PyTypeObject Movie_Type = { 0, /*tp_print*/ (getattrfunc) MovieObj_getattr, /*tp_getattr*/ (setattrfunc) MovieObj_setattr, /*tp_setattr*/ + (cmpfunc) MovieObj_compare, /*tp_compare*/ + (reprfunc) MovieObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) MovieObj_hash, /*tp_hash*/ }; /* --------------------- End object type Movie ---------------------- */ +static PyObject *Qt_CheckQuickTimeRegistration(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + void * registrationKey; + long flags; + if (!PyArg_ParseTuple(_args, "sl", + ®istrationKey, + &flags)) + return NULL; + CheckQuickTimeRegistration(registrationKey, + flags); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Qt_EnterMovies(_self, _args) PyObject *_self; PyObject *_args; @@ -6858,6 +6948,25 @@ static PyObject *Qt_VideoMediaGetStatistics(_self, _args) return _res; } +static PyObject *Qt_VideoMediaGetStallCount(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + ComponentResult _rv; + MediaHandler mh; + unsigned long stalls; + if (!PyArg_ParseTuple(_args, "O&", + CmpInstObj_Convert, &mh)) + return NULL; + _rv = VideoMediaGetStallCount(mh, + &stalls); + _res = Py_BuildValue("ll", + _rv, + stalls); + return _res; +} + static PyObject *Qt_TextMediaAddTextSample(_self, _args) PyObject *_self; PyObject *_args; @@ -7667,6 +7776,8 @@ static PyObject *Qt_MoviesTask(_self, _args) } static PyMethodDef Qt_methods[] = { + {"CheckQuickTimeRegistration", (PyCFunction)Qt_CheckQuickTimeRegistration, 1, + "(void * registrationKey, long flags) -> None"}, {"EnterMovies", (PyCFunction)Qt_EnterMovies, 1, "() -> None"}, {"ExitMovies", (PyCFunction)Qt_ExitMovies, 1, @@ -7739,6 +7850,8 @@ static PyMethodDef Qt_methods[] = { "(MediaHandler mh) -> (ComponentResult _rv)"}, {"VideoMediaGetStatistics", (PyCFunction)Qt_VideoMediaGetStatistics, 1, "(MediaHandler mh) -> (ComponentResult _rv)"}, + {"VideoMediaGetStallCount", (PyCFunction)Qt_VideoMediaGetStallCount, 1, + "(MediaHandler mh) -> (ComponentResult _rv, unsigned long stalls)"}, {"TextMediaAddTextSample", (PyCFunction)Qt_TextMediaAddTextSample, 1, "(MediaHandler mh, Ptr text, unsigned long size, short fontNumber, short fontSize, Style textFace, short textJustification, long displayFlags, TimeValue scrollDelay, short hiliteStart, short hiliteEnd, TimeValue duration) -> (ComponentResult _rv, RGBColor textColor, RGBColor backColor, Rect textBox, RGBColor rgbHiliteColor, TimeValue sampleTime)"}, {"TextMediaAddTESample", (PyCFunction)Qt_TextMediaAddTESample, 1, diff --git a/Mac/Modules/qt/qtscan.py b/Mac/Modules/qt/qtscan.py index ee45c30..ce79380 100644 --- a/Mac/Modules/qt/qtscan.py +++ b/Mac/Modules/qt/qtscan.py @@ -57,38 +57,10 @@ class MyScanner(Scanner): "AddTESample", "AddHiliteSample", "HiliteTextSample", - # Missing in CW11 quicktime library -# "SpriteMediaGetDisplayedSampleNumber", -# "SpriteMediaGetIndImageDescription", -# "SpriteMediaCountImages", -# "SpriteMediaCountSprites", -# "SpriteMediaHitTestSprites", -# "SpriteMediaGetProperty", -# "SpriteMediaSetProperty", -# "TextMediaSetTextSampleData", -# "TextMediaHiliteTextSample", -# "TextMediaFindNextText", -# "TextMediaAddHiliteSample", -# "TextMediaAddTESample", -# "TextMediaAddTextSample", -# "VideoMediaGetStatistics", -# "VideoMediaResetStatistics", -# "EndFullScreen", -# "NewMovieFromDataRef", -# "MCPtInController", -# "MCRemoveAMovie", -# "MCRemoveAllMovies", -# "MCInvalidate", -# "InvalidateMovieRegion", -# "GetMovieCompositeBufferFlags", -# "SetMovieCompositeBufferFlags", -# "SetTrackSoundLocalizationSettings", -# "GetTrackSoundLocalizationSettings", -# "GetMovieNaturalBoundsRect", "MakeTrackTimeTable", # Uses long * return? "MakeMediaTimeTable", # ditto - "VideoMediaGetStallCount", # Undefined in CW Pro 3 library +## "VideoMediaGetStallCount", # Undefined in CW Pro 3 library ] def makeblacklisttypes(self): diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c index 6eeb3b8..b5857e7 100644 --- a/Mac/Modules/res/Resmodule.c +++ b/Mac/Modules/res/Resmodule.c @@ -549,6 +549,12 @@ ResObj_setattr(self, name, value) } +#define ResObj_compare NULL + +#define ResObj_repr NULL + +#define ResObj_hash NULL + PyTypeObject Resource_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -560,6 +566,12 @@ PyTypeObject Resource_Type = { 0, /*tp_print*/ (getattrfunc) ResObj_getattr, /*tp_getattr*/ (setattrfunc) ResObj_setattr, /*tp_setattr*/ + (cmpfunc) ResObj_compare, /*tp_compare*/ + (reprfunc) ResObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) ResObj_hash, /*tp_hash*/ }; /* -------------------- End object type Resource -------------------- */ diff --git a/Mac/Modules/scrap/scrapscan.py b/Mac/Modules/scrap/scrapscan.py index 95bf1bb..1a03b18 100644 --- a/Mac/Modules/scrap/scrapscan.py +++ b/Mac/Modules/scrap/scrapscan.py @@ -11,7 +11,7 @@ from scantools import Scanner from bgenlocations import TOOLBOXDIR LONG = "Scrap" -SHORT = "Scrap" +SHORT = "scrap" def main(): input = "Scrap.h" diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c index 84d77e1..019fa25 100644 --- a/Mac/Modules/snd/Sndmodule.c +++ b/Mac/Modules/snd/Sndmodule.c @@ -272,6 +272,48 @@ static PyObject *SndCh_SndChannelStatus(_self, _args) return _res; } +static PyObject *SndCh_SndGetInfo(_self, _args) + SndChannelObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType selector; + void * infoPtr; + if (!PyArg_ParseTuple(_args, "O&w", + PyMac_GetOSType, &selector, + &infoPtr)) + return NULL; + _err = SndGetInfo(_self->ob_itself, + selector, + infoPtr); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *SndCh_SndSetInfo(_self, _args) + SndChannelObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType selector; + void * infoPtr; + if (!PyArg_ParseTuple(_args, "O&w", + PyMac_GetOSType, &selector, + &infoPtr)) + return NULL; + _err = SndSetInfo(_self->ob_itself, + selector, + infoPtr); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyMethodDef SndCh_methods[] = { {"SndDoCommand", (PyCFunction)SndCh_SndDoCommand, 1, "(SndCommand cmd, Boolean noWait) -> None"}, @@ -287,6 +329,10 @@ static PyMethodDef SndCh_methods[] = { "(Boolean quietNow) -> None"}, {"SndChannelStatus", (PyCFunction)SndCh_SndChannelStatus, 1, "(short theLength) -> (SCStatus theStatus)"}, + {"SndGetInfo", (PyCFunction)SndCh_SndGetInfo, 1, + "(OSType selector, void * infoPtr) -> None"}, + {"SndSetInfo", (PyCFunction)SndCh_SndSetInfo, 1, + "(OSType selector, void * infoPtr) -> None"}, {NULL, NULL, 0} }; @@ -301,6 +347,12 @@ static PyObject *SndCh_getattr(self, name) #define SndCh_setattr NULL +#define SndCh_compare NULL + +#define SndCh_repr NULL + +#define SndCh_hash NULL + staticforward PyTypeObject SndChannel_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -312,6 +364,12 @@ staticforward PyTypeObject SndChannel_Type = { 0, /*tp_print*/ (getattrfunc) SndCh_getattr, /*tp_getattr*/ (setattrfunc) SndCh_setattr, /*tp_setattr*/ + (cmpfunc) SndCh_compare, /*tp_compare*/ + (reprfunc) SndCh_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) SndCh_hash, /*tp_hash*/ }; /* ------------------- End object type SndChannel ------------------- */ @@ -423,6 +481,12 @@ static int SPBObj_setattr(self, name, value) else return -1; } +#define SPBObj_compare NULL + +#define SPBObj_repr NULL + +#define SPBObj_hash NULL + staticforward PyTypeObject SPB_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -434,6 +498,12 @@ staticforward PyTypeObject SPB_Type = { 0, /*tp_print*/ (getattrfunc) SPBObj_getattr, /*tp_getattr*/ (setattrfunc) SPBObj_setattr, /*tp_setattr*/ + (cmpfunc) SPBObj_compare, /*tp_compare*/ + (reprfunc) SPBObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) SPBObj_hash, /*tp_hash*/ }; /* ---------------------- End object type SPB ----------------------- */ @@ -859,6 +929,98 @@ static PyObject *Snd_GetSoundHeaderOffset(_self, _args) return _res; } +static PyObject *Snd_GetCompressionInfo(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + short compressionID; + OSType format; + short numChannels; + short sampleSize; + CompressionInfo cp__out__; + if (!PyArg_ParseTuple(_args, "hO&hh", + &compressionID, + PyMac_GetOSType, &format, + &numChannels, + &sampleSize)) + return NULL; + _err = GetCompressionInfo(compressionID, + format, + numChannels, + sampleSize, + &cp__out__); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("s#", + (char *)&cp__out__, (int)sizeof(CompressionInfo)); + cp__error__: ; + return _res; +} + +static PyObject *Snd_SetSoundPreference(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType theType; + Str255 name; + Handle settings; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &theType, + ResObj_Convert, &settings)) + return NULL; + _err = SetSoundPreference(theType, + name, + settings); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildStr255, name); + return _res; +} + +static PyObject *Snd_GetSoundPreference(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType theType; + Str255 name; + Handle settings; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &theType, + ResObj_Convert, &settings)) + return NULL; + _err = GetSoundPreference(theType, + name, + settings); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildStr255, name); + return _res; +} + +static PyObject *Snd_GetCompressionName(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + OSType compressionType; + Str255 compressionName; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetOSType, &compressionType)) + return NULL; + _err = GetCompressionName(compressionType, + compressionName); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildStr255, compressionName); + return _res; +} + static PyObject *Snd_SPBVersion(_self, _args) PyObject *_self; PyObject *_args; @@ -1220,6 +1382,14 @@ static PyMethodDef Snd_methods[] = { "(long level) -> None"}, {"GetSoundHeaderOffset", (PyCFunction)Snd_GetSoundHeaderOffset, 1, "(SndListHandle sndHandle) -> (long offset)"}, + {"GetCompressionInfo", (PyCFunction)Snd_GetCompressionInfo, 1, + "(short compressionID, OSType format, short numChannels, short sampleSize) -> (CompressionInfo cp)"}, + {"SetSoundPreference", (PyCFunction)Snd_SetSoundPreference, 1, + "(OSType theType, Handle settings) -> (Str255 name)"}, + {"GetSoundPreference", (PyCFunction)Snd_GetSoundPreference, 1, + "(OSType theType, Handle settings) -> (Str255 name)"}, + {"GetCompressionName", (PyCFunction)Snd_GetCompressionName, 1, + "(OSType compressionType) -> (Str255 compressionName)"}, {"SPBVersion", (PyCFunction)Snd_SPBVersion, 1, "() -> (NumVersion _rv)"}, {"SPBSignInDevice", (PyCFunction)Snd_SPBSignInDevice, 1, diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py index f2f19ec..676c889 100644 --- a/Mac/Modules/snd/sndscan.py +++ b/Mac/Modules/snd/sndscan.py @@ -46,12 +46,12 @@ class SoundScanner(Scanner): 'StopSound', 'SoundDone', # These do not work for cfm68k: - 'SndGetInfo', - 'SndSetInfo', - 'GetCompressionInfo', - 'GetCompressionName', - 'GetSoundPreference', - 'SetSoundPreference', +## 'SndGetInfo', +## 'SndSetInfo', +## 'GetCompressionInfo', +## 'GetCompressionName', +## 'GetSoundPreference', +## 'SetSoundPreference', # And old calls that are no longer supported 'SetSoundVol', 'GetSoundVol', diff --git a/Mac/Modules/te/TEmodule.c b/Mac/Modules/te/TEmodule.c index 1c7e4f4..5d5e05a 100644 --- a/Mac/Modules/te/TEmodule.c +++ b/Mac/Modules/te/TEmodule.c @@ -722,6 +722,24 @@ static PyObject *TEObj_TEFeatureFlag(_self, _args) return _res; } +static PyObject *TEObj_TEGetHiliteRgn(_self, _args) + TEObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + RgnHandle region; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, ®ion)) + return NULL; + _err = TEGetHiliteRgn(region, + _self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyMethodDef TEObj_methods[] = { {"TESetText", (PyCFunction)TEObj_TESetText, 1, "(Buffer text) -> None"}, @@ -793,6 +811,8 @@ static PyMethodDef TEObj_methods[] = { "(long rangeStart, long rangeEnd) -> (long _rv)"}, {"TEFeatureFlag", (PyCFunction)TEObj_TEFeatureFlag, 1, "(short feature, short action) -> (short _rv)"}, + {"TEGetHiliteRgn", (PyCFunction)TEObj_TEGetHiliteRgn, 1, + "(RgnHandle region) -> None"}, {NULL, NULL, 0} }; @@ -845,6 +865,12 @@ static PyObject *TEObj_getattr(self, name) #define TEObj_setattr NULL +#define TEObj_compare NULL + +#define TEObj_repr NULL + +#define TEObj_hash NULL + PyTypeObject TE_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -856,6 +882,12 @@ PyTypeObject TE_Type = { 0, /*tp_print*/ (getattrfunc) TEObj_getattr, /*tp_getattr*/ (setattrfunc) TEObj_setattr, /*tp_setattr*/ + (cmpfunc) TEObj_compare, /*tp_compare*/ + (reprfunc) TEObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) TEObj_hash, /*tp_hash*/ }; /* ----------------------- End object type TE ----------------------- */ diff --git a/Mac/Modules/te/tescan.py b/Mac/Modules/te/tescan.py index 0e537ab..87a25da 100644 --- a/Mac/Modules/te/tescan.py +++ b/Mac/Modules/te/tescan.py @@ -39,7 +39,7 @@ class MyScanner(Scanner): return [ "TEDispose", "TEInit", - "TEGetHiliteRgn", +## "TEGetHiliteRgn", ] def makeblacklisttypes(self): diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c index 78c801d..f895911 100644 --- a/Mac/Modules/win/Winmodule.c +++ b/Mac/Modules/win/Winmodule.c @@ -44,6 +44,9 @@ extern PyObject *WinObj_WhichWindow(WindowPtr); #include <Windows.h> +extern PyObject *QdRGB_New(RGBColor *); +extern int QdRGB_Convert(PyObject *, RGBColor *); + #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ @@ -112,6 +115,72 @@ static PyObject *WinObj_MacCloseWindow(_self, _args) return _res; } +static PyObject *WinObj_GetWindowOwnerCount(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + UInt32 outCount; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowOwnerCount(_self->ob_itself, + &outCount); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + outCount); + return _res; +} + +static PyObject *WinObj_CloneWindow(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = CloneWindow(_self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_GetWindowClass(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowClass outClass; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowClass(_self->ob_itself, + &outClass); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + outClass); + return _res; +} + +static PyObject *WinObj_GetWindowAttributes(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowAttributes outAttributes; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowAttributes(_self->ob_itself, + &outAttributes); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + outAttributes); + return _res; +} + static PyObject *WinObj_SetWinColor(_self, _args) WindowObject *_self; PyObject *_args; @@ -128,6 +197,76 @@ static PyObject *WinObj_SetWinColor(_self, _args) return _res; } +static PyObject *WinObj_SetWindowContentColor(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + RGBColor color; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = SetWindowContentColor(_self->ob_itself, + &color); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + QdRGB_New, &color); + return _res; +} + +static PyObject *WinObj_GetWindowContentColor(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + RGBColor color; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowContentColor(_self->ob_itself, + &color); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + QdRGB_New, &color); + return _res; +} + +static PyObject *WinObj_GetWindowContentPattern(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + PixPatHandle outPixPat; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &outPixPat)) + return NULL; + _err = GetWindowContentPattern(_self->ob_itself, + outPixPat); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_SetWindowContentPattern(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + PixPatHandle pixPat; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &pixPat)) + return NULL; + _err = SetWindowContentPattern(_self->ob_itself, + pixPat); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *WinObj_ClipAbove(_self, _args) WindowObject *_self; PyObject *_args; @@ -289,44 +428,6 @@ static PyObject *WinObj_HiliteWindow(_self, _args) return _res; } -static PyObject *WinObj_GetWindowFeatures(_self, _args) - WindowObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - UInt32 outFeatures; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = GetWindowFeatures(_self->ob_itself, - &outFeatures); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("l", - outFeatures); - return _res; -} - -static PyObject *WinObj_GetWindowRegion(_self, _args) - WindowObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - WindowRegionCode inRegionCode; - RgnHandle ioWinRgn; - if (!PyArg_ParseTuple(_args, "hO&", - &inRegionCode, - ResObj_Convert, &ioWinRgn)) - return NULL; - _err = GetWindowRegion(_self->ob_itself, - inRegionCode, - ioWinRgn); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *WinObj_SetWRefCon(_self, _args) WindowObject *_self; PyObject *_args; @@ -401,6 +502,44 @@ static PyObject *WinObj_GetWVariant(_self, _args) return _res; } +static PyObject *WinObj_GetWindowFeatures(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + UInt32 outFeatures; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowFeatures(_self->ob_itself, + &outFeatures); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + outFeatures); + return _res; +} + +static PyObject *WinObj_GetWindowRegion(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowRegionCode inRegionCode; + RgnHandle ioWinRgn; + if (!PyArg_ParseTuple(_args, "hO&", + &inRegionCode, + ResObj_Convert, &ioWinRgn)) + return NULL; + _err = GetWindowRegion(_self->ob_itself, + inRegionCode, + ioWinRgn); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *WinObj_BeginUpdate(_self, _args) WindowObject *_self; PyObject *_args; @@ -427,6 +566,78 @@ static PyObject *WinObj_EndUpdate(_self, _args) return _res; } +static PyObject *WinObj_InvalWindowRgn(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + RgnHandle region; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, ®ion)) + return NULL; + _err = InvalWindowRgn(_self->ob_itself, + region); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_InvalWindowRect(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Rect bounds; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetRect, &bounds)) + return NULL; + _err = InvalWindowRect(_self->ob_itself, + &bounds); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_ValidWindowRgn(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + RgnHandle region; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, ®ion)) + return NULL; + _err = ValidWindowRgn(_self->ob_itself, + region); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_ValidWindowRect(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Rect bounds; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetRect, &bounds)) + return NULL; + _err = ValidWindowRect(_self->ob_itself, + &bounds); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *WinObj_DrawGrowIcon(_self, _args) WindowObject *_self; PyObject *_args; @@ -471,7 +682,169 @@ static PyObject *WinObj_GetWTitle(_self, _args) return _res; } -static PyObject *WinObj_IsWindowCollapsable(_self, _args) +static PyObject *WinObj_SetWindowProxyFSSpec(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + FSSpec inFile; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetFSSpec, &inFile)) + return NULL; + _err = SetWindowProxyFSSpec(_self->ob_itself, + &inFile); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_GetWindowProxyFSSpec(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + FSSpec outFile; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowProxyFSSpec(_self->ob_itself, + &outFile); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildFSSpec, outFile); + return _res; +} + +static PyObject *WinObj_SetWindowProxyAlias(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + AliasHandle alias; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &alias)) + return NULL; + _err = SetWindowProxyAlias(_self->ob_itself, + alias); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_GetWindowProxyAlias(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + AliasHandle alias; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowProxyAlias(_self->ob_itself, + &alias); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, alias); + return _res; +} + +static PyObject *WinObj_SetWindowProxyCreatorAndType(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + OSType fileCreator; + OSType fileType; + SInt16 vRefNum; + if (!PyArg_ParseTuple(_args, "O&O&h", + PyMac_GetOSType, &fileCreator, + PyMac_GetOSType, &fileType, + &vRefNum)) + return NULL; + _err = SetWindowProxyCreatorAndType(_self->ob_itself, + fileCreator, + fileType, + vRefNum); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_GetWindowProxyIcon(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + IconRef outIcon; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowProxyIcon(_self->ob_itself, + &outIcon); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, outIcon); + return _res; +} + +static PyObject *WinObj_SetWindowProxyIcon(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + IconRef icon; + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &icon)) + return NULL; + _err = SetWindowProxyIcon(_self->ob_itself, + icon); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_RemoveWindowProxy(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = RemoveWindowProxy(_self->ob_itself); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_TrackWindowProxyDrag(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Point startPt; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetPoint, &startPt)) + return NULL; + _err = TrackWindowProxyDrag(_self->ob_itself, + startPt); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_IsWindowModified(_self, _args) WindowObject *_self; PyObject *_args; { @@ -479,38 +852,83 @@ static PyObject *WinObj_IsWindowCollapsable(_self, _args) Boolean _rv; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = IsWindowCollapsable(_self->ob_itself); + _rv = IsWindowModified(_self->ob_itself); _res = Py_BuildValue("b", _rv); return _res; } -static PyObject *WinObj_IsWindowCollapsed(_self, _args) +static PyObject *WinObj_SetWindowModified(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Boolean modified; + if (!PyArg_ParseTuple(_args, "b", + &modified)) + return NULL; + _err = SetWindowModified(_self->ob_itself, + modified); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_IsWindowPathSelectClick(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; Boolean _rv; + EventRecord event; if (!PyArg_ParseTuple(_args, "")) return NULL; - _rv = IsWindowCollapsed(_self->ob_itself); - _res = Py_BuildValue("b", - _rv); + _rv = IsWindowPathSelectClick(_self->ob_itself, + &event); + _res = Py_BuildValue("bO&", + _rv, + PyMac_BuildEventRecord, &event); return _res; } -static PyObject *WinObj_CollapseWindow(_self, _args) +static PyObject *WinObj_HiliteWindowFrameForDrag(_self, _args) WindowObject *_self; PyObject *_args; { PyObject *_res = NULL; OSStatus _err; - Boolean inCollapseIt; + Boolean hilited; if (!PyArg_ParseTuple(_args, "b", - &inCollapseIt)) + &hilited)) return NULL; - _err = CollapseWindow(_self->ob_itself, - inCollapseIt); + _err = HiliteWindowFrameForDrag(_self->ob_itself, + hilited); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_TransitionWindow(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowTransitionEffect effect; + WindowTransitionAction action; + Rect rect; + if (!PyArg_ParseTuple(_args, "llO&", + &effect, + &action, + PyMac_GetRect, &rect)) + return NULL; + _err = TransitionWindow(_self->ob_itself, + effect, + action, + &rect); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; @@ -561,25 +979,6 @@ static PyObject *WinObj_SizeWindow(_self, _args) return _res; } -static PyObject *WinObj_ZoomWindow(_self, _args) - WindowObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - short partCode; - Boolean front; - if (!PyArg_ParseTuple(_args, "hb", - &partCode, - &front)) - return NULL; - ZoomWindow(_self->ob_itself, - partCode, - front); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *WinObj_GrowWindow(_self, _args) WindowObject *_self; PyObject *_args; @@ -619,6 +1018,228 @@ static PyObject *WinObj_DragWindow(_self, _args) return _res; } +static PyObject *WinObj_ZoomWindow(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + short partCode; + Boolean front; + if (!PyArg_ParseTuple(_args, "hb", + &partCode, + &front)) + return NULL; + ZoomWindow(_self->ob_itself, + partCode, + front); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_IsWindowCollapsable(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsWindowCollapsable(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *WinObj_IsWindowCollapsed(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsWindowCollapsed(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *WinObj_CollapseWindow(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Boolean collapse; + if (!PyArg_ParseTuple(_args, "b", + &collapse)) + return NULL; + _err = CollapseWindow(_self->ob_itself, + collapse); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_RepositionWindow(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowPtr parentWindow; + WindowPositionMethod method; + if (!PyArg_ParseTuple(_args, "O&l", + WinObj_Convert, &parentWindow, + &method)) + return NULL; + _err = RepositionWindow(_self->ob_itself, + parentWindow, + method); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_SetWindowBounds(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowRegionCode regionCode; + Rect globalBounds; + if (!PyArg_ParseTuple(_args, "hO&", + ®ionCode, + PyMac_GetRect, &globalBounds)) + return NULL; + _err = SetWindowBounds(_self->ob_itself, + regionCode, + &globalBounds); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_GetWindowBounds(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowRegionCode regionCode; + Rect globalBounds; + if (!PyArg_ParseTuple(_args, "h", + ®ionCode)) + return NULL; + _err = GetWindowBounds(_self->ob_itself, + regionCode, + &globalBounds); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &globalBounds); + return _res; +} + +static PyObject *WinObj_MoveWindowStructure(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + short hGlobal; + short vGlobal; + if (!PyArg_ParseTuple(_args, "hh", + &hGlobal, + &vGlobal)) + return NULL; + _err = MoveWindowStructure(_self->ob_itself, + hGlobal, + vGlobal); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *WinObj_IsWindowInStandardState(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + Point idealSize; + Rect idealStandardState; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsWindowInStandardState(_self->ob_itself, + &idealSize, + &idealStandardState); + _res = Py_BuildValue("bO&O&", + _rv, + PyMac_BuildPoint, idealSize, + PyMac_BuildRect, &idealStandardState); + return _res; +} + +static PyObject *WinObj_ZoomWindowIdeal(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + SInt16 partCode; + Point ioIdealSize; + if (!PyArg_ParseTuple(_args, "h", + &partCode)) + return NULL; + _err = ZoomWindowIdeal(_self->ob_itself, + partCode, + &ioIdealSize); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildPoint, ioIdealSize); + return _res; +} + +static PyObject *WinObj_GetWindowIdealUserState(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Rect userState; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = GetWindowIdealUserState(_self->ob_itself, + &userState); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &userState); + return _res; +} + +static PyObject *WinObj_SetWindowIdealUserState(_self, _args) + WindowObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + Rect userState; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = SetWindowIdealUserState(_self->ob_itself, + &userState); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &userState); + return _res; +} + static PyObject *WinObj_HideWindow(_self, _args) WindowObject *_self; PyObject *_args; @@ -1047,8 +1668,24 @@ static PyObject *WinObj_ShowWindow(_self, _args) static PyMethodDef WinObj_methods[] = { {"MacCloseWindow", (PyCFunction)WinObj_MacCloseWindow, 1, "() -> None"}, + {"GetWindowOwnerCount", (PyCFunction)WinObj_GetWindowOwnerCount, 1, + "() -> (UInt32 outCount)"}, + {"CloneWindow", (PyCFunction)WinObj_CloneWindow, 1, + "() -> None"}, + {"GetWindowClass", (PyCFunction)WinObj_GetWindowClass, 1, + "() -> (WindowClass outClass)"}, + {"GetWindowAttributes", (PyCFunction)WinObj_GetWindowAttributes, 1, + "() -> (WindowAttributes outAttributes)"}, {"SetWinColor", (PyCFunction)WinObj_SetWinColor, 1, "(WCTabHandle newColorTable) -> None"}, + {"SetWindowContentColor", (PyCFunction)WinObj_SetWindowContentColor, 1, + "() -> (RGBColor color)"}, + {"GetWindowContentColor", (PyCFunction)WinObj_GetWindowContentColor, 1, + "() -> (RGBColor color)"}, + {"GetWindowContentPattern", (PyCFunction)WinObj_GetWindowContentPattern, 1, + "(PixPatHandle outPixPat) -> None"}, + {"SetWindowContentPattern", (PyCFunction)WinObj_SetWindowContentPattern, 1, + "(PixPatHandle pixPat) -> None"}, {"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1, "() -> None"}, {"SaveOld", (PyCFunction)WinObj_SaveOld, 1, @@ -1071,10 +1708,6 @@ static PyMethodDef WinObj_methods[] = { "() -> None"}, {"HiliteWindow", (PyCFunction)WinObj_HiliteWindow, 1, "(Boolean fHilite) -> None"}, - {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1, - "() -> (UInt32 outFeatures)"}, - {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, - "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"}, {"SetWRefCon", (PyCFunction)WinObj_SetWRefCon, 1, "(long data) -> None"}, {"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1, @@ -1085,32 +1718,88 @@ static PyMethodDef WinObj_methods[] = { "() -> (PicHandle _rv)"}, {"GetWVariant", (PyCFunction)WinObj_GetWVariant, 1, "() -> (short _rv)"}, + {"GetWindowFeatures", (PyCFunction)WinObj_GetWindowFeatures, 1, + "() -> (UInt32 outFeatures)"}, + {"GetWindowRegion", (PyCFunction)WinObj_GetWindowRegion, 1, + "(WindowRegionCode inRegionCode, RgnHandle ioWinRgn) -> None"}, {"BeginUpdate", (PyCFunction)WinObj_BeginUpdate, 1, "() -> None"}, {"EndUpdate", (PyCFunction)WinObj_EndUpdate, 1, "() -> None"}, + {"InvalWindowRgn", (PyCFunction)WinObj_InvalWindowRgn, 1, + "(RgnHandle region) -> None"}, + {"InvalWindowRect", (PyCFunction)WinObj_InvalWindowRect, 1, + "(Rect bounds) -> None"}, + {"ValidWindowRgn", (PyCFunction)WinObj_ValidWindowRgn, 1, + "(RgnHandle region) -> None"}, + {"ValidWindowRect", (PyCFunction)WinObj_ValidWindowRect, 1, + "(Rect bounds) -> None"}, {"DrawGrowIcon", (PyCFunction)WinObj_DrawGrowIcon, 1, "() -> None"}, {"SetWTitle", (PyCFunction)WinObj_SetWTitle, 1, "(Str255 title) -> None"}, {"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1, "() -> (Str255 title)"}, - {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, - "() -> (Boolean _rv)"}, - {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, + {"SetWindowProxyFSSpec", (PyCFunction)WinObj_SetWindowProxyFSSpec, 1, + "(FSSpec inFile) -> None"}, + {"GetWindowProxyFSSpec", (PyCFunction)WinObj_GetWindowProxyFSSpec, 1, + "() -> (FSSpec outFile)"}, + {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1, + "(AliasHandle alias) -> None"}, + {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1, + "() -> (AliasHandle alias)"}, + {"SetWindowProxyCreatorAndType", (PyCFunction)WinObj_SetWindowProxyCreatorAndType, 1, + "(OSType fileCreator, OSType fileType, SInt16 vRefNum) -> None"}, + {"GetWindowProxyIcon", (PyCFunction)WinObj_GetWindowProxyIcon, 1, + "() -> (IconRef outIcon)"}, + {"SetWindowProxyIcon", (PyCFunction)WinObj_SetWindowProxyIcon, 1, + "(IconRef icon) -> None"}, + {"RemoveWindowProxy", (PyCFunction)WinObj_RemoveWindowProxy, 1, + "() -> None"}, + {"TrackWindowProxyDrag", (PyCFunction)WinObj_TrackWindowProxyDrag, 1, + "(Point startPt) -> None"}, + {"IsWindowModified", (PyCFunction)WinObj_IsWindowModified, 1, "() -> (Boolean _rv)"}, - {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, - "(Boolean inCollapseIt) -> None"}, + {"SetWindowModified", (PyCFunction)WinObj_SetWindowModified, 1, + "(Boolean modified) -> None"}, + {"IsWindowPathSelectClick", (PyCFunction)WinObj_IsWindowPathSelectClick, 1, + "() -> (Boolean _rv, EventRecord event)"}, + {"HiliteWindowFrameForDrag", (PyCFunction)WinObj_HiliteWindowFrameForDrag, 1, + "(Boolean hilited) -> None"}, + {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, + "(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None"}, {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, "(short hGlobal, short vGlobal, Boolean front) -> None"}, {"SizeWindow", (PyCFunction)WinObj_SizeWindow, 1, "(short w, short h, Boolean fUpdate) -> None"}, - {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, - "(short partCode, Boolean front) -> None"}, {"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1, "(Point startPt, Rect bBox) -> (long _rv)"}, {"DragWindow", (PyCFunction)WinObj_DragWindow, 1, "(Point startPt, Rect boundsRect) -> None"}, + {"ZoomWindow", (PyCFunction)WinObj_ZoomWindow, 1, + "(short partCode, Boolean front) -> None"}, + {"IsWindowCollapsable", (PyCFunction)WinObj_IsWindowCollapsable, 1, + "() -> (Boolean _rv)"}, + {"IsWindowCollapsed", (PyCFunction)WinObj_IsWindowCollapsed, 1, + "() -> (Boolean _rv)"}, + {"CollapseWindow", (PyCFunction)WinObj_CollapseWindow, 1, + "(Boolean collapse) -> None"}, + {"RepositionWindow", (PyCFunction)WinObj_RepositionWindow, 1, + "(WindowPtr parentWindow, WindowPositionMethod method) -> None"}, + {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, + "(WindowRegionCode regionCode, Rect globalBounds) -> None"}, + {"GetWindowBounds", (PyCFunction)WinObj_GetWindowBounds, 1, + "(WindowRegionCode regionCode) -> (Rect globalBounds)"}, + {"MoveWindowStructure", (PyCFunction)WinObj_MoveWindowStructure, 1, + "(short hGlobal, short vGlobal) -> None"}, + {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, + "() -> (Boolean _rv, Point idealSize, Rect idealStandardState)"}, + {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, + "(SInt16 partCode) -> (Point ioIdealSize)"}, + {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, + "() -> (Rect userState)"}, + {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, + "() -> (Rect userState)"}, {"HideWindow", (PyCFunction)WinObj_HideWindow, 1, "() -> None"}, {"MacShowWindow", (PyCFunction)WinObj_MacShowWindow, 1, @@ -1181,6 +1870,12 @@ static PyObject *WinObj_getattr(self, name) #define WinObj_setattr NULL +#define WinObj_compare NULL + +#define WinObj_repr NULL + +#define WinObj_hash NULL + PyTypeObject Window_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -1192,6 +1887,12 @@ PyTypeObject Window_Type = { 0, /*tp_print*/ (getattrfunc) WinObj_getattr, /*tp_getattr*/ (setattrfunc) WinObj_setattr, /*tp_setattr*/ + (cmpfunc) WinObj_compare, /*tp_compare*/ + (reprfunc) WinObj_repr, /*tp_repr*/ + (PyNumberMethods *)0, /* tp_as_number */ + (PySequenceMethods *)0, /* tp_as_sequence */ + (PyMappingMethods *)0, /* tp_as_mapping */ + (hashfunc) WinObj_hash, /*tp_hash*/ }; /* --------------------- End object type Window --------------------- */ @@ -1307,6 +2008,108 @@ static PyObject *Win_NewCWindow(_self, _args) return _res; } +static PyObject *Win_CreateNewWindow(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + WindowClass windowClass; + WindowAttributes attributes; + Rect bounds; + WindowPtr outWindow; + if (!PyArg_ParseTuple(_args, "llO&", + &windowClass, + &attributes, + PyMac_GetRect, &bounds)) + return NULL; + _err = CreateNewWindow(windowClass, + attributes, + &bounds, + &outWindow); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + WinObj_WhichWindow, outWindow); + return _res; +} + +static PyObject *Win_CreateWindowFromResource(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + SInt16 resID; + WindowPtr outWindow; + if (!PyArg_ParseTuple(_args, "h", + &resID)) + return NULL; + _err = CreateWindowFromResource(resID, + &outWindow); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + WinObj_WhichWindow, outWindow); + return _res; +} + +static PyObject *Win_ShowFloatingWindows(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = ShowFloatingWindows(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Win_HideFloatingWindows(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = HideFloatingWindows(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *Win_AreFloatingWindowsVisible(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = AreFloatingWindowsVisible(); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Win_FrontNonFloatingWindow(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + WindowPtr _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = FrontNonFloatingWindow(); + _res = Py_BuildValue("O&", + WinObj_New, _rv); + return _res; +} + static PyObject *Win_SetDeskCPat(_self, _args) PyObject *_self; PyObject *_args; @@ -1345,15 +2148,15 @@ static PyObject *Win_MacFindWindow(_self, _args) PyObject *_res = NULL; short _rv; Point thePoint; - WindowPtr theWindow; + WindowPtr window; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetPoint, &thePoint)) return NULL; _rv = MacFindWindow(thePoint, - &theWindow); + &window); _res = Py_BuildValue("hO&", _rv, - WinObj_WhichWindow, theWindow); + WinObj_WhichWindow, window); return _res; } @@ -1412,6 +2215,37 @@ static PyObject *Win_GetCWMgrPort(_self, _args) return _res; } +static PyObject *Win_IsValidWindowPtr(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + Boolean _rv; + GrafPtr grafPort; + if (!PyArg_ParseTuple(_args, "O&", + GrafObj_Convert, &grafPort)) + return NULL; + _rv = IsValidWindowPtr(grafPort); + _res = Py_BuildValue("b", + _rv); + return _res; +} + +static PyObject *Win_InitFloatingWindows(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = InitFloatingWindows(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyObject *Win_InvalRect(_self, _args) PyObject *_self; PyObject *_args; @@ -1478,11 +2312,11 @@ static PyObject *Win_CollapseAllWindows(_self, _args) { PyObject *_res = NULL; OSStatus _err; - Boolean inCollapseEm; + Boolean collapse; if (!PyArg_ParseTuple(_args, "b", - &inCollapseEm)) + &collapse)) return NULL; - _err = CollapseAllWindows(inCollapseEm); + _err = CollapseAllWindows(collapse); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; @@ -1564,12 +2398,24 @@ static PyMethodDef Win_methods[] = { "(short windowID, WindowPtr behind) -> (WindowPtr _rv)"}, {"NewCWindow", (PyCFunction)Win_NewCWindow, 1, "(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"}, + {"CreateNewWindow", (PyCFunction)Win_CreateNewWindow, 1, + "(WindowClass windowClass, WindowAttributes attributes, Rect bounds) -> (WindowPtr outWindow)"}, + {"CreateWindowFromResource", (PyCFunction)Win_CreateWindowFromResource, 1, + "(SInt16 resID) -> (WindowPtr outWindow)"}, + {"ShowFloatingWindows", (PyCFunction)Win_ShowFloatingWindows, 1, + "() -> None"}, + {"HideFloatingWindows", (PyCFunction)Win_HideFloatingWindows, 1, + "() -> None"}, + {"AreFloatingWindowsVisible", (PyCFunction)Win_AreFloatingWindowsVisible, 1, + "() -> (Boolean _rv)"}, + {"FrontNonFloatingWindow", (PyCFunction)Win_FrontNonFloatingWindow, 1, + "() -> (WindowPtr _rv)"}, {"SetDeskCPat", (PyCFunction)Win_SetDeskCPat, 1, "(PixPatHandle deskPixPat) -> None"}, {"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1, "() -> (Boolean _rv, EventRecord theEvent)"}, {"MacFindWindow", (PyCFunction)Win_MacFindWindow, 1, - "(Point thePoint) -> (short _rv, WindowPtr theWindow)"}, + "(Point thePoint) -> (short _rv, WindowPtr window)"}, {"FrontWindow", (PyCFunction)Win_FrontWindow, 1, "() -> (WindowPtr _rv)"}, {"InitWindows", (PyCFunction)Win_InitWindows, 1, @@ -1578,6 +2424,10 @@ static PyMethodDef Win_methods[] = { "() -> (GrafPtr wPort)"}, {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1, "() -> (CGrafPtr wMgrCPort)"}, + {"IsValidWindowPtr", (PyCFunction)Win_IsValidWindowPtr, 1, + "(GrafPtr grafPort) -> (Boolean _rv)"}, + {"InitFloatingWindows", (PyCFunction)Win_InitFloatingWindows, 1, + "() -> None"}, {"InvalRect", (PyCFunction)Win_InvalRect, 1, "(Rect badRect) -> None"}, {"InvalRgn", (PyCFunction)Win_InvalRgn, 1, @@ -1587,7 +2437,7 @@ static PyMethodDef Win_methods[] = { {"ValidRgn", (PyCFunction)Win_ValidRgn, 1, "(RgnHandle goodRgn) -> None"}, {"CollapseAllWindows", (PyCFunction)Win_CollapseAllWindows, 1, - "(Boolean inCollapseEm) -> None"}, + "(Boolean collapse) -> None"}, {"PinRect", (PyCFunction)Win_PinRect, 1, "(Rect theRect, Point thePt) -> (long _rv)"}, {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1, diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py index f15fb16..d9ca18b 100644 --- a/Mac/Modules/win/winscan.py +++ b/Mac/Modules/win/winscan.py @@ -37,12 +37,18 @@ class MyScanner(Scanner): return [ 'DisposeWindow', # Implied when the object is deleted 'CloseWindow', + 'SetWindowProperty', # For the moment + 'GetWindowProperty', + 'GetWindowPropertySize', + 'RemoveWindowProperty', ] def makeblacklisttypes(self): return [ 'ProcPtr', 'DragGrayRgnUPP', + 'Collection', # For now, to be done later + 'DragReference', # Ditto, dragmodule doesn't export it yet. ] def makerepairinstructions(self): diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py index 6150819..a6104d8 100644 --- a/Mac/Modules/win/winsupport.py +++ b/Mac/Modules/win/winsupport.py @@ -34,12 +34,26 @@ PicHandle = OpaqueByValueType("PicHandle", "ResObj") WCTabHandle = OpaqueByValueType("WCTabHandle", "ResObj") AuxWinHandle = OpaqueByValueType("AuxWinHandle", "ResObj") PixPatHandle = OpaqueByValueType("PixPatHandle", "ResObj") +AliasHandle = OpaqueByValueType("AliasHandle", "ResObj") +IconRef = OpaqueByValueType("IconRef", "ResObj") WindowRegionCode = Type("WindowRegionCode", "h") +WindowClass = Type("WindowClass", "l") +WindowAttributes = Type("WindowAttributes", "l") +WindowPositionMethod = Type("WindowPositionMethod", "l") +WindowTransitionEffect = Type("WindowTransitionEffect", "l") +WindowTransitionAction = Type("WindowTransitionAction", "l") +WindowRegionCode = Type("WindowRegionCode", "h") +RGBColor = OpaqueType("RGBColor", "QdRGB") +PropertyCreator = OSTypeType("PropertyCreator") +PropertyTag = OSTypeType("PropertyTag") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ +extern PyObject *QdRGB_New(RGBColor *); +extern int QdRGB_Convert(PyObject *, RGBColor *); + #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ """ |