]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/mimetmac.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/classic/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"
19 #include "wx/mac/mimetype.h"
22 #include "wx/dynarray.h"
23 #include "wx/string.h"
33 #include "wx/confbase.h"
35 // other standard headers
38 // in case we're compiling in non-GUI mode
39 class WXDLLEXPORT wxIcon
;
41 bool wxFileTypeImpl::SetCommand(const wxString
& cmd
, const wxString
& verb
, bool overwriteprompt
)
46 bool wxFileTypeImpl::SetDefaultIcon(const wxString
& strIcon
, int index
)
51 bool wxFileTypeImpl::GetCommand(wxString
*command
, const char *verb
) const
56 // @@ this function is half implemented
57 bool wxFileTypeImpl::GetExtensions(wxArrayString
& extensions
)
62 bool wxFileTypeImpl::GetMimeType(wxString
*mimeType
) const
64 if ( !m_strFileType
.empty() )
66 *mimeType
= m_strFileType
;
73 bool wxFileTypeImpl::GetMimeTypes(wxArrayString
& mimeTypes
) const
87 bool wxFileTypeImpl::GetIcon(wxIconLocation
*WXUNUSED(icon
)) const
89 // no such file type or no value or incorrect icon entry
93 bool wxFileTypeImpl::GetDescription(wxString
*desc
) const
99 wxFileTypeImpl::GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
100 const wxFileType::MessageParameters
& params
) const
102 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
107 wxMimeTypesManagerImpl::Initialize(int mailcapStyles
, const wxString
& extraDir
)
109 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
113 wxMimeTypesManagerImpl::ClearData()
115 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
118 // extension -> file type
120 wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString
& e
)
124 if ( ext
== wxT("txt") )
126 wxFileType
*fileType
= new wxFileType
;
127 fileType
->m_impl
->SetFileType(wxT("text/text"));
128 fileType
->m_impl
->SetExt(ext
);
131 else if ( ext
== wxT("htm") || ext
== wxT("html") )
133 wxFileType
*fileType
= new wxFileType
;
134 fileType
->m_impl
->SetFileType(wxT("text/html"));
135 fileType
->m_impl
->SetExt(ext
);
138 else if ( ext
== wxT("gif") )
140 wxFileType
*fileType
= new wxFileType
;
141 fileType
->m_impl
->SetFileType(wxT("image/gif"));
142 fileType
->m_impl
->SetExt(ext
);
145 else if ( ext
== wxT("png" ))
147 wxFileType
*fileType
= new wxFileType
;
148 fileType
->m_impl
->SetFileType(wxT("image/png"));
149 fileType
->m_impl
->SetExt(ext
);
152 else if ( ext
== wxT("jpg" )|| ext
== wxT("jpeg") )
154 wxFileType
*fileType
= new wxFileType
;
155 fileType
->m_impl
->SetFileType(wxT("image/jpeg"));
156 fileType
->m_impl
->SetExt(ext
);
159 else if ( ext
== wxT("bmp") )
161 wxFileType
*fileType
= new wxFileType
;
162 fileType
->m_impl
->SetFileType(wxT("image/bmp"));
163 fileType
->m_impl
->SetExt(ext
);
166 else if ( ext
== wxT("tif") || ext
== wxT("tiff") )
168 wxFileType
*fileType
= new wxFileType
;
169 fileType
->m_impl
->SetFileType(wxT("image/tiff"));
170 fileType
->m_impl
->SetExt(ext
);
173 else if ( ext
== wxT("xpm") )
175 wxFileType
*fileType
= new wxFileType
;
176 fileType
->m_impl
->SetFileType(wxT("image/xpm"));
177 fileType
->m_impl
->SetExt(ext
);
180 else if ( ext
== wxT("xbm") )
182 wxFileType
*fileType
= new wxFileType
;
183 fileType
->m_impl
->SetFileType(wxT("image/xbm"));
184 fileType
->m_impl
->SetExt(ext
);
192 // MIME type -> extension -> file type
194 wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString
& mimeType
)
199 size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString
& mimetypes
)
201 // VZ: don't know anything about this for Mac
202 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
208 wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo
& ftInfo
)
210 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
216 wxMimeTypesManagerImpl::Unassociate(wxFileType
*ft
)