]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/mimetype.h
Hopefully fixed library names generated by wx-config for OS/2's PM port.
[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
a1541f5f
SN
15#ifdef __GNUG__
16 #pragma interface "mimetype.h"
17#endif
18
708795b5
DW
19#include "wx/defs.h"
20
a1541f5f
SN
21#if wxUSE_MIMETYPE
22
708795b5
DW
23#include "wx/mimetype.h"
24
a1541f5f
SN
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// ----------------------------------------------------------------------------
708795b5 29
a1541f5f 30class WXDLLIMPEXP_BASE wxFileTypeImpl
708795b5
DW
31{
32public:
33 // ctor
34 wxFileTypeImpl() { m_info = NULL; }
35
36 // one of these Init() function must be called (ctor can't take any
37 // arguments because it's common)
38
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; }
43
44 // initialize us with a wxFileTypeInfo object - it contains all the
45 // data
46 void Init(const wxFileTypeInfo& info)
47 { m_info = &info; }
48
49 // implement accessor functions
50 bool GetExtensions(wxArrayString& extensions);
51 bool GetMimeType(wxString *mimeType) const;
2a6b16e3 52 bool GetMimeTypes(wxArrayString& mimeTypes) const;
a1541f5f 53 bool GetIcon(wxIconLocation *iconLoc) const;
708795b5
DW
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;
59
a2cd9b86
SN
60 size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
61 const wxFileType::MessageParameters& params) const;
62
63 bool Unassociate();
64
65 // set an arbitrary command, ask confirmation if it already exists and
66 // overwriteprompt is TRUE
67 bool SetCommand(const wxString& cmd,
68 const wxString& verb,
69 bool overwriteprompt = TRUE);
70
71 bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
72
73 // this is called by Associate
74 bool SetDescription (const wxString& desc);
75
708795b5
DW
76private:
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;
80
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
84 m_ext;
85};
86
87
88
a1541f5f 89class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
708795b5
DW
90{
91public:
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() { }
95
96 // implement containing class functions
97 wxFileType *GetFileTypeFromExtension(const wxString& ext);
a2cd9b86 98 wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext);
708795b5
DW
99 wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
100
101 size_t EnumAllFileTypes(wxArrayString& mimetypes);
102
a1541f5f 103 // these are NOPs under OS/2
708795b5
DW
104 bool ReadMailcap(const wxString& filename, bool fallback = TRUE)
105 { return TRUE; }
106 bool ReadMimeTypes(const wxString& filename)
107 { return TRUE; }
108
109 void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
110
111private:
112 wxArrayFileTypeInfo m_fallbacks;
113};
114
a1541f5f 115#endif // wxUSE_MIMETYPE
708795b5
DW
116
117#endif
118 //_MIMETYPE_IMPL_H
119