MCPcopy Create free account
hub / github.com/mhammond/pywin32 / PyCImageList_Create

Function PyCImageList_Create

Pythonwin/win32ImageList.cpp:50–95  ·  view source on GitHub ↗

@pymethod int|win32ui|CreateImageList|Creates an image list.

Source from the content-addressed store, hash-verified

48
49// @pymethod int|win32ui|CreateImageList|Creates an image list.
50PyObject *PyCImageList_Create( PyObject *self, PyObject *args )
51{
52 int cx, cy, nInitial, nGrow;
53 COLORREF crMask;
54 BOOL bMask;
55 CImageList *pList = new PythonImageList();
56
57 if (PyArg_ParseTuple(args, "iiiii",
58 &cx, // @pyparm int|cx||Dimension of each image, in pixels.
59 &cy, // @pyparm int|cy||Dimension of each image, in pixels.
60 &bMask, // @pyparm int|mask||TRUE if the image contains a mask; otherwise FALSE.
61 &nInitial, // @pyparm int|initial||Number of images that the image list initially contains.
62 &nGrow)){ // @pyparm int|grow||Number of images by which the image list can grow when the system needs to resize the list to make room for new images. This parameter represents the number of new images the resized image list can contain.
63 if (pList->Create(cx, cy, bMask, nInitial, nGrow))
64 return ui_assoc_object::make( PyCImageList::type, pList )->GetGoodRet();
65 GUI_BGN_SAVE;
66 delete pList;
67 GUI_END_SAVE;
68 RETURN_ERR("PyCImage::Create failed");
69 }
70
71 PyErr_Clear();
72 BOOL bRet;
73 PyObject *obID;
74 TCHAR *bitmapID=NULL;
75 if (PyArg_ParseTuple(args, "Oiii",
76 &obID, // @pyparmalt1 <o PyResourceId>|bitmapId||Resource name or ID of the bitmap to be associated with the image list.
77 &cx, // @pyparmalt1 int|cx||Dimension of each image, in pixels.
78 &nGrow, // @pyparmalt1 int|grow||Number of images by which the image list can grow when the system needs to resize the list to make room for new images. This parameter represents the number of new images the resized image list can contain.
79 &crMask) // @pyparmalt1 int|crMask||Color used to generate a mask. Each pixel of this color in the specified bitmap is changed to black, and the corresponding bit in the mask is set to one.
80 &&PyWinObject_AsResourceId(obID, &bitmapID, FALSE)){
81 if (IS_INTRESOURCE(bitmapID))
82 bRet = pList->Create(MAKEINTRESOURCE(bitmapID),cx,nGrow,crMask);
83 else
84 bRet = pList->Create(bitmapID,cx,nGrow,crMask);
85 PyWinObject_FreeResourceId(bitmapID);
86 if (bRet)
87 return ui_assoc_object::make( PyCImageList::type, pList )->GetGoodRet();
88 else
89 PyErr_SetString(ui_module_error, "PyCImage::Create failed");
90 }
91 GUI_BGN_SAVE;
92 delete pList;
93 GUI_END_SAVE;
94 return NULL;
95}
96
97// @pymethod |PyCImageList|DeleteImageList|Deletes an image list.
98PyObject *PyCImageList_DeleteImageList( PyObject *self, PyObject *args )

Callers

nothing calls this directly

Calls 3

GetGoodRetMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected