summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/win
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-11-15 15:18:47 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-11-15 15:18:47 (GMT)
commitb7abb18cd99e348ab2f9f7ea85d72158684319a7 (patch)
treea1ab213b915d7a9aeda10eb92737cc6219247e51 /Mac/Modules/win
parent330381cbbb394e7e7a6841879b22218884750ca2 (diff)
downloadcpython-b7abb18cd99e348ab2f9f7ea85d72158684319a7.zip
cpython-b7abb18cd99e348ab2f9f7ea85d72158684319a7.tar.gz
cpython-b7abb18cd99e348ab2f9f7ea85d72158684319a7.tar.bz2
Added support for GrafPort object
Diffstat (limited to 'Mac/Modules/win')
-rw-r--r--Mac/Modules/win/Winmodule.c211
-rw-r--r--Mac/Modules/win/winedit.py41
-rw-r--r--Mac/Modules/win/wingen.py42
-rw-r--r--Mac/Modules/win/winscan.py5
-rw-r--r--Mac/Modules/win/winsupport.py6
5 files changed, 279 insertions, 26 deletions
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c
index 61afed4..286ef34 100644
--- a/Mac/Modules/win/Winmodule.c
+++ b/Mac/Modules/win/Winmodule.c
@@ -19,6 +19,8 @@ extern int ResObj_Convert(PyObject *, Handle *);
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
+extern PyTypeObject Window_Type;
+#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
@@ -31,6 +33,9 @@ extern int MenuObj_Convert(PyObject *, MenuHandle *);
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
+extern PyObject *GrafObj_New(GrafPtr);
+extern int GrafObj_Convert(PyObject *, GrafPtr *);
+
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Windows.h>
@@ -412,6 +417,38 @@ static PyObject *WinObj_DrawNew(_self, _args)
return _res;
}
+static PyObject *WinObj_PaintOne(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clobberedRgn))
+ return NULL;
+ PaintOne(_self->ob_itself,
+ clobberedRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_PaintBehind(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clobberedRgn))
+ return NULL;
+ PaintBehind(_self->ob_itself,
+ clobberedRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *WinObj_CalcVis(_self, _args)
WindowObject *_self;
PyObject *_args;
@@ -425,6 +462,22 @@ static PyObject *WinObj_CalcVis(_self, _args)
return _res;
}
+static PyObject *WinObj_CalcVisBehind(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle clobberedRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clobberedRgn))
+ return NULL;
+ CalcVisBehind(_self->ob_itself,
+ clobberedRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *WinObj_GrowWindow(_self, _args)
WindowObject *_self;
PyObject *_args;
@@ -531,6 +584,20 @@ static PyObject *WinObj_DragWindow(_self, _args)
return _res;
}
+static PyObject *WinObj_GetWindowPort(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ CGrafPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowPort(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, _rv);
+ return _res;
+}
+
static PyObject *WinObj_SetPortWindowPort(_self, _args)
WindowObject *_self;
PyObject *_args;
@@ -630,6 +697,54 @@ static PyObject *WinObj_GetWindowZoomFlag(_self, _args)
return _res;
}
+static PyObject *WinObj_GetWindowStructureRgn(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowStructureRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowContentRgn(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowContentRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUpdateRgn(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowUpdateRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *WinObj_GetWindowTitleWidth(_self, _args)
WindowObject *_self;
PyObject *_args;
@@ -763,8 +878,14 @@ static PyMethodDef WinObj_methods[] = {
"() -> None"},
{"DrawNew", (PyCFunction)WinObj_DrawNew, 1,
"(Boolean update) -> None"},
+ {"PaintOne", (PyCFunction)WinObj_PaintOne, 1,
+ "(RgnHandle clobberedRgn) -> None"},
+ {"PaintBehind", (PyCFunction)WinObj_PaintBehind, 1,
+ "(RgnHandle clobberedRgn) -> None"},
{"CalcVis", (PyCFunction)WinObj_CalcVis, 1,
"() -> None"},
+ {"CalcVisBehind", (PyCFunction)WinObj_CalcVisBehind, 1,
+ "(RgnHandle clobberedRgn) -> None"},
{"GrowWindow", (PyCFunction)WinObj_GrowWindow, 1,
"(Point startPt, Rect bBox) -> (long _rv)"},
{"TrackBox", (PyCFunction)WinObj_TrackBox, 1,
@@ -777,6 +898,8 @@ static PyMethodDef WinObj_methods[] = {
"(Point thePt) -> (Boolean _rv)"},
{"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
"(Point startPt, Rect boundsRect) -> None"},
+ {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1,
+ "() -> (CGrafPtr _rv)"},
{"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
"() -> None"},
{"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
@@ -791,6 +914,12 @@ static PyMethodDef WinObj_methods[] = {
"() -> (Boolean _rv)"},
{"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
"() -> (Boolean _rv)"},
+ {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
+ "(RgnHandle r) -> None"},
{"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
"() -> (short _rv)"},
{"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
@@ -833,6 +962,20 @@ PyTypeObject Window_Type = {
/* --------------------- End object type Window --------------------- */
+static PyObject *Win_GetGrayRgn(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetGrayRgn();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
static PyObject *Win_InitWindows(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -846,6 +989,20 @@ static PyObject *Win_InitWindows(_self, _args)
return _res;
}
+static PyObject *Win_GetWMgrPort(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ GrafPtr wPort;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWMgrPort(&wPort);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, wPort);
+ return _res;
+}
+
static PyObject *Win_NewWindow(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -930,6 +1087,21 @@ static PyObject *Win_InvalRect(_self, _args)
return _res;
}
+static PyObject *Win_InvalRgn(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle badRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &badRgn))
+ return NULL;
+ InvalRgn(badRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *Win_ValidRect(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -945,6 +1117,21 @@ static PyObject *Win_ValidRect(_self, _args)
return _res;
}
+static PyObject *Win_ValidRgn(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle goodRgn;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &goodRgn))
+ return NULL;
+ ValidRgn(goodRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *Win_CheckUpdate(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -999,6 +1186,20 @@ static PyObject *Win_PinRect(_self, _args)
return _res;
}
+static PyObject *Win_GetCWMgrPort(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ CGrafPtr wMgrCPort;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetCWMgrPort(&wMgrCPort);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, wMgrCPort);
+ return _res;
+}
+
static PyObject *Win_NewCWindow(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -1069,8 +1270,12 @@ static PyObject *Win_WhichWindow(_self, _args)
}
static PyMethodDef Win_methods[] = {
+ {"GetGrayRgn", (PyCFunction)Win_GetGrayRgn, 1,
+ "() -> (RgnHandle _rv)"},
{"InitWindows", (PyCFunction)Win_InitWindows, 1,
"() -> None"},
+ {"GetWMgrPort", (PyCFunction)Win_GetWMgrPort, 1,
+ "() -> (GrafPtr wPort)"},
{"NewWindow", (PyCFunction)Win_NewWindow, 1,
"(Rect boundsRect, Str255 title, Boolean visible, short theProc, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
{"GetNewWindow", (PyCFunction)Win_GetNewWindow, 1,
@@ -1079,14 +1284,20 @@ static PyMethodDef Win_methods[] = {
"() -> (WindowPtr _rv)"},
{"InvalRect", (PyCFunction)Win_InvalRect, 1,
"(Rect badRect) -> None"},
+ {"InvalRgn", (PyCFunction)Win_InvalRgn, 1,
+ "(RgnHandle badRgn) -> None"},
{"ValidRect", (PyCFunction)Win_ValidRect, 1,
"(Rect goodRect) -> None"},
+ {"ValidRgn", (PyCFunction)Win_ValidRgn, 1,
+ "(RgnHandle goodRgn) -> None"},
{"CheckUpdate", (PyCFunction)Win_CheckUpdate, 1,
"() -> (Boolean _rv, EventRecord theEvent)"},
{"FindWindow", (PyCFunction)Win_FindWindow, 1,
"(Point thePoint) -> (short _rv, WindowPtr theWindow)"},
{"PinRect", (PyCFunction)Win_PinRect, 1,
"(Rect theRect, Point thePt) -> (long _rv)"},
+ {"GetCWMgrPort", (PyCFunction)Win_GetCWMgrPort, 1,
+ "() -> (CGrafPtr wMgrCPort)"},
{"NewCWindow", (PyCFunction)Win_NewCWindow, 1,
"(Rect boundsRect, Str255 title, Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon) -> (WindowPtr _rv)"},
{"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1,
diff --git a/Mac/Modules/win/winedit.py b/Mac/Modules/win/winedit.py
index 08be8bd..a5812f1 100644
--- a/Mac/Modules/win/winedit.py
+++ b/Mac/Modules/win/winedit.py
@@ -1,6 +1,11 @@
# These are inline-routines/defines, so we do them "by hand"
#
+f = Method(CGrafPtr, 'GetWindowPort',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
f = Method(void, 'SetPortWindowPort',
(WindowRef, 'theWindow', InMode),
)
@@ -38,25 +43,23 @@ f = Method(Boolean, 'GetWindowZoomFlag',
)
methods.append(f)
-if 0:
- # Regions are not implemented yet..
- f = Method(void, 'GetWindowStructureRgn',
- (WindowRef, 'theWindow', InMode),
- (RgnHandle, 'r', InMode),
- )
- methods.append(f)
-
- f = Method(void, 'GetWindowContentRgn',
- (WindowRef, 'theWindow', InMode),
- (RgnHandle, 'r', InMode),
- )
- methods.append(f)
-
- f = Method(void, 'GetWindowUpdateRgn',
- (WindowRef, 'theWindow', InMode),
- (RgnHandle, 'r', InMode),
- )
- methods.append(f)
+f = Method(void, 'GetWindowStructureRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowContentRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowUpdateRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
f = Method(short, 'GetWindowTitleWidth',
(WindowRef, 'theWindow', InMode),
diff --git a/Mac/Modules/win/wingen.py b/Mac/Modules/win/wingen.py
index 1d0a875..8841b1e 100644
--- a/Mac/Modules/win/wingen.py
+++ b/Mac/Modules/win/wingen.py
@@ -1,9 +1,18 @@
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h'
+f = Function(RgnHandle, 'GetGrayRgn',
+)
+functions.append(f)
+
f = Function(void, 'InitWindows',
)
functions.append(f)
+f = Function(void, 'GetWMgrPort',
+ (GrafPtr, 'wPort', OutMode),
+)
+functions.append(f)
+
f = Function(WindowRef, 'NewWindow',
(NullStorage, 'wStorage', InMode),
(Rect_ptr, 'boundsRect', InMode),
@@ -104,11 +113,21 @@ f = Function(void, 'InvalRect',
)
functions.append(f)
+f = Function(void, 'InvalRgn',
+ (RgnHandle, 'badRgn', InMode),
+)
+functions.append(f)
+
f = Function(void, 'ValidRect',
(Rect_ptr, 'goodRect', InMode),
)
functions.append(f)
+f = Function(void, 'ValidRgn',
+ (RgnHandle, 'goodRgn', InMode),
+)
+functions.append(f)
+
f = Method(void, 'BeginUpdate',
(WindowRef, 'theWindow', InMode),
)
@@ -162,11 +181,29 @@ f = Method(void, 'DrawNew',
)
methods.append(f)
+f = Method(void, 'PaintOne',
+ (WindowRef, 'window', InMode),
+ (RgnHandle, 'clobberedRgn', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'PaintBehind',
+ (WindowRef, 'startWindow', InMode),
+ (RgnHandle, 'clobberedRgn', InMode),
+)
+methods.append(f)
+
f = Method(void, 'CalcVis',
(WindowRef, 'window', InMode),
)
methods.append(f)
+f = Method(void, 'CalcVisBehind',
+ (WindowRef, 'startWindow', InMode),
+ (RgnHandle, 'clobberedRgn', InMode),
+)
+methods.append(f)
+
f = Method(long, 'GrowWindow',
(WindowRef, 'theWindow', InMode),
(Point, 'startPt', InMode),
@@ -193,6 +230,11 @@ f = Method(Boolean, 'TrackBox',
)
methods.append(f)
+f = Function(void, 'GetCWMgrPort',
+ (CGrafPtr, 'wMgrCPort', OutMode),
+)
+functions.append(f)
+
f = Function(WindowRef, 'NewCWindow',
(NullStorage, 'wStorage', InMode),
(Rect_ptr, 'boundsRect', InMode),
diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py
index dd3319b..20771b0 100644
--- a/Mac/Modules/win/winscan.py
+++ b/Mac/Modules/win/winscan.py
@@ -36,13 +36,10 @@ class MyScanner(Scanner):
def makeblacklisttypes(self):
return [
'ProcPtr',
- 'GrafPtr',
- 'CGrafPtr',
- 'RgnHandle',
-## 'PicHandle',
'WCTabHandle',
'AuxWinHandle',
'PixPatHandle',
+ 'DragGrayRgnUPP',
]
def makerepairinstructions(self):
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index 39d4b7a..9aed179 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -29,9 +29,10 @@ WindowPtr = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
WindowRef = WindowPtr
WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
WindowPeek.passInput = lambda name: "(WindowPeek)(%s)" % name
-CGrafPtr = WindowPtr
+CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
+GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
-#RgnHandle = OpaqueByValueType("RgnHandle", "RgnObj")
+RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
PicHandle = OpaqueByValueType("PicHandle", "ResObj")
includestuff = includestuff + """
@@ -83,7 +84,6 @@ class MyObjectDefinition(GlobalObjectDefinition):
""")
def outputFreeIt(self, itselfname):
Output("DisposeWindow(%s);", itselfname)
-
# From here on it's basically all boiler plate...
# Create the generator groups and link them