Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f7d5aa61
Commit
f7d5aa61
authored
Dec 10, 2000
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapted to Universal Headers 3.3.2. More to follow.
parent
c6c28384
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
3034 additions
and
546 deletions
+3034
-546
Mac/Modules/ae/AEmodule.c
Mac/Modules/ae/AEmodule.c
+100
-31
Mac/Modules/ae/aescan.py
Mac/Modules/ae/aescan.py
+8
-0
Mac/Modules/ae/aesupport.py
Mac/Modules/ae/aesupport.py
+1
-0
Mac/Modules/app/Appmodule.c
Mac/Modules/app/Appmodule.c
+28
-1
Mac/Modules/app/appscan.py
Mac/Modules/app/appscan.py
+6
-0
Mac/Modules/app/appsupport.py
Mac/Modules/app/appsupport.py
+1
-0
Mac/Modules/cm/Cmmodule.c
Mac/Modules/cm/Cmmodule.c
+1
-1
Mac/Modules/cm/cmscan.py
Mac/Modules/cm/cmscan.py
+4
-0
Mac/Modules/ctl/Ctlmodule.c
Mac/Modules/ctl/Ctlmodule.c
+760
-189
Mac/Modules/ctl/ctlscan.py
Mac/Modules/ctl/ctlscan.py
+44
-9
Mac/Modules/ctl/ctlsupport.py
Mac/Modules/ctl/ctlsupport.py
+27
-0
Mac/Modules/dlg/Dlgmodule.c
Mac/Modules/dlg/Dlgmodule.c
+184
-2
Mac/Modules/dlg/dlgscan.py
Mac/Modules/dlg/dlgscan.py
+7
-0
Mac/Modules/dlg/dlgsupport.py
Mac/Modules/dlg/dlgsupport.py
+17
-8
Mac/Modules/drag/Dragmodule.c
Mac/Modules/drag/Dragmodule.c
+296
-219
Mac/Modules/drag/dragsupport.py
Mac/Modules/drag/dragsupport.py
+7
-17
Mac/Modules/evt/Evtmodule.c
Mac/Modules/evt/Evtmodule.c
+67
-1
Mac/Modules/evt/evtscan.py
Mac/Modules/evt/evtscan.py
+5
-0
Mac/Modules/fm/Fmmodule.c
Mac/Modules/fm/Fmmodule.c
+12
-12
Mac/Modules/help/Helpmodule.c
Mac/Modules/help/Helpmodule.c
+1
-1
Mac/Modules/icn/Icnmodule.c
Mac/Modules/icn/Icnmodule.c
+137
-1
Mac/Modules/icn/icnscan.py
Mac/Modules/icn/icnscan.py
+6
-0
Mac/Modules/list/Listmodule.c
Mac/Modules/list/Listmodule.c
+383
-1
Mac/Modules/list/listscan.py
Mac/Modules/list/listscan.py
+14
-0
Mac/Modules/list/listsupport.py
Mac/Modules/list/listsupport.py
+30
-0
Mac/Modules/menu/Menumodule.c
Mac/Modules/menu/Menumodule.c
+838
-52
Mac/Modules/menu/menuscan.py
Mac/Modules/menu/menuscan.py
+32
-0
Mac/Modules/menu/menusupport.py
Mac/Modules/menu/menusupport.py
+18
-1
No files found.
Mac/Modules/ae/AEmodule.c
View file @
f7d5aa61
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "pymactoolbox.h"
#include "pymactoolbox.h"
#include <AppleEvents.h>
#include <AppleEvents.h>
#include <AEObjects.h>
static
pascal
OSErr
GenericEventHandler
();
/* Forward */
static
pascal
OSErr
GenericEventHandler
();
/* Forward */
...
@@ -69,34 +70,6 @@ static void AEDesc_dealloc(self)
...
@@ -69,34 +70,6 @@ static void AEDesc_dealloc(self)
PyMem_DEL
(
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
)
static
PyObject
*
AEDesc_AEResetTimer
(
_self
,
_args
)
AEDescObject
*
_self
;
AEDescObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -672,9 +645,24 @@ static PyObject *AEDesc_AEPutAttributeDesc(_self, _args)
...
@@ -672,9 +645,24 @@ static PyObject *AEDesc_AEPutAttributeDesc(_self, _args)
return
_res
;
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
[]
=
{
static
PyMethodDef
AEDesc_methods
[]
=
{
{
"AESend"
,
(
PyCFunction
)
AEDesc_AESend
,
1
,
"(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"
},
{
"AEResetTimer"
,
(
PyCFunction
)
AEDesc_AEResetTimer
,
1
,
{
"AEResetTimer"
,
(
PyCFunction
)
AEDesc_AEResetTimer
,
1
,
"() -> None"
},
"() -> None"
},
{
"AESuspendTheCurrentEvent"
,
(
PyCFunction
)
AEDesc_AESuspendTheCurrentEvent
,
1
,
{
"AESuspendTheCurrentEvent"
,
(
PyCFunction
)
AEDesc_AESuspendTheCurrentEvent
,
1
,
...
@@ -725,6 +713,11 @@ static PyMethodDef AEDesc_methods[] = {
...
@@ -725,6 +713,11 @@ static PyMethodDef AEDesc_methods[] = {
"(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"
},
"(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"
},
{
"AEPutAttributeDesc"
,
(
PyCFunction
)
AEDesc_AEPutAttributeDesc
,
1
,
{
"AEPutAttributeDesc"
,
(
PyCFunction
)
AEDesc_AEPutAttributeDesc
,
1
,
"(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"
},
"(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"
},
#if TARGET_API_MAC_CARBON
{
"AEGetDescDataSize"
,
(
PyCFunction
)
AEDesc_AEGetDescDataSize
,
1
,
"() -> (Size _rv)"
},
#endif
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
};
};
...
@@ -941,6 +934,44 @@ static PyObject *AE_AEGetEventHandler(_self, _args)
...
@@ -941,6 +934,44 @@ static PyObject *AE_AEGetEventHandler(_self, _args)
return
_res
;
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
)
static
PyObject
*
AE_AEManagerInfo
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -1072,6 +1103,35 @@ static PyObject *AE_AECreateAppleEvent(_self, _args)
...
@@ -1072,6 +1103,35 @@ static PyObject *AE_AECreateAppleEvent(_self, _args)
return
_res
;
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
[]
=
{
static
PyMethodDef
AE_methods
[]
=
{
{
"AEProcessAppleEvent"
,
(
PyCFunction
)
AE_AEProcessAppleEvent
,
1
,
{
"AEProcessAppleEvent"
,
(
PyCFunction
)
AE_AEProcessAppleEvent
,
1
,
"(EventRecord theEventRecord) -> None"
},
"(EventRecord theEventRecord) -> None"
},
...
@@ -1087,6 +1147,10 @@ static PyMethodDef AE_methods[] = {
...
@@ -1087,6 +1147,10 @@ static PyMethodDef AE_methods[] = {
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"
},
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"
},
{
"AEGetEventHandler"
,
(
PyCFunction
)
AE_AEGetEventHandler
,
1
,
{
"AEGetEventHandler"
,
(
PyCFunction
)
AE_AEGetEventHandler
,
1
,
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"
},
"(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
,
{
"AEManagerInfo"
,
(
PyCFunction
)
AE_AEManagerInfo
,
1
,
"(AEKeyword keyWord) -> (long result)"
},
"(AEKeyword keyWord) -> (long result)"
},
{
"AECoercePtr"
,
(
PyCFunction
)
AE_AECoercePtr
,
1
,
{
"AECoercePtr"
,
(
PyCFunction
)
AE_AECoercePtr
,
1
,
...
@@ -1097,6 +1161,11 @@ static PyMethodDef AE_methods[] = {
...
@@ -1097,6 +1161,11 @@ static PyMethodDef AE_methods[] = {
"(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"
},
"(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"
},
{
"AECreateAppleEvent"
,
(
PyCFunction
)
AE_AECreateAppleEvent
,
1
,
{
"AECreateAppleEvent"
,
(
PyCFunction
)
AE_AECreateAppleEvent
,
1
,
"(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, AEReturnID returnID, AETransactionID transactionID) -> (AppleEvent result)"
},
"(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
}
{
NULL
,
NULL
,
0
}
};
};
...
@@ -1149,7 +1218,7 @@ void initAE()
...
@@ -1149,7 +1218,7 @@ void initAE()
AE_Error
=
PyMac_GetOSErrException
();
AE_Error
=
PyMac_GetOSErrException
();
if
(
AE_Error
==
NULL
||
if
(
AE_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
AE_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
AE_Error
)
!=
0
)
Py_FatalError
(
"can't initialize AE.Error"
)
;
return
;
AEDesc_Type
.
ob_type
=
&
PyType_Type
;
AEDesc_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
AEDesc_Type
);
Py_INCREF
(
&
AEDesc_Type
);
if
(
PyDict_SetItemString
(
d
,
"AEDescType"
,
(
PyObject
*
)
&
AEDesc_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"AEDescType"
,
(
PyObject
*
)
&
AEDesc_Type
)
!=
0
)
...
...
Mac/Modules/ae/aescan.py
View file @
f7d5aa61
...
@@ -70,11 +70,19 @@ class AppleEventsScanner(Scanner):
...
@@ -70,11 +70,19 @@ class AppleEventsScanner(Scanner):
return
[
return
[
"AEDisposeDesc"
,
"AEDisposeDesc"
,
# "AEGetEventHandler",
# "AEGetEventHandler",
"AEGetDescData"
,
# Use object.data
"AEGetSpecialHandler"
,
# Constants with funny definitions
# Constants with funny definitions
"kAEDontDisposeOnResume"
,
"kAEDontDisposeOnResume"
,
"kAEUseStandardDispatch"
,
"kAEUseStandardDispatch"
,
]
]
def
makegreylist
(
self
):
return
[
(
'#if TARGET_API_MAC_CARBON'
,
[
'AEGetDescDataSize'
,
'AEReplaceDescData'
,
])]
def
makeblacklisttypes
(
self
):
def
makeblacklisttypes
(
self
):
return
[
return
[
"ProcPtr"
,
"ProcPtr"
,
...
...
Mac/Modules/ae/aesupport.py
View file @
f7d5aa61
...
@@ -83,6 +83,7 @@ AEMethod = OSErrMethodGenerator
...
@@ -83,6 +83,7 @@ AEMethod = OSErrMethodGenerator
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
#include <AppleEvents.h>
#include <AppleEvents.h>
#include <AEObjects.h>
static pascal OSErr GenericEventHandler(); /* Forward */
static pascal OSErr GenericEventHandler(); /* Forward */
...
...
Mac/Modules/app/Appmodule.c
View file @
f7d5aa61
...
@@ -1111,6 +1111,28 @@ static PyObject *App_GetThemeTextColor(_self, _args)
...
@@ -1111,6 +1111,28 @@ static PyObject *App_GetThemeTextColor(_self, _args)
return
_res
;
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
[]
=
{
static
PyMethodDef
App_methods
[]
=
{
{
"RegisterAppearanceClient"
,
(
PyCFunction
)
App_RegisterAppearanceClient
,
1
,
{
"RegisterAppearanceClient"
,
(
PyCFunction
)
App_RegisterAppearanceClient
,
1
,
"() -> None"
},
"() -> None"
},
...
@@ -1218,6 +1240,11 @@ static PyMethodDef App_methods[] = {
...
@@ -1218,6 +1240,11 @@ static PyMethodDef App_methods[] = {
"(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"
},
"(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"
},
{
"GetThemeTextColor"
,
(
PyCFunction
)
App_GetThemeTextColor
,
1
,
{
"GetThemeTextColor"
,
(
PyCFunction
)
App_GetThemeTextColor
,
1
,
"(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"
},
"(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
}
{
NULL
,
NULL
,
0
}
};
};
...
@@ -1237,7 +1264,7 @@ void initApp()
...
@@ -1237,7 +1264,7 @@ void initApp()
App_Error
=
PyMac_GetOSErrException
();
App_Error
=
PyMac_GetOSErrException
();
if
(
App_Error
==
NULL
||
if
(
App_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
App_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
App_Error
)
!=
0
)
Py_FatalError
(
"can't initialize App.Error"
)
;
return
;
}
}
/* ========================= End module App ========================= */
/* ========================= End module App ========================= */
...
...
Mac/Modules/app/appscan.py
View file @
f7d5aa61
...
@@ -43,6 +43,12 @@ class MyScanner(Scanner):
...
@@ -43,6 +43,12 @@ class MyScanner(Scanner):
"GetThemeFont"
,
# Funny stringbuffer in/out parameter, I think...
"GetThemeFont"
,
# Funny stringbuffer in/out parameter, I think...
]
]
def
makegreylist
(
self
):
return
[
(
'#if TARGET_API_MAC_CARBON'
,
[
'GetThemeMetric'
,
])]
def
makeblacklisttypes
(
self
):
def
makeblacklisttypes
(
self
):
return
[
return
[
"MenuTitleDrawingUPP"
,
"MenuTitleDrawingUPP"
,
...
...
Mac/Modules/app/appsupport.py
View file @
f7d5aa61
...
@@ -65,6 +65,7 @@ ThemeGrowDirection = Type("ThemeGrowDirection", "H")
...
@@ -65,6 +65,7 @@ ThemeGrowDirection = Type("ThemeGrowDirection", "H")
ThemeSoundKind
=
OSTypeType
(
"ThemeSoundKind"
)
ThemeSoundKind
=
OSTypeType
(
"ThemeSoundKind"
)
ThemeDragSoundKind
=
OSTypeType
(
"ThemeDragSoundKind"
)
ThemeDragSoundKind
=
OSTypeType
(
"ThemeDragSoundKind"
)
ThemeBackgroundKind
=
Type
(
"ThemeBackgroundKind"
,
"l"
)
ThemeBackgroundKind
=
Type
(
"ThemeBackgroundKind"
,
"l"
)
ThemeMetric
=
Type
(
"ThemeMetric"
,
"l"
)
RGBColor
=
OpaqueType
(
"RGBColor"
,
"QdRGB"
)
RGBColor
=
OpaqueType
(
"RGBColor"
,
"QdRGB"
)
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
...
...
Mac/Modules/cm/Cmmodule.c
View file @
f7d5aa61
...
@@ -831,7 +831,7 @@ void initCm()
...
@@ -831,7 +831,7 @@ void initCm()
Cm_Error
=
PyMac_GetOSErrException
();
Cm_Error
=
PyMac_GetOSErrException
();
if
(
Cm_Error
==
NULL
||
if
(
Cm_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Cm_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Cm_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Cm.Error"
)
;
return
;
ComponentInstance_Type
.
ob_type
=
&
PyType_Type
;
ComponentInstance_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
ComponentInstance_Type
);
Py_INCREF
(
&
ComponentInstance_Type
);
if
(
PyDict_SetItemString
(
d
,
"ComponentInstanceType"
,
(
PyObject
*
)
&
ComponentInstance_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"ComponentInstanceType"
,
(
PyObject
*
)
&
ComponentInstance_Type
)
!=
0
)
...
...
Mac/Modules/cm/cmscan.py
View file @
f7d5aa61
...
@@ -56,6 +56,8 @@ class MyScanner(Scanner):
...
@@ -56,6 +56,8 @@ class MyScanner(Scanner):
"CallComponentClose"
,
"CallComponentClose"
,
"CallComponentOpen"
,
"CallComponentOpen"
,
"OpenAComponent"
,
"OpenAComponent"
,
"GetComponentPublicResource"
,
# Missing in CW Pro 6
"CallComponentGetPublicResource"
,
# Missing in CW Pro 6
]
]
def
makegreylist
(
self
):
def
makegreylist
(
self
):
...
@@ -77,6 +79,8 @@ class MyScanner(Scanner):
...
@@ -77,6 +79,8 @@ class MyScanner(Scanner):
"ComponentRoutineUPP"
,
"ComponentRoutineUPP"
,
"ComponentMPWorkFunctionUPP"
,
"ComponentMPWorkFunctionUPP"
,
"ComponentFunctionUPP"
,
"GetMissingComponentResourceUPP"
,
]
]
def
makerepairinstructions
(
self
):
def
makerepairinstructions
(
self
):
...
...
Mac/Modules/ctl/Ctlmodule.c
View file @
f7d5aa61
...
@@ -9,6 +9,9 @@
...
@@ -9,6 +9,9 @@
#include "pymactoolbox.h"
#include "pymactoolbox.h"
#include <Controls.h>
#include <Controls.h>
#ifndef kControlCheckBoxUncheckedValue
#include <ControlDefinitions.h>
#endif
staticforward
PyObject
*
CtlObj_WhichControl
(
ControlHandle
);
staticforward
PyObject
*
CtlObj_WhichControl
(
ControlHandle
);
...
@@ -46,6 +49,26 @@ ControlFontStyle_Convert(v, itself)
...
@@ -46,6 +49,26 @@ ControlFontStyle_Convert(v, itself)
QdRGB_Convert
,
&
itself
->
backColor
);
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 */
/* TrackControl and HandleControlClick callback support */
static
PyObject
*
tracker
;
static
PyObject
*
tracker
;
static
ControlActionUPP
mytracker_upp
;
static
ControlActionUPP
mytracker_upp
;
...
@@ -378,6 +401,55 @@ static PyObject *CtlObj_TestControl(_self, _args)
...
@@ -378,6 +401,55 @@ static PyObject *CtlObj_TestControl(_self, _args)
return
_res
;
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
)
static
PyObject
*
CtlObj_HandleControlKey
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -386,8 +458,8 @@ static PyObject *CtlObj_HandleControlKey(_self, _args)
...
@@ -386,8 +458,8 @@ static PyObject *CtlObj_HandleControlKey(_self, _args)
SInt16
_rv
;
SInt16
_rv
;
SInt16
inKeyCode
;
SInt16
inKeyCode
;
SInt16
inCharCode
;
SInt16
inCharCode
;
SInt16
inModifiers
;
EventModifiers
inModifiers
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh
h
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"hh
H
"
,
&
inKeyCode
,
&
inKeyCode
,
&
inCharCode
,
&
inCharCode
,
&
inModifiers
))
&
inModifiers
))
...
@@ -401,6 +473,32 @@ static PyObject *CtlObj_HandleControlKey(_self, _args)
...
@@ -401,6 +473,32 @@ static PyObject *CtlObj_HandleControlKey(_self, _args)
return
_res
;
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
)
static
PyObject
*
CtlObj_MoveControl
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -694,6 +792,47 @@ static PyObject *CtlObj_IsValidControlHandle(_self, _args)
...
@@ -694,6 +792,47 @@ static PyObject *CtlObj_IsValidControlHandle(_self, _args)
return
_res
;
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
)
static
PyObject
*
CtlObj_RemoveControlProperty
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -715,6 +854,62 @@ static PyObject *CtlObj_RemoveControlProperty(_self, _args)
...
@@ -715,6 +854,62 @@ static PyObject *CtlObj_RemoveControlProperty(_self, _args)
return
_res
;
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
)
static
PyObject
*
CtlObj_GetControlRegion
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -819,102 +1014,188 @@ static PyObject *CtlObj_SetControlColor(_self, _args)
...
@@ -819,102 +1014,188 @@ static PyObject *CtlObj_SetControlColor(_self, _args)
}
}
#endif
#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
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
SInt16
outValue
;
ControlHandle
inContainer
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
CtlObj_Convert
,
&
inContainer
))
return
NULL
;
return
NULL
;
_err
=
GetBevelButtonMenuValue
(
_self
->
ob_itself
,
_err
=
EmbedControl
(
_self
->
ob_itself
,
&
outValue
);
inContainer
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"h"
,
Py_INCREF
(
Py_None
);
outValue
)
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
#endif
#if !TARGET_API_MAC_CARBON
static
PyObject
*
CtlObj_
SetBevelButtonMenuValue
(
_self
,
_args
)
static
PyObject
*
CtlObj_
AutoEmbedControl
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
SInt16
inValue
;
WindowPtr
inWindow
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
O&
"
,
&
inValue
))
WinObj_Convert
,
&
inWindow
))
return
NULL
;
return
NULL
;
_err
=
SetBevelButtonMenuValue
(
_self
->
ob_itself
,
_err
=
AutoEmbedControl
(
_self
->
ob_itself
,
inValue
);
inWindow
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
#endif
#if !TARGET_API_MAC_CARBON
static
PyObject
*
CtlObj_GetSuperControl
(
_self
,
_args
)
static
PyObject
*
CtlObj_GetBevelButtonMenuHandle
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
MenuHandle
outHandle
;
ControlHandle
outParent
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_err
=
Get
BevelButtonMenuHandle
(
_self
->
ob_itself
,
_err
=
Get
SuperControl
(
_self
->
ob_itself
,
&
outHandle
);
&
outParent
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
_res
=
Py_BuildValue
(
"O&"
,
MenuObj_New
,
outHandle
);
CtlObj_WhichControl
,
outParent
);
return
_res
;
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
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
IconTransformType
transform
;
UInt16
inIndex
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
ControlHandle
outSubControl
;
&
transform
))
if
(
!
PyArg_ParseTuple
(
_args
,
"H"
,
&
inIndex
))
return
NULL
;
return
NULL
;
_err
=
SetBevelButtonTransform
(
_self
->
ob_itself
,
_err
=
GetIndexedSubControl
(
_self
->
ob_itself
,
transform
);
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
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
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
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
IconTransformType
inTransform
;
ControlPartCode
inPart
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
ResType
inTagName
;
&
inTransform
))
Size
outMaxSize
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hO&"
,
&
inPart
,
PyMac_GetOSType
,
&
inTagName
))
return
NULL
;
return
NULL
;
_err
=
SetImageWellTransform
(
_self
->
ob_itself
,
_err
=
GetControlDataSize
(
_self
->
ob_itself
,
inTransform
);
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
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
...
@@ -922,236 +1203,365 @@ static PyObject *CtlObj_SetImageWellTransform(_self, _args)
...
@@ -922,236 +1203,365 @@ static PyObject *CtlObj_SetImageWellTransform(_self, _args)
}
}
#endif
#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
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OS
Err
_err
;
OS
Status
_err
;
Rect
outContentRect
;
Boolean
tracks
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_err
=
GetTabContentRect
(
_self
->
ob_itself
,
_err
=
IsControlDragTrackingEnabled
(
_self
->
ob_itself
,
&
outContentRect
);
&
tracks
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
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&"
,
_res
=
Py_BuildValue
(
"O&"
,
PyMac_BuildRect
,
&
outContentRect
);
WinObj_New
,
_rv
);
return
_res
;
return
_res
;
}
}
#endif
#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
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
Handle
_rv
;
SInt16
inTabToHilite
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
Boolean
inEnabled
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hb"
,
&
inTabToHilite
,
&
inEnabled
))
return
NULL
;
return
NULL
;
_err
=
SetTabEnabled
(
_self
->
ob_itself
,
_rv
=
GetControlDataHandle
(
_self
->
ob_itself
);
inTabToHilite
,
_res
=
Py_BuildValue
(
"O&"
,
inEnabled
);
ResObj_New
,
_rv
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
#endif
#endif
#if
!TARGET_API_MAC_CARBON
#if
ACCESSOR_CALLS_ARE_FUNCTIONS
static
PyObject
*
CtlObj_
SetDisclosureTriangleLastValu
e
(
_self
,
_args
)
static
PyObject
*
CtlObj_
GetControlPopupMenuHandl
e
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
MenuHandle
_rv
;
SInt16
inValue
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
inValue
))
return
NULL
;
return
NULL
;
_err
=
SetDisclosureTriangleLastValue
(
_self
->
ob_itself
,
_rv
=
GetControlPopupMenuHandle
(
_self
->
ob_itself
);
inValue
);
_res
=
Py_BuildValue
(
"O&"
,
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
MenuObj_New
,
_rv
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
#endif
#endif
static
PyObject
*
CtlObj_SendControlMessage
(
_self
,
_args
)
#if ACCESSOR_CALLS_ARE_FUNCTIONS
static
PyObject
*
CtlObj_GetControlPopupMenuID
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
SInt32
_rv
;
short
_rv
;
SInt16
inMessage
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
SInt32
inParam
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hl"
,
&
inMessage
,
&
inParam
))
return
NULL
;
return
NULL
;
_rv
=
SendControlMessage
(
_self
->
ob_itself
,
_rv
=
GetControlPopupMenuID
(
_self
->
ob_itself
);
inMessage
,
_res
=
Py_BuildValue
(
"h"
,
inParam
);
_res
=
Py_BuildValue
(
"l"
,
_rv
);
_rv
);
return
_res
;
return
_res
;
}
}
#endif
static
PyObject
*
CtlObj_EmbedControl
(
_self
,
_args
)
#if ACCESSOR_CALLS_ARE_FUNCTIONS
static
PyObject
*
CtlObj_SetControlDataHandle
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
Handle
dataHandle
;
ControlHandle
inContainer
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
CtlObj_Convert
,
&
inContainer
))
ResObj_Convert
,
&
dataHandle
))
return
NULL
;
return
NULL
;
_err
=
EmbedControl
(
_self
->
ob_itself
,
SetControlDataHandle
(
_self
->
ob_itself
,
inContainer
);
dataHandle
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
#endif
static
PyObject
*
CtlObj_AutoEmbedControl
(
_self
,
_args
)
#if ACCESSOR_CALLS_ARE_FUNCTIONS
static
PyObject
*
CtlObj_SetControlBounds
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
Rect
bounds
;
WindowPtr
inWindow
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
WinObj_Convert
,
&
inWindow
))
PyMac_GetRect
,
&
bounds
))
return
NULL
;
return
NULL
;
_err
=
AutoEmbedControl
(
_self
->
ob_itself
,
SetControlBounds
(
_self
->
ob_itself
,
inWindow
);
&
bounds
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
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
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
ControlHandle
outParent
;
SInt16
outValue
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_err
=
Get
SuperControl
(
_self
->
ob_itself
,
_err
=
Get
BevelButtonMenuValue
(
_self
->
ob_itself
,
&
outParent
);
&
outValue
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"
O&
"
,
_res
=
Py_BuildValue
(
"
h
"
,
CtlObj_WhichControl
,
outParent
);
outValue
);
return
_res
;
return
_res
;
}
}
static
PyObject
*
CtlObj_
CountSubControls
(
_self
,
_args
)
static
PyObject
*
CtlObj_
SetBevelButtonMenuValue
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
UInt16
outNumChildren
;
SInt16
inValue
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
inValue
))
return
NULL
;
_err
=
SetBevelButtonMenuValue
(
_self
->
ob_itself
,
inValue
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
CtlObj_GetBevelButtonMenuHandle
(
_self
,
_args
)
ControlObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
OSErr
_err
;
MenuHandle
outHandle
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_err
=
CountSubControls
(
_self
->
ob_itself
,
_err
=
GetBevelButtonMenuHandle
(
_self
->
ob_itself
,
&
outNumChildren
);
&
outHandle
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"
H
"
,
_res
=
Py_BuildValue
(
"
O&
"
,
outNumChildren
);
MenuObj_New
,
outHandle
);
return
_res
;
return
_res
;
}
}
static
PyObject
*
CtlObj_
GetIndexedSubControl
(
_self
,
_args
)
static
PyObject
*
CtlObj_
SetBevelButtonTransform
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
UInt16
inIndex
;
IconTransformType
transform
;
ControlHandle
outSubControl
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"H"
,
&
transform
))
&
inIndex
))
return
NULL
;
return
NULL
;
_err
=
GetIndexedSubControl
(
_self
->
ob_itself
,
_err
=
SetBevelButtonTransform
(
_self
->
ob_itself
,
inIndex
,
transform
);
&
outSubControl
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
Py_INCREF
(
Py_None
);
CtlObj_WhichControl
,
outSubControl
)
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
static
PyObject
*
CtlObj_Set
ControlSupervisor
(
_self
,
_args
)
static
PyObject
*
CtlObj_Set
DisclosureTriangleLastValue
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
ControlHandle
inBoss
;
SInt16
inValue
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
O&
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
CtlObj_Convert
,
&
inBoss
))
&
inValue
))
return
NULL
;
return
NULL
;
_err
=
Set
ControlSupervisor
(
_self
->
ob_itself
,
_err
=
Set
DisclosureTriangleLastValue
(
_self
->
ob_itself
,
inBoss
);
inValue
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
static
PyObject
*
CtlObj_Get
ControlFeatures
(
_self
,
_args
)
static
PyObject
*
CtlObj_Get
TabContentRect
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
UInt32
outFeatures
;
Rect
outContentRect
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_err
=
Get
ControlFeatures
(
_self
->
ob_itself
,
_err
=
Get
TabContentRect
(
_self
->
ob_itself
,
&
outFeatures
);
&
outContentRect
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"
l
"
,
_res
=
Py_BuildValue
(
"
O&
"
,
outFeatures
);
PyMac_BuildRect
,
&
outContentRect
);
return
_res
;
return
_res
;
}
}
static
PyObject
*
CtlObj_
GetControlDataSize
(
_self
,
_args
)
static
PyObject
*
CtlObj_
SetTabEnabled
(
_self
,
_args
)
ControlObject
*
_self
;
ControlObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
ControlPartCode
inPart
;
SInt16
inTabToHilite
;
ResType
inTagName
;
Boolean
inEnabled
;
Size
outMaxSize
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hb"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"hO&"
,
&
inTabToHilite
,
&
inPart
,
&
inEnabled
))
PyMac_GetOSType
,
&
inTagName
))
return
NULL
;
return
NULL
;
_err
=
GetControlDataSize
(
_self
->
ob_itself
,
_err
=
SetTabEnabled
(
_self
->
ob_itself
,
inPart
,
inTabToHilite
,
inTagName
,
inEnabled
);
&
outMaxSize
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"l"
,
Py_INCREF
(
Py_None
);
outMaxSize
);
_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
;
return
_res
;
}
}
...
@@ -1540,8 +1950,23 @@ static PyMethodDef CtlObj_methods[] = {
...
@@ -1540,8 +1950,23 @@ static PyMethodDef CtlObj_methods[] = {
"(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None"
},
"(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None"
},
{
"TestControl"
,
(
PyCFunction
)
CtlObj_TestControl
,
1
,
{
"TestControl"
,
(
PyCFunction
)
CtlObj_TestControl
,
1
,
"(Point testPoint) -> (ControlPartCode _rv)"
},
"(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
,
{
"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
,
{
"MoveControl"
,
(
PyCFunction
)
CtlObj_MoveControl
,
1
,
"(SInt16 h, SInt16 v) -> None"
},
"(SInt16 h, SInt16 v) -> None"
},
{
"SizeControl"
,
(
PyCFunction
)
CtlObj_SizeControl
,
1
,
{
"SizeControl"
,
(
PyCFunction
)
CtlObj_SizeControl
,
1
,
...
@@ -1580,8 +2005,28 @@ static PyMethodDef CtlObj_methods[] = {
...
@@ -1580,8 +2005,28 @@ static PyMethodDef CtlObj_methods[] = {
"(SInt32 newMinimum) -> None"
},
"(SInt32 newMinimum) -> None"
},
{
"IsValidControlHandle"
,
(
PyCFunction
)
CtlObj_IsValidControlHandle
,
1
,
{
"IsValidControlHandle"
,
(
PyCFunction
)
CtlObj_IsValidControlHandle
,
1
,
"() -> (Boolean _rv)"
},
"() -> (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
,
{
"RemoveControlProperty"
,
(
PyCFunction
)
CtlObj_RemoveControlProperty
,
1
,
"(OSType propertyCreator, OSType propertyTag) -> None"
},
"(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
,
{
"GetControlRegion"
,
(
PyCFunction
)
CtlObj_GetControlRegion
,
1
,
"(ControlPartCode inPart, RgnHandle outRegion) -> None"
},
"(ControlPartCode inPart, RgnHandle outRegion) -> None"
},
{
"GetControlVariant"
,
(
PyCFunction
)
CtlObj_GetControlVariant
,
1
,
{
"GetControlVariant"
,
(
PyCFunction
)
CtlObj_GetControlVariant
,
1
,
...
@@ -1600,46 +2045,6 @@ static PyMethodDef CtlObj_methods[] = {
...
@@ -1600,46 +2045,6 @@ static PyMethodDef CtlObj_methods[] = {
{
"SetControlColor"
,
(
PyCFunction
)
CtlObj_SetControlColor
,
1
,
{
"SetControlColor"
,
(
PyCFunction
)
CtlObj_SetControlColor
,
1
,
"(CCTabHandle newColorTable) -> None"
},
"(CCTabHandle newColorTable) -> None"
},
#endif
#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
,
{
"SendControlMessage"
,
(
PyCFunction
)
CtlObj_SendControlMessage
,
1
,
"(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"
},
"(SInt16 inMessage, SInt32 inParam) -> (SInt32 _rv)"
},
{
"EmbedControl"
,
(
PyCFunction
)
CtlObj_EmbedControl
,
1
,
{
"EmbedControl"
,
(
PyCFunction
)
CtlObj_EmbedControl
,
1
,
...
@@ -1658,6 +2063,87 @@ static PyMethodDef CtlObj_methods[] = {
...
@@ -1658,6 +2063,87 @@ static PyMethodDef CtlObj_methods[] = {
"() -> (UInt32 outFeatures)"
},
"() -> (UInt32 outFeatures)"
},
{
"GetControlDataSize"
,
(
PyCFunction
)
CtlObj_GetControlDataSize
,
1
,
{
"GetControlDataSize"
,
(
PyCFunction
)
CtlObj_GetControlDataSize
,
1
,
"(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)"
},
"(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
,
{
"as_Resource"
,
(
PyCFunction
)
CtlObj_as_Resource
,
1
,
"() -> (Handle _rv)"
},
"() -> (Handle _rv)"
},
{
"GetControlRect"
,
(
PyCFunction
)
CtlObj_GetControlRect
,
1
,
{
"GetControlRect"
,
(
PyCFunction
)
CtlObj_GetControlRect
,
1
,
...
@@ -1906,6 +2392,31 @@ static PyObject *Ctl_IdleControls(_self, _args)
...
@@ -1906,6 +2392,31 @@ static PyObject *Ctl_IdleControls(_self, _args)
return
_res
;
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
)
static
PyObject
*
Ctl_DumpControlHierarchy
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -2057,6 +2568,51 @@ static PyObject *Ctl_ClearKeyboardFocus(_self, _args)
...
@@ -2057,6 +2568,51 @@ static PyObject *Ctl_ClearKeyboardFocus(_self, _args)
return
_res
;
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
)
static
PyObject
*
Ctl_as_Control
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -2088,6 +2644,11 @@ static PyMethodDef Ctl_methods[] = {
...
@@ -2088,6 +2644,11 @@ static PyMethodDef Ctl_methods[] = {
"(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"
},
"(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"
},
{
"IdleControls"
,
(
PyCFunction
)
Ctl_IdleControls
,
1
,
{
"IdleControls"
,
(
PyCFunction
)
Ctl_IdleControls
,
1
,
"(WindowPtr inWindow) -> None"
},
"(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
,
{
"DumpControlHierarchy"
,
(
PyCFunction
)
Ctl_DumpControlHierarchy
,
1
,
"(WindowPtr inWindow, FSSpec inDumpFile) -> None"
},
"(WindowPtr inWindow, FSSpec inDumpFile) -> None"
},
{
"CreateRootControl"
,
(
PyCFunction
)
Ctl_CreateRootControl
,
1
,
{
"CreateRootControl"
,
(
PyCFunction
)
Ctl_CreateRootControl
,
1
,
...
@@ -2104,6 +2665,16 @@ static PyMethodDef Ctl_methods[] = {
...
@@ -2104,6 +2665,16 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr inWindow) -> None"
},
"(WindowPtr inWindow) -> None"
},
{
"ClearKeyboardFocus"
,
(
PyCFunction
)
Ctl_ClearKeyboardFocus
,
1
,
{
"ClearKeyboardFocus"
,
(
PyCFunction
)
Ctl_ClearKeyboardFocus
,
1
,
"(WindowPtr inWindow) -> None"
},
"(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
,
{
"as_Control"
,
(
PyCFunction
)
Ctl_as_Control
,
1
,
"(Handle h) -> (ControlHandle _rv)"
},
"(Handle h) -> (ControlHandle _rv)"
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
...
@@ -2320,7 +2891,7 @@ void initCtl()
...
@@ -2320,7 +2891,7 @@ void initCtl()
Ctl_Error
=
PyMac_GetOSErrException
();
Ctl_Error
=
PyMac_GetOSErrException
();
if
(
Ctl_Error
==
NULL
||
if
(
Ctl_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Ctl_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Ctl_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Ctl.Error"
)
;
return
;
Control_Type
.
ob_type
=
&
PyType_Type
;
Control_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
Control_Type
);
Py_INCREF
(
&
Control_Type
);
if
(
PyDict_SetItemString
(
d
,
"ControlType"
,
(
PyObject
*
)
&
Control_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"ControlType"
,
(
PyObject
*
)
&
Control_Type
)
!=
0
)
...
...
Mac/Modules/ctl/ctlscan.py
View file @
f7d5aa61
...
@@ -8,7 +8,8 @@ from scantools import Scanner
...
@@ -8,7 +8,8 @@ from scantools import Scanner
from
bgenlocations
import
TOOLBOXDIR
from
bgenlocations
import
TOOLBOXDIR
def
main
():
def
main
():
input
=
"Controls.h"
# input = "Controls.h" # Universal Headers < 3.3
input
=
[
"Controls.h"
,
"ControlDefinitions.h"
]
# Universal Headers >= 3.3
output
=
"ctlgen.py"
output
=
"ctlgen.py"
defsoutput
=
TOOLBOXDIR
+
"Controls.py"
defsoutput
=
TOOLBOXDIR
+
"Controls.py"
scanner
=
MyScanner
(
input
,
output
,
defsoutput
)
scanner
=
MyScanner
(
input
,
output
,
defsoutput
)
...
@@ -85,14 +86,43 @@ class MyScanner(Scanner):
...
@@ -85,14 +86,43 @@ class MyScanner(Scanner):
'GetAuxiliaryControlRecord'
,
'GetAuxiliaryControlRecord'
,
'SetControlColor'
,
'SetControlColor'
,
# These have suddenly disappeared in UH 3.3.2...
# These have suddenly disappeared in UH 3.3.2...
'GetBevelButtonMenuValue'
,
## 'GetBevelButtonMenuValue',
'SetBevelButtonMenuValue'
,
## 'SetBevelButtonMenuValue',
'GetBevelButtonMenuHandle'
,
## 'GetBevelButtonMenuHandle',
'SetBevelButtonTransform'
,
## 'SetBevelButtonTransform',
'SetImageWellTransform'
,
## 'SetImageWellTransform',
'GetTabContentRect'
,
## 'GetTabContentRect',
'SetTabEnabled'
,
## 'SetTabEnabled',
'SetDisclosureTriangleLastValue'
,
## '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
):
def
makeblacklisttypes
(
self
):
...
@@ -101,6 +131,11 @@ class MyScanner(Scanner):
...
@@ -101,6 +131,11 @@ class MyScanner(Scanner):
'ControlActionUPP'
,
'ControlActionUPP'
,
'ControlButtonContentInfoPtr'
,
'ControlButtonContentInfoPtr'
,
'Ptr'
,
'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
):
def
makerepairinstructions
(
self
):
...
...
Mac/Modules/ctl/ctlsupport.py
View file @
f7d5aa61
...
@@ -32,6 +32,8 @@ ControlPartCode = Type("ControlPartCode", "h")
...
@@ -32,6 +32,8 @@ ControlPartCode = Type("ControlPartCode", "h")
DragConstraint
=
Type
(
"DragConstraint"
,
"H"
)
DragConstraint
=
Type
(
"DragConstraint"
,
"H"
)
ControlVariant
=
Type
(
"ControlVariant"
,
"h"
)
ControlVariant
=
Type
(
"ControlVariant"
,
"h"
)
IconTransformType
=
Type
(
"IconTransformType"
,
"h"
)
IconTransformType
=
Type
(
"IconTransformType"
,
"h"
)
EventModifiers
=
Type
(
"EventModifiers"
,
"H"
)
ClickActivationResult
=
Type
(
"ClickActivationResult"
,
"l"
)
ControlButtonGraphicAlignment
=
Type
(
"ControlButtonGraphicAlignment"
,
"h"
)
ControlButtonGraphicAlignment
=
Type
(
"ControlButtonGraphicAlignment"
,
"h"
)
ControlButtonTextAlignment
=
Type
(
"ControlButtonTextAlignment"
,
"h"
)
ControlButtonTextAlignment
=
Type
(
"ControlButtonTextAlignment"
,
"h"
)
ControlButtonTextPlacement
=
Type
(
"ControlButtonTextPlacement"
,
"h"
)
ControlButtonTextPlacement
=
Type
(
"ControlButtonTextPlacement"
,
"h"
)
...
@@ -40,9 +42,14 @@ ControlFocusPart = Type("ControlFocusPart", "h")
...
@@ -40,9 +42,14 @@ ControlFocusPart = Type("ControlFocusPart", "h")
ControlFontStyleRec
=
OpaqueType
(
'ControlFontStyleRec'
,
'ControlFontStyle'
)
ControlFontStyleRec
=
OpaqueType
(
'ControlFontStyleRec'
,
'ControlFontStyle'
)
ControlFontStyleRec_ptr
=
ControlFontStyleRec
ControlFontStyleRec_ptr
=
ControlFontStyleRec
ControlID
=
OpaqueType
(
'ControlID'
,
'PyControlID'
)
ControlID_ptr
=
ControlID
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
#include <%s>"""
%
MACHEADERFILE
+
"""
#include <%s>"""
%
MACHEADERFILE
+
"""
#ifndef kControlCheckBoxUncheckedValue
#include <ControlDefinitions.h>
#endif
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
staticforward PyObject *CtlObj_WhichControl(ControlHandle);
...
@@ -80,6 +87,26 @@ ControlFontStyle_Convert(v, itself)
...
@@ -80,6 +87,26 @@ ControlFontStyle_Convert(v, itself)
QdRGB_Convert, &itself->backColor);
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 */
/* TrackControl and HandleControlClick callback support */
static PyObject *tracker;
static PyObject *tracker;
static ControlActionUPP mytracker_upp;
static ControlActionUPP mytracker_upp;
...
...
Mac/Modules/dlg/Dlgmodule.c
View file @
f7d5aa61
...
@@ -10,6 +10,13 @@
...
@@ -10,6 +10,13 @@
#include <Dialogs.h>
#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? */
/* XXX Shouldn't this be a stack? */
static
PyObject
*
Dlg_FilterProc_callback
=
NULL
;
static
PyObject
*
Dlg_FilterProc_callback
=
NULL
;
...
@@ -399,6 +406,63 @@ static PyObject *DlgObj_ShortenDITL(_self, _args)
...
@@ -399,6 +406,63 @@ static PyObject *DlgObj_ShortenDITL(_self, _args)
return
_res
;
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
)
static
PyObject
*
DlgObj_StdFilterProc
(
_self
,
_args
)
DialogObject
*
_self
;
DialogObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -666,7 +730,21 @@ static PyObject *DlgObj_GetDialogWindow(_self, _args)
...
@@ -666,7 +730,21 @@ static PyObject *DlgObj_GetDialogWindow(_self, _args)
return
NULL
;
return
NULL
;
_rv
=
GetDialogWindow
(
_self
->
ob_itself
);
_rv
=
GetDialogWindow
(
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"O&"
,
_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
;
return
_res
;
}
}
...
@@ -712,6 +790,33 @@ static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args)
...
@@ -712,6 +790,33 @@ static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args)
return
_res
;
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
#if !TARGET_API_MAC_CARBON
static
PyObject
*
DlgObj_SetGrafPortOfDialog
(
_self
,
_args
)
static
PyObject
*
DlgObj_SetGrafPortOfDialog
(
_self
,
_args
)
...
@@ -759,6 +864,16 @@ static PyMethodDef DlgObj_methods[] = {
...
@@ -759,6 +864,16 @@ static PyMethodDef DlgObj_methods[] = {
"() -> (DialogItemIndex _rv)"
},
"() -> (DialogItemIndex _rv)"
},
{
"ShortenDITL"
,
(
PyCFunction
)
DlgObj_ShortenDITL
,
1
,
{
"ShortenDITL"
,
(
PyCFunction
)
DlgObj_ShortenDITL
,
1
,
"(DialogItemIndex numberItems) -> None"
},
"(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
,
{
"StdFilterProc"
,
(
PyCFunction
)
DlgObj_StdFilterProc
,
1
,
"() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"
},
"() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"
},
{
"SetDialogDefaultItem"
,
(
PyCFunction
)
DlgObj_SetDialogDefaultItem
,
1
,
{
"SetDialogDefaultItem"
,
(
PyCFunction
)
DlgObj_SetDialogDefaultItem
,
1
,
...
@@ -787,12 +902,18 @@ static PyMethodDef DlgObj_methods[] = {
...
@@ -787,12 +902,18 @@ static PyMethodDef DlgObj_methods[] = {
"() -> (EventMask outMask)"
},
"() -> (EventMask outMask)"
},
{
"GetDialogWindow"
,
(
PyCFunction
)
DlgObj_GetDialogWindow
,
1
,
{
"GetDialogWindow"
,
(
PyCFunction
)
DlgObj_GetDialogWindow
,
1
,
"() -> (WindowPtr _rv)"
},
"() -> (WindowPtr _rv)"
},
{
"GetDialogTextEditHandle"
,
(
PyCFunction
)
DlgObj_GetDialogTextEditHandle
,
1
,
"() -> (TEHandle _rv)"
},
{
"GetDialogDefaultItem"
,
(
PyCFunction
)
DlgObj_GetDialogDefaultItem
,
1
,
{
"GetDialogDefaultItem"
,
(
PyCFunction
)
DlgObj_GetDialogDefaultItem
,
1
,
"() -> (SInt16 _rv)"
},
"() -> (SInt16 _rv)"
},
{
"GetDialogCancelItem"
,
(
PyCFunction
)
DlgObj_GetDialogCancelItem
,
1
,
{
"GetDialogCancelItem"
,
(
PyCFunction
)
DlgObj_GetDialogCancelItem
,
1
,
"() -> (SInt16 _rv)"
},
"() -> (SInt16 _rv)"
},
{
"GetDialogKeyboardFocusItem"
,
(
PyCFunction
)
DlgObj_GetDialogKeyboardFocusItem
,
1
,
{
"GetDialogKeyboardFocusItem"
,
(
PyCFunction
)
DlgObj_GetDialogKeyboardFocusItem
,
1
,
"() -> (SInt16 _rv)"
},
"() -> (SInt16 _rv)"
},
{
"SetPortDialogPort"
,
(
PyCFunction
)
DlgObj_SetPortDialogPort
,
1
,
"() -> None"
},
{
"GetDialogPort"
,
(
PyCFunction
)
DlgObj_GetDialogPort
,
1
,
"() -> (CGrafPtr _rv)"
},
#if !TARGET_API_MAC_CARBON
#if !TARGET_API_MAC_CARBON
{
"SetGrafPortOfDialog"
,
(
PyCFunction
)
DlgObj_SetGrafPortOfDialog
,
1
,
{
"SetGrafPortOfDialog"
,
(
PyCFunction
)
DlgObj_SetGrafPortOfDialog
,
1
,
...
@@ -1168,6 +1289,33 @@ static PyObject *Dlg_ResetAlertStage(_self, _args)
...
@@ -1168,6 +1289,33 @@ static PyObject *Dlg_ResetAlertStage(_self, _args)
return
_res
;
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
)
static
PyObject
*
Dlg_NewFeaturesDialog
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -1209,6 +1357,22 @@ static PyObject *Dlg_NewFeaturesDialog(_self, _args)
...
@@ -1209,6 +1357,22 @@ static PyObject *Dlg_NewFeaturesDialog(_self, _args)
return
_res
;
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
)
static
PyObject
*
Dlg_SetUserItemHandler
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -1273,8 +1437,15 @@ static PyMethodDef Dlg_methods[] = {
...
@@ -1273,8 +1437,15 @@ static PyMethodDef Dlg_methods[] = {
"(SInt16 fontNum) -> None"
},
"(SInt16 fontNum) -> None"
},
{
"ResetAlertStage"
,
(
PyCFunction
)
Dlg_ResetAlertStage
,
1
,
{
"ResetAlertStage"
,
(
PyCFunction
)
Dlg_ResetAlertStage
,
1
,
"() -> None"
},
"() -> 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
,
{
"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)"
},
"(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
,
{
"SetUserItemHandler"
,
(
PyCFunction
)
Dlg_SetUserItemHandler
,
1
,
NULL
},
NULL
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
...
@@ -1282,6 +1453,17 @@ static PyMethodDef Dlg_methods[] = {
...
@@ -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
()
void
initDlg
()
{
{
...
@@ -1296,7 +1478,7 @@ void initDlg()
...
@@ -1296,7 +1478,7 @@ void initDlg()
Dlg_Error
=
PyMac_GetOSErrException
();
Dlg_Error
=
PyMac_GetOSErrException
();
if
(
Dlg_Error
==
NULL
||
if
(
Dlg_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Dlg_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Dlg_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Dlg.Error"
)
;
return
;
Dialog_Type
.
ob_type
=
&
PyType_Type
;
Dialog_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
Dialog_Type
);
Py_INCREF
(
&
Dialog_Type
);
if
(
PyDict_SetItemString
(
d
,
"DialogType"
,
(
PyObject
*
)
&
Dialog_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"DialogType"
,
(
PyObject
*
)
&
Dialog_Type
)
!=
0
)
...
...
Mac/Modules/dlg/dlgscan.py
View file @
f7d5aa61
...
@@ -59,11 +59,18 @@ class MyScanner(Scanner):
...
@@ -59,11 +59,18 @@ class MyScanner(Scanner):
return
[
return
[
(
'#if !TARGET_API_MAC_CARBON'
,
[
(
'#if !TARGET_API_MAC_CARBON'
,
[
'SetGrafPortOfDialog'
,
'SetGrafPortOfDialog'
,
]),
(
'#if TARGET_API_MAC_CARBON'
,
[
'InsertDialogItem'
,
'RemoveDialogItems'
,
'GetParamText'
,
])]
])]
def
makeblacklisttypes
(
self
):
def
makeblacklisttypes
(
self
):
return
[
return
[
"AlertStdAlertParamPtr"
,
# Too much work, for now
"AlertStdAlertParamPtr"
,
# Too much work, for now
"AlertStdAlertParamRec"
,
# ditto
"AlertStdAlertParamRec_ptr"
,
# ditto
"QTModelessCallbackProcPtr"
,
"QTModelessCallbackProcPtr"
,
]
]
...
...
Mac/Modules/dlg/dlgsupport.py
View file @
f7d5aa61
...
@@ -19,6 +19,8 @@ ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterPr
...
@@ -19,6 +19,8 @@ ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterPr
ModalFilterUPP
=
ModalFilterProcPtr
ModalFilterUPP
=
ModalFilterProcPtr
RgnHandle
=
OpaqueByValueType
(
"RgnHandle"
,
"ResObj"
)
RgnHandle
=
OpaqueByValueType
(
"RgnHandle"
,
"ResObj"
)
TEHandle
=
OpaqueByValueType
(
"TEHandle"
,
"ResObj"
)
CGrafPtr
=
OpaqueByValueType
(
"CGrafPtr"
,
"GrafObj"
)
DITLMethod
=
Type
(
"DITLMethod"
,
"h"
)
DITLMethod
=
Type
(
"DITLMethod"
,
"h"
)
DialogItemIndex
=
Type
(
"DialogItemIndex"
,
"h"
)
DialogItemIndex
=
Type
(
"DialogItemIndex"
,
"h"
)
...
@@ -31,6 +33,13 @@ EventMask = Type("EventMask", "H")
...
@@ -31,6 +33,13 @@ EventMask = Type("EventMask", "H")
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
#include <Dialogs.h>
#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? */
/* XXX Shouldn't this be a stack? */
static PyObject *Dlg_FilterProc_callback = NULL;
static PyObject *Dlg_FilterProc_callback = NULL;
...
@@ -178,14 +187,14 @@ for f in methods: object.add(f)
...
@@ -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
# Some methods that are currently macro's in C, but will be real routines
# in MacOS 8.
# in MacOS 8.
f
=
Method
(
ExistingWindowPtr
,
'GetDialogWindow'
,
(
DialogRef
,
'dialog'
,
InMode
))
##
f = Method(ExistingWindowPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode))
object
.
add
(
f
)
##
object.add(f)
f
=
Method
(
SInt16
,
'GetDialogDefaultItem'
,
(
DialogRef
,
'dialog'
,
InMode
))
##
f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode))
object
.
add
(
f
)
##
object.add(f)
f
=
Method
(
SInt16
,
'GetDialogCancelItem'
,
(
DialogRef
,
'dialog'
,
InMode
))
##
f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode))
object
.
add
(
f
)
##
object.add(f)
f
=
Method
(
SInt16
,
'GetDialogKeyboardFocusItem'
,
(
DialogRef
,
'dialog'
,
InMode
))
##
f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode))
object
.
add
(
f
)
##
object.add(f)
f
=
Method
(
void
,
'SetGrafPortOfDialog'
,
(
DialogRef
,
'dialog'
,
InMode
),
f
=
Method
(
void
,
'SetGrafPortOfDialog'
,
(
DialogRef
,
'dialog'
,
InMode
),
condition
=
'#if !TARGET_API_MAC_CARBON'
)
condition
=
'#if !TARGET_API_MAC_CARBON'
)
object
.
add
(
f
)
object
.
add
(
f
)
...
...
Mac/Modules/drag/Dragmodule.c
View file @
f7d5aa61
...
@@ -29,12 +29,12 @@ PyTypeObject DragObj_Type;
...
@@ -29,12 +29,12 @@ PyTypeObject DragObj_Type;
typedef
struct
DragObjObject
{
typedef
struct
DragObjObject
{
PyObject_HEAD
PyObject_HEAD
DragRef
erence
ob_itself
;
DragRef
ob_itself
;
PyObject
*
sendproc
;
PyObject
*
sendproc
;
}
DragObjObject
;
}
DragObjObject
;
PyObject
*
DragObj_New
(
itself
)
PyObject
*
DragObj_New
(
itself
)
DragRef
erence
itself
;
DragRef
itself
;
{
{
DragObjObject
*
it
;
DragObjObject
*
it
;
if
(
itself
==
NULL
)
{
if
(
itself
==
NULL
)
{
...
@@ -49,7 +49,7 @@ PyObject *DragObj_New(itself)
...
@@ -49,7 +49,7 @@ PyObject *DragObj_New(itself)
}
}
DragObj_Convert
(
v
,
p_itself
)
DragObj_Convert
(
v
,
p_itself
)
PyObject
*
v
;
PyObject
*
v
;
DragRef
erence
*
p_itself
;
DragRef
*
p_itself
;
{
{
if
(
!
DragObj_Check
(
v
))
if
(
!
DragObj_Check
(
v
))
{
{
...
@@ -67,41 +67,104 @@ static void DragObj_dealloc(self)
...
@@ -67,41 +67,104 @@ static void DragObj_dealloc(self)
PyMem_DEL
(
self
);
PyMem_DEL
(
self
);
}
}
static
PyObject
*
DragObj_DisposeDrag
(
_self
,
_args
)
static
PyMethodDef
DragObj_methods
[]
=
{
DragObjObject
*
_self
;
{
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
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
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
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_AddDragItemFlavor
(
_self
,
_args
)
static
PyObject
*
Drag_AddDragItemFlavor
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
FlavorType
theType
;
FlavorType
theType
;
char
*
dataPtr__in__
;
char
*
dataPtr__in__
;
long
dataPtr__len__
;
long
dataPtr__len__
;
int
dataPtr__in_len__
;
int
dataPtr__in_len__
;
FlavorFlags
theFlags
;
FlavorFlags
theFlags
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lO&z#l"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lO&z#l"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
PyMac_GetOSType
,
&
theType
,
PyMac_GetOSType
,
&
theType
,
&
dataPtr__in__
,
&
dataPtr__in_len__
,
&
dataPtr__in__
,
&
dataPtr__in_len__
,
&
theFlags
))
&
theFlags
))
return
NULL
;
return
NULL
;
dataPtr__len__
=
dataPtr__in_len__
;
dataPtr__len__
=
dataPtr__in_len__
;
_err
=
AddDragItemFlavor
(
_self
->
ob_itself
,
_err
=
AddDragItemFlavor
(
theDrag
,
theItemRef
,
theItemRef
,
theType
,
theType
,
dataPtr__in__
,
dataPtr__len__
,
dataPtr__in__
,
dataPtr__len__
,
...
@@ -113,26 +176,28 @@ static PyObject *DragObj_AddDragItemFlavor(_self, _args)
...
@@ -113,26 +176,28 @@ static PyObject *DragObj_AddDragItemFlavor(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_SetDragItemFlavorData
(
_self
,
_args
)
static
PyObject
*
Drag_SetDragItemFlavorData
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
FlavorType
theType
;
FlavorType
theType
;
char
*
dataPtr__in__
;
char
*
dataPtr__in__
;
long
dataPtr__len__
;
long
dataPtr__len__
;
int
dataPtr__in_len__
;
int
dataPtr__in_len__
;
UInt32
dataOffset
;
UInt32
dataOffset
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lO&z#l"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lO&z#l"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
PyMac_GetOSType
,
&
theType
,
PyMac_GetOSType
,
&
theType
,
&
dataPtr__in__
,
&
dataPtr__in_len__
,
&
dataPtr__in__
,
&
dataPtr__in_len__
,
&
dataOffset
))
&
dataOffset
))
return
NULL
;
return
NULL
;
dataPtr__len__
=
dataPtr__in_len__
;
dataPtr__len__
=
dataPtr__in_len__
;
_err
=
SetDragItemFlavorData
(
_self
->
ob_itself
,
_err
=
SetDragItemFlavorData
(
theDrag
,
theItemRef
,
theItemRef
,
theType
,
theType
,
dataPtr__in__
,
dataPtr__len__
,
dataPtr__in__
,
dataPtr__len__
,
...
@@ -144,23 +209,25 @@ static PyObject *DragObj_SetDragItemFlavorData(_self, _args)
...
@@ -144,23 +209,25 @@ static PyObject *DragObj_SetDragItemFlavorData(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_SetDragImage
(
_self
,
_args
)
static
PyObject
*
Drag_SetDragImage
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
PixMapHandle
imagePixMap
;
PixMapHandle
imagePixMap
;
RgnHandle
imageRgn
;
RgnHandle
imageRgn
;
Point
imageOffsetPt
;
Point
imageOffsetPt
;
DragImageFlags
theImageFlags
;
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
,
&
imagePixMap
,
ResObj_Convert
,
&
imageRgn
,
ResObj_Convert
,
&
imageRgn
,
PyMac_GetPoint
,
&
imageOffsetPt
,
PyMac_GetPoint
,
&
imageOffsetPt
,
&
theImageFlags
))
&
theImageFlags
))
return
NULL
;
return
NULL
;
_err
=
SetDragImage
(
_self
->
ob_itself
,
_err
=
SetDragImage
(
theDrag
,
imagePixMap
,
imagePixMap
,
imageRgn
,
imageRgn
,
imageOffsetPt
,
imageOffsetPt
,
...
@@ -171,19 +238,44 @@ static PyObject *DragObj_SetDragImage(_self, _args)
...
@@ -171,19 +238,44 @@ static PyObject *DragObj_SetDragImage(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
DragObj_TrackDrag
(
_self
,
_args
)
static
PyObject
*
Drag_ChangeDragBehaviors
(
_self
,
_args
)
DragObjObject
*
_self
;
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
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
EventRecord
theEvent
;
EventRecord
theEvent
;
RgnHandle
theRegion
;
RgnHandle
theRegion
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&O&"
,
DragObj_Convert
,
&
theDrag
,
PyMac_GetEventRecord
,
&
theEvent
,
PyMac_GetEventRecord
,
&
theEvent
,
ResObj_Convert
,
&
theRegion
))
ResObj_Convert
,
&
theRegion
))
return
NULL
;
return
NULL
;
_err
=
TrackDrag
(
_self
->
ob_itself
,
_err
=
TrackDrag
(
theDrag
,
&
theEvent
,
&
theEvent
,
theRegion
);
theRegion
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -192,16 +284,18 @@ static PyObject *DragObj_TrackDrag(_self, _args)
...
@@ -192,16 +284,18 @@ static PyObject *DragObj_TrackDrag(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_CountDragItems
(
_self
,
_args
)
static
PyObject
*
Drag_CountDragItems
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
UInt16
numItems
;
UInt16
numItems
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
CountDragItems
(
_self
->
ob_itself
,
_err
=
CountDragItems
(
theDrag
,
&
numItems
);
&
numItems
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"H"
,
_res
=
Py_BuildValue
(
"H"
,
...
@@ -209,18 +303,20 @@ static PyObject *DragObj_CountDragItems(_self, _args)
...
@@ -209,18 +303,20 @@ static PyObject *DragObj_CountDragItems(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDragItemReferenceNumber
(
_self
,
_args
)
static
PyObject
*
Drag_GetDragItemReferenceNumber
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
UInt16
index
;
UInt16
index
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
if
(
!
PyArg_ParseTuple
(
_args
,
"H"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&H"
,
DragObj_Convert
,
&
theDrag
,
&
index
))
&
index
))
return
NULL
;
return
NULL
;
_err
=
GetDragItemReferenceNumber
(
_self
->
ob_itself
,
_err
=
GetDragItemReferenceNumber
(
theDrag
,
index
,
index
,
&
theItemRef
);
&
theItemRef
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -229,18 +325,20 @@ static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args)
...
@@ -229,18 +325,20 @@ static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_CountDragItemFlavors
(
_self
,
_args
)
static
PyObject
*
Drag_CountDragItemFlavors
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
UInt16
numFlavors
;
UInt16
numFlavors
;
if
(
!
PyArg_ParseTuple
(
_args
,
"l"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&l"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
))
&
theItemRef
))
return
NULL
;
return
NULL
;
_err
=
CountDragItemFlavors
(
_self
->
ob_itself
,
_err
=
CountDragItemFlavors
(
theDrag
,
theItemRef
,
theItemRef
,
&
numFlavors
);
&
numFlavors
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -249,20 +347,22 @@ static PyObject *DragObj_CountDragItemFlavors(_self, _args)
...
@@ -249,20 +347,22 @@ static PyObject *DragObj_CountDragItemFlavors(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetFlavorType
(
_self
,
_args
)
static
PyObject
*
Drag_GetFlavorType
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
UInt16
index
;
UInt16
index
;
FlavorType
theType
;
FlavorType
theType
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lH"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lH"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
&
index
))
&
index
))
return
NULL
;
return
NULL
;
_err
=
GetFlavorType
(
_self
->
ob_itself
,
_err
=
GetFlavorType
(
theDrag
,
theItemRef
,
theItemRef
,
index
,
index
,
&
theType
);
&
theType
);
...
@@ -272,20 +372,22 @@ static PyObject *DragObj_GetFlavorType(_self, _args)
...
@@ -272,20 +372,22 @@ static PyObject *DragObj_GetFlavorType(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetFlavorFlags
(
_self
,
_args
)
static
PyObject
*
Drag_GetFlavorFlags
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
FlavorType
theType
;
FlavorType
theType
;
FlavorFlags
theFlags
;
FlavorFlags
theFlags
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lO&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lO&"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
PyMac_GetOSType
,
&
theType
))
PyMac_GetOSType
,
&
theType
))
return
NULL
;
return
NULL
;
_err
=
GetFlavorFlags
(
_self
->
ob_itself
,
_err
=
GetFlavorFlags
(
theDrag
,
theItemRef
,
theItemRef
,
theType
,
theType
,
&
theFlags
);
&
theFlags
);
...
@@ -295,20 +397,22 @@ static PyObject *DragObj_GetFlavorFlags(_self, _args)
...
@@ -295,20 +397,22 @@ static PyObject *DragObj_GetFlavorFlags(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetFlavorDataSize
(
_self
,
_args
)
static
PyObject
*
Drag_GetFlavorDataSize
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
FlavorType
theType
;
FlavorType
theType
;
Size
dataSize
;
Size
dataSize
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lO&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lO&"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
PyMac_GetOSType
,
&
theType
))
PyMac_GetOSType
,
&
theType
))
return
NULL
;
return
NULL
;
_err
=
GetFlavorDataSize
(
_self
->
ob_itself
,
_err
=
GetFlavorDataSize
(
theDrag
,
theItemRef
,
theItemRef
,
theType
,
theType
,
&
dataSize
);
&
dataSize
);
...
@@ -318,19 +422,21 @@ static PyObject *DragObj_GetFlavorDataSize(_self, _args)
...
@@ -318,19 +422,21 @@ static PyObject *DragObj_GetFlavorDataSize(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetFlavorData
(
_self
,
_args
)
static
PyObject
*
Drag_GetFlavorData
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
FlavorType
theType
;
FlavorType
theType
;
char
*
dataPtr__out__
;
char
*
dataPtr__out__
;
long
dataPtr__len__
;
long
dataPtr__len__
;
int
dataPtr__in_len__
;
int
dataPtr__in_len__
;
UInt32
dataOffset
;
UInt32
dataOffset
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lO&il"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lO&il"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
PyMac_GetOSType
,
&
theType
,
PyMac_GetOSType
,
&
theType
,
&
dataPtr__in_len__
,
&
dataPtr__in_len__
,
...
@@ -342,7 +448,7 @@ static PyObject *DragObj_GetFlavorData(_self, _args)
...
@@ -342,7 +448,7 @@ static PyObject *DragObj_GetFlavorData(_self, _args)
goto
dataPtr__error__
;
goto
dataPtr__error__
;
}
}
dataPtr__len__
=
dataPtr__in_len__
;
dataPtr__len__
=
dataPtr__in_len__
;
_err
=
GetFlavorData
(
_self
->
ob_itself
,
_err
=
GetFlavorData
(
theDrag
,
theItemRef
,
theItemRef
,
theType
,
theType
,
dataPtr__out__
,
&
dataPtr__len__
,
dataPtr__out__
,
&
dataPtr__len__
,
...
@@ -355,18 +461,20 @@ static PyObject *DragObj_GetFlavorData(_self, _args)
...
@@ -355,18 +461,20 @@ static PyObject *DragObj_GetFlavorData(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDragItemBounds
(
_self
,
_args
)
static
PyObject
*
Drag_GetDragItemBounds
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
Rect
itemBounds
;
Rect
itemBounds
;
if
(
!
PyArg_ParseTuple
(
_args
,
"l"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&l"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
))
&
theItemRef
))
return
NULL
;
return
NULL
;
_err
=
GetDragItemBounds
(
_self
->
ob_itself
,
_err
=
GetDragItemBounds
(
theDrag
,
theItemRef
,
theItemRef
,
&
itemBounds
);
&
itemBounds
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -375,19 +483,21 @@ static PyObject *DragObj_GetDragItemBounds(_self, _args)
...
@@ -375,19 +483,21 @@ static PyObject *DragObj_GetDragItemBounds(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_SetDragItemBounds
(
_self
,
_args
)
static
PyObject
*
Drag_SetDragItemBounds
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
ItemReference
theItemRef
;
ItemReference
theItemRef
;
Rect
itemBounds
;
Rect
itemBounds
;
if
(
!
PyArg_ParseTuple
(
_args
,
"lO&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lO&"
,
DragObj_Convert
,
&
theDrag
,
&
theItemRef
,
&
theItemRef
,
PyMac_GetRect
,
&
itemBounds
))
PyMac_GetRect
,
&
itemBounds
))
return
NULL
;
return
NULL
;
_err
=
SetDragItemBounds
(
_self
->
ob_itself
,
_err
=
SetDragItemBounds
(
theDrag
,
theItemRef
,
theItemRef
,
&
itemBounds
);
&
itemBounds
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -396,16 +506,18 @@ static PyObject *DragObj_SetDragItemBounds(_self, _args)
...
@@ -396,16 +506,18 @@ static PyObject *DragObj_SetDragItemBounds(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDropLocation
(
_self
,
_args
)
static
PyObject
*
Drag_GetDropLocation
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
AEDesc
dropLocation
;
AEDesc
dropLocation
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
GetDropLocation
(
_self
->
ob_itself
,
_err
=
GetDropLocation
(
theDrag
,
&
dropLocation
);
&
dropLocation
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
_res
=
Py_BuildValue
(
"O&"
,
...
@@ -413,17 +525,19 @@ static PyObject *DragObj_GetDropLocation(_self, _args)
...
@@ -413,17 +525,19 @@ static PyObject *DragObj_GetDropLocation(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_SetDropLocation
(
_self
,
_args
)
static
PyObject
*
Drag_SetDropLocation
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
AEDesc
dropLocation
;
AEDesc
dropLocation
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&"
,
DragObj_Convert
,
&
theDrag
,
AEDesc_Convert
,
&
dropLocation
))
AEDesc_Convert
,
&
dropLocation
))
return
NULL
;
return
NULL
;
_err
=
SetDropLocation
(
_self
->
ob_itself
,
_err
=
SetDropLocation
(
theDrag
,
&
dropLocation
);
&
dropLocation
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -431,16 +545,18 @@ static PyObject *DragObj_SetDropLocation(_self, _args)
...
@@ -431,16 +545,18 @@ static PyObject *DragObj_SetDropLocation(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDragAttributes
(
_self
,
_args
)
static
PyObject
*
Drag_GetDragAttributes
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
DragAttributes
flags
;
DragAttributes
flags
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
GetDragAttributes
(
_self
->
ob_itself
,
_err
=
GetDragAttributes
(
theDrag
,
&
flags
);
&
flags
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"l"
,
_res
=
Py_BuildValue
(
"l"
,
...
@@ -448,17 +564,19 @@ static PyObject *DragObj_GetDragAttributes(_self, _args)
...
@@ -448,17 +564,19 @@ static PyObject *DragObj_GetDragAttributes(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDragMouse
(
_self
,
_args
)
static
PyObject
*
Drag_GetDragMouse
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
Point
mouse
;
Point
mouse
;
Point
globalPinnedMouse
;
Point
globalPinnedMouse
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
GetDragMouse
(
_self
->
ob_itself
,
_err
=
GetDragMouse
(
theDrag
,
&
mouse
,
&
mouse
,
&
globalPinnedMouse
);
&
globalPinnedMouse
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -468,17 +586,19 @@ static PyObject *DragObj_GetDragMouse(_self, _args)
...
@@ -468,17 +586,19 @@ static PyObject *DragObj_GetDragMouse(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_SetDragMouse
(
_self
,
_args
)
static
PyObject
*
Drag_SetDragMouse
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
Point
globalPinnedMouse
;
Point
globalPinnedMouse
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&"
,
DragObj_Convert
,
&
theDrag
,
PyMac_GetPoint
,
&
globalPinnedMouse
))
PyMac_GetPoint
,
&
globalPinnedMouse
))
return
NULL
;
return
NULL
;
_err
=
SetDragMouse
(
_self
->
ob_itself
,
_err
=
SetDragMouse
(
theDrag
,
globalPinnedMouse
);
globalPinnedMouse
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -486,16 +606,18 @@ static PyObject *DragObj_SetDragMouse(_self, _args)
...
@@ -486,16 +606,18 @@ static PyObject *DragObj_SetDragMouse(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDragOrigin
(
_self
,
_args
)
static
PyObject
*
Drag_GetDragOrigin
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
Point
globalInitialMouse
;
Point
globalInitialMouse
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
GetDragOrigin
(
_self
->
ob_itself
,
_err
=
GetDragOrigin
(
theDrag
,
&
globalInitialMouse
);
&
globalInitialMouse
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
_res
=
Py_BuildValue
(
"O&"
,
...
@@ -503,18 +625,20 @@ static PyObject *DragObj_GetDragOrigin(_self, _args)
...
@@ -503,18 +625,20 @@ static PyObject *DragObj_GetDragOrigin(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_GetDragModifiers
(
_self
,
_args
)
static
PyObject
*
Drag_GetDragModifiers
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
SInt16
modifiers
;
SInt16
modifiers
;
SInt16
mouseDownModifiers
;
SInt16
mouseDownModifiers
;
SInt16
mouseUpModifiers
;
SInt16
mouseUpModifiers
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
GetDragModifiers
(
_self
->
ob_itself
,
_err
=
GetDragModifiers
(
theDrag
,
&
modifiers
,
&
modifiers
,
&
mouseDownModifiers
,
&
mouseDownModifiers
,
&
mouseUpModifiers
);
&
mouseUpModifiers
);
...
@@ -526,19 +650,21 @@ static PyObject *DragObj_GetDragModifiers(_self, _args)
...
@@ -526,19 +650,21 @@ static PyObject *DragObj_GetDragModifiers(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_ShowDragHilite
(
_self
,
_args
)
static
PyObject
*
Drag_ShowDragHilite
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
RgnHandle
hiliteFrame
;
RgnHandle
hiliteFrame
;
Boolean
inside
;
Boolean
inside
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&b"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&b"
,
DragObj_Convert
,
&
theDrag
,
ResObj_Convert
,
&
hiliteFrame
,
ResObj_Convert
,
&
hiliteFrame
,
&
inside
))
&
inside
))
return
NULL
;
return
NULL
;
_err
=
ShowDragHilite
(
_self
->
ob_itself
,
_err
=
ShowDragHilite
(
theDrag
,
hiliteFrame
,
hiliteFrame
,
inside
);
inside
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -547,34 +673,38 @@ static PyObject *DragObj_ShowDragHilite(_self, _args)
...
@@ -547,34 +673,38 @@ static PyObject *DragObj_ShowDragHilite(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_HideDragHilite
(
_self
,
_args
)
static
PyObject
*
Drag_HideDragHilite
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
DragRef
theDrag
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
HideDragHilite
(
_self
->
ob_itself
);
_err
=
HideDragHilite
(
theDrag
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_DragPreScroll
(
_self
,
_args
)
static
PyObject
*
Drag_DragPreScroll
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
SInt16
dH
;
SInt16
dH
;
SInt16
dV
;
SInt16
dV
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&hh"
,
DragObj_Convert
,
&
theDrag
,
&
dH
,
&
dH
,
&
dV
))
&
dV
))
return
NULL
;
return
NULL
;
_err
=
DragPreScroll
(
_self
->
ob_itself
,
_err
=
DragPreScroll
(
theDrag
,
dH
,
dH
,
dV
);
dV
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
...
@@ -583,32 +713,36 @@ static PyObject *DragObj_DragPreScroll(_self, _args)
...
@@ -583,32 +713,36 @@ static PyObject *DragObj_DragPreScroll(_self, _args)
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_DragPostScroll
(
_self
,
_args
)
static
PyObject
*
Drag_DragPostScroll
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
DragRef
theDrag
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
DragObj_Convert
,
&
theDrag
))
return
NULL
;
return
NULL
;
_err
=
DragPostScroll
(
_self
->
ob_itself
);
_err
=
DragPostScroll
(
theDrag
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
return
_res
;
}
}
static
PyObject
*
Drag
Obj
_UpdateDragHilite
(
_self
,
_args
)
static
PyObject
*
Drag_UpdateDragHilite
(
_self
,
_args
)
DragObj
Object
*
_self
;
Py
Object
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
DragRef
theDrag
;
RgnHandle
updateRgn
;
RgnHandle
updateRgn
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&"
,
DragObj_Convert
,
&
theDrag
,
ResObj_Convert
,
&
updateRgn
))
ResObj_Convert
,
&
updateRgn
))
return
NULL
;
return
NULL
;
_err
=
UpdateDragHilite
(
_self
->
ob_itself
,
_err
=
UpdateDragHilite
(
theDrag
,
updateRgn
);
updateRgn
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -616,117 +750,6 @@ static PyObject *DragObj_UpdateDragHilite(_self, _args)
...
@@ -616,117 +750,6 @@ static PyObject *DragObj_UpdateDragHilite(_self, _args)
return
_res
;
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
)
static
PyObject
*
Drag_GetDragHiliteColor
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -892,7 +915,61 @@ static PyObject *Drag_RemoveReceiveHandler(_self, _args)
...
@@ -892,7 +915,61 @@ static PyObject *Drag_RemoveReceiveHandler(_self, _args)
static
PyMethodDef
Drag_methods
[]
=
{
static
PyMethodDef
Drag_methods
[]
=
{
{
"NewDrag"
,
(
PyCFunction
)
Drag_NewDrag
,
1
,
{
"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
,
{
"GetDragHiliteColor"
,
(
PyCFunction
)
Drag_GetDragHiliteColor
,
1
,
"(WindowPtr window) -> (RGBColor color)"
},
"(WindowPtr window) -> (RGBColor color)"
},
{
"WaitMouseMoved"
,
(
PyCFunction
)
Drag_WaitMouseMoved
,
1
,
{
"WaitMouseMoved"
,
(
PyCFunction
)
Drag_WaitMouseMoved
,
1
,
...
@@ -1023,7 +1100,7 @@ void initDrag()
...
@@ -1023,7 +1100,7 @@ void initDrag()
Drag_Error
=
PyMac_GetOSErrException
();
Drag_Error
=
PyMac_GetOSErrException
();
if
(
Drag_Error
==
NULL
||
if
(
Drag_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Drag_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Drag_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Drag.Error"
)
;
return
;
DragObj_Type
.
ob_type
=
&
PyType_Type
;
DragObj_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
DragObj_Type
);
Py_INCREF
(
&
DragObj_Type
);
if
(
PyDict_SetItemString
(
d
,
"DragObjType"
,
(
PyObject
*
)
&
DragObj_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"DragObjType"
,
(
PyObject
*
)
&
DragObj_Type
)
!=
0
)
...
...
Mac/Modules/drag/dragsupport.py
View file @
f7d5aa61
...
@@ -12,7 +12,7 @@ OBJECTNAME = 'DragObj' # The basic name of the objects used here
...
@@ -12,7 +12,7 @@ OBJECTNAME = 'DragObj' # The basic name of the objects used here
# The following is *usually* unchanged but may still require tuning
# The following is *usually* unchanged but may still require tuning
MODPREFIX
=
MODNAME
# The prefix for module-wide routines
MODPREFIX
=
MODNAME
# The prefix for module-wide routines
OBJECTTYPE
=
'DragRef
erence
'
# The C type used to represent them
OBJECTTYPE
=
'DragRef'
# The C type used to represent them
OBJECTPREFIX
=
MODPREFIX
+
'Obj'
# The prefix for object methods
OBJECTPREFIX
=
MODPREFIX
+
'Obj'
# The prefix for object methods
INPUTFILE
=
string
.
lower
(
MODPREFIX
)
+
'gen.py'
# The file generated by the scanner
INPUTFILE
=
string
.
lower
(
MODPREFIX
)
+
'gen.py'
# The file generated by the scanner
OUTPUTFILE
=
MODNAME
+
"module.c"
# The file generated by this program
OUTPUTFILE
=
MODNAME
+
"module.c"
# The file generated by this program
...
@@ -21,31 +21,21 @@ from macsupport import *
...
@@ -21,31 +21,21 @@ from macsupport import *
# Create the type objects
# Create the type objects
DragReference
=
OpaqueByValueType
(
OBJECTTYPE
,
OBJECTPREFIX
)
DragRef
=
OpaqueByValueType
(
OBJECTTYPE
,
OBJECTPREFIX
)
DragItemRef
=
Type
(
"ItemReference"
,
"l"
)
##CCTabHandle = OpaqueByValueType("CCTabHandle", "ResObj")
# Old names
##AuxCtlHandle = OpaqueByValueType("AuxCtlHandle", "ResObj")
DragReference
=
DragRef
##ControlPartCode = Type("ControlPartCode", "h")
ItemReference
=
DragItemRef
##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"
)
PixMapHandle
=
OpaqueByValueType
(
"PixMapHandle"
,
"ResObj"
)
RgnHandle
=
OpaqueByValueType
(
"RgnHandle"
,
"ResObj"
)
RgnHandle
=
OpaqueByValueType
(
"RgnHandle"
,
"ResObj"
)
AEDesc
=
OpaqueType
(
'AEDesc'
)
AEDesc
=
OpaqueType
(
'AEDesc'
)
AEDesc_ptr
=
AEDesc
AEDesc_ptr
=
AEDesc
RGBColor
=
OpaqueType
(
"RGBColor"
,
"QdRGB"
)
RGBColor
=
OpaqueType
(
"RGBColor"
,
"QdRGB"
)
ItemReference
=
Type
(
"ItemReference"
,
"l"
)
FlavorType
=
OSTypeType
(
"FlavorType"
)
FlavorType
=
OSTypeType
(
"FlavorType"
)
DragAttributes
=
Type
(
"DragAttributes"
,
"l"
)
DragAttributes
=
Type
(
"DragAttributes"
,
"l"
)
DragBehaviors
=
Type
(
"DragBehaviors"
,
"l"
)
DragImageFlags
=
Type
(
"DragImageFlags"
,
"l"
)
DragImageFlags
=
Type
(
"DragImageFlags"
,
"l"
)
DragImageTranslucency
=
Type
(
"DragImageTranslucency"
,
"l"
)
DragImageTranslucency
=
Type
(
"DragImageTranslucency"
,
"l"
)
DragRegionMessage
=
Type
(
"DragRegionMessage"
,
"h"
)
DragRegionMessage
=
Type
(
"DragRegionMessage"
,
"h"
)
...
...
Mac/Modules/evt/Evtmodule.c
View file @
f7d5aa61
...
@@ -316,6 +316,57 @@ static PyObject *Evt_SystemEvent(_self, _args)
...
@@ -316,6 +316,57 @@ static PyObject *Evt_SystemEvent(_self, _args)
}
}
#endif
#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
)
static
PyObject
*
Evt_WaitNextEvent
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -396,6 +447,21 @@ static PyMethodDef Evt_methods[] = {
...
@@ -396,6 +447,21 @@ static PyMethodDef Evt_methods[] = {
{
"SystemEvent"
,
(
PyCFunction
)
Evt_SystemEvent
,
1
,
{
"SystemEvent"
,
(
PyCFunction
)
Evt_SystemEvent
,
1
,
"(EventRecord theEvent) -> (Boolean _rv)"
},
"(EventRecord theEvent) -> (Boolean _rv)"
},
#endif
#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
,
{
"WaitNextEvent"
,
(
PyCFunction
)
Evt_WaitNextEvent
,
1
,
"(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"
},
"(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
...
@@ -417,7 +483,7 @@ void initEvt()
...
@@ -417,7 +483,7 @@ void initEvt()
Evt_Error
=
PyMac_GetOSErrException
();
Evt_Error
=
PyMac_GetOSErrException
();
if
(
Evt_Error
==
NULL
||
if
(
Evt_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Evt_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Evt_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Evt.Error"
)
;
return
;
}
}
/* ========================= End module Evt ========================= */
/* ========================= End module Evt ========================= */
...
...
Mac/Modules/evt/evtscan.py
View file @
f7d5aa61
...
@@ -43,6 +43,11 @@ class MyScanner(Scanner):
...
@@ -43,6 +43,11 @@ class MyScanner(Scanner):
'SystemClick'
,
'SystemClick'
,
'GetOSEvent'
,
'GetOSEvent'
,
'OSEventAvail'
,
'OSEventAvail'
,
]),
(
'#if TARGET_API_MAC_CARBON'
,
[
'CheckEventQueueForUserCancel'
,
'GetCurrentKeyModifiers'
,
'GetGlobalMouse'
,
])]
])]
def
makeblacklistnames
(
self
):
def
makeblacklistnames
(
self
):
...
...
Mac/Modules/fm/Fmmodule.c
View file @
f7d5aa61
...
@@ -319,14 +319,14 @@ static PyObject *Fm_SetAntiAliasedTextEnabled(_self, _args)
...
@@ -319,14 +319,14 @@ static PyObject *Fm_SetAntiAliasedTextEnabled(_self, _args)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
OSStatus
_err
;
Boolean
i
n
Enable
;
Boolean
iEnable
;
SInt16
i
n
MinFontSize
;
SInt16
iMinFontSize
;
if
(
!
PyArg_ParseTuple
(
_args
,
"bh"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"bh"
,
&
i
n
Enable
,
&
iEnable
,
&
i
n
MinFontSize
))
&
iMinFontSize
))
return
NULL
;
return
NULL
;
_err
=
SetAntiAliasedTextEnabled
(
i
n
Enable
,
_err
=
SetAntiAliasedTextEnabled
(
iEnable
,
i
n
MinFontSize
);
iMinFontSize
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
...
@@ -339,13 +339,13 @@ static PyObject *Fm_IsAntiAliasedTextEnabled(_self, _args)
...
@@ -339,13 +339,13 @@ static PyObject *Fm_IsAntiAliasedTextEnabled(_self, _args)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
Boolean
_rv
;
SInt16
o
ut
MinFontSize
;
SInt16
oMinFontSize
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_rv
=
IsAntiAliasedTextEnabled
(
&
o
ut
MinFontSize
);
_rv
=
IsAntiAliasedTextEnabled
(
&
oMinFontSize
);
_res
=
Py_BuildValue
(
"bh"
,
_res
=
Py_BuildValue
(
"bh"
,
_rv
,
_rv
,
o
ut
MinFontSize
);
oMinFontSize
);
return
_res
;
return
_res
;
}
}
...
@@ -394,9 +394,9 @@ static PyMethodDef Fm_methods[] = {
...
@@ -394,9 +394,9 @@ static PyMethodDef Fm_methods[] = {
{
"GetAppFont"
,
(
PyCFunction
)
Fm_GetAppFont
,
1
,
{
"GetAppFont"
,
(
PyCFunction
)
Fm_GetAppFont
,
1
,
"() -> (short _rv)"
},
"() -> (short _rv)"
},
{
"SetAntiAliasedTextEnabled"
,
(
PyCFunction
)
Fm_SetAntiAliasedTextEnabled
,
1
,
{
"SetAntiAliasedTextEnabled"
,
(
PyCFunction
)
Fm_SetAntiAliasedTextEnabled
,
1
,
"(Boolean i
nEnable, SInt16 in
MinFontSize) -> None"
},
"(Boolean i
Enable, SInt16 i
MinFontSize) -> None"
},
{
"IsAntiAliasedTextEnabled"
,
(
PyCFunction
)
Fm_IsAntiAliasedTextEnabled
,
1
,
{
"IsAntiAliasedTextEnabled"
,
(
PyCFunction
)
Fm_IsAntiAliasedTextEnabled
,
1
,
"() -> (Boolean _rv, SInt16 o
ut
MinFontSize)"
},
"() -> (Boolean _rv, SInt16 oMinFontSize)"
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
};
};
...
@@ -416,7 +416,7 @@ void initFm()
...
@@ -416,7 +416,7 @@ void initFm()
Fm_Error
=
PyMac_GetOSErrException
();
Fm_Error
=
PyMac_GetOSErrException
();
if
(
Fm_Error
==
NULL
||
if
(
Fm_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Fm_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Fm_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Fm.Error"
)
;
return
;
}
}
/* ========================= End module Fm ========================== */
/* ========================= End module Fm ========================== */
...
...
Mac/Modules/help/Helpmodule.c
View file @
f7d5aa61
...
@@ -315,7 +315,7 @@ void initHelp()
...
@@ -315,7 +315,7 @@ void initHelp()
Help_Error
=
PyMac_GetOSErrException
();
Help_Error
=
PyMac_GetOSErrException
();
if
(
Help_Error
==
NULL
||
if
(
Help_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Help_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Help_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Help.Error"
)
;
return
;
}
}
/* ======================== End module Help ========================= */
/* ======================== End module Help ========================= */
...
...
Mac/Modules/icn/Icnmodule.c
View file @
f7d5aa61
...
@@ -1248,6 +1248,120 @@ static PyObject *Icn_GetCustomIconsEnabled(_self, _args)
...
@@ -1248,6 +1248,120 @@ static PyObject *Icn_GetCustomIconsEnabled(_self, _args)
return
_res
;
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
[]
=
{
static
PyMethodDef
Icn_methods
[]
=
{
{
"GetCIcon"
,
(
PyCFunction
)
Icn_GetCIcon
,
1
,
{
"GetCIcon"
,
(
PyCFunction
)
Icn_GetCIcon
,
1
,
"(SInt16 iconID) -> (CIconHandle _rv)"
},
"(SInt16 iconID) -> (CIconHandle _rv)"
},
...
@@ -1364,6 +1478,28 @@ static PyMethodDef Icn_methods[] = {
...
@@ -1364,6 +1478,28 @@ static PyMethodDef Icn_methods[] = {
"(SInt16 vRefNum, Boolean enableCustomIcons) -> None"
},
"(SInt16 vRefNum, Boolean enableCustomIcons) -> None"
},
{
"GetCustomIconsEnabled"
,
(
PyCFunction
)
Icn_GetCustomIconsEnabled
,
1
,
{
"GetCustomIconsEnabled"
,
(
PyCFunction
)
Icn_GetCustomIconsEnabled
,
1
,
"(SInt16 vRefNum) -> (Boolean customIconsEnabled)"
},
"(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
}
{
NULL
,
NULL
,
0
}
};
};
...
@@ -1383,7 +1519,7 @@ void initIcn()
...
@@ -1383,7 +1519,7 @@ void initIcn()
Icn_Error
=
PyMac_GetOSErrException
();
Icn_Error
=
PyMac_GetOSErrException
();
if
(
Icn_Error
==
NULL
||
if
(
Icn_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Icn_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Icn_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Icn.Error"
)
;
return
;
}
}
/* ========================= End module Icn ========================= */
/* ========================= End module Icn ========================= */
...
...
Mac/Modules/icn/icnscan.py
View file @
f7d5aa61
...
@@ -49,6 +49,12 @@ class MyScanner(Scanner):
...
@@ -49,6 +49,12 @@ class MyScanner(Scanner):
return
[
return
[
(
'#if !TARGET_API_MAC_CARBON'
,
[
(
'#if !TARGET_API_MAC_CARBON'
,
[
'IconServicesTerminate'
,
'IconServicesTerminate'
,
]),
(
'#if TARGET_API_MAC_CARBON'
,
[
'WriteIconFile'
,
'ReadIconFile'
,
'RegisterIconRefFromIconFile'
,
'GetIconRefVariant'
,
])]
])]
def
makeblacklisttypes
(
self
):
def
makeblacklisttypes
(
self
):
...
...
Mac/Modules/list/Listmodule.c
View file @
f7d5aa61
...
@@ -10,6 +10,31 @@
...
@@ -10,6 +10,31 @@
#include <Lists.h>
#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_List(x) ((ListHandle)x)
#define as_Resource(lh) ((Handle)lh)
#define as_Resource(lh) ((Handle)lh)
...
@@ -649,6 +674,325 @@ static PyObject *List_LNew(_self, _args)
...
@@ -649,6 +674,325 @@ static PyObject *List_LNew(_self, _args)
return
_res
;
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
)
static
PyObject
*
List_as_List
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -668,6 +1012,44 @@ static PyObject *List_as_List(_self, _args)
...
@@ -668,6 +1012,44 @@ static PyObject *List_as_List(_self, _args)
static
PyMethodDef
List_methods
[]
=
{
static
PyMethodDef
List_methods
[]
=
{
{
"LNew"
,
(
PyCFunction
)
List_LNew
,
1
,
{
"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)"
},
"(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
,
{
"as_List"
,
(
PyCFunction
)
List_as_List
,
1
,
"(Resource)->List.
\n
Returns List object (which is not auto-freed!)"
},
"(Resource)->List.
\n
Returns List object (which is not auto-freed!)"
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
...
@@ -689,7 +1071,7 @@ void initList()
...
@@ -689,7 +1071,7 @@ void initList()
List_Error
=
PyMac_GetOSErrException
();
List_Error
=
PyMac_GetOSErrException
();
if
(
List_Error
==
NULL
||
if
(
List_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
List_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
List_Error
)
!=
0
)
Py_FatalError
(
"can't initialize List.Error"
)
;
return
;
List_Type
.
ob_type
=
&
PyType_Type
;
List_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
List_Type
);
Py_INCREF
(
&
List_Type
);
if
(
PyDict_SetItemString
(
d
,
"ListType"
,
(
PyObject
*
)
&
List_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"ListType"
,
(
PyObject
*
)
&
List_Type
)
!=
0
)
...
...
Mac/Modules/list/listscan.py
View file @
f7d5aa61
...
@@ -40,10 +40,24 @@ class MyScanner(Scanner):
...
@@ -40,10 +40,24 @@ class MyScanner(Scanner):
"LDispose"
,
# Done by removing the object
"LDispose"
,
# Done by removing the object
"LSearch"
,
# We don't want to handle procs just yet
"LSearch"
,
# We don't want to handle procs just yet
"LGetCellDataLocation"
,
# What does this do??
"LGetCellDataLocation"
,
# What does this do??
# These have funny argument/return values
"GetListViewBounds"
,
"GetListCellIndent"
,
"GetListCellSize"
,
"GetListVisibleCells"
,
"GetListClickLocation"
,
"GetListMouseLocation"
,
"GetListDataBounds"
,
"SetListLastClick"
,
]
]
def
makeblacklisttypes
(
self
):
def
makeblacklisttypes
(
self
):
return
[
return
[
'ListDefSpec'
,
# Too difficult for now
'ListDefSpec_ptr'
,
# ditto
"ListDefUPP"
,
"ListClickLoopUPP"
,
]
]
def
makerepairinstructions
(
self
):
def
makerepairinstructions
(
self
):
...
...
Mac/Modules/list/listsupport.py
View file @
f7d5aa61
...
@@ -22,16 +22,46 @@ from macsupport import *
...
@@ -22,16 +22,46 @@ from macsupport import *
# Create the type objects
# Create the type objects
ListHandle
=
OpaqueByValueType
(
"ListHandle"
,
"ListObj"
)
ListHandle
=
OpaqueByValueType
(
"ListHandle"
,
"ListObj"
)
ListRef
=
ListHandle
# Obsolete, but used in Lists.h
Cell
=
Point
Cell
=
Point
ListBounds
=
Rect
ListBounds_ptr
=
Rect_ptr
VarOutBufferShortsize
=
VarHeapOutputBufferType
(
'char'
,
'short'
,
's'
)
# (buf, &len)
VarOutBufferShortsize
=
VarHeapOutputBufferType
(
'char'
,
'short'
,
's'
)
# (buf, &len)
InBufferShortsize
=
VarInputBufferType
(
'char'
,
'short'
,
's'
)
# (buf, len)
InBufferShortsize
=
VarInputBufferType
(
'char'
,
'short'
,
's'
)
# (buf, len)
RgnHandle
=
OpaqueByValueType
(
"RgnHandle"
,
"ResObj"
)
RgnHandle
=
OpaqueByValueType
(
"RgnHandle"
,
"ResObj"
)
DataHandle
=
OpaqueByValueType
(
"DataHandle"
,
"ResObj"
)
Handle
=
OpaqueByValueType
(
"Handle"
,
"ResObj"
)
Handle
=
OpaqueByValueType
(
"Handle"
,
"ResObj"
)
CGrafPtr
=
OpaqueByValueType
(
"CGrafPtr"
,
"GrafObj"
)
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
#include <%s>"""
%
MACHEADERFILE
+
"""
#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_List(x) ((ListHandle)x)
#define as_Resource(lh) ((Handle)lh)
#define as_Resource(lh) ((Handle)lh)
"""
"""
...
...
Mac/Modules/menu/Menumodule.c
View file @
f7d5aa61
...
@@ -11,6 +11,16 @@
...
@@ -11,6 +11,16 @@
#include <Devices.h>
/* Defines OpenDeskAcc in universal headers */
#include <Devices.h>
/* Defines OpenDeskAcc in universal headers */
#include <Menus.h>
#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_Menu(h) ((MenuHandle)h)
#define as_Resource(h) ((Handle)h)
#define as_Resource(h) ((Handle)h)
...
@@ -82,6 +92,20 @@ static PyObject *MenuObj_CalcMenuSize(_self, _args)
...
@@ -82,6 +92,20 @@ static PyObject *MenuObj_CalcMenuSize(_self, _args)
return
_res
;
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
#if !TARGET_API_MAC_CARBON
static
PyObject
*
MenuObj_CountMItems
(
_self
,
_args
)
static
PyObject
*
MenuObj_CountMItems
(
_self
,
_args
)
...
@@ -324,8 +348,8 @@ static PyObject *MenuObj_InsertMenuItemText(_self, _args)
...
@@ -324,8 +348,8 @@ static PyObject *MenuObj_InsertMenuItemText(_self, _args)
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
OSStatus
_err
;
Str255
inString
;
Str255
inString
;
UInt16
afterItem
;
MenuItemIndex
afterItem
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&
h
"
,
PyMac_GetStr255
,
inString
,
PyMac_GetStr255
,
inString
,
&
afterItem
))
&
afterItem
))
return
NULL
;
return
NULL
;
...
@@ -366,7 +390,7 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
...
@@ -366,7 +390,7 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
short
beforeID
;
MenuID
beforeID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
beforeID
))
&
beforeID
))
return
NULL
;
return
NULL
;
...
@@ -377,6 +401,25 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
...
@@ -377,6 +401,25 @@ static PyObject *MenuObj_MacInsertMenu(_self, _args)
return
_res
;
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
#if !TARGET_API_MAC_CARBON
static
PyObject
*
MenuObj_CheckItem
(
_self
,
_args
)
static
PyObject
*
MenuObj_CheckItem
(
_self
,
_args
)
...
@@ -629,7 +672,7 @@ static PyObject *MenuObj_SetMenuItemCommandID(_self, _args)
...
@@ -629,7 +672,7 @@ static PyObject *MenuObj_SetMenuItemCommandID(_self, _args)
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
SInt16
inItem
;
SInt16
inItem
;
UInt32
inCommandID
;
MenuCommand
inCommandID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hl"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"hl"
,
&
inItem
,
&
inItem
,
&
inCommandID
))
&
inCommandID
))
...
@@ -650,7 +693,7 @@ static PyObject *MenuObj_GetMenuItemCommandID(_self, _args)
...
@@ -650,7 +693,7 @@ static PyObject *MenuObj_GetMenuItemCommandID(_self, _args)
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
SInt16
inItem
;
SInt16
inItem
;
UInt32
outCommandID
;
MenuCommand
outCommandID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
inItem
))
&
inItem
))
return
NULL
;
return
NULL
;
...
@@ -799,7 +842,7 @@ static PyObject *MenuObj_SetMenuItemHierarchicalID(_self, _args)
...
@@ -799,7 +842,7 @@ static PyObject *MenuObj_SetMenuItemHierarchicalID(_self, _args)
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
SInt16
inItem
;
SInt16
inItem
;
SInt16
inHierID
;
MenuID
inHierID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
inItem
,
&
inItem
,
&
inHierID
))
&
inHierID
))
...
@@ -820,7 +863,7 @@ static PyObject *MenuObj_GetMenuItemHierarchicalID(_self, _args)
...
@@ -820,7 +863,7 @@ static PyObject *MenuObj_GetMenuItemHierarchicalID(_self, _args)
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
OSErr
_err
;
OSErr
_err
;
SInt16
inItem
;
SInt16
inItem
;
SInt16
outHierID
;
MenuID
outHierID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
inItem
))
&
inItem
))
return
NULL
;
return
NULL
;
...
@@ -1008,8 +1051,8 @@ static PyObject *MenuObj_MacEnableMenuItem(_self, _args)
...
@@ -1008,8 +1051,8 @@ static PyObject *MenuObj_MacEnableMenuItem(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
UInt16
item
;
MenuItemIndex
item
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
&
item
))
&
item
))
return
NULL
;
return
NULL
;
MacEnableMenuItem
(
_self
->
ob_itself
,
MacEnableMenuItem
(
_self
->
ob_itself
,
...
@@ -1024,8 +1067,8 @@ static PyObject *MenuObj_DisableMenuItem(_self, _args)
...
@@ -1024,8 +1067,8 @@ static PyObject *MenuObj_DisableMenuItem(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
UInt16
item
;
MenuItemIndex
item
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
&
item
))
&
item
))
return
NULL
;
return
NULL
;
DisableMenuItem
(
_self
->
ob_itself
,
DisableMenuItem
(
_self
->
ob_itself
,
...
@@ -1041,8 +1084,8 @@ static PyObject *MenuObj_IsMenuItemEnabled(_self, _args)
...
@@ -1041,8 +1084,8 @@ static PyObject *MenuObj_IsMenuItemEnabled(_self, _args)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
Boolean
_rv
;
UInt16
item
;
MenuItemIndex
item
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
&
item
))
&
item
))
return
NULL
;
return
NULL
;
_rv
=
IsMenuItemEnabled
(
_self
->
ob_itself
,
_rv
=
IsMenuItemEnabled
(
_self
->
ob_itself
,
...
@@ -1057,8 +1100,8 @@ static PyObject *MenuObj_EnableMenuItemIcon(_self, _args)
...
@@ -1057,8 +1100,8 @@ static PyObject *MenuObj_EnableMenuItemIcon(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
UInt16
item
;
MenuItemIndex
item
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
&
item
))
&
item
))
return
NULL
;
return
NULL
;
EnableMenuItemIcon
(
_self
->
ob_itself
,
EnableMenuItemIcon
(
_self
->
ob_itself
,
...
@@ -1073,8 +1116,8 @@ static PyObject *MenuObj_DisableMenuItemIcon(_self, _args)
...
@@ -1073,8 +1116,8 @@ static PyObject *MenuObj_DisableMenuItemIcon(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
UInt16
item
;
MenuItemIndex
item
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
&
item
))
&
item
))
return
NULL
;
return
NULL
;
DisableMenuItemIcon
(
_self
->
ob_itself
,
DisableMenuItemIcon
(
_self
->
ob_itself
,
...
@@ -1090,8 +1133,8 @@ static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args)
...
@@ -1090,8 +1133,8 @@ static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
Boolean
_rv
;
UInt16
item
;
MenuItemIndex
item
;
if
(
!
PyArg_ParseTuple
(
_args
,
"
H
"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"
h
"
,
&
item
))
&
item
))
return
NULL
;
return
NULL
;
_rv
=
IsMenuItemIconEnabled
(
_self
->
ob_itself
,
_rv
=
IsMenuItemIconEnabled
(
_self
->
ob_itself
,
...
@@ -1101,6 +1144,539 @@ static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args)
...
@@ -1101,6 +1144,539 @@ static PyObject *MenuObj_IsMenuItemIconEnabled(_self, _args)
return
_res
;
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
)
static
PyObject
*
MenuObj_as_Resource
(
_self
,
_args
)
MenuObject
*
_self
;
MenuObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -1171,6 +1747,8 @@ static PyMethodDef MenuObj_methods[] = {
...
@@ -1171,6 +1747,8 @@ static PyMethodDef MenuObj_methods[] = {
"() -> None"
},
"() -> None"
},
{
"CalcMenuSize"
,
(
PyCFunction
)
MenuObj_CalcMenuSize
,
1
,
{
"CalcMenuSize"
,
(
PyCFunction
)
MenuObj_CalcMenuSize
,
1
,
"() -> None"
},
"() -> None"
},
{
"CountMenuItems"
,
(
PyCFunction
)
MenuObj_CountMenuItems
,
1
,
"() -> (short _rv)"
},
#if !TARGET_API_MAC_CARBON
#if !TARGET_API_MAC_CARBON
{
"CountMItems"
,
(
PyCFunction
)
MenuObj_CountMItems
,
1
,
{
"CountMItems"
,
(
PyCFunction
)
MenuObj_CountMItems
,
1
,
...
@@ -1201,11 +1779,13 @@ static PyMethodDef MenuObj_methods[] = {
...
@@ -1201,11 +1779,13 @@ static PyMethodDef MenuObj_methods[] = {
{
"AppendMenuItemText"
,
(
PyCFunction
)
MenuObj_AppendMenuItemText
,
1
,
{
"AppendMenuItemText"
,
(
PyCFunction
)
MenuObj_AppendMenuItemText
,
1
,
"(Str255 inString) -> None"
},
"(Str255 inString) -> None"
},
{
"InsertMenuItemText"
,
(
PyCFunction
)
MenuObj_InsertMenuItemText
,
1
,
{
"InsertMenuItemText"
,
(
PyCFunction
)
MenuObj_InsertMenuItemText
,
1
,
"(Str255 inString,
UInt16
afterItem) -> None"
},
"(Str255 inString,
MenuItemIndex
afterItem) -> None"
},
{
"PopUpMenuSelect"
,
(
PyCFunction
)
MenuObj_PopUpMenuSelect
,
1
,
{
"PopUpMenuSelect"
,
(
PyCFunction
)
MenuObj_PopUpMenuSelect
,
1
,
"(short top, short left, short popUpItem) -> (long _rv)"
},
"(short top, short left, short popUpItem) -> (long _rv)"
},
{
"MacInsertMenu"
,
(
PyCFunction
)
MenuObj_MacInsertMenu
,
1
,
{
"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
#if !TARGET_API_MAC_CARBON
{
"CheckItem"
,
(
PyCFunction
)
MenuObj_CheckItem
,
1
,
{
"CheckItem"
,
(
PyCFunction
)
MenuObj_CheckItem
,
1
,
...
@@ -1242,9 +1822,9 @@ static PyMethodDef MenuObj_methods[] = {
...
@@ -1242,9 +1822,9 @@ static PyMethodDef MenuObj_methods[] = {
"(short item) -> None"
},
"(short item) -> None"
},
#endif
#endif
{
"SetMenuItemCommandID"
,
(
PyCFunction
)
MenuObj_SetMenuItemCommandID
,
1
,
{
"SetMenuItemCommandID"
,
(
PyCFunction
)
MenuObj_SetMenuItemCommandID
,
1
,
"(SInt16 inItem,
UInt32
inCommandID) -> None"
},
"(SInt16 inItem,
MenuCommand
inCommandID) -> None"
},
{
"GetMenuItemCommandID"
,
(
PyCFunction
)
MenuObj_GetMenuItemCommandID
,
1
,
{
"GetMenuItemCommandID"
,
(
PyCFunction
)
MenuObj_GetMenuItemCommandID
,
1
,
"(SInt16 inItem) -> (
UInt32
outCommandID)"
},
"(SInt16 inItem) -> (
MenuCommand
outCommandID)"
},
{
"SetMenuItemModifiers"
,
(
PyCFunction
)
MenuObj_SetMenuItemModifiers
,
1
,
{
"SetMenuItemModifiers"
,
(
PyCFunction
)
MenuObj_SetMenuItemModifiers
,
1
,
"(SInt16 inItem, UInt8 inModifiers) -> None"
},
"(SInt16 inItem, UInt8 inModifiers) -> None"
},
{
"GetMenuItemModifiers"
,
(
PyCFunction
)
MenuObj_GetMenuItemModifiers
,
1
,
{
"GetMenuItemModifiers"
,
(
PyCFunction
)
MenuObj_GetMenuItemModifiers
,
1
,
...
@@ -1258,9 +1838,9 @@ static PyMethodDef MenuObj_methods[] = {
...
@@ -1258,9 +1838,9 @@ static PyMethodDef MenuObj_methods[] = {
{
"GetMenuItemTextEncoding"
,
(
PyCFunction
)
MenuObj_GetMenuItemTextEncoding
,
1
,
{
"GetMenuItemTextEncoding"
,
(
PyCFunction
)
MenuObj_GetMenuItemTextEncoding
,
1
,
"(SInt16 inItem) -> (TextEncoding outScriptID)"
},
"(SInt16 inItem) -> (TextEncoding outScriptID)"
},
{
"SetMenuItemHierarchicalID"
,
(
PyCFunction
)
MenuObj_SetMenuItemHierarchicalID
,
1
,
{
"SetMenuItemHierarchicalID"
,
(
PyCFunction
)
MenuObj_SetMenuItemHierarchicalID
,
1
,
"(SInt16 inItem,
SInt16
inHierID) -> None"
},
"(SInt16 inItem,
MenuID
inHierID) -> None"
},
{
"GetMenuItemHierarchicalID"
,
(
PyCFunction
)
MenuObj_GetMenuItemHierarchicalID
,
1
,
{
"GetMenuItemHierarchicalID"
,
(
PyCFunction
)
MenuObj_GetMenuItemHierarchicalID
,
1
,
"(SInt16 inItem) -> (
SInt16
outHierID)"
},
"(SInt16 inItem) -> (
MenuID
outHierID)"
},
{
"SetMenuItemFontID"
,
(
PyCFunction
)
MenuObj_SetMenuItemFontID
,
1
,
{
"SetMenuItemFontID"
,
(
PyCFunction
)
MenuObj_SetMenuItemFontID
,
1
,
"(SInt16 inItem, SInt16 inFontID) -> None"
},
"(SInt16 inItem, SInt16 inFontID) -> None"
},
{
"GetMenuItemFontID"
,
(
PyCFunction
)
MenuObj_GetMenuItemFontID
,
1
,
{
"GetMenuItemFontID"
,
(
PyCFunction
)
MenuObj_GetMenuItemFontID
,
1
,
...
@@ -1284,17 +1864,124 @@ static PyMethodDef MenuObj_methods[] = {
...
@@ -1284,17 +1864,124 @@ static PyMethodDef MenuObj_methods[] = {
{
"GetMenuItemKeyGlyph"
,
(
PyCFunction
)
MenuObj_GetMenuItemKeyGlyph
,
1
,
{
"GetMenuItemKeyGlyph"
,
(
PyCFunction
)
MenuObj_GetMenuItemKeyGlyph
,
1
,
"(SInt16 inItem) -> (SInt16 outGlyph)"
},
"(SInt16 inItem) -> (SInt16 outGlyph)"
},
{
"MacEnableMenuItem"
,
(
PyCFunction
)
MenuObj_MacEnableMenuItem
,
1
,
{
"MacEnableMenuItem"
,
(
PyCFunction
)
MenuObj_MacEnableMenuItem
,
1
,
"(
UInt16
item) -> None"
},
"(
MenuItemIndex
item) -> None"
},
{
"DisableMenuItem"
,
(
PyCFunction
)
MenuObj_DisableMenuItem
,
1
,
{
"DisableMenuItem"
,
(
PyCFunction
)
MenuObj_DisableMenuItem
,
1
,
"(
UInt16
item) -> None"
},
"(
MenuItemIndex
item) -> None"
},
{
"IsMenuItemEnabled"
,
(
PyCFunction
)
MenuObj_IsMenuItemEnabled
,
1
,
{
"IsMenuItemEnabled"
,
(
PyCFunction
)
MenuObj_IsMenuItemEnabled
,
1
,
"(
UInt16
item) -> (Boolean _rv)"
},
"(
MenuItemIndex
item) -> (Boolean _rv)"
},
{
"EnableMenuItemIcon"
,
(
PyCFunction
)
MenuObj_EnableMenuItemIcon
,
1
,
{
"EnableMenuItemIcon"
,
(
PyCFunction
)
MenuObj_EnableMenuItemIcon
,
1
,
"(
UInt16
item) -> None"
},
"(
MenuItemIndex
item) -> None"
},
{
"DisableMenuItemIcon"
,
(
PyCFunction
)
MenuObj_DisableMenuItemIcon
,
1
,
{
"DisableMenuItemIcon"
,
(
PyCFunction
)
MenuObj_DisableMenuItemIcon
,
1
,
"(
UInt16
item) -> None"
},
"(
MenuItemIndex
item) -> None"
},
{
"IsMenuItemIconEnabled"
,
(
PyCFunction
)
MenuObj_IsMenuItemIconEnabled
,
1
,
{
"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
,
{
"as_Resource"
,
(
PyCFunction
)
MenuObj_as_Resource
,
1
,
"() -> (Handle _rv)"
},
"() -> (Handle _rv)"
},
{
"AppendMenu"
,
(
PyCFunction
)
MenuObj_AppendMenu
,
1
,
{
"AppendMenu"
,
(
PyCFunction
)
MenuObj_AppendMenu
,
1
,
...
@@ -1385,7 +2072,7 @@ static PyObject *Menu_NewMenu(_self, _args)
...
@@ -1385,7 +2072,7 @@ static PyObject *Menu_NewMenu(_self, _args)
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
MenuHandle
_rv
;
MenuHandle
_rv
;
short
menuID
;
MenuID
menuID
;
Str255
menuTitle
;
Str255
menuTitle
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hO&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"hO&"
,
&
menuID
,
&
menuID
,
...
@@ -1414,6 +2101,31 @@ static PyObject *Menu_MacGetMenu(_self, _args)
...
@@ -1414,6 +2101,31 @@ static PyObject *Menu_MacGetMenu(_self, _args)
return
_res
;
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
)
static
PyObject
*
Menu_MenuKey
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
...
@@ -1521,7 +2233,7 @@ static PyObject *Menu_HiliteMenu(_self, _args)
...
@@ -1521,7 +2233,7 @@ static PyObject *Menu_HiliteMenu(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
short
menuID
;
MenuID
menuID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
menuID
))
&
menuID
))
return
NULL
;
return
NULL
;
...
@@ -1536,7 +2248,7 @@ static PyObject *Menu_GetNewMBar(_self, _args)
...
@@ -1536,7 +2248,7 @@ static PyObject *Menu_GetNewMBar(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
Handle
_rv
;
MenuBar
Handle
_rv
;
short
menuBarID
;
short
menuBarID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
menuBarID
))
&
menuBarID
))
...
@@ -1552,7 +2264,7 @@ static PyObject *Menu_GetMenuBar(_self, _args)
...
@@ -1552,7 +2264,7 @@ static PyObject *Menu_GetMenuBar(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
Handle
_rv
;
MenuBar
Handle
_rv
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
return
NULL
;
_rv
=
GetMenuBar
();
_rv
=
GetMenuBar
();
...
@@ -1566,23 +2278,65 @@ static PyObject *Menu_SetMenuBar(_self, _args)
...
@@ -1566,23 +2278,65 @@ static PyObject *Menu_SetMenuBar(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
Handle
menuList
;
MenuBarHandle
mbar
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
ResObj_Convert
,
&
m
enuList
))
ResObj_Convert
,
&
m
bar
))
return
NULL
;
return
NULL
;
SetMenuBar
(
m
enuList
);
SetMenuBar
(
m
bar
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
_res
=
Py_None
;
return
_res
;
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
)
static
PyObject
*
Menu_GetMenuHandle
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_self
;
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
MenuHandle
_rv
;
MenuHandle
_rv
;
short
menuID
;
MenuID
menuID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
menuID
))
&
menuID
))
return
NULL
;
return
NULL
;
...
@@ -1597,7 +2351,7 @@ static PyObject *Menu_MacDeleteMenu(_self, _args)
...
@@ -1597,7 +2351,7 @@ static PyObject *Menu_MacDeleteMenu(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
short
menuID
;
MenuID
menuID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
menuID
))
&
menuID
))
return
NULL
;
return
NULL
;
...
@@ -1620,6 +2374,21 @@ static PyObject *Menu_ClearMenuBar(_self, _args)
...
@@ -1620,6 +2374,21 @@ static PyObject *Menu_ClearMenuBar(_self, _args)
return
_res
;
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
#if !TARGET_API_MAC_CARBON
static
PyObject
*
Menu_SetMenuFlash
(
_self
,
_args
)
static
PyObject
*
Menu_SetMenuFlash
(
_self
,
_args
)
...
@@ -1643,7 +2412,7 @@ static PyObject *Menu_FlashMenuBar(_self, _args)
...
@@ -1643,7 +2412,7 @@ static PyObject *Menu_FlashMenuBar(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
short
menuID
;
MenuID
menuID
;
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"h"
,
&
menuID
))
&
menuID
))
return
NULL
;
return
NULL
;
...
@@ -1735,7 +2504,7 @@ static PyObject *Menu_DeleteMCEntries(_self, _args)
...
@@ -1735,7 +2504,7 @@ static PyObject *Menu_DeleteMCEntries(_self, _args)
PyObject
*
_args
;
PyObject
*
_args
;
{
{
PyObject
*
_res
=
NULL
;
PyObject
*
_res
=
NULL
;
short
menuID
;
MenuID
menuID
;
short
menuItem
;
short
menuItem
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
menuID
,
&
menuID
,
...
@@ -1869,9 +2638,14 @@ static PyMethodDef Menu_methods[] = {
...
@@ -1869,9 +2638,14 @@ static PyMethodDef Menu_methods[] = {
"() -> None"
},
"() -> None"
},
#endif
#endif
{
"NewMenu"
,
(
PyCFunction
)
Menu_NewMenu
,
1
,
{
"NewMenu"
,
(
PyCFunction
)
Menu_NewMenu
,
1
,
"(
short
menuID, Str255 menuTitle) -> (MenuHandle _rv)"
},
"(
MenuID
menuID, Str255 menuTitle) -> (MenuHandle _rv)"
},
{
"MacGetMenu"
,
(
PyCFunction
)
Menu_MacGetMenu
,
1
,
{
"MacGetMenu"
,
(
PyCFunction
)
Menu_MacGetMenu
,
1
,
"(short resourceID) -> (MenuHandle _rv)"
},
"(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
,
{
"MenuKey"
,
(
PyCFunction
)
Menu_MenuKey
,
1
,
"(CharParameter ch) -> (long _rv)"
},
"(CharParameter ch) -> (long _rv)"
},
{
"MenuSelect"
,
(
PyCFunction
)
Menu_MenuSelect
,
1
,
{
"MenuSelect"
,
(
PyCFunction
)
Menu_MenuSelect
,
1
,
...
@@ -1887,26 +2661,38 @@ static PyMethodDef Menu_methods[] = {
...
@@ -1887,26 +2661,38 @@ static PyMethodDef Menu_methods[] = {
{
"InvalMenuBar"
,
(
PyCFunction
)
Menu_InvalMenuBar
,
1
,
{
"InvalMenuBar"
,
(
PyCFunction
)
Menu_InvalMenuBar
,
1
,
"() -> None"
},
"() -> None"
},
{
"HiliteMenu"
,
(
PyCFunction
)
Menu_HiliteMenu
,
1
,
{
"HiliteMenu"
,
(
PyCFunction
)
Menu_HiliteMenu
,
1
,
"(
short
menuID) -> None"
},
"(
MenuID
menuID) -> None"
},
{
"GetNewMBar"
,
(
PyCFunction
)
Menu_GetNewMBar
,
1
,
{
"GetNewMBar"
,
(
PyCFunction
)
Menu_GetNewMBar
,
1
,
"(short menuBarID) -> (Handle _rv)"
},
"(short menuBarID) -> (
MenuBar
Handle _rv)"
},
{
"GetMenuBar"
,
(
PyCFunction
)
Menu_GetMenuBar
,
1
,
{
"GetMenuBar"
,
(
PyCFunction
)
Menu_GetMenuBar
,
1
,
"() -> (Handle _rv)"
},
"() -> (
MenuBar
Handle _rv)"
},
{
"SetMenuBar"
,
(
PyCFunction
)
Menu_SetMenuBar
,
1
,
{
"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
,
{
"GetMenuHandle"
,
(
PyCFunction
)
Menu_GetMenuHandle
,
1
,
"(
short
menuID) -> (MenuHandle _rv)"
},
"(
MenuID
menuID) -> (MenuHandle _rv)"
},
{
"MacDeleteMenu"
,
(
PyCFunction
)
Menu_MacDeleteMenu
,
1
,
{
"MacDeleteMenu"
,
(
PyCFunction
)
Menu_MacDeleteMenu
,
1
,
"(
short
menuID) -> None"
},
"(
MenuID
menuID) -> None"
},
{
"ClearMenuBar"
,
(
PyCFunction
)
Menu_ClearMenuBar
,
1
,
{
"ClearMenuBar"
,
(
PyCFunction
)
Menu_ClearMenuBar
,
1
,
"() -> None"
},
"() -> None"
},
{
"SetMenuFlashCount"
,
(
PyCFunction
)
Menu_SetMenuFlashCount
,
1
,
"(short count) -> None"
},
#if !TARGET_API_MAC_CARBON
#if !TARGET_API_MAC_CARBON
{
"SetMenuFlash"
,
(
PyCFunction
)
Menu_SetMenuFlash
,
1
,
{
"SetMenuFlash"
,
(
PyCFunction
)
Menu_SetMenuFlash
,
1
,
"(short count) -> None"
},
"(short count) -> None"
},
#endif
#endif
{
"FlashMenuBar"
,
(
PyCFunction
)
Menu_FlashMenuBar
,
1
,
{
"FlashMenuBar"
,
(
PyCFunction
)
Menu_FlashMenuBar
,
1
,
"(
short
menuID) -> None"
},
"(
MenuID
menuID) -> None"
},
#if !TARGET_API_MAC_CARBON
#if !TARGET_API_MAC_CARBON
{
"SystemEdit"
,
(
PyCFunction
)
Menu_SystemEdit
,
1
,
{
"SystemEdit"
,
(
PyCFunction
)
Menu_SystemEdit
,
1
,
...
@@ -1924,7 +2710,7 @@ static PyMethodDef Menu_methods[] = {
...
@@ -1924,7 +2710,7 @@ static PyMethodDef Menu_methods[] = {
{
"HideMenuBar"
,
(
PyCFunction
)
Menu_HideMenuBar
,
1
,
{
"HideMenuBar"
,
(
PyCFunction
)
Menu_HideMenuBar
,
1
,
"() -> None"
},
"() -> None"
},
{
"DeleteMCEntries"
,
(
PyCFunction
)
Menu_DeleteMCEntries
,
1
,
{
"DeleteMCEntries"
,
(
PyCFunction
)
Menu_DeleteMCEntries
,
1
,
"(
short
menuID, short menuItem) -> None"
},
"(
MenuID
menuID, short menuItem) -> None"
},
{
"InitContextualMenus"
,
(
PyCFunction
)
Menu_InitContextualMenus
,
1
,
{
"InitContextualMenus"
,
(
PyCFunction
)
Menu_InitContextualMenus
,
1
,
"() -> None"
},
"() -> None"
},
{
"IsShowContextualMenuClick"
,
(
PyCFunction
)
Menu_IsShowContextualMenuClick
,
1
,
{
"IsShowContextualMenuClick"
,
(
PyCFunction
)
Menu_IsShowContextualMenuClick
,
1
,
...
@@ -1961,7 +2747,7 @@ void initMenu()
...
@@ -1961,7 +2747,7 @@ void initMenu()
Menu_Error
=
PyMac_GetOSErrException
();
Menu_Error
=
PyMac_GetOSErrException
();
if
(
Menu_Error
==
NULL
||
if
(
Menu_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
Menu_Error
)
!=
0
)
PyDict_SetItemString
(
d
,
"Error"
,
Menu_Error
)
!=
0
)
Py_FatalError
(
"can't initialize Menu.Error"
)
;
return
;
Menu_Type
.
ob_type
=
&
PyType_Type
;
Menu_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
Menu_Type
);
Py_INCREF
(
&
Menu_Type
);
if
(
PyDict_SetItemString
(
d
,
"MenuType"
,
(
PyObject
*
)
&
Menu_Type
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"MenuType"
,
(
PyObject
*
)
&
Menu_Type
)
!=
0
)
...
...
Mac/Modules/menu/menuscan.py
View file @
f7d5aa61
...
@@ -38,6 +38,10 @@ class MyScanner(Scanner):
...
@@ -38,6 +38,10 @@ class MyScanner(Scanner):
"GetMenuItemPropertySize"
,
"GetMenuItemPropertySize"
,
"SetMenuItemProperty"
,
"SetMenuItemProperty"
,
"RemoveMenuItemProperty"
,
"RemoveMenuItemProperty"
,
"SetMenuCommandProperty"
,
"GetMenuCommandProperty"
,
"GetMenuTitle"
,
# Funny arg/returnvalue
"SetMenuTitle"
,
]
]
def
makegreylist
(
self
):
def
makegreylist
(
self
):
...
@@ -55,6 +59,31 @@ class MyScanner(Scanner):
...
@@ -55,6 +59,31 @@ class MyScanner(Scanner):
'SetMenuFlash'
,
'SetMenuFlash'
,
'InitMenus'
,
'InitMenus'
,
'InitProcMenu'
,
'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
):
def
makeblacklisttypes
(
self
):
...
@@ -64,6 +93,9 @@ class MyScanner(Scanner):
...
@@ -64,6 +93,9 @@ class MyScanner(Scanner):
'MCTablePtr'
,
'MCTablePtr'
,
'AEDesc_ptr'
,
# For now: doable, but not easy
'AEDesc_ptr'
,
# For now: doable, but not easy
'ProcessSerialNumber'
,
# ditto
'ProcessSerialNumber'
,
# ditto
"MenuDefSpecPtr"
,
# Too difficult for now
"MenuDefSpec_ptr"
,
# ditto
"MenuTrackingData"
,
]
]
def
makerepairinstructions
(
self
):
def
makerepairinstructions
(
self
):
...
...
Mac/Modules/menu/menusupport.py
View file @
f7d5aa61
...
@@ -25,13 +25,30 @@ from macsupport import *
...
@@ -25,13 +25,30 @@ from macsupport import *
MenuHandle
=
OpaqueByValueType
(
OBJECTTYPE
,
OBJECTPREFIX
)
MenuHandle
=
OpaqueByValueType
(
OBJECTTYPE
,
OBJECTPREFIX
)
MenuRef
=
MenuHandle
MenuRef
=
MenuHandle
Handle
=
OpaqueByValueType
(
"Handle"
,
"ResObj"
)
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'
)
unsigned_char
=
Type
(
'unsigned char'
,
'b'
)
FMFontFamily
=
Type
(
"FMFontFamily"
,
"h"
)
FMFontStyle
=
Type
(
"FMFontStyle"
,
"h"
)
includestuff
=
includestuff
+
"""
includestuff
=
includestuff
+
"""
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <%s>"""
%
MACHEADERFILE
+
"""
#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_Menu(h) ((MenuHandle)h)
#define as_Resource(h) ((Handle)h)
#define as_Resource(h) ((Handle)h)
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment