]> git.saurik.com Git - wxWidgets.git/blame - interface/fs_mem.h
suppress unused parameter warning in release build
[wxWidgets.git] / interface / fs_mem.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: fs_mem.h
e54c96f1 3// Purpose: interface of wxMemoryFSHandler
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxMemoryFSHandler
11 @wxheader{fs_mem.h}
7c913512
FM
12
13 This wxFileSystem handler can store arbitrary
23324ae1
FM
14 data in memory stream and make them accessible via URL. It is particularly
15 suitable for storing bitmaps from resources or included XPM files so that
16 they can be used with wxHTML.
7c913512 17
23324ae1 18 Filenames are prefixed with "memory:", e.g. "memory:myfile.html".
7c913512 19
23324ae1 20 Example:
7c913512 21
23324ae1
FM
22 @code
23 #ifndef __WXMSW__
24 #include "logo.xpm"
25 #endif
7c913512 26
23324ae1
FM
27 void MyFrame::OnAbout(wxCommandEvent&)
28 {
29 wxBusyCursor bcur;
30 wxFileSystem::AddHandler(new wxMemoryFSHandler);
31 wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
7c913512 32 wxMemoryFSHandler::AddFile("about.htm",
23324ae1
FM
33 "htmlbodyAbout: "
34 "img src=\"memory:logo.pcx\"/body/html");
7c913512 35
23324ae1
FM
36 wxDialog dlg(this, -1, wxString(_("About")));
37 wxBoxSizer *topsizer;
38 wxHtmlWindow *html;
39 topsizer = new wxBoxSizer(wxVERTICAL);
7c913512 40 html = new wxHtmlWindow(, -1, wxDefaultPosition,
23324ae1
FM
41 wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
42 html-SetBorders(0);
43 html-LoadPage("memory:about.htm");
7c913512 44 html-SetSize(html-GetInternalRepresentation()-GetWidth(),
23324ae1
FM
45 html-GetInternalRepresentation()-GetHeight());
46 topsizer-Add(html, 1, wxALL, 10);
47 topsizer-Add(new wxStaticLine(, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
7c913512 48 topsizer-Add(new wxButton(, wxID_OK, "Ok"),
23324ae1
FM
49 0, wxALL | wxALIGN_RIGHT, 15);
50 dlg.SetAutoLayout(@true);
51 dlg.SetSizer(topsizer);
52 topsizer-Fit();
53 dlg.Centre();
54 dlg.ShowModal();
7c913512 55
23324ae1
FM
56 wxMemoryFSHandler::RemoveFile("logo.pcx");
57 wxMemoryFSHandler::RemoveFile("about.htm");
58 }
59 @endcode
7c913512 60
23324ae1
FM
61 @library{wxbase}
62 @category{FIXME}
7c913512 63
e54c96f1 64 @see wxMemoryFSHandler::AddFileWithMimeType
23324ae1
FM
65*/
66class wxMemoryFSHandler : public wxFileSystemHandler
67{
68public:
69 /**
70 Constructor.
71 */
72 wxMemoryFSHandler();
73
74 //@{
75 /**
7c913512 76 Add file to list of files stored in memory. Stored
23324ae1 77 data (bitmap, text or raw data)
7c913512 78 will be copied into private memory stream and available under
23324ae1 79 name "memory:" + @e filename.
4cc4bfaf
FM
80 The @a type argument is one of @c wxBITMAP_TYPE_XXX constants.
81 Note that you must use a @a type value (aka image format)
23324ae1 82 that wxWidgets can save (e.g. JPG, PNG, see wxImage
e54c96f1 83 documentation())!
3c4f71cc 84
4cc4bfaf 85 @see AddFileWithMimeType()
23324ae1
FM
86 */
87 static void AddFile(const wxString& filename, wxImage& image,
88 long type);
7c913512
FM
89 static void AddFile(const wxString& filename,
90 const wxBitmap& bitmap,
91 long type);
23324ae1
FM
92 //@}
93
94 //@{
95 /**
96 Like AddFile(), but lets you explicitly
97 specify added file's MIME type. This version should be used whenever you know
98 the MIME type, because it makes accessing the files faster.
3c4f71cc 99
e54c96f1 100 @wxsince{2.8.5}
3c4f71cc 101
4cc4bfaf 102 @see AddFile()
23324ae1
FM
103 */
104 static void AddFileWithMimeType(const wxString& filename,
105 const wxString& textdata,
106 const wxString& mimetype);
7c913512
FM
107 static void AddFileWithMimeType(const wxString& filename,
108 const void* binarydata,
109 size_t size,
110 const wxString& mimetype);
23324ae1
FM
111 //@}
112
113 /**
114 Remove file from memory FS and free occupied memory.
115 */
116 static void RemoveFile(const wxString& filename);
117};
e54c96f1 118