]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- Added support for PicHandle
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 14 Nov 1995 10:48:54 +0000 (10:48 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 14 Nov 1995 10:48:54 +0000 (10:48 +0000)
- Added (by hand, through winedit.py) support for WindowPeek accessor
  functions that are currently declared as macros.

Mac/Lib/toolbox/Windows.py
Mac/Modules/win/Winmodule.c
Mac/Modules/win/winedit.py [new file with mode: 0644]
Mac/Modules/win/wingen.py
Mac/Modules/win/winscan.py
Mac/Modules/win/winsupport.py

index 523cf21e5e386c3e275bedf23421ccd70f4a6e82..f2c42d29d1978e0cbba5ebee3aef2be2b62486e7 100644 (file)
@@ -1,5 +1,6 @@
-# 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'
 
+kWindowDefProcType = 'WDEF'
 kStandardWindowDefinition = 0
 kRoundWindowDefinition = 1
 kFloatingWindowDefinition = 124
index 8691501ca45ad125d4be5ae53986f7229367f6f0..61afed4f365ac575806e4547e8476995dcae07ea 100644 (file)
@@ -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 (file)
index 0000000..08be8bd
--- /dev/null
@@ -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)
+
index 4735952728f6c02d03200ba666d3e22e3c246fd9..1d0a87591f57d81d52bc9276d6ea9b79e37fdf91 100644 (file)
@@ -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),
 )
index e9ac5af37b20da2a74b789606de9ba924783d9a7..dd3319be550bc609882ad8da2092914fd36d95cc 100644 (file)
@@ -39,7 +39,7 @@ class MyScanner(Scanner):
                        'GrafPtr',
                        'CGrafPtr',
                        'RgnHandle',
-                       'PicHandle',
+##                     'PicHandle',
                        'WCTabHandle',
                        'AuxWinHandle',
                        'PixPatHandle',
index 1f0782862a00801efa61ae110b8ccf223158792b..39d4b7a900d052dea72101fec3a66ba103d8ad49 100644 (file)
@@ -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)