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