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