[pywin32-checkins] pywin32/win32/src win32gui.i,1.97,1.98
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-01-05 20:06:55
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3465/win32/src Modified Files: win32gui.i Log Message: Remove last few places where HANDLEs parsed as longs Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** win32gui.i 5 Jan 2007 05:33:13 -0000 1.97 --- win32gui.i 5 Jan 2007 20:06:53 -0000 1.98 *************** *** 484,496 **** } %typemap(python,in) ICONINFO *INPUT(ICONINFO iconinfo_input) { if (PyTuple_Check($source)) { ! if (PyArg_ParseTuple($source, "lllll", &iconinfo_input.fIcon, &iconinfo_input.xHotspot, &iconinfo_input.yHotspot, ! &iconinfo_input.hbmMask, &iconinfo_input.hbmColor) == 0) { ! return PyErr_Format(PyExc_TypeError, "%s: a ICONINFO must be a tuple of integers", "$name"); ! } $target = &iconinfo_input; } else { ! return PyErr_Format(PyExc_TypeError, "%s: a ICONINFO must be a tuple of integers", "$name"); } } --- 484,507 ---- } + // @object PyICONINFO|Tuple describing an icon or cursor + // @pyseeapi ICONINFO %typemap(python,in) ICONINFO *INPUT(ICONINFO iconinfo_input) { + PyObject *obmask, *obcolor; if (PyTuple_Check($source)) { ! if (!PyArg_ParseTuple($source, "lllOO", ! &iconinfo_input.fIcon, // @tupleitem 0|boolean|Icon|True indicates an icon, False for a cursor ! &iconinfo_input.xHotspot, // @tupleitem 1|int|xHotSpot|For a cursor, X coord of hotspot. Ignored for icons ! &iconinfo_input.yHotspot, // @tupleitem 2|int|yHotSpot|For a cursor, Y coord of hotspot. Ignored for icons ! &obmask, // @tupleitem 3|<o PyGdiHANDLE>|hbmMask|Monochrome mask bitmap ! &obcolor)) // @tupleitem 4|<o PyGdiHANDLE>|hbmColor|Color bitmap, may be None for black and white icon ! return PyErr_Format(PyExc_TypeError, "%s: an ICONINFO must be a tuple of (int,int,int,HANDLE,HANDLE)", "$name"); ! ! if (!PyWinObject_AsHANDLE(obmask, (HANDLE *)&iconinfo_input.hbmMask, FALSE)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obcolor, (HANDLE *)&iconinfo_input.hbmColor, TRUE)) ! return NULL; $target = &iconinfo_input; } else { ! return PyErr_Format(PyExc_TypeError, "%s: an ICONINFO must be a tuple of (int,int,int,HANDLE,HANDLE)", "$name"); } } *************** *** 498,503 **** %typemap(python,argout) ICONINFO *OUTPUT { PyObject *o; ! o = Py_BuildValue("lllll", $source->fIcon, $source->xHotspot, ! $source->yHotspot, $source->hbmMask, $source->hbmColor); if (!$target) { $target = o; --- 509,514 ---- %typemap(python,argout) ICONINFO *OUTPUT { PyObject *o; ! o = Py_BuildValue("lllNN", $source->fIcon, $source->xHotspot, $source->yHotspot, ! PyWinObject_FromGdiHANDLE($source->hbmMask), PyWinObject_FromGdiHANDLE($source->hbmColor)); if (!$target) { $target = o; *************** *** 590,598 **** // @object TRACKMOUSEEVENT|A tuple of (dwFlags, hwndTrack, dwHoverTime) %typemap(python,in) TRACKMOUSEEVENT *INPUT(TRACKMOUSEEVENT e){ e.cbSize = sizeof e; if (PyTuple_Check($source)) { ! if (PyArg_ParseTuple($source, "lll", &e.dwFlags, &e.hwndTrack, &e.dwHoverTime) == 0) { return PyErr_Format(PyExc_TypeError, "%s: a TRACKMOUSEEVENT must be a tuple of 3 integers", "$name"); } $target = &e; } else { --- 601,612 ---- // @object TRACKMOUSEEVENT|A tuple of (dwFlags, hwndTrack, dwHoverTime) %typemap(python,in) TRACKMOUSEEVENT *INPUT(TRACKMOUSEEVENT e){ + PyObject *obhwnd; e.cbSize = sizeof e; if (PyTuple_Check($source)) { ! if (PyArg_ParseTuple($source, "lOl", &e.dwFlags, &obhwnd, &e.dwHoverTime) == 0) { return PyErr_Format(PyExc_TypeError, "%s: a TRACKMOUSEEVENT must be a tuple of 3 integers", "$name"); } + if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&e.hwndTrack, FALSE)) + return NULL; $target = &e; } else { *************** *** 1739,1743 **** static PyObject *PyCallWindowProc(PyObject *self, PyObject *args) { ! long wndproc, hwnd, wparam, lparam; UINT msg; // @pyparm int|wndproc||The wndproc to call - this is generally the return --- 1753,1759 ---- static PyObject *PyCallWindowProc(PyObject *self, PyObject *args) { ! long wndproc, wparam, lparam; ! HWND hwnd; ! PyObject *obhwnd; UINT msg; // @pyparm int|wndproc||The wndproc to call - this is generally the return *************** *** 1747,1755 **** // @pyparm int|wparam|| // @pyparm int|lparam|| ! if (!PyArg_ParseTuple(args, "llill", &wndproc, &hwnd, &msg, &wparam, &lparam)) return NULL; LRESULT rc; Py_BEGIN_ALLOW_THREADS ! rc = CallWindowProc((MYWNDPROC)wndproc, (HWND)hwnd, msg, wparam, lparam); Py_END_ALLOW_THREADS return PyInt_FromLong(rc); --- 1763,1773 ---- // @pyparm int|wparam|| // @pyparm int|lparam|| ! if (!PyArg_ParseTuple(args, "lOill", &wndproc, &obhwnd, &msg, &wparam, &lparam)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; LRESULT rc; Py_BEGIN_ALLOW_THREADS ! rc = CallWindowProc((MYWNDPROC)wndproc, hwnd, msg, wparam, lparam); Py_END_ALLOW_THREADS return PyInt_FromLong(rc); *************** *** 2469,2473 **** // @pyswig int|CreateIconIndirect|Creates an icon or cursor from an ICONINFO structure. ! HICON CreateIconIndirect(ICONINFO *INPUT); %{ --- 2487,2491 ---- // @pyswig int|CreateIconIndirect|Creates an icon or cursor from an ICONINFO structure. ! HICON CreateIconIndirect(ICONINFO *INPUT); // @pyparm <o PyICONINFO>|iconinfo||Tuple defining the icon parameters %{ *************** *** 3411,3417 **** static PyObject *PyEdit_GetLine(PyObject *self, PyObject *args) { ! long hwnd; int line, size=0; ! if (!PyArg_ParseTuple(args, "li|i", &hwnd, &line, &size)) return NULL; int numChars; --- 3429,3438 ---- static PyObject *PyEdit_GetLine(PyObject *self, PyObject *args) { ! HWND hwnd; ! PyObject *obhwnd; int line, size=0; ! if (!PyArg_ParseTuple(args, "Oi|i", &obhwnd, &line, &size)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; int numChars; *************** *** 3419,3425 **** Py_BEGIN_ALLOW_THREADS if (size==0) ! size = Edit_LineLength((HWND)hwnd, line)+1; buf = (TCHAR *)malloc(size * sizeof(TCHAR)); ! numChars = Edit_GetLine((HWND)hwnd, line, buf, size); Py_END_ALLOW_THREADS PyObject *ret; --- 3440,3446 ---- Py_BEGIN_ALLOW_THREADS if (size==0) ! size = Edit_LineLength(hwnd, line)+1; buf = (TCHAR *)malloc(size * sizeof(TCHAR)); ! numChars = Edit_GetLine(hwnd, line, buf, size); Py_END_ALLOW_THREADS PyObject *ret; *************** *** 3642,3647 **** #ifndef MS_WINCE ! // @pyswig tuple|GetIconInfo| ! // @pyparm int|hicon||The icon to query // @rdesc The result is a tuple of (fIcon, xHotspot, yHotspot, hbmMask, hbmColor) // The hbmMask and hbmColor items are bitmaps created for the caller, so must be freed. --- 3663,3668 ---- #ifndef MS_WINCE ! // @pyswig <o PyICONINFO>|GetIconInfo|Returns parameters for an icon or cursor ! // @pyparm <o PyHANDLE>|hicon||The icon to query // @rdesc The result is a tuple of (fIcon, xHotspot, yHotspot, hbmMask, hbmColor) // The hbmMask and hbmColor items are bitmaps created for the caller, so must be freed. *************** *** 4616,4620 **** FLOAT startangle, sweepangle; PyObject *obdc; ! if (!PyArg_ParseTuple(args, "Oiikff", &obdc, // @pyparm <o PyHANDLE>|hdc||Handle to a device context &x, // @pyparm int|Y||x pos of circle --- 4637,4641 ---- FLOAT startangle, sweepangle; PyObject *obdc; ! if (!PyArg_ParseTuple(args, "Oiikff:AngleArc", &obdc, // @pyparm <o PyHANDLE>|hdc||Handle to a device context &x, // @pyparm int|Y||x pos of circle *************** *** 5025,5029 **** int *widths = NULL; HDC hdc; ! if (!PyArg_ParseTuple (args, "OiiiOs#|O", &obdc, &x, // @pyparm x|int||The x coordinate to write the text to. --- 5046,5050 ---- int *widths = NULL; HDC hdc; ! if (!PyArg_ParseTuple (args, "OiiiOs#|O:ExtTextOut", &obdc, &x, // @pyparm x|int||The x coordinate to write the text to. *************** *** 5665,5669 **** HWND hwnd; BOOL bRedraw = TRUE; ! PyObject *obInfo; // @pyparm int|hwnd||The handle to the window. --- 5686,5690 ---- HWND hwnd; BOOL bRedraw = TRUE; ! PyObject *obhwnd, *obInfo; // @pyparm int|hwnd||The handle to the window. *************** *** 5671,5679 **** // @pyparm <o PySCROLLINFO>|scollInfo||Scollbar info. // @pyparm int|bRedraw|1|Should the bar be redrawn? ! if (!PyArg_ParseTuple(args, "liO|i:SetScrollInfo", ! &hwnd, &nBar, &obInfo, &bRedraw)) { ! PyWin_SetAPIError("SetScrollInfo"); return NULL; - } SCROLLINFO info; info.cbSize = sizeof(SCROLLINFO); --- 5692,5700 ---- // @pyparm <o PySCROLLINFO>|scollInfo||Scollbar info. // @pyparm int|bRedraw|1|Should the bar be redrawn? ! if (!PyArg_ParseTuple(args, "OiO|i:SetScrollInfo", ! &obhwnd, &nBar, &obInfo, &bRedraw)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; SCROLLINFO info; info.cbSize = sizeof(SCROLLINFO); *************** *** 5695,5698 **** --- 5716,5720 ---- { HWND hwnd; + PyObject *obhwnd; int nBar; UINT fMask = SIF_ALL; *************** *** 5700,5704 **** // @pyparm int|nBar||The scroll bar to examine. Can be one of win32con.SB_CTL, win32con.SB_VERT or win32con.SB_HORZ // @pyparm int|mask|SIF_ALL|The mask for attributes to retrieve. ! if (!PyArg_ParseTuple(args, "li|i:GetScrollInfo", &hwnd, &nBar, &fMask)) return NULL; SCROLLINFO info; --- 5722,5728 ---- // @pyparm int|nBar||The scroll bar to examine. Can be one of win32con.SB_CTL, win32con.SB_VERT or win32con.SB_HORZ // @pyparm int|mask|SIF_ALL|The mask for attributes to retrieve. ! if (!PyArg_ParseTuple(args, "Oi|i:GetScrollInfo", &obhwnd, &nBar, &fMask)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; SCROLLINFO info; *************** *** 5812,5821 **** { HWND hwnd; ! PyObject *ob; PyObject *obParam = Py_None; // @pyparm int|hwnd||The handle to the window // @pyparm object|callback||A callback object, taking 3 params. // @pyparm object|param|None|The third param to the callback function. ! if (!PyArg_ParseTuple(args, "iO|O:ListView_SortItems", &hwnd, &ob, &obParam)) return NULL; if (!PyCallable_Check(ob)) --- 5836,5847 ---- { HWND hwnd; ! PyObject *ob, *obhwnd; PyObject *obParam = Py_None; // @pyparm int|hwnd||The handle to the window // @pyparm object|callback||A callback object, taking 3 params. // @pyparm object|param|None|The third param to the callback function. ! if (!PyArg_ParseTuple(args, "OO|O:ListView_SortItems", &obhwnd, &ob, &obParam)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; if (!PyCallable_Check(ob)) *************** *** 5854,5863 **** { HWND hwnd; ! PyObject *ob; PyObject *obParam = Py_None; // @pyparm int|hwnd||The handle to the window // @pyparm object|callback||A callback object, taking 3 params. // @pyparm object|param|None|The third param to the callback function. ! if (!PyArg_ParseTuple(args, "iO|O:ListView_SortItemsEx", &hwnd, &ob, &obParam)) return NULL; if (!PyCallable_Check(ob)) --- 5880,5891 ---- { HWND hwnd; ! PyObject *ob, *obhwnd; PyObject *obParam = Py_None; // @pyparm int|hwnd||The handle to the window // @pyparm object|callback||A callback object, taking 3 params. // @pyparm object|param|None|The third param to the callback function. ! if (!PyArg_ParseTuple(args, "OO|O:ListView_SortItemsEx", &obhwnd, &ob, &obParam)) ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd, FALSE)) return NULL; if (!PyCallable_Check(ob)) |