]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/mimetype.h
Many plot window gooddies.
[wxWidgets.git] / include / wx / mac / mimetype.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/mimetype.h
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 #ifndef _MIMETYPE_IMPL_H
13 #define _MIMETYPE_IMPL_H
14
15
16 #include "wx/defs.h"
17 #include "wx/mimetype.h"
18
19
20
21 class wxMimeTypesManagerImpl
22 {
23 public :
24 wxMimeTypesManagerImpl() { }
25
26 // implement containing class functions
27 wxFileType *GetFileTypeFromExtension(const wxString& ext);
28 wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
29
30 size_t EnumAllFileTypes(wxArrayString& mimetypes);
31
32 // this are NOPs under MacOS
33 bool ReadMailcap(const wxString& filename, bool fallback = TRUE) { return TRUE; }
34 bool ReadMimeTypes(const wxString& filename) { return TRUE; }
35
36 void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
37
38 private:
39 wxArrayFileTypeInfo m_fallbacks;
40 };
41
42 class wxFileTypeImpl
43 {
44 public:
45 // initialize us with our file type name
46 void SetFileType(const wxString& strFileType)
47 { m_strFileType = strFileType; }
48 void SetExt(const wxString& ext)
49 { m_ext = ext; }
50
51 // implement accessor functions
52 bool GetExtensions(wxArrayString& extensions);
53 bool GetMimeType(wxString *mimeType) const;
54 bool GetMimeTypes(wxArrayString& mimeTypes) const;
55 bool GetIcon(wxIcon *icon) const;
56 bool GetDescription(wxString *desc) const;
57 bool GetOpenCommand(wxString *openCmd,
58 const wxFileType::MessageParameters&) const
59 { return GetCommand(openCmd, "open"); }
60 bool GetPrintCommand(wxString *printCmd,
61 const wxFileType::MessageParameters&) const
62 { return GetCommand(printCmd, "print"); }
63
64 private:
65 // helper function
66 bool GetCommand(wxString *command, const char *verb) const;
67
68 wxString m_strFileType, m_ext;
69 };
70
71
72
73 #endif
74 //_MIMETYPE_H
75
76 /* vi: set cin tw=80 ts=4 sw=4: */