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