]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix choice of tree item icon for the selected state in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 4 Nov 2011 12:02:07 +0000 (12:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 4 Nov 2011 12:02:07 +0000 (12:02 +0000)
The logic for selecting the item icon was broken when selected image was
specified as it was not taken into account as fallback for selected expanded
state so selected icon was used only for collapsed items.

Fix this by using the selected icon if it is specified and selected expanded
one is not.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/treectrl.cpp

index c00ead4cf3304d5d58e7015bcb168952baaecee1..f67589c3f7cf53e1b0c6ad843fcb98dd44777d47 100644 (file)
@@ -439,14 +439,18 @@ public:
             switch ( which )
             {
                 case wxTreeItemIcon_SelectedExpanded:
-                    image = GetImage(wxTreeItemIcon_Expanded);
+                    // We consider that expanded icon is more important than
+                    // selected so test for it first.
+                    image = m_images[wxTreeItemIcon_Expanded];
+                    if ( image == -1 )
+                        image = m_images[wxTreeItemIcon_Selected];
                     if ( image != -1 )
                         break;
                     //else: fall through
 
                 case wxTreeItemIcon_Selected:
                 case wxTreeItemIcon_Expanded:
-                    image = GetImage(wxTreeItemIcon_Normal);
+                    image = m_images[wxTreeItemIcon_Normal];
                     break;
 
                 case wxTreeItemIcon_Normal: