]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/mimetype.h
Change wxWakeUpPipe to be a wxEventLoopSourceHandler.
[wxWidgets.git] / include / wx / os2 / mimetype.h
CommitLineData
708795b5 1/////////////////////////////////////////////////////////////////////////////
a1541f5f 2// Name: wx/os2/mimetype.h
708795b5 3// Purpose: classes and functions to manage MIME types
2a6b16e3 4// Author: David Webster
708795b5
DW
5// Modified by:
6// Created: 01.21.99
7// RCS-ID: $Id$
8// Copyright: adopted from msw port -- (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence (part of wxExtra library)
708795b5
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _MIMETYPE_IMPL_H
13#define _MIMETYPE_IMPL_H
14
15#include "wx/defs.h"
16
a1541f5f
SN
17#if wxUSE_MIMETYPE
18
708795b5
DW
19#include "wx/mimetype.h"
20
a1541f5f
SN
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// ----------------------------------------------------------------------------
708795b5 25
a1541f5f 26class WXDLLIMPEXP_BASE wxFileTypeImpl
708795b5
DW
27{
28public:
29 // ctor
30 wxFileTypeImpl() { m_info = NULL; }
31
32 // one of these Init() function must be called (ctor can't take any
33 // arguments because it's common)
34
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; }
39
40 // initialize us with a wxFileTypeInfo object - it contains all the
41 // data
42 void Init(const wxFileTypeInfo& info)
43 { m_info = &info; }
44
45 // implement accessor functions
46 bool GetExtensions(wxArrayString& extensions);
47 bool GetMimeType(wxString *mimeType) const;
2a6b16e3 48 bool GetMimeTypes(wxArrayString& mimeTypes) const;
a1541f5f 49 bool GetIcon(wxIconLocation *iconLoc) const;
708795b5
DW
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;
55
a2cd9b86
SN
56 size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
57 const wxFileType::MessageParameters& params) const;
58
59 bool Unassociate();
60
61 // set an arbitrary command, ask confirmation if it already exists and
7e1e6965 62 // overwriteprompt is true
a2cd9b86
SN
63 bool SetCommand(const wxString& cmd,
64 const wxString& verb,
7e1e6965 65 bool overwriteprompt = true);
a2cd9b86
SN
66
67 bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
68
69 // this is called by Associate
70 bool SetDescription (const wxString& desc);
71
708795b5
DW
72private:
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;
76
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
80 m_ext;
81};
82
83
84
a1541f5f 85class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
708795b5
DW
86{
87public:
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() { }
91
92 // implement containing class functions
93 wxFileType *GetFileTypeFromExtension(const wxString& ext);
a2cd9b86 94 wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext);
708795b5
DW
95 wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
96
97 size_t EnumAllFileTypes(wxArrayString& mimetypes);
98
708795b5
DW
99 void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
100
101private:
102 wxArrayFileTypeInfo m_fallbacks;
103};
104
a1541f5f 105#endif // wxUSE_MIMETYPE
708795b5
DW
106
107#endif
108 //_MIMETYPE_IMPL_H