]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/mimetype.h
GSocket:
[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 GetIcon(wxIcon *icon) const;
55 bool GetDescription(wxString *desc) const;
56 bool GetOpenCommand(wxString *openCmd,
57 const wxFileType::MessageParameters&) const
58 { return GetCommand(openCmd, "open"); }
59 bool GetPrintCommand(wxString *printCmd,
60 const wxFileType::MessageParameters&) const
61 { return GetCommand(printCmd, "print"); }
62
63 private:
64 // helper function
65 bool GetCommand(wxString *command, const char *verb) const;
66
67 wxString m_strFileType, m_ext;
68 };
69
70
71
72 #endif
73 //_MIMETYPE_H
74
75 /* vi: set cin tw=80 ts=4 sw=4: */