]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/mimetype.h
A no-change for scroll events.
[wxWidgets.git] / include / wx / msw / mimetype.h
CommitLineData
7dc3cc31
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mimetype.h
3// Purpose: classes and functions to manage MIME types
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 23.09.98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9// Licence: wxWindows license (part of wxExtra library)
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _MIMETYPE_IMPL_H
13#define _MIMETYPE_IMPL_H
14
15#ifdef __GNUG__
16#pragma interface "mimetype.h"
17#endif
18
19#include "wx/defs.h"
20
21#include "wx/mimetype.h"
22
23
24class WXDLLEXPORT wxFileTypeImpl
25{
26public:
27 // ctor
28 wxFileTypeImpl() { m_info = NULL; }
29
30 // one of these Init() function must be called (ctor can't take any
31 // arguments because it's common)
32
33 // initialize us with our file type name and extension - in this case
34 // we will read all other data from the registry
35 void Init(const wxString& strFileType, const wxString& ext)
36 { m_strFileType = strFileType; m_ext = ext; }
37
38 // initialize us with a wxFileTypeInfo object - it contains all the
39 // data
40 void Init(const wxFileTypeInfo& info)
41 { m_info = &info; }
42
43 // implement accessor functions
44 bool GetExtensions(wxArrayString& extensions);
45 bool GetMimeType(wxString *mimeType) const;
46 bool GetIcon(wxIcon *icon) const;
47 bool GetDescription(wxString *desc) const;
48 bool GetOpenCommand(wxString *openCmd,
49 const wxFileType::MessageParameters& params) const;
50 bool GetPrintCommand(wxString *printCmd,
51 const wxFileType::MessageParameters& params) const;
52
53private:
54 // helper function: reads the command corresponding to the specified verb
55 // from the registry (returns an empty string if not found)
56 wxString GetCommand(const wxChar *verb) const;
57
58 // we use either m_info or read the data from the registry if m_info == NULL
59 const wxFileTypeInfo *m_info;
60 wxString m_strFileType, // may be empty
61 m_ext;
62};
63
64
65
66class WXDLLEXPORT wxMimeTypesManagerImpl
67{
68public:
69 // nothing to do here, we don't load any data but just go and fetch it from
70 // the registry when asked for
71 wxMimeTypesManagerImpl() { }
72
73 // implement containing class functions
74 wxFileType *GetFileTypeFromExtension(const wxString& ext);
75 wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
76
77 size_t EnumAllFileTypes(wxArrayString& mimetypes);
78
79 // this are NOPs under Windows
80 bool ReadMailcap(const wxString& filename, bool fallback = TRUE)
81 { return TRUE; }
82 bool ReadMimeTypes(const wxString& filename)
83 { return TRUE; }
84
85 void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
86
87private:
88 wxArrayFileTypeInfo m_fallbacks;
89};
90
91
92#endif
93 //_MIMETYPE_IMPL_H
94