1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/mimetype.h
3 // Purpose: classes and functions to manage MIME types
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license (part of wxExtra library)
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _MIMETYPE_IMPL_H
13 #define _MIMETYPE_IMPL_H
16 #pragma interface "mimetype.h"
21 #include "wx/mimetype.h"
24 class WXDLLEXPORT wxFileTypeImpl
28 wxFileTypeImpl() { m_info
= NULL
; }
30 // one of these Init() function must be called (ctor can't take any
31 // arguments because it's common)
33 // initialize us with our file type name and extension - in this case
34 // we will read all other data from the registry
35 void Init(const wxString
& strFileType
, const wxString
& ext
)
36 { m_strFileType
= strFileType
; m_ext
= ext
; }
38 // initialize us with a wxFileTypeInfo object - it contains all the
40 void Init(const wxFileTypeInfo
& info
)
43 // implement accessor functions
44 bool GetExtensions(wxArrayString
& extensions
);
45 bool GetMimeType(wxString
*mimeType
) const;
46 bool GetMimeTypes(wxArrayString
& mimeTypes
) const;
47 bool GetIcon(wxIcon
*icon
) const;
48 bool GetDescription(wxString
*desc
) const;
49 bool GetOpenCommand(wxString
*openCmd
,
50 const wxFileType::MessageParameters
& params
) const;
51 bool GetPrintCommand(wxString
*printCmd
,
52 const wxFileType::MessageParameters
& params
) const;
55 // helper function: reads the command corresponding to the specified verb
56 // from the registry (returns an empty string if not found)
57 wxString
GetCommand(const wxChar
*verb
) const;
59 // we use either m_info or read the data from the registry if m_info == NULL
60 const wxFileTypeInfo
*m_info
;
61 wxString m_strFileType
, // may be empty
67 class WXDLLEXPORT wxMimeTypesManagerImpl
70 // nothing to do here, we don't load any data but just go and fetch it from
71 // the registry when asked for
72 wxMimeTypesManagerImpl() { }
74 // implement containing class functions
75 wxFileType
*GetFileTypeFromExtension(const wxString
& ext
);
76 wxFileType
*GetFileTypeFromMimeType(const wxString
& mimeType
);
78 size_t EnumAllFileTypes(wxArrayString
& mimetypes
);
80 // this are NOPs under Windows
81 bool ReadMailcap(const wxString
& filename
, bool fallback
= TRUE
)
83 bool ReadMimeTypes(const wxString
& filename
)
86 void AddFallback(const wxFileTypeInfo
& ft
) { m_fallbacks
.Add(ft
); }
89 wxArrayFileTypeInfo m_fallbacks
;