@pymethod int|PyCListCtrl|InsertItem|Inserts an item into the list.
| 269 | |
| 270 | // @pymethod int|PyCListCtrl|InsertItem|Inserts an item into the list. |
| 271 | PyObject *PyCListCtrl_InsertItem( PyObject *self, PyObject *args ) |
| 272 | { |
| 273 | CListCtrl *pList; |
| 274 | int ret; |
| 275 | int item; |
| 276 | TCHAR *text=NULL; |
| 277 | int image; |
| 278 | PyObject *obLVItem, *obtext; |
| 279 | if (!(pList=GetListCtrl(self))) |
| 280 | return NULL; |
| 281 | |
| 282 | if (PyArg_ParseTuple(args, "iOi:InsertItem", |
| 283 | &item, // @pyparmalt1 int|item||The index of the item. |
| 284 | &obtext, // @pyparmalt1 string|text||The text of the item. |
| 285 | &image) // @pyparmalt1 int|image||The index of the image to use. |
| 286 | && PyWinObject_AsTCHAR(obtext, &text, FALSE)){ |
| 287 | GUI_BGN_SAVE; |
| 288 | ret = pList->InsertItem(item, text, image ); |
| 289 | GUI_END_SAVE; |
| 290 | |
| 291 | } else { |
| 292 | PyErr_Clear(); |
| 293 | if (PyArg_ParseTuple(args, "iO:InsertItem", |
| 294 | &item, // @pyparmalt2 int|item||The index of the item. |
| 295 | &obtext) // @pyparmalt2 string|text||The text of the item. |
| 296 | && PyWinObject_AsTCHAR(obtext, &text, FALSE)){ |
| 297 | GUI_BGN_SAVE; |
| 298 | ret = pList->InsertItem(item, text ); |
| 299 | GUI_END_SAVE; |
| 300 | } else { |
| 301 | PyErr_Clear(); |
| 302 | if (PyArg_ParseTuple(args, "O:InsertItem", |
| 303 | &obLVItem)) { // @pyparm <o LV_ITEM>|item||A tuple describing the new item. |
| 304 | LV_ITEM lvItem; |
| 305 | if (!PyWinObject_AsLV_ITEM(obLVItem, &lvItem)) |
| 306 | return NULL; |
| 307 | GUI_BGN_SAVE; |
| 308 | ret = pList->InsertItem(&lvItem); |
| 309 | GUI_END_SAVE; |
| 310 | PyWinObject_FreeLV_ITEM(&lvItem); |
| 311 | } else { |
| 312 | PyErr_Clear(); |
| 313 | RETURN_ERR("InsertItem requires (item, text, image), (item, text), or (itemObject)"); |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | PyWinObject_FreeTCHAR(text); |
| 318 | if (ret==-1) |
| 319 | RETURN_ERR("InsertItem failed"); |
| 320 | return PyInt_FromLong(ret); |
| 321 | } |
| 322 | |
| 323 | // @pymethod int|PyCListCtrl|SetItem|Sets some of all of an items attributes. |
| 324 | PyObject *PyCListCtrl_SetItem( PyObject *self, PyObject *args ) |
nothing calls this directly
no test coverage detected