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