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