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