]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/mimetype.h
Adapted SetData function to common API (taking a reference
[wxWidgets.git] / include / wx / mac / mimetype.h
CommitLineData
7dc3cc31
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mac/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
4b6ed6bc
GD
15#ifdef __GNUG__
16 #pragma interface "mimetype.h"
17#endif
7dc3cc31
VS
18
19#include "wx/defs.h"
20#include "wx/mimetype.h"
21
22
7dc3cc31
VS
23class wxMimeTypesManagerImpl
24{
25public :
26 wxMimeTypesManagerImpl() { }
4b6ed6bc
GD
27#ifdef __WXMAC_X__
28 ~wxMimeTypesManagerImpl() { }
29#endif
30
7dc3cc31
VS
31 // implement containing class functions
32 wxFileType *GetFileTypeFromExtension(const wxString& ext);
03e11df5 33 wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ;
7dc3cc31
VS
34 wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
35
36 size_t EnumAllFileTypes(wxArrayString& mimetypes);
37
38 // this are NOPs under MacOS
39 bool ReadMailcap(const wxString& filename, bool fallback = TRUE) { return TRUE; }
40 bool ReadMimeTypes(const wxString& filename) { return TRUE; }
41
42 void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); }
43
03e11df5
GD
44 // create a new filetype association
45 wxFileType *Associate(const wxFileTypeInfo& ftInfo);
46
47 // create a new filetype with the given name and extension
48 wxFileType *CreateFileType(const wxString& filetype, const wxString& ext);
49
7dc3cc31
VS
50private:
51 wxArrayFileTypeInfo m_fallbacks;
52};
53
54class wxFileTypeImpl
55{
56public:
57 // initialize us with our file type name
58 void SetFileType(const wxString& strFileType)
59 { m_strFileType = strFileType; }
60 void SetExt(const wxString& ext)
61 { m_ext = ext; }
62
63 // implement accessor functions
64 bool GetExtensions(wxArrayString& extensions);
65 bool GetMimeType(wxString *mimeType) const;
4d2976ad 66 bool GetMimeTypes(wxArrayString& mimeTypes) const;
7dc3cc31
VS
67 bool GetIcon(wxIcon *icon) const;
68 bool GetDescription(wxString *desc) const;
69 bool GetOpenCommand(wxString *openCmd,
70 const wxFileType::MessageParameters&) const
71 { return GetCommand(openCmd, "open"); }
72 bool GetPrintCommand(wxString *printCmd,
73 const wxFileType::MessageParameters&) const
74 { return GetCommand(printCmd, "print"); }
75
03e11df5
GD
76 size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
77 const wxFileType::MessageParameters& params) const;
78
79 bool Unassociate();
80
7dc3cc31
VS
81private:
82 // helper function
83 bool GetCommand(wxString *command, const char *verb) const;
84
85 wxString m_strFileType, m_ext;
86};
87
88
89
90#endif
91 //_MIMETYPE_H
92
93/* vi: set cin tw=80 ts=4 sw=4: */