Fix size of the icon returned from wxFSVolume::GetIcon().

Calling SetHICON() is not enough, the icon size already needs to be set or,
even better, CreateFromHICON(), which does both atomically, should be used.

Closes #16672.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-11-11 00:59:13 +00:00
parent 386feaba50
commit 6b9910ac8c
2 changed files with 5 additions and 1 deletions

View File

@@ -594,6 +594,7 @@ wxMSW:
- Fix best height of wxSlider with labels but without ticks (Artur Wieczorek).
- Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat).
- Fix best size calculation for bitmaps with buttons (Artur Wieczorek).
- Fix size of the icon returned from wxFSVolume::GetIcon() (troelsk).
3.0.2: (released 2014-10-06)

View File

@@ -614,11 +614,14 @@ wxIcon wxFSVolume::GetIcon(wxFSIconType type) const
SHFILEINFO fi;
long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), flags);
m_icons[type].SetHICON((WXHICON)fi.hIcon);
if (!rc || !fi.hIcon)
{
wxLogError(_("Cannot load icon from '%s'."), m_volName.c_str());
}
else
{
m_icons[type].CreateFromHICON((WXHICON)fi.hIcon);
}
}
return m_icons[type];