]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/mimetmac.cpp
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 licence (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(wxIconLocation
*WXUNUSED(icon
)) 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("wxFileTypeImpl::GetAllCommands() not yet implemented") );
115 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& extraDir
)
117 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
121 wxMimeTypesManagerImpl::ClearData()
123 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
126 // extension -> file type
128 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
132 if ( ext
== wxT("txt") )
134 wxFileType
*fileType
= new wxFileType
;
135 fileType
->m_impl
->SetFileType(wxT("text/text"));
136 fileType
->m_impl
->SetExt(ext
);
139 else if ( ext
== wxT("htm") || ext
== wxT("html") )
141 wxFileType
*fileType
= new wxFileType
;
142 fileType
->m_impl
->SetFileType(wxT("text/html"));
143 fileType
->m_impl
->SetExt(ext
);
146 else if ( ext
== wxT("gif") )
148 wxFileType
*fileType
= new wxFileType
;
149 fileType
->m_impl
->SetFileType(wxT("image/gif"));
150 fileType
->m_impl
->SetExt(ext
);
153 else if ( ext
== wxT("png" ))
155 wxFileType
*fileType
= new wxFileType
;
156 fileType
->m_impl
->SetFileType(wxT("image/png"));
157 fileType
->m_impl
->SetExt(ext
);
160 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
162 wxFileType
*fileType
= new wxFileType
;
163 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
164 fileType
->m_impl
->SetExt(ext
);
167 else if ( ext
== wxT("bmp") )
169 wxFileType
*fileType
= new wxFileType
;
170 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
171 fileType
->m_impl
->SetExt(ext
);
174 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
176 wxFileType
*fileType
= new wxFileType
;
177 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
178 fileType
->m_impl
->SetExt(ext
);
181 else if ( ext
== wxT("xpm") )
183 wxFileType
*fileType
= new wxFileType
;
184 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
185 fileType
->m_impl
->SetExt(ext
);
188 else if ( ext
== wxT("xbm") )
190 wxFileType
*fileType
= new wxFileType
;
191 fileType
->m_impl
->SetFileType(wxT("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 // VZ: don't know anything about this for Mac
210 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
216 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
218 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
224 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)