]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/mimetmac.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"
34 #include "wx/dynarray.h"
35 #include "wx/confbase.h"
37 #include "wx/mac/mimetype.h"
39 // other standard headers
42 // in case we're compiling in non-GUI mode
43 class WXDLLEXPORT wxIcon
;
45 bool wxFileTypeImpl::SetCommand(const wxString
& cmd
, const wxString
& verb
, bool overwriteprompt
)
50 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& strIcon
, int index
)
55 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
60 // @@ this function is half implemented
61 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
66 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
68 if ( m_strFileType
.Length() > 0 )
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
*desc
) const
103 wxFileTypeImpl::GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
104 const wxFileType::MessageParameters
& params
) const
106 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
111 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& extraDir
)
113 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
117 wxMimeTypesManagerImpl::ClearData()
119 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
122 // extension -> file type
124 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
128 if ( ext
== wxT("txt") )
130 wxFileType
*fileType
= new wxFileType
;
131 fileType
->m_impl
->SetFileType(wxT("text/text"));
132 fileType
->m_impl
->SetExt(ext
);
135 else if ( ext
== wxT("htm") || ext
== wxT("html") )
137 wxFileType
*fileType
= new wxFileType
;
138 fileType
->m_impl
->SetFileType(wxT("text/html"));
139 fileType
->m_impl
->SetExt(ext
);
142 else if ( ext
== wxT("gif") )
144 wxFileType
*fileType
= new wxFileType
;
145 fileType
->m_impl
->SetFileType(wxT("image/gif"));
146 fileType
->m_impl
->SetExt(ext
);
149 else if ( ext
== wxT("png" ))
151 wxFileType
*fileType
= new wxFileType
;
152 fileType
->m_impl
->SetFileType(wxT("image/png"));
153 fileType
->m_impl
->SetExt(ext
);
156 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
158 wxFileType
*fileType
= new wxFileType
;
159 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
160 fileType
->m_impl
->SetExt(ext
);
163 else if ( ext
== wxT("bmp") )
165 wxFileType
*fileType
= new wxFileType
;
166 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
167 fileType
->m_impl
->SetExt(ext
);
170 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
172 wxFileType
*fileType
= new wxFileType
;
173 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
174 fileType
->m_impl
->SetExt(ext
);
177 else if ( ext
== wxT("xpm") )
179 wxFileType
*fileType
= new wxFileType
;
180 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
181 fileType
->m_impl
->SetExt(ext
);
184 else if ( ext
== wxT("xbm") )
186 wxFileType
*fileType
= new wxFileType
;
187 fileType
->m_impl
->SetFileType(wxT("image/xbm"));
188 fileType
->m_impl
->SetExt(ext
);
196 // MIME type -> extension -> file type
198 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
203 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
205 // VZ: don't know anything about this for Mac
206 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
212 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
214 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
220 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)