]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fs_mem.h
removed not implemented anyhow SetIcons()
[wxWidgets.git] / include / wx / fs_mem.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fs_mem.h
3 // Purpose: in-memory file system
4 // Author: Vaclav Slavik
5 // Copyright: (c) 2000 Vaclav Slavik
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef _WX_FS_MEM_H_
10 #define _WX_FS_MEM_H_
11
12 #include "wx/defs.h"
13
14 #if wxUSE_FILESYSTEM
15
16 #include "wx/filesys.h"
17
18 #if wxUSE_GUI
19 class WXDLLIMPEXP_FWD_CORE wxBitmap;
20 class WXDLLIMPEXP_FWD_CORE wxImage;
21 #endif // wxUSE_GUI
22
23 // ----------------------------------------------------------------------------
24 // wxMemoryFSHandlerBase
25 // ----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
28 {
29 public:
30 wxMemoryFSHandlerBase();
31 virtual ~wxMemoryFSHandlerBase();
32
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
36 static void AddFile(const wxString& filename, const wxString& textdata);
37 static void AddFile(const wxString& filename, const void *binarydata, size_t size);
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);
44
45 // Remove file from memory FS and free occupied memory
46 static void RemoveFile(const wxString& filename);
47
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();
52
53 protected:
54 static bool CheckHash(const wxString& filename);
55 static wxHashTable *m_Hash;
56 };
57
58 // ----------------------------------------------------------------------------
59 // wxMemoryFSHandler
60 // ----------------------------------------------------------------------------
61
62 #if wxUSE_GUI
63
64 // add GUI-only operations to the base class
65 class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
66 {
67 public:
68 // bring the base class versions into the scope, otherwise they would be
69 // inaccessible in wxMemoryFSHandler
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 }
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 }
98
99 #if wxUSE_IMAGE
100 static void AddFile(const wxString& filename,
101 const wxImage& image,
102 long type);
103
104 static void AddFile(const wxString& filename,
105 const wxBitmap& bitmap,
106 long type);
107 #endif // wxUSE_IMAGE
108
109 };
110
111 #else // !wxUSE_GUI
112
113 // just the same thing as the base class in wxBase
114 class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
115 {
116 };
117
118 #endif // wxUSE_GUI/!wxUSE_GUI
119
120 #endif // wxUSE_FILESYSTEM
121
122 #endif // _WX_FS_MEM_H_
123