- m_imageList = new wxImageList(bmpWidth, bmpHeight);
- Header_SetImageList(GetHwnd(), GetHimagelistOf(m_imageList));
+ const int bmpWidth = bmp.GetWidth(),
+ bmpHeight = bmp.GetHeight();
+
+ if ( !m_imageList )
+ {
+ m_imageList = new wxImageList(bmpWidth, bmpHeight);
+ Header_SetImageList(GetHwnd(), GetHimagelistOf(m_imageList));
+ }
+ else // already have an image list
+ {
+ // check that all bitmaps we use have the same size
+ int imageWidth,
+ imageHeight;
+ m_imageList->GetSize(0, imageWidth, imageHeight);
+
+ wxASSERT_MSG( imageWidth == bmpWidth && imageHeight == bmpHeight,
+ "all column bitmaps must have the same size" );
+ }
+
+ m_imageList->Add(bmp);
+ hdi.iImage = m_imageList->GetImageCount() - 1;