]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/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 license (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"
38 #include "wx/dynarray.h"
39 #include "wx/confbase.h"
41 #include "wx/mac/mimetype.h"
43 // other standard headers
46 // in case we're compiling in non-GUI mode
47 class WXDLLEXPORT wxIcon
;
54 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
59 // @@ this function is half implemented
60 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
65 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
67 if ( m_strFileType
.Length() > 0 )
69 *mimeType
= m_strFileType
;
76 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
90 bool wxFileTypeImpl::GetIcon(wxIcon
*icon
) const
92 // no such file type or no value or incorrect icon entry
96 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
101 // extension -> file type
103 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
109 wxFileType
*fileType
= new wxFileType
;
110 fileType
->m_impl
->SetFileType("text/text");
111 fileType
->m_impl
->SetExt(ext
);
114 else if ( ext
== "htm" || ext
== "html" )
116 wxFileType
*fileType
= new wxFileType
;
117 fileType
->m_impl
->SetFileType("text/html");
118 fileType
->m_impl
->SetExt(ext
);
121 else if ( ext
== "gif" )
123 wxFileType
*fileType
= new wxFileType
;
124 fileType
->m_impl
->SetFileType("image/gif");
125 fileType
->m_impl
->SetExt(ext
);
128 else if ( ext
== "png" )
130 wxFileType
*fileType
= new wxFileType
;
131 fileType
->m_impl
->SetFileType("image/png");
132 fileType
->m_impl
->SetExt(ext
);
135 else if ( ext
== "jpg" || ext
== "jpeg" )
137 wxFileType
*fileType
= new wxFileType
;
138 fileType
->m_impl
->SetFileType("image/jpeg");
139 fileType
->m_impl
->SetExt(ext
);
142 else if ( ext
== "bmp" )
144 wxFileType
*fileType
= new wxFileType
;
145 fileType
->m_impl
->SetFileType("image/bmp");
146 fileType
->m_impl
->SetExt(ext
);
149 else if ( ext
== "tif" || ext
== "tiff" )
151 wxFileType
*fileType
= new wxFileType
;
152 fileType
->m_impl
->SetFileType("image/tiff");
153 fileType
->m_impl
->SetExt(ext
);
156 else if ( ext
== "xpm" )
158 wxFileType
*fileType
= new wxFileType
;
159 fileType
->m_impl
->SetFileType("image/xpm");
160 fileType
->m_impl
->SetExt(ext
);
163 else if ( ext
== "xbm" )
165 wxFileType
*fileType
= new wxFileType
;
166 fileType
->m_impl
->SetFileType("image/xbm");
167 fileType
->m_impl
->SetExt(ext
);
175 // MIME type -> extension -> file type
177 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
182 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
184 wxFAIL_MSG( _T("TODO") ); // VZ: don't know anything about this for Mac