@pymethod int|PyCTreeCtrl|InsertItem|Inserts an item into the list.
| 408 | |
| 409 | // @pymethod int|PyCTreeCtrl|InsertItem|Inserts an item into the list. |
| 410 | PyObject *PyCTreeCtrl_InsertItem( PyObject *self, PyObject *args ) |
| 411 | { |
| 412 | CTreeCtrl *pList; |
| 413 | HTREEITEM ret = NULL; |
| 414 | UINT mask; |
| 415 | int image, selImage, state, stateMask; |
| 416 | PyObject *obParent, *obInsertAfter; |
| 417 | LPARAM lParam; |
| 418 | HTREEITEM hParent, hInsertAfter; |
| 419 | TCHAR *text=NULL; |
| 420 | PyObject *obtext=Py_None; |
| 421 | if (!(pList=GetTreeCtrl(self))) |
| 422 | return NULL; |
| 423 | |
| 424 | if (PyArg_ParseTuple(args, "iOiiiiOOO:InsertItem", |
| 425 | &mask, // @pyparmalt1 int|mask||Integer specifying which attributes to set |
| 426 | &obtext, // @pyparmalt1 string|text||The text of the item. |
| 427 | &image, // @pyparmalt1 int|image||The index of the image to use. |
| 428 | &selImage, // @pyparmalt1 int|selectedImage||The index of the items selected image. |
| 429 | &state, // @pyparmalt1 int|state||The initial state of the item. |
| 430 | &stateMask, // @pyparmalt1 int|stateMask||Specifies which bits of the state are valid. |
| 431 | &lParam, // @pyparmalt1 object|lParam||A user defined object for the item. |
| 432 | &obParent, // @pyparmalt1 HTREEITEM|parent||The parent of the item. |
| 433 | &obInsertAfter)) { // @pyparmalt1 HTREEITEM|parent||The parent of the item. |
| 434 | if (!PyWinObject_AsHANDLE(obParent, (HANDLE *)&hParent)) |
| 435 | return NULL; |
| 436 | if (!PyWinObject_AsHANDLE(obInsertAfter, (HANDLE *)&hInsertAfter)) |
| 437 | return NULL; |
| 438 | if (!PyWinObject_AsTCHAR(obtext, &text, TRUE)) |
| 439 | return NULL; |
| 440 | GUI_BGN_SAVE; |
| 441 | ret = pList->InsertItem(mask, text, image, selImage, state, stateMask, lParam, hParent, hInsertAfter); |
| 442 | GUI_END_SAVE; |
| 443 | goto done; |
| 444 | } |
| 445 | |
| 446 | PyErr_Clear(); |
| 447 | hParent = TVI_ROOT; |
| 448 | hInsertAfter = TVI_LAST; |
| 449 | if (PyArg_ParseTuple(args, "Oii|O&O&:InsertItem", |
| 450 | &obtext, // @pyparmalt2 string|text||The text for the item. |
| 451 | &image, // @pyparmalt2 int|image||The index of the image to use. |
| 452 | &selImage, // @pyparmalt2 int|selectedImage||The index of the items selected image. |
| 453 | PyWinObject_AsHANDLE, &hParent, // @pyparmalt2 HTREEITEM|parent|commctrl.TVI_ROOT|The parent of the item. |
| 454 | PyWinObject_AsHANDLE, &hInsertAfter) // @pyparmalt2 HTREEITEM|insertAfter|commctrl.TVI_LAST|The item to insert the new item after, or TVI_FIRST, TVI_LAST or TVI_SORT |
| 455 | && PyWinObject_AsTCHAR(obtext, &text, FALSE)){ |
| 456 | GUI_BGN_SAVE; |
| 457 | ret = pList->InsertItem(text, image, selImage, hParent, hInsertAfter); |
| 458 | GUI_END_SAVE; |
| 459 | goto done; |
| 460 | } |
| 461 | |
| 462 | // This arg format conflicts with the above. Handle's can be parsed as ints, so if both optional items are |
| 463 | // passed, they will be caught by the above and never get here ! |
| 464 | PyErr_Clear(); |
| 465 | hParent = TVI_ROOT; |
| 466 | hInsertAfter = TVI_LAST; |
| 467 | if (PyArg_ParseTuple(args, "O|O&O&:InsertItem", |
nothing calls this directly
no test coverage detected