Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cdcbd1f

Browse files
committed
Added {Get,Set}WindowUserData methods.
1 parent 3dd1c39 commit cdcbd1f

3 files changed

Lines changed: 44 additions & 6 deletions

File tree

Mac/Modules/win/Winmodule.c

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
4646

4747
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
4848

49-
#ifdef HAVE_UNIVERSAL_HEADERS
50-
#define WindowPeek WindowPtr
51-
#endif
5249

5350
static PyObject *Win_Error;
5451

@@ -967,6 +964,36 @@ static PyObject *WinObj_SetWindowUserState(_self, _args)
967964
return _res;
968965
}
969966

967+
static PyObject *WinObj_GetWindowDataHandle(_self, _args)
968+
WindowObject *_self;
969+
PyObject *_args;
970+
{
971+
PyObject *_res = NULL;
972+
Handle _rv;
973+
if (!PyArg_ParseTuple(_args, ""))
974+
return NULL;
975+
_rv = GetWindowDataHandle(_self->ob_itself);
976+
_res = Py_BuildValue("O&",
977+
ResObj_New, _rv);
978+
return _res;
979+
}
980+
981+
static PyObject *WinObj_SetWindowDataHandle(_self, _args)
982+
WindowObject *_self;
983+
PyObject *_args;
984+
{
985+
PyObject *_res = NULL;
986+
Handle data;
987+
if (!PyArg_ParseTuple(_args, "O&",
988+
ResObj_Convert, &data))
989+
return NULL;
990+
SetWindowDataHandle(_self->ob_itself,
991+
data);
992+
Py_INCREF(Py_None);
993+
_res = Py_None;
994+
return _res;
995+
}
996+
970997
static PyObject *WinObj_CloseWindow(_self, _args)
971998
WindowObject *_self;
972999
PyObject *_args;
@@ -1128,6 +1155,10 @@ static PyMethodDef WinObj_methods[] = {
11281155
"(Rect r) -> None"},
11291156
{"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
11301157
"(Rect r) -> None"},
1158+
{"GetWindowDataHandle", (PyCFunction)WinObj_GetWindowDataHandle, 1,
1159+
"() -> (Handle _rv)"},
1160+
{"SetWindowDataHandle", (PyCFunction)WinObj_SetWindowDataHandle, 1,
1161+
"(Handle data) -> None"},
11311162
{"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1,
11321163
"() -> None"},
11331164
{"MoveWindow", (PyCFunction)WinObj_MoveWindow, 1,

Mac/Modules/win/winedit.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@
9696
)
9797
methods.append(f)
9898

99+
f = Method(Handle, 'GetWindowDataHandle',
100+
(WindowRef, 'theWindow', InMode),
101+
)
102+
methods.append(f)
103+
f = Method(void, 'SetWindowDataHandle',
104+
(WindowRef, 'theWindow', InMode),
105+
(Handle, 'data', InMode),
106+
)
107+
methods.append(f)
108+
99109
# These have Mac prefixed to their name in the 3.1 universal headers,
100110
# so we add the old/real names by hand.
101111
f = Method(void, 'CloseWindow',

Mac/Modules/win/winsupport.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
4343
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
4444
45-
#ifdef HAVE_UNIVERSAL_HEADERS
46-
#define WindowPeek WindowPtr
47-
#endif
4845
"""
4946

5047
finalstuff = finalstuff + """

0 commit comments

Comments
 (0)