]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/mimetmac.cpp
Got rid of some wierd VisualAge debug nonsense that had appeared in this after the...
[wxWidgets.git] / src / mac / carbon / mimetmac.cpp
CommitLineData
7dc3cc31
VS
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>
9// Licence: wxWindows license (part of wxExtra library)
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "mimetype.h"
14#endif
15
16// for compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20 #pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
24 #include "wx/defs.h"
25#endif
26
27#ifndef WX_PRECOMP
28 #include "wx/string.h"
29 #if wxUSE_GUI
30 #include "wx/icon.h"
31 #endif
32#endif //WX_PRECOMP
33
34
35#include "wx/log.h"
36#include "wx/file.h"
37#include "wx/intl.h"
38#include "wx/dynarray.h"
39#include "wx/confbase.h"
40
41#include "wx/mac/mimetype.h"
42
43// other standard headers
44#include <ctype.h>
45
46// in case we're compiling in non-GUI mode
47class WXDLLEXPORT wxIcon;
48
49
7dc3cc31
VS
50bool wxFileTypeImpl::GetCommand(wxString *command, const char *verb) const
51{
52 return FALSE;
53}
54
55// @@ this function is half implemented
56bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
57{
58 return FALSE;
59}
60
61bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
62{
63 if ( m_strFileType.Length() > 0 )
64 {
65 *mimeType = m_strFileType ;
66 return TRUE ;
67 }
68 else
69 return FALSE;
70}
71
4d2976ad
VS
72bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
73{
74 wxString s;
75
76 if (GetMimeType(&s))
77 {
78 mimeTypes.Clear();
79 mimeTypes.Add(s);
80 return TRUE;
81 }
82 else
83 return FALSE;
84}
85
7dc3cc31
VS
86bool wxFileTypeImpl::GetIcon(wxIcon *icon) const
87{
88 // no such file type or no value or incorrect icon entry
89 return FALSE;
90}
91
92bool wxFileTypeImpl::GetDescription(wxString *desc) const
93{
94 return FALSE;
95}
96
007ae8d0
GD
97bool wxFileTypeImpl::Unassociate()
98{
99 return FALSE;
100}
101
7dc3cc31
VS
102// extension -> file type
103wxFileType *
104wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
105{
106 wxString ext = e ;
107 ext = ext.Lower() ;
108 if ( ext == "txt" )
109 {
110 wxFileType *fileType = new wxFileType;
111 fileType->m_impl->SetFileType("text/text");
112 fileType->m_impl->SetExt(ext);
113 return fileType;
114 }
115 else if ( ext == "htm" || ext == "html" )
116 {
117 wxFileType *fileType = new wxFileType;
118 fileType->m_impl->SetFileType("text/html");
119 fileType->m_impl->SetExt(ext);
120 return fileType;
121 }
122 else if ( ext == "gif" )
123 {
124 wxFileType *fileType = new wxFileType;
125 fileType->m_impl->SetFileType("image/gif");
126 fileType->m_impl->SetExt(ext);
127 return fileType;
128 }
129 else if ( ext == "png" )
130 {
131 wxFileType *fileType = new wxFileType;
132 fileType->m_impl->SetFileType("image/png");
133 fileType->m_impl->SetExt(ext);
134 return fileType;
135 }
136 else if ( ext == "jpg" || ext == "jpeg" )
137 {
138 wxFileType *fileType = new wxFileType;
139 fileType->m_impl->SetFileType("image/jpeg");
140 fileType->m_impl->SetExt(ext);
141 return fileType;
142 }
143 else if ( ext == "bmp" )
144 {
145 wxFileType *fileType = new wxFileType;
146 fileType->m_impl->SetFileType("image/bmp");
147 fileType->m_impl->SetExt(ext);
148 return fileType;
149 }
150 else if ( ext == "tif" || ext == "tiff" )
151 {
152 wxFileType *fileType = new wxFileType;
153 fileType->m_impl->SetFileType("image/tiff");
154 fileType->m_impl->SetExt(ext);
155 return fileType;
156 }
157 else if ( ext == "xpm" )
158 {
159 wxFileType *fileType = new wxFileType;
160 fileType->m_impl->SetFileType("image/xpm");
161 fileType->m_impl->SetExt(ext);
162 return fileType;
163 }
164 else if ( ext == "xbm" )
165 {
166 wxFileType *fileType = new wxFileType;
167 fileType->m_impl->SetFileType("image/xbm");
168 fileType->m_impl->SetExt(ext);
169 return fileType;
170 }
171
172 // unknown extension
173 return NULL;
174}
175
176// MIME type -> extension -> file type
177wxFileType *
178wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
179{
180 return NULL;
181}
182
183size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
184{
185 wxFAIL_MSG( _T("TODO") ); // VZ: don't know anything about this for Mac
186
187 return 0;
188}
189
007ae8d0
GD
190wxFileType *
191wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
192{
193 wxFAIL_MSG( _T("TODO") );
194
195 return NULL;
196}