X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9196d9c63d36656bfd53fd115d80572349b2c0a..5e0d7b6bce53ad3ceb3c832925c25d2e614a0d62:/src/msw/mimetype.cpp diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index 1d504dd974..8e663b816b 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -35,6 +35,7 @@ #include "wx/log.h" #include "wx/file.h" +#include "wx/iconloc.h" #include "wx/intl.h" #include "wx/dynarray.h" #include "wx/confbase.h" @@ -334,11 +335,8 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const } -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"); @@ -363,42 +361,18 @@ bool wxFileTypeImpl::GetIcon(wxIcon *icon, strIndex = wxT("0"); } - wxString strExpPath = wxExpandEnvVars(strFullPath); - // here we need C based counting! - int nIndex = wxAtoi(strIndex); -#ifdef __DIGITALMARS__ -//FIXME __DIGITALMARS__ April 2003 CE - // why no ExtractIcon in library - wxLogTrace(_T("wxFileTypeImpl::GetIcon"), - _T("Returning false from wxFileTypeImpl::GetIcon because of DigitalMars compiler bug")); - HICON hIcon = 0 ; -#else - - HICON hIcon = ExtractIcon(GetModuleHandle(NULL), strExpPath, nIndex); -#endif - 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; }