[pywin32-checkins] pywin32/win32/src win32gui.i,1.52,1.53
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: Mark H. <mha...@us...> - 2004-12-01 00:07:13
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11682 Modified Files: win32gui.i Log Message: Add BeginPaint, EndPaint and CreateIconIndirect Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** win32gui.i 9 Oct 2004 00:36:57 -0000 1.52 --- win32gui.i 1 Dec 2004 00:07:03 -0000 1.53 *************** *** 303,306 **** --- 303,319 ---- } + %typemap(python,in) ICONINFO *INPUT { + ICONINFO s; + if (PyTuple_Check($source)) { + if (PyArg_ParseTuple($source, "lllll", &s.fIcon, &s.xHotspot, &s.yHotspot, + &s.hbmMask, &s.hbmColor) == 0) { + return PyErr_Format(PyExc_TypeError, "%s: a ICONINFO must be a tuple of integers", "$name"); + } + $target = &s; + } else { + return PyErr_Format(PyExc_TypeError, "%s: a ICONINFO must be a tuple of integers", "$name"); + } + } + %typemap(python,argout) ICONINFO *OUTPUT { PyObject *o; *************** *** 343,346 **** --- 356,417 ---- } + %typemap(python,argout) PAINTSTRUCT *OUTPUT { + PyObject *o; + o = Py_BuildValue("(ll(iiii)lls#)", + $source->hdc, + $source->fErase, + $source->rcPaint.left, $source->rcPaint.top, $source->rcPaint.right, $source->rcPaint.bottom, + $source->fRestore, + $source->fIncUpdate, + (char *)$source->rgbReserved, + sizeof($source->rgbReserved)); + if (!$target) { + $target = o; + } else if ($target == Py_None) { + Py_DECREF(Py_None); + $target = o; + } else { + if (!PyList_Check($target)) { + PyObject *o2 = $target; + $target = PyList_New(0); + PyList_Append($target,o2); + Py_XDECREF(o2); + } + PyList_Append($target,o); + Py_XDECREF(o); + } + } + + %typemap(python,ignore) PAINTSTRUCT *OUTPUT(PAINTSTRUCT temp) + { + $target = &temp; + } + + %typemap(python,in) PAINTSTRUCT *INPUT { + PAINTSTRUCT r; + char *szReserved; + int lenReserved; + if (PyTuple_Check($source)) { + if (!PyArg_ParseTuple($source, + "ll(iiii)lls#", + &r.hdc, + &r.fErase, + &r.rcPaint.left, &r.rcPaint.top, &r.rcPaint.right, &r.rcPaint.bottom, + &r.fRestore, + &r.fIncUpdate, + &szReserved, + &lenReserved)) { + return NULL; + } + if (lenReserved != sizeof(r.rgbReserved)) + return PyErr_Format(PyExc_ValueError, "%s: last element must be string of %d bytes", + "$name", sizeof(r.rgbReserved)); + memcpy(&r.rgbReserved, szReserved, sizeof(r.rgbReserved)); + $target = &r; + } else { + return PyErr_Format(PyExc_TypeError, "%s: a PAINTSTRUCT must be a tuple", "$name"); + } + } + %typemap(python,except) LRESULT { Py_BEGIN_ALLOW_THREADS *************** *** 1829,1832 **** --- 1900,1905 ---- ); + // @pyswig int|CreateIconIndirect|Creates an icon or cursor from an ICONINFO structure. + HICON CreateIconIndirect(ICONINFO *INPUT); // @pyswig HANDLE|LoadImage|Loads a bitmap, cursor or icon *************** *** 2703,2710 **** int FrameRect(HDC hDC, RECT *INPUT, HBRUSH hbr); int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase); ! /* ! HDC BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint); ! BOOLAPI EndPaint(HWND hWnd, PAINTSTRUCT *lpPaint); ! */ // @pyswig int|CreateWindowEx|Creates a new window with Extended Style. --- 2776,2787 ---- int FrameRect(HDC hDC, RECT *INPUT, HBRUSH hbr); int GetUpdateRgn(HWND hWnd, HRGN hRgn, BOOL bErase); ! ! // @pyswig hdc, paintstruct|BeginPaint| ! HDC BeginPaint(HWND hwnd, PAINTSTRUCT *OUTPUT); ! ! // @pyswig |EndPaint| ! // @pyparm int|hwnd|| ! // @pyparm paintstruct|ps||As returned from <om win32gui.BeginPaint> ! BOOLAPI EndPaint(HWND hWnd, PAINTSTRUCT *INPUT); // @pyswig int|CreateWindowEx|Creates a new window with Extended Style. |