1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/mimetype.h
3 // Purpose: classes and functions to manage MIME types
4 // Author: David Webster
8 // Copyright: adopted from msw port -- (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence (part of wxExtra library)
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _MIMETYPE_IMPL_H
13 #define _MIMETYPE_IMPL_H
16 #pragma interface "mimetype.h"
23 #include "wx/mimetype.h"
25 // ----------------------------------------------------------------------------
26 // wxFileTypeImpl is the OS/2 version of wxFileType, this is a private class
27 // and is never used directly by the application
28 // ----------------------------------------------------------------------------
30 class WXDLLIMPEXP_BASE wxFileTypeImpl
34 wxFileTypeImpl() { m_info
= NULL
; }
36 // one of these Init() function must be called (ctor can't take any
37 // arguments because it's common)
39 // initialize us with our file type name and extension - in this case
40 // we will read all other data from the registry
41 void Init(const wxString
& strFileType
, const wxString
& ext
)
42 { m_strFileType
= strFileType
; m_ext
= ext
; }
44 // initialize us with a wxFileTypeInfo object - it contains all the
46 void Init(const wxFileTypeInfo
& info
)
49 // implement accessor functions
50 bool GetExtensions(wxArrayString
& extensions
);
51 bool GetMimeType(wxString
*mimeType
) const;
52 bool GetMimeTypes(wxArrayString
& mimeTypes
) const;
53 bool GetIcon(wxIconLocation
*iconLoc
) const;
54 bool GetDescription(wxString
*desc
) const;
55 bool GetOpenCommand(wxString
*openCmd
,
56 const wxFileType::MessageParameters
& params
) const;
57 bool GetPrintCommand(wxString
*printCmd
,
58 const wxFileType::MessageParameters
& params
) const;
60 size_t GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
61 const wxFileType::MessageParameters
& params
) const;
65 // set an arbitrary command, ask confirmation if it already exists and
66 // overwriteprompt is TRUE
67 bool SetCommand(const wxString
& cmd
,
69 bool overwriteprompt
= TRUE
);
71 bool SetDefaultIcon(const wxString
& cmd
= wxEmptyString
, int index
= 0);
73 // this is called by Associate
74 bool SetDescription (const wxString
& desc
);
77 // helper function: reads the command corresponding to the specified verb
78 // from the registry (returns an empty string if not found)
79 wxString
GetCommand(const wxChar
*verb
) const;
81 // we use either m_info or read the data from the registry if m_info == NULL
82 const wxFileTypeInfo
*m_info
;
83 wxString m_strFileType
, // may be empty
89 class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
92 // nothing to do here, we don't load any data but just go and fetch it from
93 // the registry when asked for
94 wxMimeTypesManagerImpl() { }
96 // implement containing class functions
97 wxFileType
*GetFileTypeFromExtension(const wxString
& ext
);
98 wxFileType
*GetOrAllocateFileTypeFromExtension(const wxString
& ext
);
99 wxFileType
*GetFileTypeFromMimeType(const wxString
& mimeType
);
101 size_t EnumAllFileTypes(wxArrayString
& mimetypes
);
103 // these are NOPs under OS/2
104 bool ReadMailcap(const wxString
& filename
, bool fallback
= TRUE
)
106 bool ReadMimeTypes(const wxString
& filename
)
109 void AddFallback(const wxFileTypeInfo
& ft
) { m_fallbacks
.Add(ft
); }
112 wxArrayFileTypeInfo m_fallbacks
;
115 #endif // wxUSE_MIMETYPE