]>
git.saurik.com Git - wxWidgets.git/blob - src/msdos/mimetype.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 /////////////////////////////////////////////////////////////////////////////
12 // for compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
24 #include "wx/string.h"
35 #include "wx/dynarray.h"
36 #include "wx/confbase.h"
38 #include "wx/msdos/mimetype.h"
40 // other standard headers
43 // in case we're compiling in non-GUI mode
44 class WXDLLEXPORT wxIcon
;
46 bool wxFileTypeImpl::SetCommand(const wxString
& cmd
, const wxString
& verb
, bool overwriteprompt
)
51 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& strIcon
, int index
)
56 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
61 // @@ this function is half implemented
62 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
67 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
69 if ( m_strFileType
.Length() > 0 )
71 *mimeType
= m_strFileType
;
78 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
92 bool wxFileTypeImpl::GetIcon(wxIconLocation
*WXUNUSED(icon
)) const
94 // no such file type or no value or incorrect icon entry
98 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
104 wxFileTypeImpl::GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
105 const wxFileType::MessageParameters
& params
) const
107 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
112 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& extraDir
)
114 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
118 wxMimeTypesManagerImpl::ClearData()
120 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
123 // extension -> file type
125 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
129 if ( ext
== wxT("txt") )
131 wxFileType
*fileType
= new wxFileType
;
132 fileType
->m_impl
->SetFileType(wxT("text/text"));
133 fileType
->m_impl
->SetExt(ext
);
136 else if ( ext
== wxT("htm") || ext
== wxT("html") )
138 wxFileType
*fileType
= new wxFileType
;
139 fileType
->m_impl
->SetFileType(wxT("text/html"));
140 fileType
->m_impl
->SetExt(ext
);
143 else if ( ext
== wxT("gif") )
145 wxFileType
*fileType
= new wxFileType
;
146 fileType
->m_impl
->SetFileType(wxT("image/gif"));
147 fileType
->m_impl
->SetExt(ext
);
150 else if ( ext
== wxT("png" ))
152 wxFileType
*fileType
= new wxFileType
;
153 fileType
->m_impl
->SetFileType(wxT("image/png"));
154 fileType
->m_impl
->SetExt(ext
);
157 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
159 wxFileType
*fileType
= new wxFileType
;
160 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
161 fileType
->m_impl
->SetExt(ext
);
164 else if ( ext
== wxT("bmp") )
166 wxFileType
*fileType
= new wxFileType
;
167 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
168 fileType
->m_impl
->SetExt(ext
);
171 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
173 wxFileType
*fileType
= new wxFileType
;
174 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
175 fileType
->m_impl
->SetExt(ext
);
178 else if ( ext
== wxT("xpm") )
180 wxFileType
*fileType
= new wxFileType
;
181 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
182 fileType
->m_impl
->SetExt(ext
);
185 else if ( ext
== wxT("xbm") )
187 wxFileType
*fileType
= new wxFileType
;
188 fileType
->m_impl
->SetFileType(wxT("image/xbm"));
189 fileType
->m_impl
->SetExt(ext
);
197 // MIME type -> extension -> file type
199 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
204 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
206 // VZ: don't know anything about this for Mac
207 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
213 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
215 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
221 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)
226 #endif // wxUSE_MIMETYPE