]> git.saurik.com Git - wxWidgets.git/commitdiff
always update the column icon field when updating the item as it could be reset to...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Dec 2008 21:22:26 +0000 (21:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Dec 2008 21:22:26 +0000 (21:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57208 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/headerctrl.cpp

index d7206e12ff388fff1fec75683c1609adf55b9299..84736a1e1f90d78f19b211590d1986cd36f3739f 100644 (file)
@@ -168,44 +168,47 @@ void wxHeaderCtrl::DoSetOrInsertItem(Operation oper, unsigned int idx)
 
     // notice that we need to store the string we use the pointer to until we
     // pass it to the control
-    wxWxCharBuffer buf;
-    if ( !col.GetTitle().empty() )
-    {
-        hdi.mask |= HDI_TEXT;
-
-        buf = col.GetTitle().wx_str();
-        hdi.pszText = buf.data();
-        hdi.cchTextMax = wxStrlen(buf);
-    }
+    hdi.mask |= HDI_TEXT;
+    wxWxCharBuffer buf = col.GetTitle().wx_str();
+    hdi.pszText = buf.data();
+    hdi.cchTextMax = wxStrlen(buf);
 
     const wxBitmap bmp = col.GetBitmap();
-    if ( bmp.IsOk() )
+    if ( bmp.IsOk() || oper == Set )
     {
-        const int bmpWidth = bmp.GetWidth(),
-                  bmpHeight = bmp.GetHeight();
+        hdi.mask |= HDI_IMAGE;
 
-        if ( !m_imageList )
+        if ( bmp.IsOk() )
         {
-            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;
         }
-        else // already have an image list
+        else // no bitmap but we still need to update the item
         {
-            // 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" );
+            hdi.iImage = I_IMAGENONE;
         }
-
-        m_imageList->Add(bmp);
-        hdi.mask |= HDI_IMAGE;
-        hdi.iImage = m_imageList->GetImageCount() - 1;
     }
 
-    if ( col.GetAlignment() != wxALIGN_NOT )
+    if ( col.GetAlignment() != wxALIGN_NOT || oper == Set )
     {
         hdi.mask |= HDI_FORMAT;
         switch ( col.GetAlignment() )