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