]> granicus.if.org Git - python/commitdiff
Added {Get,Set}WindowUserData methods.
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 22 Oct 1998 15:08:00 +0000 (15:08 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 22 Oct 1998 15:08:00 +0000 (15:08 +0000)
Mac/Modules/win/Winmodule.c
Mac/Modules/win/winedit.py
Mac/Modules/win/winsupport.py

index 58da8fdbc78e1f9d32080b026efa8ac19bbfdf30..dd23ab00efb8d947e29b3fa66af5c101f30aedc0 100644 (file)
@@ -46,9 +46,6 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
 
 #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
 
-#ifdef HAVE_UNIVERSAL_HEADERS
-#define WindowPeek WindowPtr
-#endif
 
 static PyObject *Win_Error;
 
@@ -967,6 +964,36 @@ static PyObject *WinObj_SetWindowUserState(_self, _args)
        return _res;
 }
 
+static PyObject *WinObj_GetWindowDataHandle(_self, _args)
+       WindowObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       Handle _rv;
+       if (!PyArg_ParseTuple(_args, ""))
+               return NULL;
+       _rv = GetWindowDataHandle(_self->ob_itself);
+       _res = Py_BuildValue("O&",
+                            ResObj_New, _rv);
+       return _res;
+}
+
+static PyObject *WinObj_SetWindowDataHandle(_self, _args)
+       WindowObject *_self;
+       PyObject *_args;
+{
+       PyObject *_res = NULL;
+       Handle data;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             ResObj_Convert, &data))
+               return NULL;
+       SetWindowDataHandle(_self->ob_itself,
+                           data);
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       return _res;
+}
+
 static PyObject *WinObj_CloseWindow(_self, _args)
        WindowObject *_self;
        PyObject *_args;
@@ -1128,6 +1155,10 @@ static PyMethodDef WinObj_methods[] = {
         "(Rect r) -> None"},
        {"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
         "(Rect r) -> None"},
+       {"GetWindowDataHandle", (PyCFunction)WinObj_GetWindowDataHandle, 1,
+        "() -> (Handle _rv)"},
+       {"SetWindowDataHandle", (PyCFunction)WinObj_SetWindowDataHandle, 1,
+        "(Handle data) -> None"},
        {"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1,
         "() -> None"},
        {"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,
index b7c2a97fcb183d474d2753dcca615aaace63d51a..6a81b9be56774a7c8da396f7e9110bcf092f7aac 100644 (file)
@@ -96,6 +96,16 @@ f = Method(void, 'SetWindowUserState',
 )
 methods.append(f)
 
+f = Method(Handle, 'GetWindowDataHandle',
+       (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
+f = Method(void, 'SetWindowDataHandle',
+       (WindowRef, 'theWindow', InMode),
+       (Handle, 'data', InMode),
+)
+methods.append(f)
+
 # These have Mac prefixed to their name in the 3.1 universal headers,
 # so we add the old/real names by hand.
 f = Method(void, 'CloseWindow',
index c7e1f7ac72156b1f9eff514881091ce7210cd0bd..6150819c20615593fd7e266352822e644a569837 100644 (file)
@@ -42,9 +42,6 @@ includestuff = includestuff + """
 
 #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
 
-#ifdef HAVE_UNIVERSAL_HEADERS
-#define WindowPeek WindowPtr
-#endif
 """
 
 finalstuff = finalstuff + """