]>
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 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "mimetype.h"
16 // for compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
28 #include "wx/string.h"
39 #include "wx/dynarray.h"
40 #include "wx/confbase.h"
42 #include "wx/msdos/mimetype.h"
44 // other standard headers
47 // in case we're compiling in non-GUI mode
48 class WXDLLEXPORT wxIcon
;
50 bool wxFileTypeImpl::SetCommand(const wxString
& cmd
, const wxString
& verb
, bool overwriteprompt
)
55 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& strIcon
, int index
)
60 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
65 // @@ this function is half implemented
66 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
71 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
73 if ( m_strFileType
.Length() > 0 )
75 *mimeType
= m_strFileType
;
82 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
96 bool wxFileTypeImpl::GetIcon(wxIconLocation
*WXUNUSED(icon
)) const
98 // no such file type or no value or incorrect icon entry
102 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
108 wxFileTypeImpl::GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
109 const wxFileType::MessageParameters
& params
) const
111 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
116 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& extraDir
)
118 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
122 wxMimeTypesManagerImpl::ClearData()
124 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
127 // extension -> file type
129 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
133 if ( ext
== wxT("txt") )
135 wxFileType
*fileType
= new wxFileType
;
136 fileType
->m_impl
->SetFileType(wxT("text/text"));
137 fileType
->m_impl
->SetExt(ext
);
140 else if ( ext
== wxT("htm") || ext
== wxT("html") )
142 wxFileType
*fileType
= new wxFileType
;
143 fileType
->m_impl
->SetFileType(wxT("text/html"));
144 fileType
->m_impl
->SetExt(ext
);
147 else if ( ext
== wxT("gif") )
149 wxFileType
*fileType
= new wxFileType
;
150 fileType
->m_impl
->SetFileType(wxT("image/gif"));
151 fileType
->m_impl
->SetExt(ext
);
154 else if ( ext
== wxT("png" ))
156 wxFileType
*fileType
= new wxFileType
;
157 fileType
->m_impl
->SetFileType(wxT("image/png"));
158 fileType
->m_impl
->SetExt(ext
);
161 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
163 wxFileType
*fileType
= new wxFileType
;
164 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
165 fileType
->m_impl
->SetExt(ext
);
168 else if ( ext
== wxT("bmp") )
170 wxFileType
*fileType
= new wxFileType
;
171 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
172 fileType
->m_impl
->SetExt(ext
);
175 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
177 wxFileType
*fileType
= new wxFileType
;
178 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
179 fileType
->m_impl
->SetExt(ext
);
182 else if ( ext
== wxT("xpm") )
184 wxFileType
*fileType
= new wxFileType
;
185 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
186 fileType
->m_impl
->SetExt(ext
);
189 else if ( ext
== wxT("xbm") )
191 wxFileType
*fileType
= new wxFileType
;
192 fileType
->m_impl
->SetFileType(wxT("image/xbm"));
193 fileType
->m_impl
->SetExt(ext
);
201 // MIME type -> extension -> file type
203 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
208 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
210 // VZ: don't know anything about this for Mac
211 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
217 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
219 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
225 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)
230 #endif // wxUSE_MIMETYPE