Adapted to Universal Headers 3.3.2. More to follow.

This commit is contained in:
Jack Jansen 2000-12-10 23:43:49 +00:00
parent c6c2838403
commit f7d5aa61d3
28 changed files with 3445 additions and 957 deletions

View File

@ -9,6 +9,7 @@
#include "pymactoolbox.h"
#include <AppleEvents.h>
#include <AEObjects.h>
static pascal OSErr GenericEventHandler(); /* Forward */
@ -69,34 +70,6 @@ static void AEDesc_dealloc(self)
PyMem_DEL(self);
}
static PyObject *AEDesc_AESend(_self, _args)
AEDescObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
AppleEvent reply;
AESendMode sendMode;
AESendPriority sendPriority;
long timeOutInTicks;
if (!PyArg_ParseTuple(_args, "lhl",
&sendMode,
&sendPriority,
&timeOutInTicks))
return NULL;
_err = AESend(&_self->ob_itself,
&reply,
sendMode,
sendPriority,
timeOutInTicks,
upp_AEIdleProc,
(AEFilterUPP)0);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &reply);
return _res;
}
static PyObject *AEDesc_AEResetTimer(_self, _args)
AEDescObject *_self;
PyObject *_args;
@ -672,9 +645,24 @@ static PyObject *AEDesc_AEPutAttributeDesc(_self, _args)
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *AEDesc_AEGetDescDataSize(_self, _args)
AEDescObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Size _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = AEGetDescDataSize(&_self->ob_itself);
_res = Py_BuildValue("l",
_rv);
return _res;
}
#endif
static PyMethodDef AEDesc_methods[] = {
{"AESend", (PyCFunction)AEDesc_AESend, 1,
"(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"},
{"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1,
"() -> None"},
{"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1,
@ -725,6 +713,11 @@ static PyMethodDef AEDesc_methods[] = {
"(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"},
{"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1,
"(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"},
#if TARGET_API_MAC_CARBON
{"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1,
"() -> (Size _rv)"},
#endif
{NULL, NULL, 0}
};
@ -941,6 +934,44 @@ static PyObject *AE_AEGetEventHandler(_self, _args)
return _res;
}
static PyObject *AE_AEInstallSpecialHandler(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
AEKeyword functionClass;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetOSType, &functionClass))
return NULL;
_err = AEInstallSpecialHandler(functionClass,
upp_GenericEventHandler,
0);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AE_AERemoveSpecialHandler(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
AEKeyword functionClass;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetOSType, &functionClass))
return NULL;
_err = AERemoveSpecialHandler(functionClass,
upp_GenericEventHandler,
0);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AE_AEManagerInfo(_self, _args)
PyObject *_self;
PyObject *_args;
@ -1072,6 +1103,35 @@ static PyObject *AE_AECreateAppleEvent(_self, _args)
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *AE_AEReplaceDescData(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
DescType typeCode;
char *dataPtr__in__;
long dataPtr__len__;
int dataPtr__in_len__;
AEDesc theAEDesc;
if (!PyArg_ParseTuple(_args, "O&s#",
PyMac_GetOSType, &typeCode,
&dataPtr__in__, &dataPtr__in_len__))
return NULL;
dataPtr__len__ = dataPtr__in_len__;
_err = AEReplaceDescData(typeCode,
dataPtr__in__, dataPtr__len__,
&theAEDesc);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &theAEDesc);
dataPtr__error__: ;
return _res;
}
#endif
static PyMethodDef AE_methods[] = {
{"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1,
"(EventRecord theEventRecord) -> None"},
@ -1087,6 +1147,10 @@ static PyMethodDef AE_methods[] = {
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"},
{"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1,
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"},
{"AEInstallSpecialHandler", (PyCFunction)AE_AEInstallSpecialHandler, 1,
"(AEKeyword functionClass) -> None"},
{"AERemoveSpecialHandler", (PyCFunction)AE_AERemoveSpecialHandler, 1,
"(AEKeyword functionClass) -> None"},
{"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1,
"(AEKeyword keyWord) -> (long result)"},
{"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1,
@ -1097,6 +1161,11 @@ static PyMethodDef AE_methods[] = {
"(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"},
{"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1,
"(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)"},
#if TARGET_API_MAC_CARBON
{"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1,
"(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)"},
#endif
{NULL, NULL, 0}
};
@ -1149,7 +1218,7 @@ void initAE()
AE_Error = PyMac_GetOSErrException();
if (AE_Error == NULL ||
PyDict_SetItemString(d, "Error", AE_Error) != 0)
Py_FatalError("can't initialize AE.Error");
return;
AEDesc_Type.ob_type = &PyType_Type;
Py_INCREF(&AEDesc_Type);
if (PyDict_SetItemString(d, "AEDescType", (PyObject *)&AEDesc_Type) != 0)

View File

@ -70,11 +70,19 @@ class AppleEventsScanner(Scanner):
return [
"AEDisposeDesc",
# "AEGetEventHandler",
"AEGetDescData", # Use object.data
"AEGetSpecialHandler",
# Constants with funny definitions
"kAEDontDisposeOnResume",
"kAEUseStandardDispatch",
]
def makegreylist(self):
return [
('#if TARGET_API_MAC_CARBON', [
'AEGetDescDataSize',
'AEReplaceDescData',
])]
def makeblacklisttypes(self):
return [
"ProcPtr",

View File

@ -83,6 +83,7 @@ AEMethod = OSErrMethodGenerator
includestuff = includestuff + """
#include <AppleEvents.h>
#include <AEObjects.h>
static pascal OSErr GenericEventHandler(); /* Forward */

View File

@ -1111,6 +1111,28 @@ static PyObject *App_GetThemeTextColor(_self, _args)
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *App_GetThemeMetric(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSStatus _err;
ThemeMetric inMetric;
SInt32 outMetric;
if (!PyArg_ParseTuple(_args, "l",
&inMetric))
return NULL;
_err = GetThemeMetric(inMetric,
&outMetric);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("l",
outMetric);
return _res;
}
#endif
static PyMethodDef App_methods[] = {
{"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1,
"() -> None"},
@ -1218,6 +1240,11 @@ static PyMethodDef App_methods[] = {
"(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"},
{"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1,
"(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"},
#if TARGET_API_MAC_CARBON
{"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1,
"(ThemeMetric inMetric) -> (SInt32 outMetric)"},
#endif
{NULL, NULL, 0}
};
@ -1237,7 +1264,7 @@ void initApp()
App_Error = PyMac_GetOSErrException();
if (App_Error == NULL ||
PyDict_SetItemString(d, "Error", App_Error) != 0)
Py_FatalError("can't initialize App.Error");
return;
}
/* ========================= End module App ========================= */

View File

@ -43,6 +43,12 @@ class MyScanner(Scanner):
"GetThemeFont", # Funny stringbuffer in/out parameter, I think...
]
def makegreylist(self):
return [
('#if TARGET_API_MAC_CARBON', [
'GetThemeMetric',
])]
def makeblacklisttypes(self):
return [
"MenuTitleDrawingUPP",

View File

@ -65,6 +65,7 @@ ThemeGrowDirection = Type("ThemeGrowDirection", "H")
ThemeSoundKind = OSTypeType("ThemeSoundKind")
ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind")
ThemeBackgroundKind = Type("ThemeBackgroundKind", "l")
ThemeMetric = Type("ThemeMetric", "l")
RGBColor = OpaqueType("RGBColor", "QdRGB")
includestuff = includestuff + """

View File

@ -831,7 +831,7 @@ void initCm()
Cm_Error = PyMac_GetOSErrException();
if (Cm_Error == NULL ||
PyDict_SetItemString(d, "Error", Cm_Error) != 0)
Py_FatalError("can't initialize Cm.Error");
return;
ComponentInstance_Type.ob_type = &PyType_Type;
Py_INCREF(&ComponentInstance_Type);
if (PyDict_SetItemString(d, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type) != 0)

View File

@ -56,6 +56,8 @@ class MyScanner(Scanner):
"CallComponentClose",
"CallComponentOpen",
"OpenAComponent",
"GetComponentPublicResource", # Missing in CW Pro 6
"CallComponentGetPublicResource", # Missing in CW Pro 6
]
def makegreylist(self):
@ -77,6 +79,8 @@ class MyScanner(Scanner):
"ComponentRoutineUPP",
"ComponentMPWorkFunctionUPP",
"ComponentFunctionUPP",
"GetMissingComponentResourceUPP",
]
def makerepairinstructions(self):

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,8 @@ from scantools import Scanner
from bgenlocations import TOOLBOXDIR
def main():
input = "Controls.h"
# input = "Controls.h" # Universal Headers < 3.3
input = ["Controls.h", "ControlDefinitions.h"] # Universal Headers >= 3.3
output = "ctlgen.py"
defsoutput = TOOLBOXDIR + "Controls.py"
scanner = MyScanner(input, output, defsoutput)
@ -85,14 +86,43 @@ class MyScanner(Scanner):
'GetAuxiliaryControlRecord',
'SetControlColor',
# These have suddenly disappeared in UH 3.3.2...
'GetBevelButtonMenuValue',
'SetBevelButtonMenuValue',
'GetBevelButtonMenuHandle',
'SetBevelButtonTransform',
'SetImageWellTransform',
'GetTabContentRect',
'SetTabEnabled',
'SetDisclosureTriangleLastValue',
## 'GetBevelButtonMenuValue',
## 'SetBevelButtonMenuValue',
## 'GetBevelButtonMenuHandle',
## 'SetBevelButtonTransform',
## 'SetImageWellTransform',
## 'GetTabContentRect',
## 'SetTabEnabled',
## 'SetDisclosureTriangleLastValue',
]),
('#if TARGET_API_MAC_CARBON', [
'IsAutomaticControlDragTrackingEnabledForWindow',
'SetAutomaticControlDragTrackingEnabledForWindow',
'GetControlByID',
'IsControlDragTrackingEnabled',
'SetControlDragTrackingEnabled',
'GetControlPropertyAttributes',
'ChangeControlPropertyAttributes',
'GetControlID',
'SetControlID',
'HandleControlSetCursor',
'GetControlClickActivation',
'HandleControlContextualMenuClick',
]),
('#if ACCESSOR_CALLS_ARE_FUNCTIONS', [
# XXX These are silly, they should be #defined to access the fields
# directly. Later...
'GetControlBounds',
'IsControlHilited',
'GetControlHilite',
'GetControlOwner',
'GetControlDataHandle',
'GetControlPopupMenuHandle',
'GetControlPopupMenuID',
'SetControlDataHandle',
'SetControlBounds',
'SetControlPopupMenuHandle',
'SetControlPopupMenuID',
])]
def makeblacklisttypes(self):
@ -101,6 +131,11 @@ class MyScanner(Scanner):
'ControlActionUPP',
'ControlButtonContentInfoPtr',
'Ptr',
'ControlDefSpec', # Don't know how to do this yet
'ControlDefSpec_ptr', # ditto
'Collection', # Ditto
'DragTrackingMessage', # Needs Drag module, must implement later
'DragReference', # ditto
]
def makerepairinstructions(self):

View File

@ -32,6 +32,8 @@ ControlPartCode = Type("ControlPartCode", "h")
DragConstraint = Type("DragConstraint", "H")
ControlVariant = Type("ControlVariant", "h")
IconTransformType = Type("IconTransformType", "h")
EventModifiers = Type("EventModifiers", "H")
ClickActivationResult = Type("ClickActivationResult", "l")
ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h")
ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h")
ControlButtonTextPlacement = Type("ControlButtonTextPlacement", "h")
@ -40,9 +42,14 @@ ControlFocusPart = Type("ControlFocusPart", "h")
ControlFontStyleRec = OpaqueType('ControlFontStyleRec', 'ControlFontStyle')
ControlFontStyleRec_ptr = ControlFontStyleRec
ControlID = OpaqueType('ControlID', 'PyControlID')
ControlID_ptr = ControlID
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
#ifndef kControlCheckBoxUncheckedValue
#include <ControlDefinitions.h>
#endif
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
@ -80,6 +87,26 @@ ControlFontStyle_Convert(v, itself)
QdRGB_Convert, &itself->backColor);
}
/*
** Parse/generate ControlID records
*/
static PyObject *
PyControlID_New(itself)
ControlID *itself;
{
return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
}
static int
PyControlID_Convert(v, itself)
PyObject *v;
ControlID *itself;
{
return PyArg_ParseTuple(v, "O&l", PyMac_GetOSType, &itself->signature, &itself->id);
}
/* TrackControl and HandleControlClick callback support */
static PyObject *tracker;
static ControlActionUPP mytracker_upp;

View File

@ -10,6 +10,13 @@
#include <Dialogs.h>
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
#define SetPortDialogPort(dlg) SetPort(dlg)
#define GetDialogPort(dlg) ((CGrafPtr)(dlg))
#define GetDialogFromWindow(win) ((DialogRef)(win))
#endif
/* XXX Shouldn't this be a stack? */
static PyObject *Dlg_FilterProc_callback = NULL;
@ -399,6 +406,63 @@ static PyObject *DlgObj_ShortenDITL(_self, _args)
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *DlgObj_InsertDialogItem(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSStatus _err;
DialogItemIndex afterItem;
DialogItemType itemType;
Handle itemHandle;
Rect box;
if (!PyArg_ParseTuple(_args, "hhO&O&",
&afterItem,
&itemType,
ResObj_Convert, &itemHandle,
PyMac_GetRect, &box))
return NULL;
_err = InsertDialogItem(_self->ob_itself,
afterItem,
itemType,
itemHandle,
&box);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *DlgObj_RemoveDialogItems(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSStatus _err;
DialogItemIndex itemNo;
DialogItemIndex amountToRemove;
Boolean disposeItemData;
if (!PyArg_ParseTuple(_args, "hhb",
&itemNo,
&amountToRemove,
&disposeItemData))
return NULL;
_err = RemoveDialogItems(_self->ob_itself,
itemNo,
amountToRemove,
disposeItemData);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
#endif
static PyObject *DlgObj_StdFilterProc(_self, _args)
DialogObject *_self;
PyObject *_args;
@ -666,7 +730,21 @@ static PyObject *DlgObj_GetDialogWindow(_self, _args)
return NULL;
_rv = GetDialogWindow(_self->ob_itself);
_res = Py_BuildValue("O&",
WinObj_WhichWindow, _rv);
WinObj_New, _rv);
return _res;
}
static PyObject *DlgObj_GetDialogTextEditHandle(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
TEHandle _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetDialogTextEditHandle(_self->ob_itself);
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
@ -712,6 +790,33 @@ static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args)
return _res;
}
static PyObject *DlgObj_SetPortDialogPort(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
SetPortDialogPort(_self->ob_itself);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *DlgObj_GetDialogPort(_self, _args)
DialogObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
CGrafPtr _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetDialogPort(_self->ob_itself);
_res = Py_BuildValue("O&",
GrafObj_New, _rv);
return _res;
}
#if !TARGET_API_MAC_CARBON
static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args)
@ -759,6 +864,16 @@ static PyMethodDef DlgObj_methods[] = {
"() -> (DialogItemIndex _rv)"},
{"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1,
"(DialogItemIndex numberItems) -> None"},
#if TARGET_API_MAC_CARBON
{"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1,
"(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None"},
#endif
#if TARGET_API_MAC_CARBON
{"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1,
"(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None"},
#endif
{"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1,
"() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"},
{"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1,
@ -787,12 +902,18 @@ static PyMethodDef DlgObj_methods[] = {
"() -> (EventMask outMask)"},
{"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
"() -> (WindowPtr _rv)"},
{"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1,
"() -> (TEHandle _rv)"},
{"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
"() -> (SInt16 _rv)"},
{"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
"() -> (SInt16 _rv)"},
{"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
"() -> (SInt16 _rv)"},
{"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1,
"() -> None"},
{"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1,
"() -> (CGrafPtr _rv)"},
#if !TARGET_API_MAC_CARBON
{"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1,
@ -1168,6 +1289,33 @@ static PyObject *Dlg_ResetAlertStage(_self, _args)
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *Dlg_GetParamText(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Str255 param0;
Str255 param1;
Str255 param2;
Str255 param3;
if (!PyArg_ParseTuple(_args, "O&O&O&O&",
PyMac_GetStr255, param0,
PyMac_GetStr255, param1,
PyMac_GetStr255, param2,
PyMac_GetStr255, param3))
return NULL;
GetParamText(param0,
param1,
param2,
param3);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
#endif
static PyObject *Dlg_NewFeaturesDialog(_self, _args)
PyObject *_self;
PyObject *_args;
@ -1209,6 +1357,22 @@ static PyObject *Dlg_NewFeaturesDialog(_self, _args)
return _res;
}
static PyObject *Dlg_GetDialogFromWindow(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
DialogPtr _rv;
WindowPtr window;
if (!PyArg_ParseTuple(_args, "O&",
WinObj_Convert, &window))
return NULL;
_rv = GetDialogFromWindow(window);
_res = Py_BuildValue("O&",
DlgObj_New, _rv);
return _res;
}
static PyObject *Dlg_SetUserItemHandler(_self, _args)
PyObject *_self;
PyObject *_args;
@ -1273,8 +1437,15 @@ static PyMethodDef Dlg_methods[] = {
"(SInt16 fontNum) -> None"},
{"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1,
"() -> None"},
#if TARGET_API_MAC_CARBON
{"GetParamText", (PyCFunction)Dlg_GetParamText, 1,
"(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
#endif
{"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1,
"(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)"},
{"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1,
"(WindowPtr window) -> (DialogPtr _rv)"},
{"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1,
NULL},
{NULL, NULL, 0}
@ -1282,6 +1453,17 @@ static PyMethodDef Dlg_methods[] = {
/* Return the WindowPtr corresponding to a DialogObject */
WindowPtr
DlgObj_ConvertToWindow(self)
PyObject *self;
{
if ( DlgObj_Check(self) )
return GetDialogWindow(((DialogObject *)self)->ob_itself);
return NULL;
}
void initDlg()
{
@ -1296,7 +1478,7 @@ void initDlg()
Dlg_Error = PyMac_GetOSErrException();
if (Dlg_Error == NULL ||
PyDict_SetItemString(d, "Error", Dlg_Error) != 0)
Py_FatalError("can't initialize Dlg.Error");
return;
Dialog_Type.ob_type = &PyType_Type;
Py_INCREF(&Dialog_Type);
if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0)

View File

@ -59,11 +59,18 @@ class MyScanner(Scanner):
return [
('#if !TARGET_API_MAC_CARBON', [
'SetGrafPortOfDialog',
]),
('#if TARGET_API_MAC_CARBON', [
'InsertDialogItem',
'RemoveDialogItems',
'GetParamText',
])]
def makeblacklisttypes(self):
return [
"AlertStdAlertParamPtr", # Too much work, for now
"AlertStdAlertParamRec", # ditto
"AlertStdAlertParamRec_ptr", # ditto
"QTModelessCallbackProcPtr",
]

View File

@ -19,6 +19,8 @@ ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterPr
ModalFilterUPP = ModalFilterProcPtr
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
TEHandle = OpaqueByValueType("TEHandle", "ResObj")
CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
DITLMethod = Type("DITLMethod", "h")
DialogItemIndex = Type("DialogItemIndex", "h")
@ -31,6 +33,13 @@ EventMask = Type("EventMask", "H")
includestuff = includestuff + """
#include <Dialogs.h>
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
#define SetPortDialogPort(dlg) SetPort(dlg)
#define GetDialogPort(dlg) ((CGrafPtr)(dlg))
#define GetDialogFromWindow(win) ((DialogRef)(win))
#endif
/* XXX Shouldn't this be a stack? */
static PyObject *Dlg_FilterProc_callback = NULL;
@ -178,14 +187,14 @@ for f in methods: object.add(f)
# Some methods that are currently macro's in C, but will be real routines
# in MacOS 8.
f = Method(ExistingWindowPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode))
object.add(f)
f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode))
object.add(f)
f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode))
object.add(f)
f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode))
object.add(f)
##f = Method(ExistingWindowPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode))
##object.add(f)
##f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode))
##object.add(f)
##f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode))
##object.add(f)
##f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode))
##object.add(f)
f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode),
condition='#if !TARGET_API_MAC_CARBON')
object.add(f)

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ OBJECTNAME = 'DragObj' # The basic name of the objects used here
# The following is *usually* unchanged but may still require tuning
MODPREFIX = MODNAME # The prefix for module-wide routines
OBJECTTYPE = 'DragReference' # The C type used to represent them
OBJECTTYPE = 'DragRef' # The C type used to represent them
OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
@ -21,31 +21,21 @@ from macsupport import *
# Create the type objects
DragReference = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
DragRef = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
DragItemRef = Type("ItemReference", "l")
# Old names
DragReference = DragRef
ItemReference = DragItemRef
##CCTabHandle = OpaqueByValueType("CCTabHandle", "ResObj")
##AuxCtlHandle = OpaqueByValueType("AuxCtlHandle", "ResObj")
##ControlPartCode = Type("ControlPartCode", "h")
##DragConstraint = Type("DragConstraint", "h")
##ControlVariant = Type("ControlVariant", "h")
##IconTransformType = Type("IconTransformType", "h")
##ControlButtonGraphicAlignment = Type("ControlButtonGraphicAlignment", "h")
##ControlButtonTextAlignment = Type("ControlButtonTextAlignment", "h")
##ControlButtonTextPlacement = Type("ControlButtonTextPlacement", "h")
##ControlContentType = Type("ControlContentType", "h")
##ControlFocusPart = Type("ControlFocusPart", "h")
##
##ControlFontStyleRec = OpaqueType('ControlFontStyleRec', 'ControlFontStyle')
##ControlFontStyleRec_ptr = ControlFontStyleRec
PixMapHandle = OpaqueByValueType("PixMapHandle", "ResObj")
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
AEDesc = OpaqueType('AEDesc')
AEDesc_ptr = AEDesc
RGBColor = OpaqueType("RGBColor", "QdRGB")
ItemReference = Type("ItemReference", "l")
FlavorType = OSTypeType("FlavorType")
DragAttributes = Type("DragAttributes", "l")
DragBehaviors = Type("DragBehaviors", "l")
DragImageFlags = Type("DragImageFlags", "l")
DragImageTranslucency = Type("DragImageTranslucency", "l")
DragRegionMessage = Type("DragRegionMessage", "h")

View File

@ -316,6 +316,57 @@ static PyObject *Evt_SystemEvent(_self, _args)
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *Evt_GetGlobalMouse(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Point globalMouse;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
GetGlobalMouse(&globalMouse);
_res = Py_BuildValue("O&",
PyMac_BuildPoint, globalMouse);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *Evt_GetCurrentKeyModifiers(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetCurrentKeyModifiers();
_res = Py_BuildValue("l",
_rv);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *Evt_CheckEventQueueForUserCancel(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CheckEventQueueForUserCancel();
_res = Py_BuildValue("b",
_rv);
return _res;
}
#endif
static PyObject *Evt_WaitNextEvent(_self, _args)
PyObject *_self;
PyObject *_args;
@ -396,6 +447,21 @@ static PyMethodDef Evt_methods[] = {
{"SystemEvent", (PyCFunction)Evt_SystemEvent, 1,
"(EventRecord theEvent) -> (Boolean _rv)"},
#endif
#if TARGET_API_MAC_CARBON
{"GetGlobalMouse", (PyCFunction)Evt_GetGlobalMouse, 1,
"() -> (Point globalMouse)"},
#endif
#if TARGET_API_MAC_CARBON
{"GetCurrentKeyModifiers", (PyCFunction)Evt_GetCurrentKeyModifiers, 1,
"() -> (UInt32 _rv)"},
#endif
#if TARGET_API_MAC_CARBON
{"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1,
"() -> (Boolean _rv)"},
#endif
{"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
"(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"},
{NULL, NULL, 0}
@ -417,7 +483,7 @@ void initEvt()
Evt_Error = PyMac_GetOSErrException();
if (Evt_Error == NULL ||
PyDict_SetItemString(d, "Error", Evt_Error) != 0)
Py_FatalError("can't initialize Evt.Error");
return;
}
/* ========================= End module Evt ========================= */

View File

@ -43,6 +43,11 @@ class MyScanner(Scanner):
'SystemClick',
'GetOSEvent',
'OSEventAvail',
]),
('#if TARGET_API_MAC_CARBON', [
'CheckEventQueueForUserCancel',
'GetCurrentKeyModifiers',
'GetGlobalMouse',
])]
def makeblacklistnames(self):

View File

@ -319,14 +319,14 @@ static PyObject *Fm_SetAntiAliasedTextEnabled(_self, _args)
{
PyObject *_res = NULL;
OSStatus _err;
Boolean inEnable;
SInt16 inMinFontSize;
Boolean iEnable;
SInt16 iMinFontSize;
if (!PyArg_ParseTuple(_args, "bh",
&inEnable,
&inMinFontSize))
&iEnable,
&iMinFontSize))
return NULL;
_err = SetAntiAliasedTextEnabled(inEnable,
inMinFontSize);
_err = SetAntiAliasedTextEnabled(iEnable,
iMinFontSize);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
@ -339,13 +339,13 @@ static PyObject *Fm_IsAntiAliasedTextEnabled(_self, _args)
{
PyObject *_res = NULL;
Boolean _rv;
SInt16 outMinFontSize;
SInt16 oMinFontSize;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = IsAntiAliasedTextEnabled(&outMinFontSize);
_rv = IsAntiAliasedTextEnabled(&oMinFontSize);
_res = Py_BuildValue("bh",
_rv,
outMinFontSize);
oMinFontSize);
return _res;
}
@ -394,9 +394,9 @@ static PyMethodDef Fm_methods[] = {
{"GetAppFont", (PyCFunction)Fm_GetAppFont, 1,
"() -> (short _rv)"},
{"SetAntiAliasedTextEnabled", (PyCFunction)Fm_SetAntiAliasedTextEnabled, 1,
"(Boolean inEnable, SInt16 inMinFontSize) -> None"},
"(Boolean iEnable, SInt16 iMinFontSize) -> None"},
{"IsAntiAliasedTextEnabled", (PyCFunction)Fm_IsAntiAliasedTextEnabled, 1,
"() -> (Boolean _rv, SInt16 outMinFontSize)"},
"() -> (Boolean _rv, SInt16 oMinFontSize)"},
{NULL, NULL, 0}
};
@ -416,7 +416,7 @@ void initFm()
Fm_Error = PyMac_GetOSErrException();
if (Fm_Error == NULL ||
PyDict_SetItemString(d, "Error", Fm_Error) != 0)
Py_FatalError("can't initialize Fm.Error");
return;
}
/* ========================= End module Fm ========================== */

View File

@ -315,7 +315,7 @@ void initHelp()
Help_Error = PyMac_GetOSErrException();
if (Help_Error == NULL ||
PyDict_SetItemString(d, "Error", Help_Error) != 0)
Py_FatalError("can't initialize Help.Error");
return;
}
/* ======================== End module Help ========================= */

View File

@ -1248,6 +1248,120 @@ static PyObject *Icn_GetCustomIconsEnabled(_self, _args)
return _res;
}
static PyObject *Icn_IsIconRefMaskEmpty(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
IconRef iconRef;
if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &iconRef))
return NULL;
_rv = IsIconRefMaskEmpty(iconRef);
_res = Py_BuildValue("b",
_rv);
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *Icn_GetIconRefVariant(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
IconRef _rv;
IconRef inIconRef;
OSType inVariant;
IconTransformType outTransform;
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &inIconRef,
PyMac_GetOSType, &inVariant))
return NULL;
_rv = GetIconRefVariant(inIconRef,
inVariant,
&outTransform);
_res = Py_BuildValue("O&h",
ResObj_New, _rv,
outTransform);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *Icn_RegisterIconRefFromIconFile(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
OSType creator;
OSType iconType;
FSSpec iconFile;
IconRef theIconRef;
if (!PyArg_ParseTuple(_args, "O&O&O&",
PyMac_GetOSType, &creator,
PyMac_GetOSType, &iconType,
PyMac_GetFSSpec, &iconFile))
return NULL;
_err = RegisterIconRefFromIconFile(creator,
iconType,
&iconFile,
&theIconRef);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
ResObj_New, theIconRef);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *Icn_ReadIconFile(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
FSSpec iconFile;
IconFamilyHandle iconFamily;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetFSSpec, &iconFile))
return NULL;
_err = ReadIconFile(&iconFile,
&iconFamily);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
ResObj_New, iconFamily);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *Icn_WriteIconFile(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
IconFamilyHandle iconFamily;
FSSpec iconFile;
if (!PyArg_ParseTuple(_args, "O&O&",
ResObj_Convert, &iconFamily,
PyMac_GetFSSpec, &iconFile))
return NULL;
_err = WriteIconFile(iconFamily,
&iconFile);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
#endif
static PyMethodDef Icn_methods[] = {
{"GetCIcon", (PyCFunction)Icn_GetCIcon, 1,
"(SInt16 iconID) -> (CIconHandle _rv)"},
@ -1364,6 +1478,28 @@ static PyMethodDef Icn_methods[] = {
"(SInt16 vRefNum, Boolean enableCustomIcons) -> None"},
{"GetCustomIconsEnabled", (PyCFunction)Icn_GetCustomIconsEnabled, 1,
"(SInt16 vRefNum) -> (Boolean customIconsEnabled)"},
{"IsIconRefMaskEmpty", (PyCFunction)Icn_IsIconRefMaskEmpty, 1,
"(IconRef iconRef) -> (Boolean _rv)"},
#if TARGET_API_MAC_CARBON
{"GetIconRefVariant", (PyCFunction)Icn_GetIconRefVariant, 1,
"(IconRef inIconRef, OSType inVariant) -> (IconRef _rv, IconTransformType outTransform)"},
#endif
#if TARGET_API_MAC_CARBON
{"RegisterIconRefFromIconFile", (PyCFunction)Icn_RegisterIconRefFromIconFile, 1,
"(OSType creator, OSType iconType, FSSpec iconFile) -> (IconRef theIconRef)"},
#endif
#if TARGET_API_MAC_CARBON
{"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1,
"(FSSpec iconFile) -> (IconFamilyHandle iconFamily)"},
#endif
#if TARGET_API_MAC_CARBON
{"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1,
"(IconFamilyHandle iconFamily, FSSpec iconFile) -> None"},
#endif
{NULL, NULL, 0}
};
@ -1383,7 +1519,7 @@ void initIcn()
Icn_Error = PyMac_GetOSErrException();
if (Icn_Error == NULL ||
PyDict_SetItemString(d, "Error", Icn_Error) != 0)
Py_FatalError("can't initialize Icn.Error");
return;
}
/* ========================= End module Icn ========================= */

View File

@ -49,6 +49,12 @@ class MyScanner(Scanner):
return [
('#if !TARGET_API_MAC_CARBON', [
'IconServicesTerminate',
]),
('#if TARGET_API_MAC_CARBON', [
'WriteIconFile',
'ReadIconFile',
'RegisterIconRefFromIconFile',
'GetIconRefVariant',
])]
def makeblacklisttypes(self):

View File

@ -10,6 +10,31 @@
#include <Lists.h>
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetListPort(list) ((CGrafPtr)(*(list))->port)
#define GetListVerticalScrollBar(list) ((*(list))->vScroll)
#define GetListHorizontalScrollBar(list) ((*(list))->hScroll)
#define GetListActive(list) ((*(list))->lActive)
#define GetListClickTime(list) ((*(list))->clikTime)
#define GetListRefCon(list) ((*(list))->refCon)
#define GetListDefinition(list) ((*(list))->listDefProc) /* XXX Is this indeed the same? */
#define GetListUserHandle(list) ((*(list))->userHandle)
#define GetListDataHandle(list) ((*(list))->cells)
#define GetListFlags(list) ((*(list))->listFlags)
#define GetListSelectionFlags(list) ((*(list))->selFlags)
#define SetListViewBounds(list, bounds) (((*(list))->rView) = *(bounds))
#define SetListPort(list, port) (((*(list))->port) = (GrafPtr)(port))
#define SetListCellIndent(list, ind) (((*(list))->indent) = *(ind))
#define SetListClickTime(list, time) (((*(list))->clikTime) = (time))
#define SetListLastClick(list, click) (((*(list)->lastClick) = *(click))
#define SetListRefCon(list, refcon) (((*(list))->refCon) = (refcon))
#define SetListUserHandle(list, handle) (((*(list))->userHandle) = (handle))
#define SetListFlags(list, flags) (((*(list))->listFlags) = (flags))
#define SetListSelectionFlags(list, flags) (((*(list))->selFlags) = (flags))
#endif
#define as_List(x) ((ListHandle)x)
#define as_Resource(lh) ((Handle)lh)
@ -649,6 +674,325 @@ static PyObject *List_LNew(_self, _args)
return _res;
}
static PyObject *List_GetListPort(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
CGrafPtr _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListPort(list);
_res = Py_BuildValue("O&",
GrafObj_New, _rv);
return _res;
}
static PyObject *List_GetListVerticalScrollBar(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ControlHandle _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListVerticalScrollBar(list);
_res = Py_BuildValue("O&",
CtlObj_New, _rv);
return _res;
}
static PyObject *List_GetListHorizontalScrollBar(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ControlHandle _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListHorizontalScrollBar(list);
_res = Py_BuildValue("O&",
CtlObj_New, _rv);
return _res;
}
static PyObject *List_GetListActive(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Boolean _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListActive(list);
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *List_GetListClickTime(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
SInt32 _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListClickTime(list);
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *List_GetListRefCon(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
SInt32 _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListRefCon(list);
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *List_GetListDefinition(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Handle _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListDefinition(list);
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
static PyObject *List_GetListUserHandle(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Handle _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListUserHandle(list);
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
static PyObject *List_GetListDataHandle(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
DataHandle _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListDataHandle(list);
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
static PyObject *List_GetListFlags(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OptionBits _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListFlags(list);
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *List_GetListSelectionFlags(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OptionBits _rv;
ListHandle list;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
_rv = GetListSelectionFlags(list);
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *List_SetListViewBounds(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
Rect view;
if (!PyArg_ParseTuple(_args, "O&O&",
ListObj_Convert, &list,
PyMac_GetRect, &view))
return NULL;
SetListViewBounds(list,
&view);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_SetListPort(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
CGrafPtr port;
if (!PyArg_ParseTuple(_args, "O&O&",
ListObj_Convert, &list,
GrafObj_Convert, &port))
return NULL;
SetListPort(list,
port);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_SetListCellIndent(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
Point indent;
if (!PyArg_ParseTuple(_args, "O&",
ListObj_Convert, &list))
return NULL;
SetListCellIndent(list,
&indent);
_res = Py_BuildValue("O&",
PyMac_BuildPoint, indent);
return _res;
}
static PyObject *List_SetListClickTime(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
SInt32 time;
if (!PyArg_ParseTuple(_args, "O&l",
ListObj_Convert, &list,
&time))
return NULL;
SetListClickTime(list,
time);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_SetListRefCon(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
SInt32 refCon;
if (!PyArg_ParseTuple(_args, "O&l",
ListObj_Convert, &list,
&refCon))
return NULL;
SetListRefCon(list,
refCon);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_SetListUserHandle(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
Handle userHandle;
if (!PyArg_ParseTuple(_args, "O&O&",
ListObj_Convert, &list,
ResObj_Convert, &userHandle))
return NULL;
SetListUserHandle(list,
userHandle);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_SetListFlags(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
OptionBits listFlags;
if (!PyArg_ParseTuple(_args, "O&l",
ListObj_Convert, &list,
&listFlags))
return NULL;
SetListFlags(list,
listFlags);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_SetListSelectionFlags(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
ListHandle list;
OptionBits selectionFlags;
if (!PyArg_ParseTuple(_args, "O&l",
ListObj_Convert, &list,
&selectionFlags))
return NULL;
SetListSelectionFlags(list,
selectionFlags);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *List_as_List(_self, _args)
PyObject *_self;
PyObject *_args;
@ -668,6 +1012,44 @@ static PyObject *List_as_List(_self, _args)
static PyMethodDef List_methods[] = {
{"LNew", (PyCFunction)List_LNew, 1,
"(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)"},
{"GetListPort", (PyCFunction)List_GetListPort, 1,
"(ListHandle list) -> (CGrafPtr _rv)"},
{"GetListVerticalScrollBar", (PyCFunction)List_GetListVerticalScrollBar, 1,
"(ListHandle list) -> (ControlHandle _rv)"},
{"GetListHorizontalScrollBar", (PyCFunction)List_GetListHorizontalScrollBar, 1,
"(ListHandle list) -> (ControlHandle _rv)"},
{"GetListActive", (PyCFunction)List_GetListActive, 1,
"(ListHandle list) -> (Boolean _rv)"},
{"GetListClickTime", (PyCFunction)List_GetListClickTime, 1,
"(ListHandle list) -> (SInt32 _rv)"},
{"GetListRefCon", (PyCFunction)List_GetListRefCon, 1,
"(ListHandle list) -> (SInt32 _rv)"},
{"GetListDefinition", (PyCFunction)List_GetListDefinition, 1,
"(ListHandle list) -> (Handle _rv)"},
{"GetListUserHandle", (PyCFunction)List_GetListUserHandle, 1,
"(ListHandle list) -> (Handle _rv)"},
{"GetListDataHandle", (PyCFunction)List_GetListDataHandle, 1,
"(ListHandle list) -> (DataHandle _rv)"},
{"GetListFlags", (PyCFunction)List_GetListFlags, 1,
"(ListHandle list) -> (OptionBits _rv)"},
{"GetListSelectionFlags", (PyCFunction)List_GetListSelectionFlags, 1,
"(ListHandle list) -> (OptionBits _rv)"},
{"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1,
"(ListHandle list, Rect view) -> None"},
{"SetListPort", (PyCFunction)List_SetListPort, 1,
"(ListHandle list, CGrafPtr port) -> None"},
{"SetListCellIndent", (PyCFunction)List_SetListCellIndent, 1,
"(ListHandle list) -> (Point indent)"},
{"SetListClickTime", (PyCFunction)List_SetListClickTime, 1,
"(ListHandle list, SInt32 time) -> None"},
{"SetListRefCon", (PyCFunction)List_SetListRefCon, 1,
"(ListHandle list, SInt32 refCon) -> None"},
{"SetListUserHandle", (PyCFunction)List_SetListUserHandle, 1,
"(ListHandle list, Handle userHandle) -> None"},
{"SetListFlags", (PyCFunction)List_SetListFlags, 1,
"(ListHandle list, OptionBits listFlags) -> None"},
{"SetListSelectionFlags", (PyCFunction)List_SetListSelectionFlags, 1,
"(ListHandle list, OptionBits selectionFlags) -> None"},
{"as_List", (PyCFunction)List_as_List, 1,
"(Resource)->List.\nReturns List object (which is not auto-freed!)"},
{NULL, NULL, 0}
@ -689,7 +1071,7 @@ void initList()
List_Error = PyMac_GetOSErrException();
if (List_Error == NULL ||
PyDict_SetItemString(d, "Error", List_Error) != 0)
Py_FatalError("can't initialize List.Error");
return;
List_Type.ob_type = &PyType_Type;
Py_INCREF(&List_Type);
if (PyDict_SetItemString(d, "ListType", (PyObject *)&List_Type) != 0)

View File

@ -40,10 +40,24 @@ class MyScanner(Scanner):
"LDispose", # Done by removing the object
"LSearch", # We don't want to handle procs just yet
"LGetCellDataLocation", # What does this do??
# These have funny argument/return values
"GetListViewBounds",
"GetListCellIndent",
"GetListCellSize",
"GetListVisibleCells",
"GetListClickLocation",
"GetListMouseLocation",
"GetListDataBounds",
"SetListLastClick",
]
def makeblacklisttypes(self):
return [
'ListDefSpec', # Too difficult for now
'ListDefSpec_ptr', # ditto
"ListDefUPP",
"ListClickLoopUPP",
]
def makerepairinstructions(self):

View File

@ -22,16 +22,46 @@ from macsupport import *
# Create the type objects
ListHandle = OpaqueByValueType("ListHandle", "ListObj")
ListRef = ListHandle # Obsolete, but used in Lists.h
Cell = Point
ListBounds = Rect
ListBounds_ptr = Rect_ptr
VarOutBufferShortsize = VarHeapOutputBufferType('char', 'short', 's') # (buf, &len)
InBufferShortsize = VarInputBufferType('char', 'short', 's') # (buf, len)
RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
DataHandle = OpaqueByValueType("DataHandle", "ResObj")
Handle = OpaqueByValueType("Handle", "ResObj")
CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetListPort(list) ((CGrafPtr)(*(list))->port)
#define GetListVerticalScrollBar(list) ((*(list))->vScroll)
#define GetListHorizontalScrollBar(list) ((*(list))->hScroll)
#define GetListActive(list) ((*(list))->lActive)
#define GetListClickTime(list) ((*(list))->clikTime)
#define GetListRefCon(list) ((*(list))->refCon)
#define GetListDefinition(list) ((*(list))->listDefProc) /* XXX Is this indeed the same? */
#define GetListUserHandle(list) ((*(list))->userHandle)
#define GetListDataHandle(list) ((*(list))->cells)
#define GetListFlags(list) ((*(list))->listFlags)
#define GetListSelectionFlags(list) ((*(list))->selFlags)
#define SetListViewBounds(list, bounds) (((*(list))->rView) = *(bounds))
#define SetListPort(list, port) (((*(list))->port) = (GrafPtr)(port))
#define SetListCellIndent(list, ind) (((*(list))->indent) = *(ind))
#define SetListClickTime(list, time) (((*(list))->clikTime) = (time))
#define SetListLastClick(list, click) (((*(list)->lastClick) = *(click))
#define SetListRefCon(list, refcon) (((*(list))->refCon) = (refcon))
#define SetListUserHandle(list, handle) (((*(list))->userHandle) = (handle))
#define SetListFlags(list, flags) (((*(list))->listFlags) = (flags))
#define SetListSelectionFlags(list, flags) (((*(list))->selFlags) = (flags))
#endif
#define as_List(x) ((ListHandle)x)
#define as_Resource(lh) ((Handle)lh)
"""

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,10 @@ class MyScanner(Scanner):
"GetMenuItemPropertySize",
"SetMenuItemProperty",
"RemoveMenuItemProperty",
"SetMenuCommandProperty",
"GetMenuCommandProperty",
"GetMenuTitle", # Funny arg/returnvalue
"SetMenuTitle",
]
def makegreylist(self):
@ -55,6 +59,31 @@ class MyScanner(Scanner):
'SetMenuFlash',
'InitMenus',
'InitProcMenu',
]),
('#if TARGET_API_MAC_CARBON', [
'DisposeMenuBar',
'DuplicateMenuBar',
'CreateNewMenu',
'GetFontFamilyFromMenuSelection',
'UpdateStandardFontMenu',
'CreateStandardFontMenu',
'RemoveMenuCommandProperty',
'GetMenuCommandPropertySize',
'IsMenuCommandEnabled',
'DisableMenuCommand',
'EnableMenuCommand',
'GetIndMenuItemWithCommandID',
'CountMenuItemsWithCommandID',
'MenuHasEnabledItems',
'EnableAllMenuItems',
'DisableAllMenuItems',
'ChangeMenuItemAttributes',
'GetMenuItemAttributes',
'ChangeMenuAttributes',
'GetMenuAttributes',
'ChangeMenuItemPropertyAttributes',
'GetMenuItemPropertyAttributes',
])]
def makeblacklisttypes(self):
@ -64,6 +93,9 @@ class MyScanner(Scanner):
'MCTablePtr',
'AEDesc_ptr', # For now: doable, but not easy
'ProcessSerialNumber', # ditto
"MenuDefSpecPtr", # Too difficult for now
"MenuDefSpec_ptr", # ditto
"MenuTrackingData",
]
def makerepairinstructions(self):

View File

@ -25,13 +25,30 @@ from macsupport import *
MenuHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
MenuRef = MenuHandle
Handle = OpaqueByValueType("Handle", "ResObj")
MenuBarHandle = OpaqueByValueType("MenuBarHandle", "ResObj")
MenuID = Type("MenuID", "h")
MenuItemIndex = Type("MenuItemIndex", "h")
MenuCommand = Type("MenuCommand", "l")
MenuAttributes = Type("MenuAttributes", "l")
MenuItemAttributes = Type("MenuItemAttributes", "l")
unsigned_char = Type('unsigned char', 'b')
FMFontFamily = Type("FMFontFamily", "h")
FMFontStyle = Type("FMFontStyle", "h")
includestuff = includestuff + """
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <%s>""" % MACHEADERFILE + """
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetMenuID(menu) ((*(menu))->menuID)
#define GetMenuWidth(menu) ((*(menu))->menuWidth)
#define GetMenuHeight(menu) ((*(menu))->menuHeight)
#define SetMenuID(menu, id) ((*(menu))->menuID = (id))
#define SetMenuWidth(menu, width) ((*(menu))->menuWidth = (width))
#define SetMenuHeight(menu, height) ((*(menu))->menuHeight = (height))
#endif
#define as_Menu(h) ((MenuHandle)h)
#define as_Resource(h) ((Handle)h)
"""