summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2000-12-10 23:43:49 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2000-12-10 23:43:49 (GMT)
commitf7d5aa61d34cb7816ead2757860e5a66f7da0dcb (patch)
treefaba3f23c2f0fdfa74a156d441f6fa8945c337f8 /Mac/Modules
parentc6c283840316dec54244b311657511e95e742eb0 (diff)
downloadcpython-f7d5aa61d34cb7816ead2757860e5a66f7da0dcb.zip
cpython-f7d5aa61d34cb7816ead2757860e5a66f7da0dcb.tar.gz
cpython-f7d5aa61d34cb7816ead2757860e5a66f7da0dcb.tar.bz2
Adapted to Universal Headers 3.3.2. More to follow.
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/ae/AEmodule.c131
-rw-r--r--Mac/Modules/ae/aescan.py8
-rw-r--r--Mac/Modules/ae/aesupport.py1
-rw-r--r--Mac/Modules/app/Appmodule.c29
-rw-r--r--Mac/Modules/app/appscan.py6
-rw-r--r--Mac/Modules/app/appsupport.py1
-rw-r--r--Mac/Modules/cm/Cmmodule.c2
-rw-r--r--Mac/Modules/cm/cmscan.py4
-rw-r--r--Mac/Modules/ctl/Ctlmodule.c949
-rw-r--r--Mac/Modules/ctl/ctlscan.py53
-rw-r--r--Mac/Modules/ctl/ctlsupport.py27
-rw-r--r--Mac/Modules/dlg/Dlgmodule.c186
-rw-r--r--Mac/Modules/dlg/dlgscan.py7
-rw-r--r--Mac/Modules/dlg/dlgsupport.py25
-rw-r--r--Mac/Modules/drag/Dragmodule.c515
-rw-r--r--Mac/Modules/drag/dragsupport.py24
-rw-r--r--Mac/Modules/evt/Evtmodule.c68
-rw-r--r--Mac/Modules/evt/evtscan.py5
-rw-r--r--Mac/Modules/fm/Fmmodule.c24
-rw-r--r--Mac/Modules/help/Helpmodule.c2
-rw-r--r--Mac/Modules/icn/Icnmodule.c138
-rw-r--r--Mac/Modules/icn/icnscan.py6
-rw-r--r--Mac/Modules/list/Listmodule.c384
-rw-r--r--Mac/Modules/list/listscan.py14
-rw-r--r--Mac/Modules/list/listsupport.py30
-rw-r--r--Mac/Modules/menu/Menumodule.c890
-rw-r--r--Mac/Modules/menu/menuscan.py32
-rw-r--r--Mac/Modules/menu/menusupport.py19
28 files changed, 3034 insertions, 546 deletions
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c
index ab07544..d15c1d8 100644
--- a/Mac/Modules/ae/AEmodule.c
+++ b/Mac/Modules/ae/AEmodule.c
@@ -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)
diff --git a/Mac/Modules/ae/aescan.py b/Mac/Modules/ae/aescan.py
index b2174a8..b744489 100644
--- a/Mac/Modules/ae/aescan.py
+++ b/Mac/Modules/ae/aescan.py
@@ -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",
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index 9931f9d..1a13537 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -83,6 +83,7 @@ AEMethod = OSErrMethodGenerator
includestuff = includestuff + """
#include <AppleEvents.h>
+#include <AEObjects.h>
static pascal OSErr GenericEventHandler(); /* Forward */
diff --git a/Mac/Modules/app/Appmodule.c b/Mac/Modules/app/Appmodule.c
index fd12135..929c34f 100644
--- a/Mac/Modules/app/Appmodule.c
+++ b/Mac/Modules/app/Appmodule.c
@@ -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 ========================= */
diff --git a/Mac/Modules/app/appscan.py b/Mac/Modules/app/appscan.py
index 82bdd1b..9cfc598 100644
--- a/Mac/Modules/app/appscan.py
+++ b/Mac/Modules/app/appscan.py
@@ -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",
diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py
index 11b6d2f..bd314dd 100644
--- a/Mac/Modules/app/appsupport.py
+++ b/Mac/Modules/app/appsupport.py
@@ -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 + """
diff --git a/Mac/Modules/cm/Cmmodule.c b/Mac/Modules/cm/Cmmodule.c
index 79a1b7c..93a3e09 100644
--- a/Mac/Modules/cm/Cmmodule.c
+++ b/Mac/Modules/cm/Cmmodule.c
@@ -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)
diff --git a/Mac/Modules/cm/cmscan.py b/Mac/Modules/cm/cmscan.py
index 1c36eaa..1136fe5 100644
--- a/Mac/Modules/cm/cmscan.py
+++ b/Mac/Modules/cm/cmscan.py
@@ -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):
diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c
index 6007220..cd45260 100644
--- a/Mac/Modules/ctl/Ctlmodule.c
+++ b/Mac/Modules/ctl/Ctlmodule.c
@@ -9,6 +9,9 @@
#include "pymactoolbox.h"
#include <Controls.h>
+#ifndef kControlCheckBoxUncheckedValue
+#include <ControlDefinitions.h>
+#endif
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
@@ -46,6 +49,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;
@@ -378,6 +401,55 @@ static PyObject *CtlObj_TestControl(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_HandleControlContextualMenuClick(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point inWhere;
+ Boolean menuDisplayed;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &inWhere))
+ return NULL;
+ _err = HandleControlContextualMenuClick(_self->ob_itself,
+ inWhere,
+ &menuDisplayed);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ menuDisplayed);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetControlClickActivation(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point inWhere;
+ EventModifiers inModifiers;
+ ClickActivationResult outResult;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &inWhere,
+ &inModifiers))
+ return NULL;
+ _err = GetControlClickActivation(_self->ob_itself,
+ inWhere,
+ inModifiers,
+ &outResult);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outResult);
+ return _res;
+}
+#endif
+
static PyObject *CtlObj_HandleControlKey(_self, _args)
ControlObject *_self;
PyObject *_args;
@@ -386,8 +458,8 @@ static PyObject *CtlObj_HandleControlKey(_self, _args)
SInt16 _rv;
SInt16 inKeyCode;
SInt16 inCharCode;
- SInt16 inModifiers;
- if (!PyArg_ParseTuple(_args, "hhh",
+ EventModifiers inModifiers;
+ if (!PyArg_ParseTuple(_args, "hhH",
&inKeyCode,
&inCharCode,
&inModifiers))
@@ -401,6 +473,32 @@ static PyObject *CtlObj_HandleControlKey(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_HandleControlSetCursor(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Point localPoint;
+ EventModifiers modifiers;
+ Boolean cursorWasSet;
+ if (!PyArg_ParseTuple(_args, "O&H",
+ PyMac_GetPoint, &localPoint,
+ &modifiers))
+ return NULL;
+ _err = HandleControlSetCursor(_self->ob_itself,
+ localPoint,
+ modifiers,
+ &cursorWasSet);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ cursorWasSet);
+ return _res;
+}
+#endif
+
static PyObject *CtlObj_MoveControl(_self, _args)
ControlObject *_self;
PyObject *_args;
@@ -694,6 +792,47 @@ static PyObject *CtlObj_IsValidControlHandle(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_SetControlID(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlID inID;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyControlID_Convert, &inID))
+ return NULL;
+ _err = SetControlID(_self->ob_itself,
+ &inID);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetControlID(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ControlID outID;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlID(_self->ob_itself,
+ &outID);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyControlID_New, &outID);
+ return _res;
+}
+#endif
+
static PyObject *CtlObj_RemoveControlProperty(_self, _args)
ControlObject *_self;
PyObject *_args;
@@ -715,6 +854,62 @@ static PyObject *CtlObj_RemoveControlProperty(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_GetControlPropertyAttributes(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetControlPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_ChangeControlPropertyAttributes(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+ if (!PyArg_ParseTuple(_args, "O&O&ll",
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeControlPropertyAttributes(_self->ob_itself,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
static PyObject *CtlObj_GetControlRegion(_self, _args)
ControlObject *_self;
PyObject *_args;
@@ -819,102 +1014,188 @@ static PyObject *CtlObj_SetControlColor(_self, _args)
}
#endif
-#if !TARGET_API_MAC_CARBON
+static PyObject *CtlObj_SendControlMessage(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ SInt32 _rv;
+ SInt16 inMessage;
+ SInt32 inParam;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &inMessage,
+ &inParam))
+ return NULL;
+ _rv = SendControlMessage(_self->ob_itself,
+ inMessage,
+ inParam);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
-static PyObject *CtlObj_GetBevelButtonMenuValue(_self, _args)
+static PyObject *CtlObj_EmbedControl(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- SInt16 outValue;
- if (!PyArg_ParseTuple(_args, ""))
+ ControlHandle inContainer;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inContainer))
return NULL;
- _err = GetBevelButtonMenuValue(_self->ob_itself,
- &outValue);
+ _err = EmbedControl(_self->ob_itself,
+ inContainer);
if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("h",
- outValue);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-#endif
-
-#if !TARGET_API_MAC_CARBON
-static PyObject *CtlObj_SetBevelButtonMenuValue(_self, _args)
+static PyObject *CtlObj_AutoEmbedControl(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- SInt16 inValue;
- if (!PyArg_ParseTuple(_args, "h",
- &inValue))
+ WindowPtr inWindow;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &inWindow))
return NULL;
- _err = SetBevelButtonMenuValue(_self->ob_itself,
- inValue);
+ _err = AutoEmbedControl(_self->ob_itself,
+ inWindow);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-#endif
-
-#if !TARGET_API_MAC_CARBON
-static PyObject *CtlObj_GetBevelButtonMenuHandle(_self, _args)
+static PyObject *CtlObj_GetSuperControl(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- MenuHandle outHandle;
+ ControlHandle outParent;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = GetBevelButtonMenuHandle(_self->ob_itself,
- &outHandle);
+ _err = GetSuperControl(_self->ob_itself,
+ &outParent);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
- MenuObj_New, outHandle);
+ CtlObj_WhichControl, outParent);
return _res;
}
-#endif
-#if !TARGET_API_MAC_CARBON
+static PyObject *CtlObj_CountSubControls(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt16 outNumChildren;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CountSubControls(_self->ob_itself,
+ &outNumChildren);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("H",
+ outNumChildren);
+ return _res;
+}
-static PyObject *CtlObj_SetBevelButtonTransform(_self, _args)
+static PyObject *CtlObj_GetIndexedSubControl(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- IconTransformType transform;
- if (!PyArg_ParseTuple(_args, "h",
- &transform))
+ UInt16 inIndex;
+ ControlHandle outSubControl;
+ if (!PyArg_ParseTuple(_args, "H",
+ &inIndex))
return NULL;
- _err = SetBevelButtonTransform(_self->ob_itself,
- transform);
+ _err = GetIndexedSubControl(_self->ob_itself,
+ inIndex,
+ &outSubControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outSubControl);
+ return _res;
+}
+
+static PyObject *CtlObj_SetControlSupervisor(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ ControlHandle inBoss;
+ if (!PyArg_ParseTuple(_args, "O&",
+ CtlObj_Convert, &inBoss))
+ return NULL;
+ _err = SetControlSupervisor(_self->ob_itself,
+ inBoss);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-#endif
-#if !TARGET_API_MAC_CARBON
+static PyObject *CtlObj_GetControlFeatures(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ UInt32 outFeatures;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetControlFeatures(_self->ob_itself,
+ &outFeatures);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outFeatures);
+ return _res;
+}
-static PyObject *CtlObj_SetImageWellTransform(_self, _args)
+static PyObject *CtlObj_GetControlDataSize(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- IconTransformType inTransform;
- if (!PyArg_ParseTuple(_args, "h",
- &inTransform))
+ ControlPartCode inPart;
+ ResType inTagName;
+ Size outMaxSize;
+ if (!PyArg_ParseTuple(_args, "hO&",
+ &inPart,
+ PyMac_GetOSType, &inTagName))
return NULL;
- _err = SetImageWellTransform(_self->ob_itself,
- inTransform);
+ _err = GetControlDataSize(_self->ob_itself,
+ inPart,
+ inTagName,
+ &outMaxSize);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outMaxSize);
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *CtlObj_SetControlDragTrackingEnabled(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "b",
+ &tracks))
+ return NULL;
+ _err = SetControlDragTrackingEnabled(_self->ob_itself,
+ tracks);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
@@ -922,236 +1203,365 @@ static PyObject *CtlObj_SetImageWellTransform(_self, _args)
}
#endif
-#if !TARGET_API_MAC_CARBON
+#if TARGET_API_MAC_CARBON
-static PyObject *CtlObj_GetTabContentRect(_self, _args)
+static PyObject *CtlObj_IsControlDragTrackingEnabled(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
- OSErr _err;
- Rect outContentRect;
+ OSStatus _err;
+ Boolean tracks;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = GetTabContentRect(_self->ob_itself,
- &outContentRect);
+ _err = IsControlDragTrackingEnabled(_self->ob_itself,
+ &tracks);
if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ tracks);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlBounds(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Rect _rv;
+ Rect bounds;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlBounds(_self->ob_itself,
+ &bounds);
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildRect, &_rv,
+ PyMac_BuildRect, &bounds);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_IsControlHilited(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlHilited(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlHilite(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ UInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlHilite(_self->ob_itself);
+ _res = Py_BuildValue("H",
+ _rv);
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlOwner(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetControlOwner(_self->ob_itself);
_res = Py_BuildValue("O&",
- PyMac_BuildRect, &outContentRect);
+ WinObj_New, _rv);
return _res;
}
#endif
-#if !TARGET_API_MAC_CARBON
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
-static PyObject *CtlObj_SetTabEnabled(_self, _args)
+static PyObject *CtlObj_GetControlDataHandle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
- OSErr _err;
- SInt16 inTabToHilite;
- Boolean inEnabled;
- if (!PyArg_ParseTuple(_args, "hb",
- &inTabToHilite,
- &inEnabled))
+ Handle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = SetTabEnabled(_self->ob_itself,
- inTabToHilite,
- inEnabled);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetControlDataHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
#endif
-#if !TARGET_API_MAC_CARBON
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
-static PyObject *CtlObj_SetDisclosureTriangleLastValue(_self, _args)
+static PyObject *CtlObj_GetControlPopupMenuHandle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
- OSErr _err;
- SInt16 inValue;
- if (!PyArg_ParseTuple(_args, "h",
- &inValue))
+ MenuHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = SetDisclosureTriangleLastValue(_self->ob_itself,
- inValue);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetControlPopupMenuHandle(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, _rv);
return _res;
}
#endif
-static PyObject *CtlObj_SendControlMessage(_self, _args)
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_GetControlPopupMenuID(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
- SInt32 _rv;
- SInt16 inMessage;
- SInt32 inParam;
- if (!PyArg_ParseTuple(_args, "hl",
- &inMessage,
- &inParam))
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = SendControlMessage(_self->ob_itself,
- inMessage,
- inParam);
- _res = Py_BuildValue("l",
+ _rv = GetControlPopupMenuID(_self->ob_itself);
+ _res = Py_BuildValue("h",
_rv);
return _res;
}
+#endif
-static PyObject *CtlObj_EmbedControl(_self, _args)
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlDataHandle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
- OSErr _err;
- ControlHandle inContainer;
+ Handle dataHandle;
if (!PyArg_ParseTuple(_args, "O&",
- CtlObj_Convert, &inContainer))
+ ResObj_Convert, &dataHandle))
return NULL;
- _err = EmbedControl(_self->ob_itself,
- inContainer);
- if (_err != noErr) return PyMac_Error(_err);
+ SetControlDataHandle(_self->ob_itself,
+ dataHandle);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
+#endif
-static PyObject *CtlObj_AutoEmbedControl(_self, _args)
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlBounds(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
- OSErr _err;
- WindowPtr inWindow;
+ Rect bounds;
if (!PyArg_ParseTuple(_args, "O&",
- WinObj_Convert, &inWindow))
+ PyMac_GetRect, &bounds))
return NULL;
- _err = AutoEmbedControl(_self->ob_itself,
- inWindow);
- if (_err != noErr) return PyMac_Error(_err);
+ SetControlBounds(_self->ob_itself,
+ &bounds);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
+#endif
-static PyObject *CtlObj_GetSuperControl(_self, _args)
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlPopupMenuHandle(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ MenuHandle popupMenu;
+ if (!PyArg_ParseTuple(_args, "O&",
+ MenuObj_Convert, &popupMenu))
+ return NULL;
+ SetControlPopupMenuHandle(_self->ob_itself,
+ popupMenu);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+
+static PyObject *CtlObj_SetControlPopupMenuID(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ SetControlPopupMenuID(_self->ob_itself,
+ menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyObject *CtlObj_GetBevelButtonMenuValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- ControlHandle outParent;
+ SInt16 outValue;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = GetSuperControl(_self->ob_itself,
- &outParent);
+ _err = GetBevelButtonMenuValue(_self->ob_itself,
+ &outValue);
if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- CtlObj_WhichControl, outParent);
+ _res = Py_BuildValue("h",
+ outValue);
return _res;
}
-static PyObject *CtlObj_CountSubControls(_self, _args)
+static PyObject *CtlObj_SetBevelButtonMenuValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- UInt16 outNumChildren;
- if (!PyArg_ParseTuple(_args, ""))
+ SInt16 inValue;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inValue))
return NULL;
- _err = CountSubControls(_self->ob_itself,
- &outNumChildren);
+ _err = SetBevelButtonMenuValue(_self->ob_itself,
+ inValue);
if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("H",
- outNumChildren);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetIndexedSubControl(_self, _args)
+static PyObject *CtlObj_GetBevelButtonMenuHandle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- UInt16 inIndex;
- ControlHandle outSubControl;
- if (!PyArg_ParseTuple(_args, "H",
- &inIndex))
+ MenuHandle outHandle;
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = GetIndexedSubControl(_self->ob_itself,
- inIndex,
- &outSubControl);
+ _err = GetBevelButtonMenuHandle(_self->ob_itself,
+ &outHandle);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
- CtlObj_WhichControl, outSubControl);
+ MenuObj_New, outHandle);
return _res;
}
-static PyObject *CtlObj_SetControlSupervisor(_self, _args)
+static PyObject *CtlObj_SetBevelButtonTransform(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- ControlHandle inBoss;
- if (!PyArg_ParseTuple(_args, "O&",
- CtlObj_Convert, &inBoss))
+ IconTransformType transform;
+ if (!PyArg_ParseTuple(_args, "h",
+ &transform))
return NULL;
- _err = SetControlSupervisor(_self->ob_itself,
- inBoss);
+ _err = SetBevelButtonTransform(_self->ob_itself,
+ transform);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetControlFeatures(_self, _args)
+static PyObject *CtlObj_SetDisclosureTriangleLastValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- UInt32 outFeatures;
+ SInt16 inValue;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inValue))
+ return NULL;
+ _err = SetDisclosureTriangleLastValue(_self->ob_itself,
+ inValue);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_GetTabContentRect(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ Rect outContentRect;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = GetControlFeatures(_self->ob_itself,
- &outFeatures);
+ _err = GetTabContentRect(_self->ob_itself,
+ &outContentRect);
if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outFeatures);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outContentRect);
return _res;
}
-static PyObject *CtlObj_GetControlDataSize(_self, _args)
+static PyObject *CtlObj_SetTabEnabled(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- ControlPartCode inPart;
- ResType inTagName;
- Size outMaxSize;
- if (!PyArg_ParseTuple(_args, "hO&",
- &inPart,
- PyMac_GetOSType, &inTagName))
+ SInt16 inTabToHilite;
+ Boolean inEnabled;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &inTabToHilite,
+ &inEnabled))
return NULL;
- _err = GetControlDataSize(_self->ob_itself,
- inPart,
- inTagName,
- &outMaxSize);
+ _err = SetTabEnabled(_self->ob_itself,
+ inTabToHilite,
+ inEnabled);
if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outMaxSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *CtlObj_SetImageWellTransform(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ IconTransformType inTransform;
+ if (!PyArg_ParseTuple(_args, "h",
+ &inTransform))
+ return NULL;
+ _err = SetImageWellTransform(_self->ob_itself,
+ inTransform);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
@@ -1540,8 +1950,23 @@ static PyMethodDef CtlObj_methods[] = {
"(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None"},
{"TestControl", (PyCFunction)CtlObj_TestControl, 1,
"(Point testPoint) -> (ControlPartCode _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"HandleControlContextualMenuClick", (PyCFunction)CtlObj_HandleControlContextualMenuClick, 1,
+ "(Point inWhere) -> (Boolean menuDisplayed)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlClickActivation", (PyCFunction)CtlObj_GetControlClickActivation, 1,
+ "(Point inWhere, EventModifiers inModifiers) -> (ClickActivationResult outResult)"},
+#endif
{"HandleControlKey", (PyCFunction)CtlObj_HandleControlKey, 1,
- "(SInt16 inKeyCode, SInt16 inCharCode, SInt16 inModifiers) -> (SInt16 _rv)"},
+ "(SInt16 inKeyCode, SInt16 inCharCode, EventModifiers inModifiers) -> (SInt16 _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"HandleControlSetCursor", (PyCFunction)CtlObj_HandleControlSetCursor, 1,
+ "(Point localPoint, EventModifiers modifiers) -> (Boolean cursorWasSet)"},
+#endif
{"MoveControl", (PyCFunction)CtlObj_MoveControl, 1,
"(SInt16 h, SInt16 v) -> None"},
{"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
@@ -1580,8 +2005,28 @@ static PyMethodDef CtlObj_methods[] = {
"(SInt32 newMinimum) -> None"},
{"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1,
"() -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"SetControlID", (PyCFunction)CtlObj_SetControlID, 1,
+ "(ControlID inID) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlID", (PyCFunction)CtlObj_GetControlID, 1,
+ "() -> (ControlID outID)"},
+#endif
{"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1,
"(OSType propertyCreator, OSType propertyTag) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlPropertyAttributes", (PyCFunction)CtlObj_GetControlPropertyAttributes, 1,
+ "(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeControlPropertyAttributes", (PyCFunction)CtlObj_ChangeControlPropertyAttributes, 1,
+ "(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
+#endif
{"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1,
"(ControlPartCode inPart, RgnHandle outRegion) -> None"},
{"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
@@ -1600,46 +2045,6 @@ static PyMethodDef CtlObj_methods[] = {
{"SetControlColor", (PyCFunction)CtlObj_SetControlColor, 1,
"(CCTabHandle newColorTable) -> None"},
#endif
-
-#if !TARGET_API_MAC_CARBON
- {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1,
- "() -> (SInt16 outValue)"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1,
- "(SInt16 inValue) -> None"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1,
- "() -> (MenuHandle outHandle)"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1,
- "(IconTransformType transform) -> None"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1,
- "(IconTransformType inTransform) -> None"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1,
- "() -> (Rect outContentRect)"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1,
- "(SInt16 inTabToHilite, Boolean inEnabled) -> None"},
-#endif
-
-#if !TARGET_API_MAC_CARBON
- {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1,
- "(SInt16 inValue) -> None"},
-#endif
{"SendControlMessage", (PyCFunction)CtlObj_SendControlMessage, 1,
"(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"},
{"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1,
@@ -1658,6 +2063,87 @@ static PyMethodDef CtlObj_methods[] = {
"() -> (UInt32 outFeatures)"},
{"GetControlDataSize", (PyCFunction)CtlObj_GetControlDataSize, 1,
"(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)"},
+
+#if TARGET_API_MAC_CARBON
+ {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1,
+ "(Boolean tracks) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1,
+ "() -> (Boolean tracks)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1,
+ "() -> (Rect _rv, Rect bounds)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"IsControlHilited", (PyCFunction)CtlObj_IsControlHilited, 1,
+ "() -> (Boolean _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlHilite", (PyCFunction)CtlObj_GetControlHilite, 1,
+ "() -> (UInt16 _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlOwner", (PyCFunction)CtlObj_GetControlOwner, 1,
+ "() -> (WindowPtr _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1,
+ "() -> (Handle _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlPopupMenuHandle", (PyCFunction)CtlObj_GetControlPopupMenuHandle, 1,
+ "() -> (MenuHandle _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"GetControlPopupMenuID", (PyCFunction)CtlObj_GetControlPopupMenuID, 1,
+ "() -> (short _rv)"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlDataHandle", (PyCFunction)CtlObj_SetControlDataHandle, 1,
+ "(Handle dataHandle) -> None"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlBounds", (PyCFunction)CtlObj_SetControlBounds, 1,
+ "(Rect bounds) -> None"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlPopupMenuHandle", (PyCFunction)CtlObj_SetControlPopupMenuHandle, 1,
+ "(MenuHandle popupMenu) -> None"},
+#endif
+
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+ {"SetControlPopupMenuID", (PyCFunction)CtlObj_SetControlPopupMenuID, 1,
+ "(short menuID) -> None"},
+#endif
+ {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1,
+ "() -> (SInt16 outValue)"},
+ {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1,
+ "(SInt16 inValue) -> None"},
+ {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1,
+ "() -> (MenuHandle outHandle)"},
+ {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1,
+ "(IconTransformType transform) -> None"},
+ {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1,
+ "(SInt16 inValue) -> None"},
+ {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1,
+ "() -> (Rect outContentRect)"},
+ {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1,
+ "(SInt16 inTabToHilite, Boolean inEnabled) -> None"},
+ {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1,
+ "(IconTransformType inTransform) -> None"},
{"as_Resource", (PyCFunction)CtlObj_as_Resource, 1,
"() -> (Handle _rv)"},
{"GetControlRect", (PyCFunction)CtlObj_GetControlRect, 1,
@@ -1906,6 +2392,31 @@ static PyObject *Ctl_IdleControls(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Ctl_GetControlByID(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ ControlID inID;
+ ControlHandle outControl;
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ WinObj_Convert, &inWindow,
+ PyControlID_Convert, &inID))
+ return NULL;
+ _err = GetControlByID(inWindow,
+ &inID,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_WhichControl, outControl);
+ return _res;
+}
+#endif
+
static PyObject *Ctl_DumpControlHierarchy(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -2057,6 +2568,51 @@ static PyObject *Ctl_ClearKeyboardFocus(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Ctl_SetAutomaticControlDragTrackingEnabledForWindow(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr theWindow;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ WinObj_Convert, &theWindow,
+ &tracks))
+ return NULL;
+ _err = SetAutomaticControlDragTrackingEnabledForWindow(theWindow,
+ tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Ctl_IsAutomaticControlDragTrackingEnabledForWindow(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr theWindow;
+ Boolean tracks;
+ if (!PyArg_ParseTuple(_args, "O&",
+ WinObj_Convert, &theWindow))
+ return NULL;
+ _err = IsAutomaticControlDragTrackingEnabledForWindow(theWindow,
+ &tracks);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ tracks);
+ return _res;
+}
+#endif
+
static PyObject *Ctl_as_Control(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -2088,6 +2644,11 @@ static PyMethodDef Ctl_methods[] = {
"(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"},
{"IdleControls", (PyCFunction)Ctl_IdleControls, 1,
"(WindowPtr inWindow) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetControlByID", (PyCFunction)Ctl_GetControlByID, 1,
+ "(WindowPtr inWindow, ControlID inID) -> (ControlHandle outControl)"},
+#endif
{"DumpControlHierarchy", (PyCFunction)Ctl_DumpControlHierarchy, 1,
"(WindowPtr inWindow, FSSpec inDumpFile) -> None"},
{"CreateRootControl", (PyCFunction)Ctl_CreateRootControl, 1,
@@ -2104,6 +2665,16 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr inWindow) -> None"},
{"ClearKeyboardFocus", (PyCFunction)Ctl_ClearKeyboardFocus, 1,
"(WindowPtr inWindow) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1,
+ "(WindowPtr theWindow, Boolean tracks) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1,
+ "(WindowPtr theWindow) -> (Boolean tracks)"},
+#endif
{"as_Control", (PyCFunction)Ctl_as_Control, 1,
"(Handle h) -> (ControlHandle _rv)"},
{NULL, NULL, 0}
@@ -2320,7 +2891,7 @@ void initCtl()
Ctl_Error = PyMac_GetOSErrException();
if (Ctl_Error == NULL ||
PyDict_SetItemString(d, "Error", Ctl_Error) != 0)
- Py_FatalError("can't initialize Ctl.Error");
+ return;
Control_Type.ob_type = &PyType_Type;
Py_INCREF(&Control_Type);
if (PyDict_SetItemString(d, "ControlType", (PyObject *)&Control_Type) != 0)
diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py
index 9f9b20b..709fa10 100644
--- a/Mac/Modules/ctl/ctlscan.py
+++ b/Mac/Modules/ctl/ctlscan.py
@@ -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):
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index 064e1c5..ab2a999 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -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;
diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c
index b686839..3ab14a0 100644
--- a/Mac/Modules/dlg/Dlgmodule.c
+++ b/Mac/Modules/dlg/Dlgmodule.c
@@ -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)
diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py
index 3092dec..549d0b3 100644
--- a/Mac/Modules/dlg/dlgscan.py
+++ b/Mac/Modules/dlg/dlgscan.py
@@ -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",
]
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index f243cc1..e537c66 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -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)
diff --git a/Mac/Modules/drag/Dragmodule.c b/Mac/Modules/drag/Dragmodule.c
index 716d2d5..e3801b6 100644
--- a/Mac/Modules/drag/Dragmodule.c
+++ b/Mac/Modules/drag/Dragmodule.c
@@ -29,12 +29,12 @@ PyTypeObject DragObj_Type;
typedef struct DragObjObject {
PyObject_HEAD
- DragReference ob_itself;
+ DragRef ob_itself;
PyObject *sendproc;
} DragObjObject;
PyObject *DragObj_New(itself)
- DragReference itself;
+ DragRef itself;
{
DragObjObject *it;
if (itself == NULL) {
@@ -49,7 +49,7 @@ PyObject *DragObj_New(itself)
}
DragObj_Convert(v, p_itself)
PyObject *v;
- DragReference *p_itself;
+ DragRef *p_itself;
{
if (!DragObj_Check(v))
{
@@ -67,41 +67,104 @@ static void DragObj_dealloc(self)
PyMem_DEL(self);
}
-static PyObject *DragObj_DisposeDrag(_self, _args)
- DragObjObject *_self;
+static PyMethodDef DragObj_methods[] = {
+ {NULL, NULL, 0}
+};
+
+PyMethodChain DragObj_chain = { DragObj_methods, NULL };
+
+static PyObject *DragObj_getattr(self, name)
+ DragObjObject *self;
+ char *name;
+{
+ return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name);
+}
+
+#define DragObj_setattr NULL
+
+#define DragObj_compare NULL
+
+#define DragObj_repr NULL
+
+#define DragObj_hash NULL
+
+PyTypeObject DragObj_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ "DragObj", /*tp_name*/
+ sizeof(DragObjObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) DragObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc) DragObj_getattr, /*tp_getattr*/
+ (setattrfunc) DragObj_setattr, /*tp_setattr*/
+ (cmpfunc) DragObj_compare, /*tp_compare*/
+ (reprfunc) DragObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) DragObj_hash, /*tp_hash*/
+};
+
+/* -------------------- End object type DragObj --------------------- */
+
+
+static PyObject *Drag_NewDrag(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _err = DisposeDrag(_self->ob_itself);
+ _err = NewDrag(&theDrag);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ DragObj_New, theDrag);
+ return _res;
+}
+
+static PyObject *Drag_DisposeDrag(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragRef theDrag;
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
+ return NULL;
+ _err = DisposeDrag(theDrag);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *DragObj_AddDragItemFlavor(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_AddDragItemFlavor(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
FlavorType theType;
char *dataPtr__in__;
long dataPtr__len__;
int dataPtr__in_len__;
FlavorFlags theFlags;
- if (!PyArg_ParseTuple(_args, "lO&z#l",
+ if (!PyArg_ParseTuple(_args, "O&lO&z#l",
+ DragObj_Convert, &theDrag,
&theItemRef,
PyMac_GetOSType, &theType,
&dataPtr__in__, &dataPtr__in_len__,
&theFlags))
return NULL;
dataPtr__len__ = dataPtr__in_len__;
- _err = AddDragItemFlavor(_self->ob_itself,
+ _err = AddDragItemFlavor(theDrag,
theItemRef,
theType,
dataPtr__in__, dataPtr__len__,
@@ -113,26 +176,28 @@ static PyObject *DragObj_AddDragItemFlavor(_self, _args)
return _res;
}
-static PyObject *DragObj_SetDragItemFlavorData(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_SetDragItemFlavorData(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
FlavorType theType;
char *dataPtr__in__;
long dataPtr__len__;
int dataPtr__in_len__;
UInt32 dataOffset;
- if (!PyArg_ParseTuple(_args, "lO&z#l",
+ if (!PyArg_ParseTuple(_args, "O&lO&z#l",
+ DragObj_Convert, &theDrag,
&theItemRef,
PyMac_GetOSType, &theType,
&dataPtr__in__, &dataPtr__in_len__,
&dataOffset))
return NULL;
dataPtr__len__ = dataPtr__in_len__;
- _err = SetDragItemFlavorData(_self->ob_itself,
+ _err = SetDragItemFlavorData(theDrag,
theItemRef,
theType,
dataPtr__in__, dataPtr__len__,
@@ -144,23 +209,25 @@ static PyObject *DragObj_SetDragItemFlavorData(_self, _args)
return _res;
}
-static PyObject *DragObj_SetDragImage(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_SetDragImage(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
PixMapHandle imagePixMap;
RgnHandle imageRgn;
Point imageOffsetPt;
DragImageFlags theImageFlags;
- if (!PyArg_ParseTuple(_args, "O&O&O&l",
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&l",
+ DragObj_Convert, &theDrag,
ResObj_Convert, &imagePixMap,
ResObj_Convert, &imageRgn,
PyMac_GetPoint, &imageOffsetPt,
&theImageFlags))
return NULL;
- _err = SetDragImage(_self->ob_itself,
+ _err = SetDragImage(theDrag,
imagePixMap,
imageRgn,
imageOffsetPt,
@@ -171,19 +238,44 @@ static PyObject *DragObj_SetDragImage(_self, _args)
return _res;
}
-static PyObject *DragObj_TrackDrag(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_ChangeDragBehaviors(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ DragRef theDrag;
+ DragBehaviors inBehaviorsToSet;
+ DragBehaviors inBehaviorsToClear;
+ if (!PyArg_ParseTuple(_args, "O&ll",
+ DragObj_Convert, &theDrag,
+ &inBehaviorsToSet,
+ &inBehaviorsToClear))
+ return NULL;
+ _err = ChangeDragBehaviors(theDrag,
+ inBehaviorsToSet,
+ inBehaviorsToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Drag_TrackDrag(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
EventRecord theEvent;
RgnHandle theRegion;
- if (!PyArg_ParseTuple(_args, "O&O&",
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ DragObj_Convert, &theDrag,
PyMac_GetEventRecord, &theEvent,
ResObj_Convert, &theRegion))
return NULL;
- _err = TrackDrag(_self->ob_itself,
+ _err = TrackDrag(theDrag,
&theEvent,
theRegion);
if (_err != noErr) return PyMac_Error(_err);
@@ -192,16 +284,18 @@ static PyObject *DragObj_TrackDrag(_self, _args)
return _res;
}
-static PyObject *DragObj_CountDragItems(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_CountDragItems(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
UInt16 numItems;
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = CountDragItems(_self->ob_itself,
+ _err = CountDragItems(theDrag,
&numItems);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("H",
@@ -209,18 +303,20 @@ static PyObject *DragObj_CountDragItems(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDragItemReferenceNumber(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
UInt16 index;
ItemReference theItemRef;
- if (!PyArg_ParseTuple(_args, "H",
+ if (!PyArg_ParseTuple(_args, "O&H",
+ DragObj_Convert, &theDrag,
&index))
return NULL;
- _err = GetDragItemReferenceNumber(_self->ob_itself,
+ _err = GetDragItemReferenceNumber(theDrag,
index,
&theItemRef);
if (_err != noErr) return PyMac_Error(_err);
@@ -229,18 +325,20 @@ static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args)
return _res;
}
-static PyObject *DragObj_CountDragItemFlavors(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_CountDragItemFlavors(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
UInt16 numFlavors;
- if (!PyArg_ParseTuple(_args, "l",
+ if (!PyArg_ParseTuple(_args, "O&l",
+ DragObj_Convert, &theDrag,
&theItemRef))
return NULL;
- _err = CountDragItemFlavors(_self->ob_itself,
+ _err = CountDragItemFlavors(theDrag,
theItemRef,
&numFlavors);
if (_err != noErr) return PyMac_Error(_err);
@@ -249,20 +347,22 @@ static PyObject *DragObj_CountDragItemFlavors(_self, _args)
return _res;
}
-static PyObject *DragObj_GetFlavorType(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetFlavorType(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
UInt16 index;
FlavorType theType;
- if (!PyArg_ParseTuple(_args, "lH",
+ if (!PyArg_ParseTuple(_args, "O&lH",
+ DragObj_Convert, &theDrag,
&theItemRef,
&index))
return NULL;
- _err = GetFlavorType(_self->ob_itself,
+ _err = GetFlavorType(theDrag,
theItemRef,
index,
&theType);
@@ -272,20 +372,22 @@ static PyObject *DragObj_GetFlavorType(_self, _args)
return _res;
}
-static PyObject *DragObj_GetFlavorFlags(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetFlavorFlags(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
FlavorType theType;
FlavorFlags theFlags;
- if (!PyArg_ParseTuple(_args, "lO&",
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ DragObj_Convert, &theDrag,
&theItemRef,
PyMac_GetOSType, &theType))
return NULL;
- _err = GetFlavorFlags(_self->ob_itself,
+ _err = GetFlavorFlags(theDrag,
theItemRef,
theType,
&theFlags);
@@ -295,20 +397,22 @@ static PyObject *DragObj_GetFlavorFlags(_self, _args)
return _res;
}
-static PyObject *DragObj_GetFlavorDataSize(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetFlavorDataSize(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
FlavorType theType;
Size dataSize;
- if (!PyArg_ParseTuple(_args, "lO&",
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ DragObj_Convert, &theDrag,
&theItemRef,
PyMac_GetOSType, &theType))
return NULL;
- _err = GetFlavorDataSize(_self->ob_itself,
+ _err = GetFlavorDataSize(theDrag,
theItemRef,
theType,
&dataSize);
@@ -318,19 +422,21 @@ static PyObject *DragObj_GetFlavorDataSize(_self, _args)
return _res;
}
-static PyObject *DragObj_GetFlavorData(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetFlavorData(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
FlavorType theType;
char *dataPtr__out__;
long dataPtr__len__;
int dataPtr__in_len__;
UInt32 dataOffset;
- if (!PyArg_ParseTuple(_args, "lO&il",
+ if (!PyArg_ParseTuple(_args, "O&lO&il",
+ DragObj_Convert, &theDrag,
&theItemRef,
PyMac_GetOSType, &theType,
&dataPtr__in_len__,
@@ -342,7 +448,7 @@ static PyObject *DragObj_GetFlavorData(_self, _args)
goto dataPtr__error__;
}
dataPtr__len__ = dataPtr__in_len__;
- _err = GetFlavorData(_self->ob_itself,
+ _err = GetFlavorData(theDrag,
theItemRef,
theType,
dataPtr__out__, &dataPtr__len__,
@@ -355,18 +461,20 @@ static PyObject *DragObj_GetFlavorData(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDragItemBounds(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDragItemBounds(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
Rect itemBounds;
- if (!PyArg_ParseTuple(_args, "l",
+ if (!PyArg_ParseTuple(_args, "O&l",
+ DragObj_Convert, &theDrag,
&theItemRef))
return NULL;
- _err = GetDragItemBounds(_self->ob_itself,
+ _err = GetDragItemBounds(theDrag,
theItemRef,
&itemBounds);
if (_err != noErr) return PyMac_Error(_err);
@@ -375,19 +483,21 @@ static PyObject *DragObj_GetDragItemBounds(_self, _args)
return _res;
}
-static PyObject *DragObj_SetDragItemBounds(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_SetDragItemBounds(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
ItemReference theItemRef;
Rect itemBounds;
- if (!PyArg_ParseTuple(_args, "lO&",
+ if (!PyArg_ParseTuple(_args, "O&lO&",
+ DragObj_Convert, &theDrag,
&theItemRef,
PyMac_GetRect, &itemBounds))
return NULL;
- _err = SetDragItemBounds(_self->ob_itself,
+ _err = SetDragItemBounds(theDrag,
theItemRef,
&itemBounds);
if (_err != noErr) return PyMac_Error(_err);
@@ -396,16 +506,18 @@ static PyObject *DragObj_SetDragItemBounds(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDropLocation(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDropLocation(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
AEDesc dropLocation;
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = GetDropLocation(_self->ob_itself,
+ _err = GetDropLocation(theDrag,
&dropLocation);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
@@ -413,17 +525,19 @@ static PyObject *DragObj_GetDropLocation(_self, _args)
return _res;
}
-static PyObject *DragObj_SetDropLocation(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_SetDropLocation(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
AEDesc dropLocation;
- if (!PyArg_ParseTuple(_args, "O&",
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ DragObj_Convert, &theDrag,
AEDesc_Convert, &dropLocation))
return NULL;
- _err = SetDropLocation(_self->ob_itself,
+ _err = SetDropLocation(theDrag,
&dropLocation);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
@@ -431,16 +545,18 @@ static PyObject *DragObj_SetDropLocation(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDragAttributes(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDragAttributes(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
DragAttributes flags;
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = GetDragAttributes(_self->ob_itself,
+ _err = GetDragAttributes(theDrag,
&flags);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("l",
@@ -448,17 +564,19 @@ static PyObject *DragObj_GetDragAttributes(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDragMouse(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDragMouse(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
Point mouse;
Point globalPinnedMouse;
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = GetDragMouse(_self->ob_itself,
+ _err = GetDragMouse(theDrag,
&mouse,
&globalPinnedMouse);
if (_err != noErr) return PyMac_Error(_err);
@@ -468,17 +586,19 @@ static PyObject *DragObj_GetDragMouse(_self, _args)
return _res;
}
-static PyObject *DragObj_SetDragMouse(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_SetDragMouse(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
Point globalPinnedMouse;
- if (!PyArg_ParseTuple(_args, "O&",
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ DragObj_Convert, &theDrag,
PyMac_GetPoint, &globalPinnedMouse))
return NULL;
- _err = SetDragMouse(_self->ob_itself,
+ _err = SetDragMouse(theDrag,
globalPinnedMouse);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
@@ -486,16 +606,18 @@ static PyObject *DragObj_SetDragMouse(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDragOrigin(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDragOrigin(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
Point globalInitialMouse;
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = GetDragOrigin(_self->ob_itself,
+ _err = GetDragOrigin(theDrag,
&globalInitialMouse);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
@@ -503,18 +625,20 @@ static PyObject *DragObj_GetDragOrigin(_self, _args)
return _res;
}
-static PyObject *DragObj_GetDragModifiers(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_GetDragModifiers(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
SInt16 modifiers;
SInt16 mouseDownModifiers;
SInt16 mouseUpModifiers;
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = GetDragModifiers(_self->ob_itself,
+ _err = GetDragModifiers(theDrag,
&modifiers,
&mouseDownModifiers,
&mouseUpModifiers);
@@ -526,19 +650,21 @@ static PyObject *DragObj_GetDragModifiers(_self, _args)
return _res;
}
-static PyObject *DragObj_ShowDragHilite(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_ShowDragHilite(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
RgnHandle hiliteFrame;
Boolean inside;
- if (!PyArg_ParseTuple(_args, "O&b",
+ if (!PyArg_ParseTuple(_args, "O&O&b",
+ DragObj_Convert, &theDrag,
ResObj_Convert, &hiliteFrame,
&inside))
return NULL;
- _err = ShowDragHilite(_self->ob_itself,
+ _err = ShowDragHilite(theDrag,
hiliteFrame,
inside);
if (_err != noErr) return PyMac_Error(_err);
@@ -547,34 +673,38 @@ static PyObject *DragObj_ShowDragHilite(_self, _args)
return _res;
}
-static PyObject *DragObj_HideDragHilite(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_HideDragHilite(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
+ DragRef theDrag;
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = HideDragHilite(_self->ob_itself);
+ _err = HideDragHilite(theDrag);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *DragObj_DragPreScroll(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_DragPreScroll(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
SInt16 dH;
SInt16 dV;
- if (!PyArg_ParseTuple(_args, "hh",
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ DragObj_Convert, &theDrag,
&dH,
&dV))
return NULL;
- _err = DragPreScroll(_self->ob_itself,
+ _err = DragPreScroll(theDrag,
dH,
dV);
if (_err != noErr) return PyMac_Error(_err);
@@ -583,32 +713,36 @@ static PyObject *DragObj_DragPreScroll(_self, _args)
return _res;
}
-static PyObject *DragObj_DragPostScroll(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_DragPostScroll(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
+ DragRef theDrag;
+ if (!PyArg_ParseTuple(_args, "O&",
+ DragObj_Convert, &theDrag))
return NULL;
- _err = DragPostScroll(_self->ob_itself);
+ _err = DragPostScroll(theDrag);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *DragObj_UpdateDragHilite(_self, _args)
- DragObjObject *_self;
+static PyObject *Drag_UpdateDragHilite(_self, _args)
+ PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
OSErr _err;
+ DragRef theDrag;
RgnHandle updateRgn;
- if (!PyArg_ParseTuple(_args, "O&",
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ DragObj_Convert, &theDrag,
ResObj_Convert, &updateRgn))
return NULL;
- _err = UpdateDragHilite(_self->ob_itself,
+ _err = UpdateDragHilite(theDrag,
updateRgn);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
@@ -616,117 +750,6 @@ static PyObject *DragObj_UpdateDragHilite(_self, _args)
return _res;
}
-static PyMethodDef DragObj_methods[] = {
- {"DisposeDrag", (PyCFunction)DragObj_DisposeDrag, 1,
- "() -> None"},
- {"AddDragItemFlavor", (PyCFunction)DragObj_AddDragItemFlavor, 1,
- "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None"},
- {"SetDragItemFlavorData", (PyCFunction)DragObj_SetDragItemFlavorData, 1,
- "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None"},
- {"SetDragImage", (PyCFunction)DragObj_SetDragImage, 1,
- "(PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None"},
- {"TrackDrag", (PyCFunction)DragObj_TrackDrag, 1,
- "(EventRecord theEvent, RgnHandle theRegion) -> None"},
- {"CountDragItems", (PyCFunction)DragObj_CountDragItems, 1,
- "() -> (UInt16 numItems)"},
- {"GetDragItemReferenceNumber", (PyCFunction)DragObj_GetDragItemReferenceNumber, 1,
- "(UInt16 index) -> (ItemReference theItemRef)"},
- {"CountDragItemFlavors", (PyCFunction)DragObj_CountDragItemFlavors, 1,
- "(ItemReference theItemRef) -> (UInt16 numFlavors)"},
- {"GetFlavorType", (PyCFunction)DragObj_GetFlavorType, 1,
- "(ItemReference theItemRef, UInt16 index) -> (FlavorType theType)"},
- {"GetFlavorFlags", (PyCFunction)DragObj_GetFlavorFlags, 1,
- "(ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)"},
- {"GetFlavorDataSize", (PyCFunction)DragObj_GetFlavorDataSize, 1,
- "(ItemReference theItemRef, FlavorType theType) -> (Size dataSize)"},
- {"GetFlavorData", (PyCFunction)DragObj_GetFlavorData, 1,
- "(ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)"},
- {"GetDragItemBounds", (PyCFunction)DragObj_GetDragItemBounds, 1,
- "(ItemReference theItemRef) -> (Rect itemBounds)"},
- {"SetDragItemBounds", (PyCFunction)DragObj_SetDragItemBounds, 1,
- "(ItemReference theItemRef, Rect itemBounds) -> None"},
- {"GetDropLocation", (PyCFunction)DragObj_GetDropLocation, 1,
- "() -> (AEDesc dropLocation)"},
- {"SetDropLocation", (PyCFunction)DragObj_SetDropLocation, 1,
- "(AEDesc dropLocation) -> None"},
- {"GetDragAttributes", (PyCFunction)DragObj_GetDragAttributes, 1,
- "() -> (DragAttributes flags)"},
- {"GetDragMouse", (PyCFunction)DragObj_GetDragMouse, 1,
- "() -> (Point mouse, Point globalPinnedMouse)"},
- {"SetDragMouse", (PyCFunction)DragObj_SetDragMouse, 1,
- "(Point globalPinnedMouse) -> None"},
- {"GetDragOrigin", (PyCFunction)DragObj_GetDragOrigin, 1,
- "() -> (Point globalInitialMouse)"},
- {"GetDragModifiers", (PyCFunction)DragObj_GetDragModifiers, 1,
- "() -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)"},
- {"ShowDragHilite", (PyCFunction)DragObj_ShowDragHilite, 1,
- "(RgnHandle hiliteFrame, Boolean inside) -> None"},
- {"HideDragHilite", (PyCFunction)DragObj_HideDragHilite, 1,
- "() -> None"},
- {"DragPreScroll", (PyCFunction)DragObj_DragPreScroll, 1,
- "(SInt16 dH, SInt16 dV) -> None"},
- {"DragPostScroll", (PyCFunction)DragObj_DragPostScroll, 1,
- "() -> None"},
- {"UpdateDragHilite", (PyCFunction)DragObj_UpdateDragHilite, 1,
- "(RgnHandle updateRgn) -> None"},
- {NULL, NULL, 0}
-};
-
-PyMethodChain DragObj_chain = { DragObj_methods, NULL };
-
-static PyObject *DragObj_getattr(self, name)
- DragObjObject *self;
- char *name;
-{
- return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name);
-}
-
-#define DragObj_setattr NULL
-
-#define DragObj_compare NULL
-
-#define DragObj_repr NULL
-
-#define DragObj_hash NULL
-
-PyTypeObject DragObj_Type = {
- PyObject_HEAD_INIT(&PyType_Type)
- 0, /*ob_size*/
- "DragObj", /*tp_name*/
- sizeof(DragObjObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) DragObj_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc) DragObj_getattr, /*tp_getattr*/
- (setattrfunc) DragObj_setattr, /*tp_setattr*/
- (cmpfunc) DragObj_compare, /*tp_compare*/
- (reprfunc) DragObj_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) DragObj_hash, /*tp_hash*/
-};
-
-/* -------------------- End object type DragObj --------------------- */
-
-
-static PyObject *Drag_NewDrag(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- OSErr _err;
- DragReference theDrag;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = NewDrag(&theDrag);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- DragObj_New, theDrag);
- return _res;
-}
-
static PyObject *Drag_GetDragHiliteColor(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -892,7 +915,61 @@ static PyObject *Drag_RemoveReceiveHandler(_self, _args)
static PyMethodDef Drag_methods[] = {
{"NewDrag", (PyCFunction)Drag_NewDrag, 1,
- "() -> (DragReference theDrag)"},
+ "() -> (DragRef theDrag)"},
+ {"DisposeDrag", (PyCFunction)Drag_DisposeDrag, 1,
+ "(DragRef theDrag) -> None"},
+ {"AddDragItemFlavor", (PyCFunction)Drag_AddDragItemFlavor, 1,
+ "(DragRef theDrag, ItemReference theItemRef, FlavorType theType, Buffer dataPtr, FlavorFlags theFlags) -> None"},
+ {"SetDragItemFlavorData", (PyCFunction)Drag_SetDragItemFlavorData, 1,
+ "(DragRef theDrag, ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> None"},
+ {"SetDragImage", (PyCFunction)Drag_SetDragImage, 1,
+ "(DragRef theDrag, PixMapHandle imagePixMap, RgnHandle imageRgn, Point imageOffsetPt, DragImageFlags theImageFlags) -> None"},
+ {"ChangeDragBehaviors", (PyCFunction)Drag_ChangeDragBehaviors, 1,
+ "(DragRef theDrag, DragBehaviors inBehaviorsToSet, DragBehaviors inBehaviorsToClear) -> None"},
+ {"TrackDrag", (PyCFunction)Drag_TrackDrag, 1,
+ "(DragRef theDrag, EventRecord theEvent, RgnHandle theRegion) -> None"},
+ {"CountDragItems", (PyCFunction)Drag_CountDragItems, 1,
+ "(DragRef theDrag) -> (UInt16 numItems)"},
+ {"GetDragItemReferenceNumber", (PyCFunction)Drag_GetDragItemReferenceNumber, 1,
+ "(DragRef theDrag, UInt16 index) -> (ItemReference theItemRef)"},
+ {"CountDragItemFlavors", (PyCFunction)Drag_CountDragItemFlavors, 1,
+ "(DragRef theDrag, ItemReference theItemRef) -> (UInt16 numFlavors)"},
+ {"GetFlavorType", (PyCFunction)Drag_GetFlavorType, 1,
+ "(DragRef theDrag, ItemReference theItemRef, UInt16 index) -> (FlavorType theType)"},
+ {"GetFlavorFlags", (PyCFunction)Drag_GetFlavorFlags, 1,
+ "(DragRef theDrag, ItemReference theItemRef, FlavorType theType) -> (FlavorFlags theFlags)"},
+ {"GetFlavorDataSize", (PyCFunction)Drag_GetFlavorDataSize, 1,
+ "(DragRef theDrag, ItemReference theItemRef, FlavorType theType) -> (Size dataSize)"},
+ {"GetFlavorData", (PyCFunction)Drag_GetFlavorData, 1,
+ "(DragRef theDrag, ItemReference theItemRef, FlavorType theType, Buffer dataPtr, UInt32 dataOffset) -> (Buffer dataPtr)"},
+ {"GetDragItemBounds", (PyCFunction)Drag_GetDragItemBounds, 1,
+ "(DragRef theDrag, ItemReference theItemRef) -> (Rect itemBounds)"},
+ {"SetDragItemBounds", (PyCFunction)Drag_SetDragItemBounds, 1,
+ "(DragRef theDrag, ItemReference theItemRef, Rect itemBounds) -> None"},
+ {"GetDropLocation", (PyCFunction)Drag_GetDropLocation, 1,
+ "(DragRef theDrag) -> (AEDesc dropLocation)"},
+ {"SetDropLocation", (PyCFunction)Drag_SetDropLocation, 1,
+ "(DragRef theDrag, AEDesc dropLocation) -> None"},
+ {"GetDragAttributes", (PyCFunction)Drag_GetDragAttributes, 1,
+ "(DragRef theDrag) -> (DragAttributes flags)"},
+ {"GetDragMouse", (PyCFunction)Drag_GetDragMouse, 1,
+ "(DragRef theDrag) -> (Point mouse, Point globalPinnedMouse)"},
+ {"SetDragMouse", (PyCFunction)Drag_SetDragMouse, 1,
+ "(DragRef theDrag, Point globalPinnedMouse) -> None"},
+ {"GetDragOrigin", (PyCFunction)Drag_GetDragOrigin, 1,
+ "(DragRef theDrag) -> (Point globalInitialMouse)"},
+ {"GetDragModifiers", (PyCFunction)Drag_GetDragModifiers, 1,
+ "(DragRef theDrag) -> (SInt16 modifiers, SInt16 mouseDownModifiers, SInt16 mouseUpModifiers)"},
+ {"ShowDragHilite", (PyCFunction)Drag_ShowDragHilite, 1,
+ "(DragRef theDrag, RgnHandle hiliteFrame, Boolean inside) -> None"},
+ {"HideDragHilite", (PyCFunction)Drag_HideDragHilite, 1,
+ "(DragRef theDrag) -> None"},
+ {"DragPreScroll", (PyCFunction)Drag_DragPreScroll, 1,
+ "(DragRef theDrag, SInt16 dH, SInt16 dV) -> None"},
+ {"DragPostScroll", (PyCFunction)Drag_DragPostScroll, 1,
+ "(DragRef theDrag) -> None"},
+ {"UpdateDragHilite", (PyCFunction)Drag_UpdateDragHilite, 1,
+ "(DragRef theDrag, RgnHandle updateRgn) -> None"},
{"GetDragHiliteColor", (PyCFunction)Drag_GetDragHiliteColor, 1,
"(WindowPtr window) -> (RGBColor color)"},
{"WaitMouseMoved", (PyCFunction)Drag_WaitMouseMoved, 1,
@@ -1023,7 +1100,7 @@ void initDrag()
Drag_Error = PyMac_GetOSErrException();
if (Drag_Error == NULL ||
PyDict_SetItemString(d, "Error", Drag_Error) != 0)
- Py_FatalError("can't initialize Drag.Error");
+ return;
DragObj_Type.ob_type = &PyType_Type;
Py_INCREF(&DragObj_Type);
if (PyDict_SetItemString(d, "DragObjType", (PyObject *)&DragObj_Type) != 0)
diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py
index af8a255..d90acc9 100644
--- a/Mac/Modules/drag/dragsupport.py
+++ b/Mac/Modules/drag/dragsupport.py
@@ -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")
diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c
index c161c75..ed18f9c 100644
--- a/Mac/Modules/evt/Evtmodule.c
+++ b/Mac/Modules/evt/Evtmodule.c
@@ -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 ========================= */
diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py
index 3695440..82b9260 100644
--- a/Mac/Modules/evt/evtscan.py
+++ b/Mac/Modules/evt/evtscan.py
@@ -43,6 +43,11 @@ class MyScanner(Scanner):
'SystemClick',
'GetOSEvent',
'OSEventAvail',
+ ]),
+ ('#if TARGET_API_MAC_CARBON', [
+ 'CheckEventQueueForUserCancel',
+ 'GetCurrentKeyModifiers',
+ 'GetGlobalMouse',
])]
def makeblacklistnames(self):
diff --git a/Mac/Modules/fm/Fmmodule.c b/Mac/Modules/fm/Fmmodule.c
index 6d1c507..0d66d16 100644
--- a/Mac/Modules/fm/Fmmodule.c
+++ b/Mac/Modules/fm/Fmmodule.c
@@ -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 ========================== */
diff --git a/Mac/Modules/help/Helpmodule.c b/Mac/Modules/help/Helpmodule.c
index ffd2090..3a44632 100644
--- a/Mac/Modules/help/Helpmodule.c
+++ b/Mac/Modules/help/Helpmodule.c
@@ -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 ========================= */
diff --git a/Mac/Modules/icn/Icnmodule.c b/Mac/Modules/icn/Icnmodule.c
index 6cbb936..4a5eda0 100644
--- a/Mac/Modules/icn/Icnmodule.c
+++ b/Mac/Modules/icn/Icnmodule.c
@@ -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 ========================= */
diff --git a/Mac/Modules/icn/icnscan.py b/Mac/Modules/icn/icnscan.py
index 93d27d0..4dbccfe 100644
--- a/Mac/Modules/icn/icnscan.py
+++ b/Mac/Modules/icn/icnscan.py
@@ -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):
diff --git a/Mac/Modules/list/Listmodule.c b/Mac/Modules/list/Listmodule.c
index f5360f2..338b611 100644
--- a/Mac/Modules/list/Listmodule.c
+++ b/Mac/Modules/list/Listmodule.c
@@ -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)
diff --git a/Mac/Modules/list/listscan.py b/Mac/Modules/list/listscan.py
index a5dd9eb..b8bd549 100644
--- a/Mac/Modules/list/listscan.py
+++ b/Mac/Modules/list/listscan.py
@@ -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):
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index eca08cb..ecf8392 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -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)
"""
diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c
index a47c88a..7f15330 100644
--- a/Mac/Modules/menu/Menumodule.c
+++ b/Mac/Modules/menu/Menumodule.c
@@ -11,6 +11,16 @@
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <Menus.h>
+#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)
@@ -82,6 +92,20 @@ static PyObject *MenuObj_CalcMenuSize(_self, _args)
return _res;
}
+static PyObject *MenuObj_CountMenuItems(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = CountMenuItems(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
#if !TARGET_API_MAC_CARBON
static PyObject *MenuObj_CountMItems(_self, _args)
@@ -324,8 +348,8 @@ static PyObject *MenuObj_InsertMenuItemText(_self, _args)
PyObject *_res = NULL;
OSStatus _err;
Str255 inString;
- UInt16 afterItem;
- if (!PyArg_ParseTuple(_args, "O&H",
+ MenuItemIndex afterItem;
+ if (!PyArg_ParseTuple(_args, "O&h",
PyMac_GetStr255, inString,
&afterItem))
return NULL;
@@ -366,7 +390,7 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- short beforeID;
+ MenuID beforeID;
if (!PyArg_ParseTuple(_args, "h",
&beforeID))
return NULL;
@@ -377,6 +401,25 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
return _res;
}
+static PyObject *MenuObj_MacCheckMenuItem(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short item;
+ Boolean checked;
+ if (!PyArg_ParseTuple(_args, "hb",
+ &item,
+ &checked))
+ return NULL;
+ MacCheckMenuItem(_self->ob_itself,
+ item,
+ checked);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
#if !TARGET_API_MAC_CARBON
static PyObject *MenuObj_CheckItem(_self, _args)
@@ -629,7 +672,7 @@ static PyObject *MenuObj_SetMenuItemCommandID(_self, _args)
PyObject *_res = NULL;
OSErr _err;
SInt16 inItem;
- UInt32 inCommandID;
+ MenuCommand inCommandID;
if (!PyArg_ParseTuple(_args, "hl",
&inItem,
&inCommandID))
@@ -650,7 +693,7 @@ static PyObject *MenuObj_GetMenuItemCommandID(_self, _args)
PyObject *_res = NULL;
OSErr _err;
SInt16 inItem;
- UInt32 outCommandID;
+ MenuCommand outCommandID;
if (!PyArg_ParseTuple(_args, "h",
&inItem))
return NULL;
@@ -799,7 +842,7 @@ static PyObject *MenuObj_SetMenuItemHierarchicalID(_self, _args)
PyObject *_res = NULL;
OSErr _err;
SInt16 inItem;
- SInt16 inHierID;
+ MenuID inHierID;
if (!PyArg_ParseTuple(_args, "hh",
&inItem,
&inHierID))
@@ -820,7 +863,7 @@ static PyObject *MenuObj_GetMenuItemHierarchicalID(_self, _args)
PyObject *_res = NULL;
OSErr _err;
SInt16 inItem;
- SInt16 outHierID;
+ MenuID outHierID;
if (!PyArg_ParseTuple(_args, "h",
&inItem))
return NULL;
@@ -1008,8 +1051,8 @@ static PyObject *MenuObj_MacEnableMenuItem(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- UInt16 item;
- if (!PyArg_ParseTuple(_args, "H",
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
MacEnableMenuItem(_self->ob_itself,
@@ -1024,8 +1067,8 @@ static PyObject *MenuObj_DisableMenuItem(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- UInt16 item;
- if (!PyArg_ParseTuple(_args, "H",
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
DisableMenuItem(_self->ob_itself,
@@ -1041,8 +1084,8 @@ static PyObject *MenuObj_IsMenuItemEnabled(_self, _args)
{
PyObject *_res = NULL;
Boolean _rv;
- UInt16 item;
- if (!PyArg_ParseTuple(_args, "H",
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
_rv = IsMenuItemEnabled(_self->ob_itself,
@@ -1057,8 +1100,8 @@ static PyObject *MenuObj_EnableMenuItemIcon(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- UInt16 item;
- if (!PyArg_ParseTuple(_args, "H",
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
EnableMenuItemIcon(_self->ob_itself,
@@ -1073,8 +1116,8 @@ static PyObject *MenuObj_DisableMenuItemIcon(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- UInt16 item;
- if (!PyArg_ParseTuple(_args, "H",
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
DisableMenuItemIcon(_self->ob_itself,
@@ -1090,8 +1133,8 @@ static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args)
{
PyObject *_res = NULL;
Boolean _rv;
- UInt16 item;
- if (!PyArg_ParseTuple(_args, "H",
+ MenuItemIndex item;
+ if (!PyArg_ParseTuple(_args, "h",
&item))
return NULL;
_rv = IsMenuItemIconEnabled(_self->ob_itself,
@@ -1101,6 +1144,539 @@ static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuItemPropertyAttributes(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributes;
+ if (!PyArg_ParseTuple(_args, "hO&O&",
+ &item,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetMenuItemPropertyAttributes(_self->ob_itself,
+ item,
+ propertyCreator,
+ propertyTag,
+ &attributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ attributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_ChangeMenuItemPropertyAttributes(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ OSType propertyCreator;
+ OSType propertyTag;
+ UInt32 attributesToSet;
+ UInt32 attributesToClear;
+ if (!PyArg_ParseTuple(_args, "hO&O&ll",
+ &item,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag,
+ &attributesToSet,
+ &attributesToClear))
+ return NULL;
+ _err = ChangeMenuItemPropertyAttributes(_self->ob_itself,
+ item,
+ propertyCreator,
+ propertyTag,
+ attributesToSet,
+ attributesToClear);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuAttributes(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuAttributes outAttributes;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = GetMenuAttributes(_self->ob_itself,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_ChangeMenuAttributes(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuAttributes setTheseAttributes;
+ MenuAttributes clearTheseAttributes;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeMenuAttributes(_self->ob_itself,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuItemAttributes(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ MenuItemAttributes outAttributes;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _err = GetMenuItemAttributes(_self->ob_itself,
+ item,
+ &outAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outAttributes);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_ChangeMenuItemAttributes(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ MenuItemAttributes setTheseAttributes;
+ MenuItemAttributes clearTheseAttributes;
+ if (!PyArg_ParseTuple(_args, "hll",
+ &item,
+ &setTheseAttributes,
+ &clearTheseAttributes))
+ return NULL;
+ _err = ChangeMenuItemAttributes(_self->ob_itself,
+ item,
+ setTheseAttributes,
+ clearTheseAttributes);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_DisableAllMenuItems(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ DisableAllMenuItems(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_EnableAllMenuItems(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ EnableAllMenuItems(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_MenuHasEnabledItems(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = MenuHasEnabledItems(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_CountMenuItemsWithCommandID(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ ItemCount _rv;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ _rv = CountMenuItemsWithCommandID(_self->ob_itself,
+ commandID);
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetIndMenuItemWithCommandID(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand commandID;
+ UInt32 itemIndex;
+ MenuHandle outMenu;
+ MenuItemIndex outIndex;
+ if (!PyArg_ParseTuple(_args, "ll",
+ &commandID,
+ &itemIndex))
+ return NULL;
+ _err = GetIndMenuItemWithCommandID(_self->ob_itself,
+ commandID,
+ itemIndex,
+ &outMenu,
+ &outIndex);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ MenuObj_New, outMenu,
+ outIndex);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_EnableMenuCommand(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ EnableMenuCommand(_self->ob_itself,
+ commandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_DisableMenuCommand(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ DisableMenuCommand(_self->ob_itself,
+ commandID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_IsMenuCommandEnabled(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ MenuCommand commandID;
+ if (!PyArg_ParseTuple(_args, "l",
+ &commandID))
+ return NULL;
+ _rv = IsMenuCommandEnabled(_self->ob_itself,
+ commandID);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetMenuCommandPropertySize(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand commandID;
+ OSType propertyCreator;
+ OSType propertyTag;
+ ByteCount size;
+ if (!PyArg_ParseTuple(_args, "lO&O&",
+ &commandID,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = GetMenuCommandPropertySize(_self->ob_itself,
+ commandID,
+ propertyCreator,
+ propertyTag,
+ &size);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ size);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_RemoveMenuCommandProperty(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuCommand commandID;
+ OSType propertyCreator;
+ OSType propertyTag;
+ if (!PyArg_ParseTuple(_args, "lO&O&",
+ &commandID,
+ PyMac_GetOSType, &propertyCreator,
+ PyMac_GetOSType, &propertyTag))
+ return NULL;
+ _err = RemoveMenuCommandProperty(_self->ob_itself,
+ commandID,
+ propertyCreator,
+ propertyTag);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_CreateStandardFontMenu(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex afterItem;
+ MenuID firstHierMenuID;
+ OptionBits options;
+ ItemCount outHierMenuCount;
+ if (!PyArg_ParseTuple(_args, "hhl",
+ &afterItem,
+ &firstHierMenuID,
+ &options))
+ return NULL;
+ _err = CreateStandardFontMenu(_self->ob_itself,
+ afterItem,
+ firstHierMenuID,
+ options,
+ &outHierMenuCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outHierMenuCount);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_UpdateStandardFontMenu(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ItemCount outHierMenuCount;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = UpdateStandardFontMenu(_self->ob_itself,
+ &outHierMenuCount);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("l",
+ outHierMenuCount);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *MenuObj_GetFontFamilyFromMenuSelection(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuItemIndex item;
+ FMFontFamily outFontFamily;
+ FMFontStyle outStyle;
+ if (!PyArg_ParseTuple(_args, "h",
+ &item))
+ return NULL;
+ _err = GetFontFamilyFromMenuSelection(_self->ob_itself,
+ item,
+ &outFontFamily,
+ &outStyle);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("hh",
+ outFontFamily,
+ outStyle);
+ return _res;
+}
+#endif
+
+static PyObject *MenuObj_GetMenuID(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ MenuID _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuID(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuWidth(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuWidth(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_GetMenuHeight(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ SInt16 _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetMenuHeight(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuID(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ MenuID menuID;
+ if (!PyArg_ParseTuple(_args, "h",
+ &menuID))
+ return NULL;
+ SetMenuID(_self->ob_itself,
+ menuID);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuWidth(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ SInt16 width;
+ if (!PyArg_ParseTuple(_args, "h",
+ &width))
+ return NULL;
+ SetMenuWidth(_self->ob_itself,
+ width);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *MenuObj_SetMenuHeight(_self, _args)
+ MenuObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ SInt16 height;
+ if (!PyArg_ParseTuple(_args, "h",
+ &height))
+ return NULL;
+ SetMenuHeight(_self->ob_itself,
+ height);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *MenuObj_as_Resource(_self, _args)
MenuObject *_self;
PyObject *_args;
@@ -1171,6 +1747,8 @@ static PyMethodDef MenuObj_methods[] = {
"() -> None"},
{"CalcMenuSize", (PyCFunction)MenuObj_CalcMenuSize, 1,
"() -> None"},
+ {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1,
+ "() -> (short _rv)"},
#if !TARGET_API_MAC_CARBON
{"CountMItems", (PyCFunction)MenuObj_CountMItems, 1,
@@ -1201,11 +1779,13 @@ static PyMethodDef MenuObj_methods[] = {
{"AppendMenuItemText", (PyCFunction)MenuObj_AppendMenuItemText, 1,
"(Str255 inString) -> None"},
{"InsertMenuItemText", (PyCFunction)MenuObj_InsertMenuItemText, 1,
- "(Str255 inString, UInt16 afterItem) -> None"},
+ "(Str255 inString, MenuItemIndex afterItem) -> None"},
{"PopUpMenuSelect", (PyCFunction)MenuObj_PopUpMenuSelect, 1,
"(short top, short left, short popUpItem) -> (long _rv)"},
{"MacInsertMenu", (PyCFunction)MenuObj_MacInsertMenu, 1,
- "(short beforeID) -> None"},
+ "(MenuID beforeID) -> None"},
+ {"MacCheckMenuItem", (PyCFunction)MenuObj_MacCheckMenuItem, 1,
+ "(short item, Boolean checked) -> None"},
#if !TARGET_API_MAC_CARBON
{"CheckItem", (PyCFunction)MenuObj_CheckItem, 1,
@@ -1242,9 +1822,9 @@ static PyMethodDef MenuObj_methods[] = {
"(short item) -> None"},
#endif
{"SetMenuItemCommandID", (PyCFunction)MenuObj_SetMenuItemCommandID, 1,
- "(SInt16 inItem, UInt32 inCommandID) -> None"},
+ "(SInt16 inItem, MenuCommand inCommandID) -> None"},
{"GetMenuItemCommandID", (PyCFunction)MenuObj_GetMenuItemCommandID, 1,
- "(SInt16 inItem) -> (UInt32 outCommandID)"},
+ "(SInt16 inItem) -> (MenuCommand outCommandID)"},
{"SetMenuItemModifiers", (PyCFunction)MenuObj_SetMenuItemModifiers, 1,
"(SInt16 inItem, UInt8 inModifiers) -> None"},
{"GetMenuItemModifiers", (PyCFunction)MenuObj_GetMenuItemModifiers, 1,
@@ -1258,9 +1838,9 @@ static PyMethodDef MenuObj_methods[] = {
{"GetMenuItemTextEncoding", (PyCFunction)MenuObj_GetMenuItemTextEncoding, 1,
"(SInt16 inItem) -> (TextEncoding outScriptID)"},
{"SetMenuItemHierarchicalID", (PyCFunction)MenuObj_SetMenuItemHierarchicalID, 1,
- "(SInt16 inItem, SInt16 inHierID) -> None"},
+ "(SInt16 inItem, MenuID inHierID) -> None"},
{"GetMenuItemHierarchicalID", (PyCFunction)MenuObj_GetMenuItemHierarchicalID, 1,
- "(SInt16 inItem) -> (SInt16 outHierID)"},
+ "(SInt16 inItem) -> (MenuID outHierID)"},
{"SetMenuItemFontID", (PyCFunction)MenuObj_SetMenuItemFontID, 1,
"(SInt16 inItem, SInt16 inFontID) -> None"},
{"GetMenuItemFontID", (PyCFunction)MenuObj_GetMenuItemFontID, 1,
@@ -1284,17 +1864,124 @@ static PyMethodDef MenuObj_methods[] = {
{"GetMenuItemKeyGlyph", (PyCFunction)MenuObj_GetMenuItemKeyGlyph, 1,
"(SInt16 inItem) -> (SInt16 outGlyph)"},
{"MacEnableMenuItem", (PyCFunction)MenuObj_MacEnableMenuItem, 1,
- "(UInt16 item) -> None"},
+ "(MenuItemIndex item) -> None"},
{"DisableMenuItem", (PyCFunction)MenuObj_DisableMenuItem, 1,
- "(UInt16 item) -> None"},
+ "(MenuItemIndex item) -> None"},
{"IsMenuItemEnabled", (PyCFunction)MenuObj_IsMenuItemEnabled, 1,
- "(UInt16 item) -> (Boolean _rv)"},
+ "(MenuItemIndex item) -> (Boolean _rv)"},
{"EnableMenuItemIcon", (PyCFunction)MenuObj_EnableMenuItemIcon, 1,
- "(UInt16 item) -> None"},
+ "(MenuItemIndex item) -> None"},
{"DisableMenuItemIcon", (PyCFunction)MenuObj_DisableMenuItemIcon, 1,
- "(UInt16 item) -> None"},
+ "(MenuItemIndex item) -> None"},
{"IsMenuItemIconEnabled", (PyCFunction)MenuObj_IsMenuItemIconEnabled, 1,
- "(UInt16 item) -> (Boolean _rv)"},
+ "(MenuItemIndex item) -> (Boolean _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuItemPropertyAttributes", (PyCFunction)MenuObj_GetMenuItemPropertyAttributes, 1,
+ "(MenuItemIndex item, OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeMenuItemPropertyAttributes", (PyCFunction)MenuObj_ChangeMenuItemPropertyAttributes, 1,
+ "(MenuItemIndex item, OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuAttributes", (PyCFunction)MenuObj_GetMenuAttributes, 1,
+ "() -> (MenuAttributes outAttributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeMenuAttributes", (PyCFunction)MenuObj_ChangeMenuAttributes, 1,
+ "(MenuAttributes setTheseAttributes, MenuAttributes clearTheseAttributes) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuItemAttributes", (PyCFunction)MenuObj_GetMenuItemAttributes, 1,
+ "(MenuItemIndex item) -> (MenuItemAttributes outAttributes)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"ChangeMenuItemAttributes", (PyCFunction)MenuObj_ChangeMenuItemAttributes, 1,
+ "(MenuItemIndex item, MenuItemAttributes setTheseAttributes, MenuItemAttributes clearTheseAttributes) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisableAllMenuItems", (PyCFunction)MenuObj_DisableAllMenuItems, 1,
+ "() -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"EnableAllMenuItems", (PyCFunction)MenuObj_EnableAllMenuItems, 1,
+ "() -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"MenuHasEnabledItems", (PyCFunction)MenuObj_MenuHasEnabledItems, 1,
+ "() -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CountMenuItemsWithCommandID", (PyCFunction)MenuObj_CountMenuItemsWithCommandID, 1,
+ "(MenuCommand commandID) -> (ItemCount _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetIndMenuItemWithCommandID", (PyCFunction)MenuObj_GetIndMenuItemWithCommandID, 1,
+ "(MenuCommand commandID, UInt32 itemIndex) -> (MenuHandle outMenu, MenuItemIndex outIndex)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"EnableMenuCommand", (PyCFunction)MenuObj_EnableMenuCommand, 1,
+ "(MenuCommand commandID) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisableMenuCommand", (PyCFunction)MenuObj_DisableMenuCommand, 1,
+ "(MenuCommand commandID) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsMenuCommandEnabled", (PyCFunction)MenuObj_IsMenuCommandEnabled, 1,
+ "(MenuCommand commandID) -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetMenuCommandPropertySize", (PyCFunction)MenuObj_GetMenuCommandPropertySize, 1,
+ "(MenuCommand commandID, OSType propertyCreator, OSType propertyTag) -> (ByteCount size)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"RemoveMenuCommandProperty", (PyCFunction)MenuObj_RemoveMenuCommandProperty, 1,
+ "(MenuCommand commandID, OSType propertyCreator, OSType propertyTag) -> None"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"CreateStandardFontMenu", (PyCFunction)MenuObj_CreateStandardFontMenu, 1,
+ "(MenuItemIndex afterItem, MenuID firstHierMenuID, OptionBits options) -> (ItemCount outHierMenuCount)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"UpdateStandardFontMenu", (PyCFunction)MenuObj_UpdateStandardFontMenu, 1,
+ "() -> (ItemCount outHierMenuCount)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetFontFamilyFromMenuSelection", (PyCFunction)MenuObj_GetFontFamilyFromMenuSelection, 1,
+ "(MenuItemIndex item) -> (FMFontFamily outFontFamily, FMFontStyle outStyle)"},
+#endif
+ {"GetMenuID", (PyCFunction)MenuObj_GetMenuID, 1,
+ "() -> (MenuID _rv)"},
+ {"GetMenuWidth", (PyCFunction)MenuObj_GetMenuWidth, 1,
+ "() -> (SInt16 _rv)"},
+ {"GetMenuHeight", (PyCFunction)MenuObj_GetMenuHeight, 1,
+ "() -> (SInt16 _rv)"},
+ {"SetMenuID", (PyCFunction)MenuObj_SetMenuID, 1,
+ "(MenuID menuID) -> None"},
+ {"SetMenuWidth", (PyCFunction)MenuObj_SetMenuWidth, 1,
+ "(SInt16 width) -> None"},
+ {"SetMenuHeight", (PyCFunction)MenuObj_SetMenuHeight, 1,
+ "(SInt16 height) -> None"},
{"as_Resource", (PyCFunction)MenuObj_as_Resource, 1,
"() -> (Handle _rv)"},
{"AppendMenu", (PyCFunction)MenuObj_AppendMenu, 1,
@@ -1385,7 +2072,7 @@ static PyObject *Menu_NewMenu(_self, _args)
{
PyObject *_res = NULL;
MenuHandle _rv;
- short menuID;
+ MenuID menuID;
Str255 menuTitle;
if (!PyArg_ParseTuple(_args, "hO&",
&menuID,
@@ -1414,6 +2101,31 @@ static PyObject *Menu_MacGetMenu(_self, _args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Menu_CreateNewMenu(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuID menuID;
+ MenuAttributes menuAttributes;
+ MenuHandle outMenuRef;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &menuID,
+ &menuAttributes))
+ return NULL;
+ _err = CreateNewMenu(menuID,
+ menuAttributes,
+ &outMenuRef);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ MenuObj_New, outMenuRef);
+ return _res;
+}
+#endif
+
static PyObject *Menu_MenuKey(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -1521,7 +2233,7 @@ static PyObject *Menu_HiliteMenu(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- short menuID;
+ MenuID menuID;
if (!PyArg_ParseTuple(_args, "h",
&menuID))
return NULL;
@@ -1536,7 +2248,7 @@ static PyObject *Menu_GetNewMBar(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- Handle _rv;
+ MenuBarHandle _rv;
short menuBarID;
if (!PyArg_ParseTuple(_args, "h",
&menuBarID))
@@ -1552,7 +2264,7 @@ static PyObject *Menu_GetMenuBar(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- Handle _rv;
+ MenuBarHandle _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = GetMenuBar();
@@ -1566,23 +2278,65 @@ static PyObject *Menu_SetMenuBar(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- Handle menuList;
+ MenuBarHandle mbar;
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &menuList))
+ ResObj_Convert, &mbar))
return NULL;
- SetMenuBar(menuList);
+ SetMenuBar(mbar);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Menu_DuplicateMenuBar(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuBarHandle mbar;
+ MenuBarHandle outBar;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &mbar))
+ return NULL;
+ _err = DuplicateMenuBar(mbar,
+ &outBar);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ ResObj_New, outBar);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *Menu_DisposeMenuBar(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ MenuBarHandle mbar;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &mbar))
+ return NULL;
+ _err = DisposeMenuBar(mbar);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
static PyObject *Menu_GetMenuHandle(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
MenuHandle _rv;
- short menuID;
+ MenuID menuID;
if (!PyArg_ParseTuple(_args, "h",
&menuID))
return NULL;
@@ -1597,7 +2351,7 @@ static PyObject *Menu_MacDeleteMenu(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- short menuID;
+ MenuID menuID;
if (!PyArg_ParseTuple(_args, "h",
&menuID))
return NULL;
@@ -1620,6 +2374,21 @@ static PyObject *Menu_ClearMenuBar(_self, _args)
return _res;
}
+static PyObject *Menu_SetMenuFlashCount(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short count;
+ if (!PyArg_ParseTuple(_args, "h",
+ &count))
+ return NULL;
+ SetMenuFlashCount(count);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
#if !TARGET_API_MAC_CARBON
static PyObject *Menu_SetMenuFlash(_self, _args)
@@ -1643,7 +2412,7 @@ static PyObject *Menu_FlashMenuBar(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- short menuID;
+ MenuID menuID;
if (!PyArg_ParseTuple(_args, "h",
&menuID))
return NULL;
@@ -1735,7 +2504,7 @@ static PyObject *Menu_DeleteMCEntries(_self, _args)
PyObject *_args;
{
PyObject *_res = NULL;
- short menuID;
+ MenuID menuID;
short menuItem;
if (!PyArg_ParseTuple(_args, "hh",
&menuID,
@@ -1869,9 +2638,14 @@ static PyMethodDef Menu_methods[] = {
"() -> None"},
#endif
{"NewMenu", (PyCFunction)Menu_NewMenu, 1,
- "(short menuID, Str255 menuTitle) -> (MenuHandle _rv)"},
+ "(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)"},
{"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1,
"(short resourceID) -> (MenuHandle _rv)"},
+
+#if TARGET_API_MAC_CARBON
+ {"CreateNewMenu", (PyCFunction)Menu_CreateNewMenu, 1,
+ "(MenuID menuID, MenuAttributes menuAttributes) -> (MenuHandle outMenuRef)"},
+#endif
{"MenuKey", (PyCFunction)Menu_MenuKey, 1,
"(CharParameter ch) -> (long _rv)"},
{"MenuSelect", (PyCFunction)Menu_MenuSelect, 1,
@@ -1887,26 +2661,38 @@ static PyMethodDef Menu_methods[] = {
{"InvalMenuBar", (PyCFunction)Menu_InvalMenuBar, 1,
"() -> None"},
{"HiliteMenu", (PyCFunction)Menu_HiliteMenu, 1,
- "(short menuID) -> None"},
+ "(MenuID menuID) -> None"},
{"GetNewMBar", (PyCFunction)Menu_GetNewMBar, 1,
- "(short menuBarID) -> (Handle _rv)"},
+ "(short menuBarID) -> (MenuBarHandle _rv)"},
{"GetMenuBar", (PyCFunction)Menu_GetMenuBar, 1,
- "() -> (Handle _rv)"},
+ "() -> (MenuBarHandle _rv)"},
{"SetMenuBar", (PyCFunction)Menu_SetMenuBar, 1,
- "(Handle menuList) -> None"},
+ "(MenuBarHandle mbar) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"DuplicateMenuBar", (PyCFunction)Menu_DuplicateMenuBar, 1,
+ "(MenuBarHandle mbar) -> (MenuBarHandle outBar)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"DisposeMenuBar", (PyCFunction)Menu_DisposeMenuBar, 1,
+ "(MenuBarHandle mbar) -> None"},
+#endif
{"GetMenuHandle", (PyCFunction)Menu_GetMenuHandle, 1,
- "(short menuID) -> (MenuHandle _rv)"},
+ "(MenuID menuID) -> (MenuHandle _rv)"},
{"MacDeleteMenu", (PyCFunction)Menu_MacDeleteMenu, 1,
- "(short menuID) -> None"},
+ "(MenuID menuID) -> None"},
{"ClearMenuBar", (PyCFunction)Menu_ClearMenuBar, 1,
"() -> None"},
+ {"SetMenuFlashCount", (PyCFunction)Menu_SetMenuFlashCount, 1,
+ "(short count) -> None"},
#if !TARGET_API_MAC_CARBON
{"SetMenuFlash", (PyCFunction)Menu_SetMenuFlash, 1,
"(short count) -> None"},
#endif
{"FlashMenuBar", (PyCFunction)Menu_FlashMenuBar, 1,
- "(short menuID) -> None"},
+ "(MenuID menuID) -> None"},
#if !TARGET_API_MAC_CARBON
{"SystemEdit", (PyCFunction)Menu_SystemEdit, 1,
@@ -1924,7 +2710,7 @@ static PyMethodDef Menu_methods[] = {
{"HideMenuBar", (PyCFunction)Menu_HideMenuBar, 1,
"() -> None"},
{"DeleteMCEntries", (PyCFunction)Menu_DeleteMCEntries, 1,
- "(short menuID, short menuItem) -> None"},
+ "(MenuID menuID, short menuItem) -> None"},
{"InitContextualMenus", (PyCFunction)Menu_InitContextualMenus, 1,
"() -> None"},
{"IsShowContextualMenuClick", (PyCFunction)Menu_IsShowContextualMenuClick, 1,
@@ -1961,7 +2747,7 @@ void initMenu()
Menu_Error = PyMac_GetOSErrException();
if (Menu_Error == NULL ||
PyDict_SetItemString(d, "Error", Menu_Error) != 0)
- Py_FatalError("can't initialize Menu.Error");
+ return;
Menu_Type.ob_type = &PyType_Type;
Py_INCREF(&Menu_Type);
if (PyDict_SetItemString(d, "MenuType", (PyObject *)&Menu_Type) != 0)
diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py
index 965172a..c9b1b42 100644
--- a/Mac/Modules/menu/menuscan.py
+++ b/Mac/Modules/menu/menuscan.py
@@ -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):
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
index 1325e10..20b4f36 100644
--- a/Mac/Modules/menu/menusupport.py
+++ b/Mac/Modules/menu/menusupport.py
@@ -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)
"""