summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/ctl
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-06-06 12:55:40 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-06-06 12:55:40 (GMT)
commitae8a68f40cd56aa952520260970ebd5b9d3fb95c (patch)
treee1d470857f4a2fb83fe4fae48509f0babb93852c /Mac/Modules/ctl
parentc7cfb9555974e2e3789a629f1b7509eaa73ee2c6 (diff)
downloadcpython-ae8a68f40cd56aa952520260970ebd5b9d3fb95c.zip
cpython-ae8a68f40cd56aa952520260970ebd5b9d3fb95c.tar.gz
cpython-ae8a68f40cd56aa952520260970ebd5b9d3fb95c.tar.bz2
Trying again to check it in. Changes to:
- Use Universal Headers as input - Change addpack calls to not depend on Guido's disklayout - Checkge testprograms to use new names for some functions
Diffstat (limited to 'Mac/Modules/ctl')
-rw-r--r--Mac/Modules/ctl/Ctlmodule.c132
-rw-r--r--Mac/Modules/ctl/ctlgen.py106
-rw-r--r--Mac/Modules/ctl/ctlscan.py9
-rw-r--r--Mac/Modules/ctl/ctlsupport.py4
4 files changed, 130 insertions, 121 deletions
diff --git a/Mac/Modules/ctl/Ctlmodule.c b/Mac/Modules/ctl/Ctlmodule.c
index fb1459a..6af76a5 100644
--- a/Mac/Modules/ctl/Ctlmodule.c
+++ b/Mac/Modules/ctl/Ctlmodule.c
@@ -56,7 +56,7 @@ typedef struct ControlObject {
} ControlObject;
PyObject *CtlObj_New(itself)
- const ControlHandle itself;
+ ControlHandle itself;
{
ControlObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
@@ -86,7 +86,7 @@ static void CtlObj_dealloc(self)
PyMem_DEL(self);
}
-static PyObject *CtlObj_SetCTitle(_self, _args)
+static PyObject *CtlObj_SetControlTitle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -95,14 +95,14 @@ static PyObject *CtlObj_SetCTitle(_self, _args)
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, title))
return NULL;
- SetCTitle(_self->ob_itself,
- title);
+ SetControlTitle(_self->ob_itself,
+ title);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetCTitle(_self, _args)
+static PyObject *CtlObj_GetControlTitle(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -111,8 +111,8 @@ static PyObject *CtlObj_GetCTitle(_self, _args)
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, title))
return NULL;
- GetCTitle(_self->ob_itself,
- title);
+ GetControlTitle(_self->ob_itself,
+ title);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
@@ -224,7 +224,7 @@ static PyObject *CtlObj_SizeControl(_self, _args)
return _res;
}
-static PyObject *CtlObj_SetCtlValue(_self, _args)
+static PyObject *CtlObj_SetControlValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -233,14 +233,14 @@ static PyObject *CtlObj_SetCtlValue(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&theValue))
return NULL;
- SetCtlValue(_self->ob_itself,
- theValue);
+ SetControlValue(_self->ob_itself,
+ theValue);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetCtlValue(_self, _args)
+static PyObject *CtlObj_GetControlValue(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -248,13 +248,13 @@ static PyObject *CtlObj_GetCtlValue(_self, _args)
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetCtlValue(_self->ob_itself);
+ _rv = GetControlValue(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
-static PyObject *CtlObj_SetCtlMin(_self, _args)
+static PyObject *CtlObj_SetControlMinimum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -263,14 +263,14 @@ static PyObject *CtlObj_SetCtlMin(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&minValue))
return NULL;
- SetCtlMin(_self->ob_itself,
- minValue);
+ SetControlMinimum(_self->ob_itself,
+ minValue);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetCtlMin(_self, _args)
+static PyObject *CtlObj_GetControlMinimum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -278,13 +278,13 @@ static PyObject *CtlObj_GetCtlMin(_self, _args)
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetCtlMin(_self->ob_itself);
+ _rv = GetControlMinimum(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
-static PyObject *CtlObj_SetCtlMax(_self, _args)
+static PyObject *CtlObj_SetControlMaximum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -293,14 +293,14 @@ static PyObject *CtlObj_SetCtlMax(_self, _args)
if (!PyArg_ParseTuple(_args, "h",
&maxValue))
return NULL;
- SetCtlMax(_self->ob_itself,
- maxValue);
+ SetControlMaximum(_self->ob_itself,
+ maxValue);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetCtlMax(_self, _args)
+static PyObject *CtlObj_GetControlMaximum(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -308,13 +308,13 @@ static PyObject *CtlObj_GetCtlMax(_self, _args)
short _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetCtlMax(_self->ob_itself);
+ _rv = GetControlMaximum(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
-static PyObject *CtlObj_SetCRefCon(_self, _args)
+static PyObject *CtlObj_SetControlReference(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -323,14 +323,14 @@ static PyObject *CtlObj_SetCRefCon(_self, _args)
if (!PyArg_ParseTuple(_args, "l",
&data))
return NULL;
- SetCRefCon(_self->ob_itself,
- data);
+ SetControlReference(_self->ob_itself,
+ data);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *CtlObj_GetCRefCon(_self, _args)
+static PyObject *CtlObj_GetControlReference(_self, _args)
ControlObject *_self;
PyObject *_args;
{
@@ -338,12 +338,26 @@ static PyObject *CtlObj_GetCRefCon(_self, _args)
long _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetCRefCon(_self->ob_itself);
+ _rv = GetControlReference(_self->ob_itself);
_res = Py_BuildValue("l",
_rv);
return _res;
}
+static PyObject *CtlObj_SetControlAction(_self, _args)
+ ControlObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetControlAction(_self->ob_itself,
+ (ControlActionUPP)0);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *CtlObj_DragControl(_self, _args)
ControlObject *_self;
PyObject *_args;
@@ -386,42 +400,42 @@ static PyObject *CtlObj_TestControl(_self, _args)
return _res;
}
-static PyObject *CtlObj_TrackControl(_self, _args)
+static PyObject *CtlObj_GetControlVariant(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
- Point thePoint;
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &thePoint))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = TrackControl(_self->ob_itself,
- thePoint,
- (ControlActionUPP)0);
+ _rv = GetControlVariant(_self->ob_itself);
_res = Py_BuildValue("h",
_rv);
return _res;
}
-static PyObject *CtlObj_GetCVariant(_self, _args)
+static PyObject *CtlObj_TrackControl(_self, _args)
ControlObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
short _rv;
- if (!PyArg_ParseTuple(_args, ""))
+ Point thePoint;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &thePoint))
return NULL;
- _rv = GetCVariant(_self->ob_itself);
+ _rv = TrackControl(_self->ob_itself,
+ thePoint,
+ (ControlActionUPP)0);
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyMethodDef CtlObj_methods[] = {
- {"SetCTitle", (PyCFunction)CtlObj_SetCTitle, 1,
+ {"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1,
"(Str255 title) -> None"},
- {"GetCTitle", (PyCFunction)CtlObj_GetCTitle, 1,
+ {"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1,
"(Str255 title) -> None"},
{"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1,
"() -> None"},
@@ -437,30 +451,32 @@ static PyMethodDef CtlObj_methods[] = {
"(short h, short v) -> None"},
{"SizeControl", (PyCFunction)CtlObj_SizeControl, 1,
"(short w, short h) -> None"},
- {"SetCtlValue", (PyCFunction)CtlObj_SetCtlValue, 1,
+ {"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1,
"(short theValue) -> None"},
- {"GetCtlValue", (PyCFunction)CtlObj_GetCtlValue, 1,
+ {"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1,
"() -> (short _rv)"},
- {"SetCtlMin", (PyCFunction)CtlObj_SetCtlMin, 1,
+ {"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1,
"(short minValue) -> None"},
- {"GetCtlMin", (PyCFunction)CtlObj_GetCtlMin, 1,
+ {"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1,
"() -> (short _rv)"},
- {"SetCtlMax", (PyCFunction)CtlObj_SetCtlMax, 1,
+ {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1,
"(short maxValue) -> None"},
- {"GetCtlMax", (PyCFunction)CtlObj_GetCtlMax, 1,
+ {"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1,
"() -> (short _rv)"},
- {"SetCRefCon", (PyCFunction)CtlObj_SetCRefCon, 1,
+ {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1,
"(long data) -> None"},
- {"GetCRefCon", (PyCFunction)CtlObj_GetCRefCon, 1,
+ {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1,
"() -> (long _rv)"},
+ {"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1,
+ "() -> None"},
{"DragControl", (PyCFunction)CtlObj_DragControl, 1,
"(Point startPt, Rect limitRect, Rect slopRect, short axis) -> None"},
{"TestControl", (PyCFunction)CtlObj_TestControl, 1,
"(Point thePt) -> (short _rv)"},
+ {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1,
+ "() -> (short _rv)"},
{"TrackControl", (PyCFunction)CtlObj_TrackControl, 1,
"(Point thePoint) -> (short _rv)"},
- {"GetCVariant", (PyCFunction)CtlObj_GetCVariant, 1,
- "() -> (short _rv)"},
{NULL, NULL, 0}
};
@@ -580,22 +596,6 @@ static PyObject *Ctl_DrawControls(_self, _args)
return _res;
}
-static PyObject *Ctl_UpdtControl(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- WindowPtr theWindow;
- if (!PyArg_ParseTuple(_args, "O&",
- WinObj_Convert, &theWindow))
- return NULL;
- UpdtControl(theWindow,
- theWindow->visRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
static PyObject *Ctl_UpdateControls(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -643,8 +643,6 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr theWindow) -> None"},
{"DrawControls", (PyCFunction)Ctl_DrawControls, 1,
"(WindowPtr theWindow) -> None"},
- {"UpdtControl", (PyCFunction)Ctl_UpdtControl, 1,
- "(WindowPtr theWindow) -> None"},
{"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1,
"(WindowPtr theWindow) -> None"},
{"FindControl", (PyCFunction)Ctl_FindControl, 1,
diff --git a/Mac/Modules/ctl/ctlgen.py b/Mac/Modules/ctl/ctlgen.py
index 0a355cf..85fc6c7 100644
--- a/Mac/Modules/ctl/ctlgen.py
+++ b/Mac/Modules/ctl/ctlgen.py
@@ -1,7 +1,7 @@
-# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Controls.h'
+# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Controls.h'
-f = Function(ControlHandle, 'NewControl',
- (WindowPtr, 'theWindow', InMode),
+f = Function(ControlRef, 'NewControl',
+ (WindowRef, 'theWindow', InMode),
(Rect_ptr, 'boundsRect', InMode),
(ConstStr255Param, 'title', InMode),
(Boolean, 'visible', InMode),
@@ -13,132 +13,132 @@ f = Function(ControlHandle, 'NewControl',
)
functions.append(f)
-f = Method(void, 'SetCTitle',
- (ControlHandle, 'theControl', InMode),
+f = Method(void, 'SetControlTitle',
+ (ControlRef, 'theControl', InMode),
(ConstStr255Param, 'title', InMode),
)
methods.append(f)
-f = Method(void, 'GetCTitle',
- (ControlHandle, 'theControl', InMode),
+f = Method(void, 'GetControlTitle',
+ (ControlRef, 'theControl', InMode),
(Str255, 'title', InMode),
)
methods.append(f)
-f = Function(ControlHandle, 'GetNewControl',
+f = Function(ControlRef, 'GetNewControl',
(short, 'controlID', InMode),
- (WindowPtr, 'owner', InMode),
+ (WindowRef, 'owner', InMode),
)
functions.append(f)
f = Method(void, 'DisposeControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Function(void, 'KillControls',
- (WindowPtr, 'theWindow', InMode),
+ (WindowRef, 'theWindow', InMode),
)
functions.append(f)
f = Method(void, 'HideControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'ShowControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Function(void, 'DrawControls',
- (WindowPtr, 'theWindow', InMode),
+ (WindowRef, 'theWindow', InMode),
)
functions.append(f)
f = Method(void, 'Draw1Control',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
f = Method(void, 'HiliteControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
(short, 'hiliteState', InMode),
)
methods.append(f)
-f = Function(void, 'UpdtControl',
- (WindowPtr, 'theWindow', InMode),
- (RgnHandle, 'updateRgn', InMode),
-)
-functions.append(f)
-
f = Function(void, 'UpdateControls',
- (WindowPtr, 'theWindow', InMode),
+ (WindowRef, 'theWindow', InMode),
(RgnHandle, 'updateRgn', InMode),
)
functions.append(f)
f = Method(void, 'MoveControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
(short, 'h', InMode),
(short, 'v', InMode),
)
methods.append(f)
f = Method(void, 'SizeControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
(short, 'w', InMode),
(short, 'h', InMode),
)
methods.append(f)
-f = Method(void, 'SetCtlValue',
- (ControlHandle, 'theControl', InMode),
+f = Method(void, 'SetControlValue',
+ (ControlRef, 'theControl', InMode),
(short, 'theValue', InMode),
)
methods.append(f)
-f = Method(short, 'GetCtlValue',
- (ControlHandle, 'theControl', InMode),
+f = Method(short, 'GetControlValue',
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
-f = Method(void, 'SetCtlMin',
- (ControlHandle, 'theControl', InMode),
+f = Method(void, 'SetControlMinimum',
+ (ControlRef, 'theControl', InMode),
(short, 'minValue', InMode),
)
methods.append(f)
-f = Method(short, 'GetCtlMin',
- (ControlHandle, 'theControl', InMode),
+f = Method(short, 'GetControlMinimum',
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
-f = Method(void, 'SetCtlMax',
- (ControlHandle, 'theControl', InMode),
+f = Method(void, 'SetControlMaximum',
+ (ControlRef, 'theControl', InMode),
(short, 'maxValue', InMode),
)
methods.append(f)
-f = Method(short, 'GetCtlMax',
- (ControlHandle, 'theControl', InMode),
+f = Method(short, 'GetControlMaximum',
+ (ControlRef, 'theControl', InMode),
)
methods.append(f)
-f = Method(void, 'SetCRefCon',
- (ControlHandle, 'theControl', InMode),
+f = Method(void, 'SetControlReference',
+ (ControlRef, 'theControl', InMode),
(long, 'data', InMode),
)
methods.append(f)
-f = Method(long, 'GetCRefCon',
- (ControlHandle, 'theControl', InMode),
+f = Method(long, 'GetControlReference',
+ (ControlRef, 'theControl', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'SetControlAction',
+ (ControlRef, 'theControl', InMode),
+ (FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
)
methods.append(f)
f = Method(void, 'DragControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
(Point, 'startPt', InMode),
(Rect_ptr, 'limitRect', InMode),
(Rect_ptr, 'slopRect', InMode),
@@ -147,27 +147,27 @@ f = Method(void, 'DragControl',
methods.append(f)
f = Method(short, 'TestControl',
- (ControlHandle, 'theControl', InMode),
+ (ControlRef, 'theControl', InMode),
(Point, 'thePt', InMode),
)
methods.append(f)
-f = Method(short, 'TrackControl',
- (ControlHandle, 'theControl', InMode),
- (Point, 'thePoint', InMode),
- (FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
-)
-methods.append(f)
-
f = Function(short, 'FindControl',
(Point, 'thePoint', InMode),
- (WindowPtr, 'theWindow', InMode),
+ (WindowRef, 'theWindow', InMode),
(ExistingControlHandle, 'theControl', OutMode),
)
functions.append(f)
-f = Method(short, 'GetCVariant',
- (ControlHandle, 'theControl', InMode),
+f = Method(short, 'GetControlVariant',
+ (ControlRef, 'theControl', InMode),
+)
+methods.append(f)
+
+f = Method(short, 'TrackControl',
+ (ControlRef, 'theControl', InMode),
+ (Point, 'thePoint', InMode),
+ (FakeType('(ControlActionUPP)0'), 'actionProc', InMode),
)
methods.append(f)
diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py
index f104e8d..e36db2c 100644
--- a/Mac/Modules/ctl/ctlscan.py
+++ b/Mac/Modules/ctl/ctlscan.py
@@ -1,4 +1,6 @@
# Scan <Controls.h>, generating ctlgen.py.
+import addpack
+addpack.addpack(':Tools:bgen:bgen')
from scantools import Scanner
@@ -20,7 +22,7 @@ class MyScanner(Scanner):
listname = "functions"
if arglist:
t, n, m = arglist[0]
- if t == "ControlHandle" and m == "InMode":
+ if t in ("ControlHandle", "ControlRef") and m == "InMode":
classname = "Method"
listname = "methods"
return classname, listname
@@ -35,6 +37,7 @@ class MyScanner(Scanner):
def makeblacklisttypes(self):
return [
'ProcPtr',
+ 'ControlActionUPP',
'CCTabHandle',
'AuxCtlHandle',
]
@@ -51,9 +54,13 @@ class MyScanner(Scanner):
# For TrackControl
([("ProcPtr", "actionProc", "InMode")],
[("FakeType('(ControlActionUPP)0')", "*", "*")]),
+ ([("ControlActionUPP", "actionProc", "InMode")],
+ [("FakeType('(ControlActionUPP)0')", "*", "*")]),
([("ControlHandle", "*", "OutMode")],
[("ExistingControlHandle", "*", "*")]),
+ ([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
+ [("ExistingControlHandle", "*", "*")]),
]
if __name__ == "__main__":
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index 97b1f33..9846631 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -5,6 +5,9 @@
import string
+import addpack
+addpack.addpack(':Tools:bgen:bgen')
+
# Declarations that change for each manager
MACHEADERFILE = 'Controls.h' # The Apple header file
MODNAME = 'Ctl' # The name of the module
@@ -22,6 +25,7 @@ from macsupport import *
# Create the type objects
ControlHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
+ControlRef = ControlHandle
ExistingControlHandle = OpaqueByValueType(OBJECTTYPE, "CtlObj_WhichControl", "BUG")
RgnHandle = FakeType("theWindow->visRgn") # XXX