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
19 #include "wx/mimetype.h"
21 // ----------------------------------------------------------------------------
22 // wxFileTypeImpl is the OS/2 version of wxFileType, this is a private class
23 // and is never used directly by the application
24 // ----------------------------------------------------------------------------
26 class WXDLLIMPEXP_BASE wxFileTypeImpl
30 wxFileTypeImpl() { m_info
= NULL
; }
32 // one of these Init() function must be called (ctor can't take any
33 // arguments because it's common)
35 // initialize us with our file type name and extension - in this case
36 // we will read all other data from the registry
37 void Init(const wxString
& strFileType
, const wxString
& ext
)
38 { m_strFileType
= strFileType
; m_ext
= ext
; }
40 // initialize us with a wxFileTypeInfo object - it contains all the
42 void Init(const wxFileTypeInfo
& info
)
45 // implement accessor functions
46 bool GetExtensions(wxArrayString
& extensions
);
47 bool GetMimeType(wxString
*mimeType
) const;
48 bool GetMimeTypes(wxArrayString
& mimeTypes
) const;
49 bool GetIcon(wxIconLocation
*iconLoc
) const;
50 bool GetDescription(wxString
*desc
) const;
51 bool GetOpenCommand(wxString
*openCmd
,
52 const wxFileType::MessageParameters
& params
) const;
53 bool GetPrintCommand(wxString
*printCmd
,
54 const wxFileType::MessageParameters
& params
) const;
56 size_t GetAllCommands(wxArrayString
* verbs
, wxArrayString
* commands
,
57 const wxFileType::MessageParameters
& params
) const;
61 // set an arbitrary command, ask confirmation if it already exists and
62 // overwriteprompt is true
63 bool SetCommand(const wxString
& cmd
,
65 bool overwriteprompt
= true);
67 bool SetDefaultIcon(const wxString
& cmd
= wxEmptyString
, int index
= 0);
69 // this is called by Associate
70 bool SetDescription (const wxString
& desc
);
73 // helper function: reads the command corresponding to the specified verb
74 // from the registry (returns an empty string if not found)
75 wxString
GetCommand(const wxChar
*verb
) const;
77 // we use either m_info or read the data from the registry if m_info == NULL
78 const wxFileTypeInfo
*m_info
;
79 wxString m_strFileType
, // may be empty
85 class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
88 // nothing to do here, we don't load any data but just go and fetch it from
89 // the registry when asked for
90 wxMimeTypesManagerImpl() { }
92 // implement containing class functions
93 wxFileType
*GetFileTypeFromExtension(const wxString
& ext
);
94 wxFileType
*GetOrAllocateFileTypeFromExtension(const wxString
& ext
);
95 wxFileType
*GetFileTypeFromMimeType(const wxString
& mimeType
);
97 size_t EnumAllFileTypes(wxArrayString
& mimetypes
);
99 void AddFallback(const wxFileTypeInfo
& ft
) { m_fallbacks
.Add(ft
); }
102 wxArrayFileTypeInfo m_fallbacks
;
105 #endif // wxUSE_MIMETYPE