]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/mimetmac.cpp
COW cleanup patch (1583966):
[wxWidgets.git] / src / mac / classic / mimetmac.cpp
CommitLineData
2646f485 1/////////////////////////////////////////////////////////////////////////////
18f3decb 2// Name: src/mac/classic/mimetype.cpp
2646f485
SC
3// Purpose: classes and functions to manage MIME types
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 23.09.98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence (part of wxExtra library)
2646f485
SC
10/////////////////////////////////////////////////////////////////////////////
11
2646f485
SC
12// for compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
ad9835c9 16 #pragma hdrstop
2646f485
SC
17#endif
18
88a7a4e1
WS
19#include "wx/mac/mimetype.h"
20
2646f485 21#ifndef WX_PRECOMP
ad9835c9
WS
22 #include "wx/dynarray.h"
23 #include "wx/string.h"
88a7a4e1 24 #include "wx/intl.h"
e4db172a 25 #include "wx/log.h"
ad9835c9
WS
26 #if wxUSE_GUI
27 #include "wx/icon.h"
28 #endif
2646f485
SC
29#endif //WX_PRECOMP
30
31
2646f485 32#include "wx/file.h"
2646f485
SC
33#include "wx/confbase.h"
34
2646f485
SC
35// other standard headers
36#include <ctype.h>
37
38// in case we're compiling in non-GUI mode
39class WXDLLEXPORT wxIcon;
40
41bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt)
42{
01aefd22 43 return false;
2646f485
SC
44}
45
46bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int index)
47{
01aefd22 48 return false;
2646f485
SC
49}
50
51bool wxFileTypeImpl::GetCommand(wxString *command, const char *verb) const
52{
01aefd22 53 return false;
2646f485
SC
54}
55
56// @@ this function is half implemented
57bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
58{
01aefd22 59 return false;
2646f485
SC
60}
61
62bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
63{
ad9835c9 64 if ( !m_strFileType.empty() )
2646f485
SC
65 {
66 *mimeType = m_strFileType ;
01aefd22 67 return true ;
2646f485
SC
68 }
69 else
01aefd22 70 return false;
2646f485
SC
71}
72
73bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
74{
75 wxString s;
01aefd22 76
2646f485
SC
77 if (GetMimeType(&s))
78 {
79 mimeTypes.Clear();
80 mimeTypes.Add(s);
01aefd22 81 return true;
2646f485 82 }
01aefd22
WS
83 else
84 return false;
2646f485
SC
85}
86
87bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
88{
89 // no such file type or no value or incorrect icon entry
01aefd22 90 return false;
2646f485
SC
91}
92
93bool wxFileTypeImpl::GetDescription(wxString *desc) const
94{
01aefd22 95 return false;
2646f485
SC
96}
97
98size_t
99wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
100 const wxFileType::MessageParameters& params) const
101{
102 wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
103 return 0;
104}
105
106void
107wxMimeTypesManagerImpl::Initialize(int mailcapStyles, const wxString& extraDir)
108{
109 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
110}
111
112void
113wxMimeTypesManagerImpl::ClearData()
114{
115 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::ClearData() not yet implemented") );
116}
117
118// extension -> file type
119wxFileType *
120wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
121{
122 wxString ext = e ;
123 ext = ext.Lower() ;
124 if ( ext == wxT("txt") )
125 {
126 wxFileType *fileType = new wxFileType;
127 fileType->m_impl->SetFileType(wxT("text/text"));
128 fileType->m_impl->SetExt(ext);
129 return fileType;
130 }
131 else if ( ext == wxT("htm") || ext == wxT("html") )
132 {
133 wxFileType *fileType = new wxFileType;
134 fileType->m_impl->SetFileType(wxT("text/html"));
135 fileType->m_impl->SetExt(ext);
136 return fileType;
137 }
138 else if ( ext == wxT("gif") )
139 {
140 wxFileType *fileType = new wxFileType;
141 fileType->m_impl->SetFileType(wxT("image/gif"));
142 fileType->m_impl->SetExt(ext);
143 return fileType;
144 }
145 else if ( ext == wxT("png" ))
146 {
147 wxFileType *fileType = new wxFileType;
148 fileType->m_impl->SetFileType(wxT("image/png"));
149 fileType->m_impl->SetExt(ext);
150 return fileType;
151 }
152 else if ( ext == wxT("jpg" )|| ext == wxT("jpeg") )
153 {
154 wxFileType *fileType = new wxFileType;
155 fileType->m_impl->SetFileType(wxT("image/jpeg"));
156 fileType->m_impl->SetExt(ext);
157 return fileType;
158 }
159 else if ( ext == wxT("bmp") )
160 {
161 wxFileType *fileType = new wxFileType;
162 fileType->m_impl->SetFileType(wxT("image/bmp"));
163 fileType->m_impl->SetExt(ext);
164 return fileType;
165 }
166 else if ( ext == wxT("tif") || ext == wxT("tiff") )
167 {
168 wxFileType *fileType = new wxFileType;
169 fileType->m_impl->SetFileType(wxT("image/tiff"));
170 fileType->m_impl->SetExt(ext);
171 return fileType;
172 }
173 else if ( ext == wxT("xpm") )
174 {
175 wxFileType *fileType = new wxFileType;
176 fileType->m_impl->SetFileType(wxT("image/xpm"));
177 fileType->m_impl->SetExt(ext);
178 return fileType;
179 }
180 else if ( ext == wxT("xbm") )
181 {
182 wxFileType *fileType = new wxFileType;
183 fileType->m_impl->SetFileType(wxT("image/xbm"));
184 fileType->m_impl->SetExt(ext);
185 return fileType;
186 }
187
188 // unknown extension
189 return NULL;
190}
191
192// MIME type -> extension -> file type
193wxFileType *
194wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
195{
196 return NULL;
197}
198
199size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
200{
201 // VZ: don't know anything about this for Mac
202 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
203
204 return 0;
205}
206
207wxFileType *
208wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
209{
210 wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
211
212 return NULL;
213}
214
215bool
216wxMimeTypesManagerImpl::Unassociate(wxFileType *ft)
217{
01aefd22 218 return false;
2646f485 219}