#include "wx/log.h"
#include "wx/file.h"
+#include "wx/iconloc.h"
#include "wx/intl.h"
#include "wx/dynarray.h"
#include "wx/confbase.h"
}
-bool wxFileTypeImpl::GetIcon(wxIcon *icon,
- wxString *iconFile,
- int *iconIndex) const
+bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const
{
-#if wxUSE_GUI
wxString strIconKey;
strIconKey << m_strFileType << wxT("\\DefaultIcon");
strIndex = wxT("0");
}
- wxString strExpPath = wxExpandEnvVars(strFullPath);
- // here we need C based counting!
- int nIndex = wxAtoi(strIndex);
-
- HICON hIcon = ExtractIcon(GetModuleHandle(NULL), strExpPath, nIndex);
-
- switch ( (int)hIcon ) {
- case 0: // means no icons were found
- case 1: // means no such file or it wasn't a DLL/EXE/OCX/ICO/...
- wxLogDebug(wxT("incorrect registry entry '%s': no such icon."),
- key.GetName().c_str());
- break;
-
- default:
- icon->SetHICON((WXHICON)hIcon);
- wxSize size = wxGetHiconSize(hIcon);
- icon->SetSize(size);
- if ( iconIndex )
- *iconIndex = nIndex;
- if ( iconFile )
- *iconFile = strFullPath;
- return TRUE;
+ if ( iconLoc )
+ {
+ iconLoc->SetFileName(wxExpandEnvVars(strFullPath));
+
+ iconLoc->SetIndex(wxAtoi(strIndex));
}
+
+ return TRUE;
}
}
// no such file type or no value or incorrect icon entry
-#endif // wxUSE_GUI
-
return FALSE;
}