]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fs_mem.h
Revert my last commit, GetClientAreaOrigin was already implemented
[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
e4844687
SN
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
13// Some older compilers (such as EMX) cannot handle
a62848fd 14// #pragma interface/implementation correctly, iff
e4844687
SN
15// #pragma implementation is used in _two_ translation
16// units (as created by e.g. event.cpp compiled for
17// libwx_base and event.cpp compiled for libwx_gui_core).
18// So we must not use those pragmas for those compilers in
19// such files.
c3f4609e 20#pragma interface "fs_mem.h"
dcb86da0
VS
21#endif
22
372c511b 23#include "wx/defs.h"
dcb86da0 24
24528b0c 25#if wxUSE_FILESYSTEM
dcb86da0 26
dcb86da0 27#include "wx/filesys.h"
04dbb646 28
886dd7d2 29#if wxUSE_GUI
bddd7a8d
VZ
30 class WXDLLIMPEXP_CORE wxBitmap;
31 class WXDLLIMPEXP_CORE wxImage;
886dd7d2 32#endif // wxUSE_GUI
dcb86da0 33
a8f12b67
VZ
34// ----------------------------------------------------------------------------
35// wxMemoryFSHandlerBase
36// ----------------------------------------------------------------------------
dcb86da0 37
bddd7a8d 38class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
dcb86da0 39{
e2478fde
VZ
40public:
41 wxMemoryFSHandlerBase();
42 ~wxMemoryFSHandlerBase();
dcb86da0 43
e2478fde
VZ
44 // Add file to list of files stored in memory. Stored data (bitmap, text or
45 // raw data) will be copied into private memory stream and available under
46 // name "memory:" + filename
e2478fde
VZ
47 static void AddFile(const wxString& filename, const wxString& textdata);
48 static void AddFile(const wxString& filename, const void *binarydata, size_t size);
04dbb646 49
e2478fde
VZ
50 // Remove file from memory FS and free occupied memory
51 static void RemoveFile(const wxString& filename);
04dbb646 52
e2478fde
VZ
53 virtual bool CanOpen(const wxString& location);
54 virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
55 virtual wxString FindFirst(const wxString& spec, int flags = 0);
56 virtual wxString FindNext();
04dbb646 57
60c0a8db 58protected:
e2478fde 59 static bool CheckHash(const wxString& filename);
60c0a8db 60 static wxHashTable *m_Hash;
dcb86da0
VS
61};
62
a8f12b67
VZ
63// ----------------------------------------------------------------------------
64// wxMemoryFSHandler
65// ----------------------------------------------------------------------------
66
67#if wxUSE_GUI
68
69// add GUI-only operations to the base class
70class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
e2478fde
VZ
71{
72public:
a8f12b67
VZ
73 // bring the base class versions into the scope, otherwise they would be
74 // inaccessible in wxMemoryFSHandler
192a6c88
VZ
75 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
76 static void AddFile(const wxString& filename, const wxString& textdata)
77 {
78 wxMemoryFSHandlerBase::AddFile(filename, textdata);
79 }
80
81 static void AddFile(const wxString& filename,
82 const void *binarydata,
83 size_t size)
84 {
85 wxMemoryFSHandlerBase::AddFile(filename, binarydata, size);
86 }
a8f12b67 87
2de5a6ee 88#if wxUSE_IMAGE
989a2421
VZ
89 static void AddFile(const wxString& filename,
90 const wxImage& image,
91 long type);
a8f12b67 92
192a6c88
VZ
93 static void AddFile(const wxString& filename,
94 const wxBitmap& bitmap,
95 long type);
1904aa72
DS
96#endif // wxUSE_IMAGE
97
e2478fde 98};
dcb86da0 99
a8f12b67
VZ
100#else // !wxUSE_GUI
101
102// just the same thing as the base class in wxBase
103class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
104{
105};
106
107#endif // wxUSE_GUI/!wxUSE_GUI
108
e2478fde 109#endif // wxUSE_FILESYSTEM
dcb86da0 110
4e8e18e2
VZ
111#endif // _WX_FS_MEM_H_
112