// Created: 23.09.98
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows license (part of wxExtra library)
+// Licence: wxWindows licence (part of wxExtra library)
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma hdrstop
#endif
-// this is Win32 only code
+#if wxUSE_MIMETYPE
+
+// Doesn't compile in WIN16 mode
#ifndef __WIN16__
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/file.h"
+#include "wx/iconloc.h"
#include "wx/intl.h"
#include "wx/dynarray.h"
#include "wx/confbase.h"
#ifdef __WXMSW__
#include "wx/msw/registry.h"
- #include "windows.h"
+ #include "wx/msw/private.h"
#endif // OS
#include "wx/msw/mimetype.h"
m_strFileType = strFileType;
if ( !strFileType ) {
- m_strFileType = m_ext.AfterFirst('.') + "_auto_file";
+ m_strFileType = m_ext.AfterFirst('.') + _T("_auto_file");
}
}
wxRegKey(wxRegKey::HKCR, strKey + _T("\\Topic")).
QueryValue(_T(""), ddeTopic);
+ if (ddeTopic.IsEmpty())
+ ddeTopic = wxT("System");
+
// HACK: we use a special feature of wxExecute which exists
// just because we need it here: it will establish DDE
// conversation with the program it just launched
}
-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);
- 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;
}
// now make other extensions have the same filetype
-
+
for (iExtCount=1; iExtCount < ftInfo.GetExtensionsCount(); iExtCount++ )
{
ext = ftInfo.GetExtensions()[iExtCount];
// SetCommand(), SetDefaultIcon() &c will use it later)
wxRegKey keyFT(wxRegKey::HKCR, filetype);
ok = keyFT.Create();
-
- wxFileType *ft = NULL;
+
+ wxFileType *ft = NULL;
ft = CreateFileType(filetype, extWithDot);
if (ft)
bool wxFileTypeImpl::SetCommand(const wxString& cmd,
const wxString& verb,
- bool overwriteprompt)
+ bool WXUNUSED(overwriteprompt))
{
wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), FALSE,
_T("SetCommand() needs an extension and a verb") );
#endif
// __WIN16__
+
+#endif // wxUSE_MIMETYPE