]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fs_mem.h
#4479: wx.ComboBox needs a SetFont method
[wxWidgets.git] / include / wx / fs_mem.h
CommitLineData
dcb86da0
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: fs_mem.h
3// Purpose: in-memory file system
4// Author: Vaclav Slavik
5// Copyright: (c) 2000 Vaclav Slavik
65571936 6// Licence: wxWindows licence
dcb86da0
VS
7/////////////////////////////////////////////////////////////////////////////
8
4e8e18e2
VZ
9#ifndef _WX_FS_MEM_H_
10#define _WX_FS_MEM_H_
dcb86da0 11
372c511b 12#include "wx/defs.h"
dcb86da0 13
24528b0c 14#if wxUSE_FILESYSTEM
dcb86da0 15
dcb86da0 16#include "wx/filesys.h"
04dbb646 17
886dd7d2 18#if wxUSE_GUI
f92ef853 19 #include "wx/bitmap.h"
886dd7d2 20#endif // wxUSE_GUI
dcb86da0 21
a8f12b67
VZ
22// ----------------------------------------------------------------------------
23// wxMemoryFSHandlerBase
24// ----------------------------------------------------------------------------
dcb86da0 25
bddd7a8d 26class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
dcb86da0 27{
e2478fde
VZ
28public:
29 wxMemoryFSHandlerBase();
d3c7fc99 30 virtual ~wxMemoryFSHandlerBase();
dcb86da0 31
e2478fde
VZ
32 // Add file to list of files stored in memory. Stored data (bitmap, text or
33 // raw data) will be copied into private memory stream and available under
34 // name "memory:" + filename
e2478fde
VZ
35 static void AddFile(const wxString& filename, const wxString& textdata);
36 static void AddFile(const wxString& filename, const void *binarydata, size_t size);
c5d7b81e
VS
37 static void AddFileWithMimeType(const wxString& filename,
38 const wxString& textdata,
39 const wxString& mimetype);
40 static void AddFileWithMimeType(const wxString& filename,
41 const void *binarydata, size_t size,
42 const wxString& mimetype);
04dbb646 43
e2478fde
VZ
44 // Remove file from memory FS and free occupied memory
45 static void RemoveFile(const wxString& filename);
04dbb646 46
e2478fde
VZ
47 virtual bool CanOpen(const wxString& location);
48 virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
49 virtual wxString FindFirst(const wxString& spec, int flags = 0);
50 virtual wxString FindNext();
04dbb646 51
60c0a8db 52protected:
e2478fde 53 static bool CheckHash(const wxString& filename);
60c0a8db 54 static wxHashTable *m_Hash;
dcb86da0
VS
55};
56
a8f12b67
VZ
57// ----------------------------------------------------------------------------
58// wxMemoryFSHandler
59// ----------------------------------------------------------------------------
60
61#if wxUSE_GUI
62
63// add GUI-only operations to the base class
64class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
e2478fde
VZ
65{
66public:
a8f12b67
VZ
67 // bring the base class versions into the scope, otherwise they would be
68 // inaccessible in wxMemoryFSHandler
192a6c88
VZ
69 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
70 static void AddFile(const wxString& filename, const wxString& textdata)
71 {
72 wxMemoryFSHandlerBase::AddFile(filename, textdata);
73 }
74
75 static void AddFile(const wxString& filename,
76 const void *binarydata,
77 size_t size)
78 {
79 wxMemoryFSHandlerBase::AddFile(filename, binarydata, size);
80 }
c5d7b81e
VS
81 static void AddFileWithMimeType(const wxString& filename,
82 const wxString& textdata,
83 const wxString& mimetype)
84 {
85 wxMemoryFSHandlerBase::AddFileWithMimeType(filename,
86 textdata,
87 mimetype);
88 }
89 static void AddFileWithMimeType(const wxString& filename,
90 const void *binarydata, size_t size,
91 const wxString& mimetype)
92 {
93 wxMemoryFSHandlerBase::AddFileWithMimeType(filename,
94 binarydata, size,
95 mimetype);
96 }
a8f12b67 97
2de5a6ee 98#if wxUSE_IMAGE
989a2421
VZ
99 static void AddFile(const wxString& filename,
100 const wxImage& image,
d75a69e8 101 wxBitmapType type);
a8f12b67 102
192a6c88
VZ
103 static void AddFile(const wxString& filename,
104 const wxBitmap& bitmap,
d75a69e8 105 wxBitmapType type);
1904aa72
DS
106#endif // wxUSE_IMAGE
107
e2478fde 108};
dcb86da0 109
a8f12b67
VZ
110#else // !wxUSE_GUI
111
112// just the same thing as the base class in wxBase
113class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
114{
115};
116
117#endif // wxUSE_GUI/!wxUSE_GUI
118
e2478fde 119#endif // wxUSE_FILESYSTEM
dcb86da0 120
4e8e18e2
VZ
121#endif // _WX_FS_MEM_H_
122