]>
git.saurik.com Git - wxWidgets.git/blob - src/msdos/mimetype.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msdos/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
& WXUNUSED(cmd
),
47 const wxString
& WXUNUSED(verb
),
48 bool WXUNUSED(overwriteprompt
))
53 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& WXUNUSED(strIcon
),
59 bool wxFileTypeImpl::GetCommand(wxString
*WXUNUSED(command
),
60 const char *WXUNUSED(verb
)) const
65 bool wxFileTypeImpl::GetExtensions(wxArrayString
& WXUNUSED(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
*WXUNUSED(desc
)) const
107 wxFileTypeImpl::GetAllCommands(wxArrayString
* WXUNUSED(verbs
),
108 wxArrayString
* WXUNUSED(commands
),
109 const wxFileType::MessageParameters
& WXUNUSED(params
)) const
111 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
116 wxMimeTypesManagerImpl::Initialize(int WXUNUSED(mailcapStyles
),
117 const wxString
& WXUNUSED(extraDir
))
119 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
123 wxMimeTypesManagerImpl::ClearData()
125 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
128 // extension -> file type
130 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
134 if ( ext
== wxT("txt") )
136 wxFileType
*fileType
= new wxFileType
;
137 fileType
->m_impl
->SetFileType(wxT("text/text"));
138 fileType
->m_impl
->SetExt(ext
);
141 else if ( ext
== wxT("htm") || ext
== wxT("html") )
143 wxFileType
*fileType
= new wxFileType
;
144 fileType
->m_impl
->SetFileType(wxT("text/html"));
145 fileType
->m_impl
->SetExt(ext
);
148 else if ( ext
== wxT("gif") )
150 wxFileType
*fileType
= new wxFileType
;
151 fileType
->m_impl
->SetFileType(wxT("image/gif"));
152 fileType
->m_impl
->SetExt(ext
);
155 else if ( ext
== wxT("png" ))
157 wxFileType
*fileType
= new wxFileType
;
158 fileType
->m_impl
->SetFileType(wxT("image/png"));
159 fileType
->m_impl
->SetExt(ext
);
162 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
164 wxFileType
*fileType
= new wxFileType
;
165 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
166 fileType
->m_impl
->SetExt(ext
);
169 else if ( ext
== wxT("bmp") )
171 wxFileType
*fileType
= new wxFileType
;
172 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
173 fileType
->m_impl
->SetExt(ext
);
176 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
178 wxFileType
*fileType
= new wxFileType
;
179 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
180 fileType
->m_impl
->SetExt(ext
);
183 else if ( ext
== wxT("xpm") )
185 wxFileType
*fileType
= new wxFileType
;
186 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
187 fileType
->m_impl
->SetExt(ext
);
190 else if ( ext
== wxT("xbm") )
192 wxFileType
*fileType
= new wxFileType
;
193 fileType
->m_impl
->SetFileType(wxT("image/xbm"));
194 fileType
->m_impl
->SetExt(ext
);
202 // MIME type -> extension -> file type
204 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& WXUNUSED(mimeType
))
209 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& WXUNUSED(mimetypes
))
211 // VZ: don't know anything about this for Mac
212 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
218 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& WXUNUSED(ftInfo
))
220 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
226 wxMimeTypesManagerImpl::Unassociate(wxFileType
*WXUNUSED(ft
))
231 #endif // wxUSE_MIMETYPE