]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/mimetype.h
fixed wxUSE_MAC not being defined under Unix => -D_REENTRANT was missing resulting...
[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 #ifdef __GNUG__
16 #pragma interface "mimetype.h"
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/mimetype.h"
21
22
23 class wxMimeTypesManagerImpl
24 {
25 public :
26 wxMimeTypesManagerImpl() { }
27 #ifdef __WXMAC_X__
28 ~wxMimeTypesManagerImpl() { }
29 #endif
30
31 // implement containing class functions
32 wxFileType *GetFileTypeFromExtension(const wxString& ext);
33 wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ;
34 wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
35
36 size_t EnumAllFileTypes(wxArrayString& mimetypes);
37
38 // this are NOPs under MacOS
39 bool ReadMailcap(const wxString& filename, bool fallback = TRUE) { return TRUE; }
40 bool ReadMimeTypes(const wxString& filename) { return TRUE; }
41
42 void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
43
44 // create a new filetype association
45 wxFileType *Associate(const wxFileTypeInfo& ftInfo);
46
47 // create a new filetype with the given name and extension
48 wxFileType *CreateFileType(const wxString& filetype, const wxString& ext);
49
50 private:
51 wxArrayFileTypeInfo m_fallbacks;
52 };
53
54 class wxFileTypeImpl
55 {
56 public:
57 // initialize us with our file type name
58 void SetFileType(const wxString& strFileType)
59 { m_strFileType = strFileType; }
60 void SetExt(const wxString& ext)
61 { m_ext = ext; }
62
63 // implement accessor functions
64 bool GetExtensions(wxArrayString& extensions);
65 bool GetMimeType(wxString *mimeType) const;
66 bool GetMimeTypes(wxArrayString& mimeTypes) const;
67 bool GetIcon(wxIcon *icon) const;
68 bool GetDescription(wxString *desc) const;
69 bool GetOpenCommand(wxString *openCmd,
70 const wxFileType::MessageParameters&) const
71 { return GetCommand(openCmd, "open"); }
72 bool GetPrintCommand(wxString *printCmd,
73 const wxFileType::MessageParameters&) const
74 { return GetCommand(printCmd, "print"); }
75
76 size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
77 const wxFileType::MessageParameters& params) const;
78
79 bool Unassociate();
80
81 private:
82 // helper function
83 bool GetCommand(wxString *command, const char *verb) const;
84
85 wxString m_strFileType, m_ext;
86 };
87
88
89
90 #endif
91 //_MIMETYPE_H
92
93 /* vi: set cin tw=80 ts=4 sw=4: */