]>
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"
21 #include "wx/msdos/mimetype.h"
24 #include "wx/dynarray.h"
25 #include "wx/string.h"
34 #include "wx/confbase.h"
36 // other standard headers
39 // in case we're compiling in non-GUI mode
40 class WXDLLEXPORT wxIcon
;
42 bool wxFileTypeImpl::SetCommand(const wxString
& WXUNUSED(cmd
),
43 const wxString
& WXUNUSED(verb
),
44 bool WXUNUSED(overwriteprompt
))
49 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& WXUNUSED(strIcon
),
55 bool wxFileTypeImpl::GetCommand(wxString
*WXUNUSED(command
),
56 const char *WXUNUSED(verb
)) const
61 bool wxFileTypeImpl::GetExtensions(wxArrayString
& WXUNUSED(extensions
))
66 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
68 if ( !m_strFileType
.empty() )
70 *mimeType
= m_strFileType
;
77 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
91 bool wxFileTypeImpl::GetIcon(wxIconLocation
*WXUNUSED(icon
)) const
93 // no such file type or no value or incorrect icon entry
97 bool wxFileTypeImpl::GetDescription(wxString
*WXUNUSED(desc
)) const
103 wxFileTypeImpl::GetAllCommands(wxArrayString
* WXUNUSED(verbs
),
104 wxArrayString
* WXUNUSED(commands
),
105 const wxFileType::MessageParameters
& WXUNUSED(params
)) const
107 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
112 wxMimeTypesManagerImpl::Initialize(int WXUNUSED(mailcapStyles
),
113 const wxString
& WXUNUSED(extraDir
))
115 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
119 wxMimeTypesManagerImpl::ClearData()
121 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
124 // extension -> file type
126 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
130 if ( ext
== wxT("txt") )
132 wxFileType
*fileType
= new wxFileType
;
133 fileType
->m_impl
->SetFileType(wxT("text/text"));
134 fileType
->m_impl
->SetExt(ext
);
137 else if ( ext
== wxT("htm") || ext
== wxT("html") )
139 wxFileType
*fileType
= new wxFileType
;
140 fileType
->m_impl
->SetFileType(wxT("text/html"));
141 fileType
->m_impl
->SetExt(ext
);
144 else if ( ext
== wxT("gif") )
146 wxFileType
*fileType
= new wxFileType
;
147 fileType
->m_impl
->SetFileType(wxT("image/gif"));
148 fileType
->m_impl
->SetExt(ext
);
151 else if ( ext
== wxT("png" ))
153 wxFileType
*fileType
= new wxFileType
;
154 fileType
->m_impl
->SetFileType(wxT("image/png"));
155 fileType
->m_impl
->SetExt(ext
);
158 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
160 wxFileType
*fileType
= new wxFileType
;
161 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
162 fileType
->m_impl
->SetExt(ext
);
165 else if ( ext
== wxT("bmp") )
167 wxFileType
*fileType
= new wxFileType
;
168 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
169 fileType
->m_impl
->SetExt(ext
);
172 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
174 wxFileType
*fileType
= new wxFileType
;
175 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
176 fileType
->m_impl
->SetExt(ext
);
179 else if ( ext
== wxT("xpm") )
181 wxFileType
*fileType
= new wxFileType
;
182 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
183 fileType
->m_impl
->SetExt(ext
);
186 else if ( ext
== wxT("xbm") )
188 wxFileType
*fileType
= new wxFileType
;
189 fileType
->m_impl
->SetFileType(wxT("image/xbm"));
190 fileType
->m_impl
->SetExt(ext
);
198 // MIME type -> extension -> file type
200 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& WXUNUSED(mimeType
))
205 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& WXUNUSED(mimetypes
))
207 // VZ: don't know anything about this for Mac
208 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
214 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& WXUNUSED(ftInfo
))
216 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
222 wxMimeTypesManagerImpl::Unassociate(wxFileType
*WXUNUSED(ft
))
227 #endif // wxUSE_MIMETYPE