]> git.saurik.com Git - wxWidgets.git/commitdiff
reset the old disabled image list even if there is no new one (bug 1604374)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 2 Dec 2006 12:50:58 +0000 (12:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 2 Dec 2006 12:50:58 +0000 (12:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/tbar95.cpp

index 8cab9f682ee7859fe7924d5798218d39a6bb85df..64a3802e260ea5492881730cc2b425b450ef07f0 100644 (file)
@@ -784,17 +784,21 @@ bool wxToolBar::Realize()
             }
         }
 
-        if ( m_disabledImgList )
+        // disable image lists are only supported in comctl32.dll 4.70+
+        if ( wxApp::GetComCtl32Version() >= 470 )
         {
+            HIMAGELIST hil = m_disabledImgList
+                                ? GetHimagelistOf(m_disabledImgList)
+                                : 0;
+
+            // notice that we set the image list even if don't have one right
+            // now as we could have it before and need to reset it in this case
             HIMAGELIST oldImageList = (HIMAGELIST)
-                ::SendMessage(GetHwnd(),
-                              TB_SETDISABLEDIMAGELIST,
-                              0,
-                              (LPARAM)GetHimagelistOf(m_disabledImgList));
+              ::SendMessage(GetHwnd(), TB_SETDISABLEDIMAGELIST, 0, (LPARAM)hil);
 
             // delete previous image list if any
             if ( oldImageList )
-                ::DeleteObject( oldImageList );
+                ::DeleteObject(oldImageList);
         }
     }