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