]>
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
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence (part of wxExtra library)
9 /////////////////////////////////////////////////////////////////////////////
11 // for compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
20 #include "wx/msdos/mimetype.h"
23 #include "wx/dynarray.h"
24 #include "wx/string.h"
33 #include "wx/confbase.h"
35 // other standard headers
38 // in case we're compiling in non-GUI mode
39 class WXDLLEXPORT wxIcon
;
41 bool wxFileTypeImpl::SetCommand(const wxString
& WXUNUSED(cmd
),
42 const wxString
& WXUNUSED(verb
),
43 bool WXUNUSED(overwriteprompt
))
48 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& WXUNUSED(strIcon
),
54 bool wxFileTypeImpl::GetCommand(wxString
*WXUNUSED(command
),
55 const char *WXUNUSED(verb
)) const
60 bool wxFileTypeImpl::GetExtensions(wxArrayString
& WXUNUSED(extensions
))
65 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
67 if ( !m_strFileType
.empty() )
69 *mimeType
= m_strFileType
;
76 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
90 bool wxFileTypeImpl::GetIcon(wxIconLocation
*WXUNUSED(icon
)) const
92 // no such file type or no value or incorrect icon entry
96 bool wxFileTypeImpl::GetDescription(wxString
*WXUNUSED(desc
)) const
102 wxFileTypeImpl::GetAllCommands(wxArrayString
* WXUNUSED(verbs
),
103 wxArrayString
* WXUNUSED(commands
),
104 const wxFileType::MessageParameters
& WXUNUSED(params
)) const
106 wxFAIL_MSG( wxT("wxFileTypeImpl::GetAllCommands() not yet implemented") );
111 wxMimeTypesManagerImpl::Initialize(int WXUNUSED(mailcapStyles
),
112 const wxString
& WXUNUSED(extraDir
))
114 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
118 wxMimeTypesManagerImpl::ClearData()
120 wxFAIL_MSG( wxT("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
& WXUNUSED(mimeType
))
204 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& WXUNUSED(mimetypes
))
206 // VZ: don't know anything about this for Mac
207 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
213 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& WXUNUSED(ftInfo
))
215 wxFAIL_MSG( wxT("wxMimeTypesManagerImpl::Associate() not yet implemented") );
221 wxMimeTypesManagerImpl::Unassociate(wxFileType
*WXUNUSED(ft
))
226 #endif // wxUSE_MIMETYPE