1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mac/mimetype.cpp
3 // Purpose: classes and functions to manage MIME types
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license (part of wxExtra library)
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "mimetype.h"
16 // for compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
28 #include "wx/string.h"
38 #include "wx/dynarray.h"
39 #include "wx/confbase.h"
41 #include "wx/mac/mimetype.h"
43 // other standard headers
46 // in case we're compiling in non-GUI mode
47 class WXDLLEXPORT wxIcon
;
49 bool wxFileTypeImpl::SetCommand(const wxString
& cmd
, const wxString
& verb
, bool overwriteprompt
)
54 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& strIcon
, int index
)
59 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
64 // @@ this function is half implemented
65 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
70 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
72 if ( m_strFileType
.Length() > 0 )
74 *mimeType
= m_strFileType
;
81 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
95 bool wxFileTypeImpl::GetIcon(wxIcon
*icon
, wxString
*sCommand
, int *iIndex
) const
97 // no such file type or no value or incorrect icon entry
101 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
107 wxFileTypeImpl::GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
108 const wxFileType::MessageParameters
& params
) const
110 wxFAIL_MSG( _T("TODO") );
115 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& extraDir
)
117 wxFAIL_MSG( _T("TODO") );
121 wxMimeTypesManagerImpl::ClearData()
123 wxFAIL_MSG( _T("TODO") );
126 // extension -> file type
128 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
134 wxFileType
*fileType
= new wxFileType
;
135 fileType
->m_impl
->SetFileType("text/text");
136 fileType
->m_impl
->SetExt(ext
);
139 else if ( ext
== "htm" || ext
== "html" )
141 wxFileType
*fileType
= new wxFileType
;
142 fileType
->m_impl
->SetFileType("text/html");
143 fileType
->m_impl
->SetExt(ext
);
146 else if ( ext
== "gif" )
148 wxFileType
*fileType
= new wxFileType
;
149 fileType
->m_impl
->SetFileType("image/gif");
150 fileType
->m_impl
->SetExt(ext
);
153 else if ( ext
== "png" )
155 wxFileType
*fileType
= new wxFileType
;
156 fileType
->m_impl
->SetFileType("image/png");
157 fileType
->m_impl
->SetExt(ext
);
160 else if ( ext
== "jpg" || ext
== "jpeg" )
162 wxFileType
*fileType
= new wxFileType
;
163 fileType
->m_impl
->SetFileType("image/jpeg");
164 fileType
->m_impl
->SetExt(ext
);
167 else if ( ext
== "bmp" )
169 wxFileType
*fileType
= new wxFileType
;
170 fileType
->m_impl
->SetFileType("image/bmp");
171 fileType
->m_impl
->SetExt(ext
);
174 else if ( ext
== "tif" || ext
== "tiff" )
176 wxFileType
*fileType
= new wxFileType
;
177 fileType
->m_impl
->SetFileType("image/tiff");
178 fileType
->m_impl
->SetExt(ext
);
181 else if ( ext
== "xpm" )
183 wxFileType
*fileType
= new wxFileType
;
184 fileType
->m_impl
->SetFileType("image/xpm");
185 fileType
->m_impl
->SetExt(ext
);
188 else if ( ext
== "xbm" )
190 wxFileType
*fileType
= new wxFileType
;
191 fileType
->m_impl
->SetFileType("image/xbm");
192 fileType
->m_impl
->SetExt(ext
);
200 // MIME type -> extension -> file type
202 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
207 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
209 wxFAIL_MSG( _T("TODO") ); // VZ: don't know anything about this for Mac
215 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
217 wxFAIL_MSG( _T("TODO") );
223 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)