]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "mimetype.h"
16 // for compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/string.h"
36 #include "wx/dynarray.h"
37 #include "wx/confbase.h"
39 #include "wx/mac/mimetype.h"
41 // other standard headers
44 // in case we're compiling in non-GUI mode
45 class WXDLLEXPORT wxIcon
;
47 bool wxFileTypeImpl::SetCommand(const wxString
& cmd
, const wxString
& verb
, bool overwriteprompt
)
52 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& strIcon
, int index
)
57 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
62 // @@ this function is half implemented
63 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
68 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
70 if ( m_strFileType
.Length() > 0 )
72 *mimeType
= m_strFileType
;
79 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
93 bool wxFileTypeImpl::GetIcon(wxIconLocation
*WXUNUSED(icon
)) const
95 // no such file type or no value or incorrect icon entry
99 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
105 wxFileTypeImpl::GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
106 const wxFileType::MessageParameters
& params
) const
108 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
113 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& 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
& mimeType
)
205 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& 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
& ftInfo
)
216 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
222 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)
227 #endif //wxUSE_MIMETYPE