summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/win
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-11-14 10:48:54 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-11-14 10:48:54 (GMT)
commit330f57699fd3e5c22c7f354ea0fb52deb47fa6a7 (patch)
tree826c2d514b845a443198b93d37a22424b656b47e /Mac/Modules/win
parenta01a8f78cb76242cdc5f6f2ef67678c4172bb7d2 (diff)
downloadcpython-330f57699fd3e5c22c7f354ea0fb52deb47fa6a7.zip
cpython-330f57699fd3e5c22c7f354ea0fb52deb47fa6a7.tar.gz
cpython-330f57699fd3e5c22c7f354ea0fb52deb47fa6a7.tar.bz2
- Added support for PicHandle
- Added (by hand, through winedit.py) support for WindowPeek accessor functions that are currently declared as macros.
Diffstat (limited to 'Mac/Modules/win')
-rw-r--r--Mac/Modules/win/Winmodule.c249
-rw-r--r--Mac/Modules/win/winedit.py95
-rw-r--r--Mac/Modules/win/wingen.py13
-rw-r--r--Mac/Modules/win/winscan.py2
-rw-r--r--Mac/Modules/win/winsupport.py10
5 files changed, 366 insertions, 3 deletions
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c
index 8691501..61afed4 100644
--- a/Mac/Modules/win/Winmodule.c
+++ b/Mac/Modules/win/Winmodule.c
@@ -340,6 +340,36 @@ static PyObject *WinObj_GetWRefCon(_self, _args)
return _res;
}
+static PyObject *WinObj_SetWindowPic(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ PicHandle pic;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pic))
+ return NULL;
+ SetWindowPic(_self->ob_itself,
+ pic);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowPic(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ PicHandle _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowPic(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
+ return _res;
+}
+
static PyObject *WinObj_ClipAbove(_self, _args)
WindowObject *_self;
PyObject *_args;
@@ -501,6 +531,195 @@ static PyObject *WinObj_DragWindow(_self, _args)
return _res;
}
+static PyObject *WinObj_SetPortWindowPort(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SetPortWindowPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowKind(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowKind(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowKind(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short wKind;
+ if (!PyArg_ParseTuple(_args, "h",
+ &wKind))
+ return NULL;
+ SetWindowKind(_self->ob_itself,
+ wKind);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowVisible(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_IsWindowHilited(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowHilited(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowGoAwayFlag(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowZoomFlag(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowZoomFlag(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowTitleWidth(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowTitleWidth(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetNextWindow(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNextWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStandardState(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowStandardState(_self->ob_itself,
+ &r);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUserState(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ GetWindowUserState(_self->ob_itself,
+ &r);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowStandardState(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ SetWindowStandardState(_self->ob_itself,
+ &r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_SetWindowUserState(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Rect r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ SetWindowUserState(_self->ob_itself,
+ &r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyMethodDef WinObj_methods[] = {
{"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
"() -> (Str255 title)"},
@@ -534,6 +753,10 @@ static PyMethodDef WinObj_methods[] = {
"(long data) -> None"},
{"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
"() -> (long _rv)"},
+ {"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1,
+ "(PicHandle pic) -> None"},
+ {"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
+ "() -> (PicHandle _rv)"},
{"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
"() -> None"},
{"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
@@ -554,6 +777,32 @@ static PyMethodDef WinObj_methods[] = {
"(Point thePt) -> (Boolean _rv)"},
{"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
"(Point startPt, Rect boundsRect) -> None"},
+ {"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
+ "() -> None"},
+ {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
+ "() -> (short _rv)"},
+ {"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1,
+ "(short wKind) -> None"},
+ {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
+ "() -> (Boolean _rv)"},
+ {"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1,
+ "() -> (Boolean _rv)"},
+ {"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1,
+ "() -> (Boolean _rv)"},
+ {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
+ "() -> (Boolean _rv)"},
+ {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
+ "() -> (short _rv)"},
+ {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
+ "() -> (WindowPtr _rv)"},
+ {"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
+ "() -> (Rect r)"},
+ {"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1,
+ "() -> (Rect r)"},
+ {"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1,
+ "(Rect r) -> None"},
+ {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
+ "(Rect r) -> None"},
{NULL, NULL, 0}
};
diff --git a/Mac/Modules/win/winedit.py b/Mac/Modules/win/winedit.py
new file mode 100644
index 0000000..08be8bd
--- /dev/null
+++ b/Mac/Modules/win/winedit.py
@@ -0,0 +1,95 @@
+# These are inline-routines/defines, so we do them "by hand"
+#
+
+f = Method(void, 'SetPortWindowPort',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(short, 'GetWindowKind',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'SetWindowKind',
+ (WindowRef, 'theWindow', InMode),
+ (short, 'wKind', InMode),
+)
+methods.append(f)
+
+
+f = Method(Boolean, 'IsWindowVisible',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(Boolean, 'IsWindowHilited',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(Boolean, 'GetWindowGoAwayFlag',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(Boolean, 'GetWindowZoomFlag',
+ (WindowRef, 'theWindow', InMode),
+)
+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(short, 'GetWindowTitleWidth',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(ExistingWindowPtr, 'GetNextWindow',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowStandardState',
+ (WindowRef, 'theWindow', InMode),
+ (Rect, 'r', OutMode),
+)
+methods.append(f)
+
+f = Method(void, 'GetWindowUserState',
+ (WindowRef, 'theWindow', InMode),
+ (Rect, 'r', OutMode),
+)
+methods.append(f)
+
+
+f = Method(void, 'SetWindowStandardState',
+ (WindowRef, 'theWindow', InMode),
+ (Rect, 'r', InMode),
+)
+methods.append(f)
+
+f = Method(void, 'SetWindowUserState',
+ (WindowRef, 'theWindow', InMode),
+ (Rect, 'r', InMode),
+)
+methods.append(f)
+
diff --git a/Mac/Modules/win/wingen.py b/Mac/Modules/win/wingen.py
index 4735952..1d0a875 100644
--- a/Mac/Modules/win/wingen.py
+++ b/Mac/Modules/win/wingen.py
@@ -1,4 +1,4 @@
-# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:Windows.h'
+# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h'
f = Function(void, 'InitWindows',
)
@@ -130,6 +130,17 @@ f = Method(long, 'GetWRefCon',
)
methods.append(f)
+f = Method(void, 'SetWindowPic',
+ (WindowRef, 'theWindow', InMode),
+ (PicHandle, 'pic', InMode),
+)
+methods.append(f)
+
+f = Method(PicHandle, 'GetWindowPic',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+
f = Function(Boolean, 'CheckUpdate',
(EventRecord, 'theEvent', OutMode),
)
diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py
index e9ac5af..dd3319b 100644
--- a/Mac/Modules/win/winscan.py
+++ b/Mac/Modules/win/winscan.py
@@ -39,7 +39,7 @@ class MyScanner(Scanner):
'GrafPtr',
'CGrafPtr',
'RgnHandle',
- 'PicHandle',
+## 'PicHandle',
'WCTabHandle',
'AuxWinHandle',
'PixPatHandle',
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index 1f07828..39d4b7a 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -18,6 +18,7 @@ MODPREFIX = MODNAME # The prefix for module-wide routines
OBJECTTYPE = OBJECTNAME + 'Ptr' # The C type used to represent them
OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
+EDITFILE = string.lower(MODPREFIX) + 'edit.py' # The manual definitions
OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
from macsupport import *
@@ -28,8 +29,10 @@ WindowPtr = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
WindowRef = WindowPtr
WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX)
WindowPeek.passInput = lambda name: "(WindowPeek)(%s)" % name
+CGrafPtr = WindowPtr
-#RgnHandle = FakeType("theWindow->updtRgn") # XXX
+#RgnHandle = OpaqueByValueType("RgnHandle", "RgnObj")
+PicHandle = OpaqueByValueType("PicHandle", "ResObj")
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
@@ -112,6 +115,11 @@ f.docstring = lambda : "Resolve an integer WindowPtr address to a Window object"
functions.append(f)
+# And add the routines that access the internal bits of a window struct. They
+# are currently #defined in Windows.h, they will be real routines in Copland
+# (at which time this execfile can go)
+execfile(EDITFILE)
+
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for f in functions: module.add(f)