]>
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 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
;
50 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
55 // @@ this function is half implemented
56 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
61 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
63 if ( m_strFileType
.Length() > 0 )
65 *mimeType
= m_strFileType
;
72 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
86 bool wxFileTypeImpl::GetIcon(wxIcon
*icon
) const
88 // no such file type or no value or incorrect icon entry
92 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
97 bool wxFileTypeImpl::Unassociate()
102 // extension -> file type
104 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
110 wxFileType
*fileType
= new wxFileType
;
111 fileType
->m_impl
->SetFileType("text/text");
112 fileType
->m_impl
->SetExt(ext
);
115 else if ( ext
== "htm" || ext
== "html" )
117 wxFileType
*fileType
= new wxFileType
;
118 fileType
->m_impl
->SetFileType("text/html");
119 fileType
->m_impl
->SetExt(ext
);
122 else if ( ext
== "gif" )
124 wxFileType
*fileType
= new wxFileType
;
125 fileType
->m_impl
->SetFileType("image/gif");
126 fileType
->m_impl
->SetExt(ext
);
129 else if ( ext
== "png" )
131 wxFileType
*fileType
= new wxFileType
;
132 fileType
->m_impl
->SetFileType("image/png");
133 fileType
->m_impl
->SetExt(ext
);
136 else if ( ext
== "jpg" || ext
== "jpeg" )
138 wxFileType
*fileType
= new wxFileType
;
139 fileType
->m_impl
->SetFileType("image/jpeg");
140 fileType
->m_impl
->SetExt(ext
);
143 else if ( ext
== "bmp" )
145 wxFileType
*fileType
= new wxFileType
;
146 fileType
->m_impl
->SetFileType("image/bmp");
147 fileType
->m_impl
->SetExt(ext
);
150 else if ( ext
== "tif" || ext
== "tiff" )
152 wxFileType
*fileType
= new wxFileType
;
153 fileType
->m_impl
->SetFileType("image/tiff");
154 fileType
->m_impl
->SetExt(ext
);
157 else if ( ext
== "xpm" )
159 wxFileType
*fileType
= new wxFileType
;
160 fileType
->m_impl
->SetFileType("image/xpm");
161 fileType
->m_impl
->SetExt(ext
);
164 else if ( ext
== "xbm" )
166 wxFileType
*fileType
= new wxFileType
;
167 fileType
->m_impl
->SetFileType("image/xbm");
168 fileType
->m_impl
->SetExt(ext
);
176 // MIME type -> extension -> file type
178 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
183 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
185 wxFAIL_MSG( _T("TODO") ); // VZ: don't know anything about this for Mac
191 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
193 wxFAIL_MSG( _T("TODO") );