]>
git.saurik.com Git - wxWidgets.git/blob - interface/fs_mem.h
ab950988b9c19e83e69d3683140618839c41b489
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxMemoryFSHandler class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxMemoryFSHandler
13 This wxFileSystem handler can store arbitrary
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.
18 Filenames are prefixed with "memory:", e.g. "memory:myfile.html".
27 void MyFrame::OnAbout(wxCommandEvent&)
30 wxFileSystem::AddHandler(new wxMemoryFSHandler);
31 wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
32 wxMemoryFSHandler::AddFile("about.htm",
34 "img src=\"memory:logo.pcx\"/body/html");
36 wxDialog dlg(this, -1, wxString(_("About")));
39 topsizer = new wxBoxSizer(wxVERTICAL);
40 html = new wxHtmlWindow(, -1, wxDefaultPosition,
41 wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
43 html-LoadPage("memory:about.htm");
44 html-SetSize(html-GetInternalRepresentation()-GetWidth(),
45 html-GetInternalRepresentation()-GetHeight());
46 topsizer-Add(html, 1, wxALL, 10);
47 topsizer-Add(new wxStaticLine(, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
48 topsizer-Add(new wxButton(, wxID_OK, "Ok"),
49 0, wxALL | wxALIGN_RIGHT, 15);
50 dlg.SetAutoLayout(@true);
51 dlg.SetSizer(topsizer);
56 wxMemoryFSHandler::RemoveFile("logo.pcx");
57 wxMemoryFSHandler::RemoveFile("about.htm");
65 wxMemoryFSHandler::AddFileWithMimeType
67 class wxMemoryFSHandler
: public wxFileSystemHandler
77 Add file to list of files stored in memory. Stored
78 data (bitmap, text or raw data)
79 will be copied into private memory stream and available under
80 name "memory:" + @e filename.
82 The @e type argument is one of @c wxBITMAP_TYPE_XXX constants.
83 Note that you must use a @e type value (aka image format)
84 that wxWidgets can save (e.g. JPG, PNG, see wxImage
87 @sa AddFileWithMimeType()
89 static void AddFile(const wxString
& filename
, wxImage
& image
,
91 static void AddFile(const wxString
& filename
,
92 const wxBitmap
& bitmap
,
98 Like AddFile(), but lets you explicitly
99 specify added file's MIME type. This version should be used whenever you know
100 the MIME type, because it makes accessing the files faster.
102 This function is new since wxWidgets version 2.8.5
106 static void AddFileWithMimeType(const wxString
& filename
,
107 const wxString
& textdata
,
108 const wxString
& mimetype
);
109 static void AddFileWithMimeType(const wxString
& filename
,
110 const void* binarydata
,
112 const wxString
& mimetype
);
116 Remove file from memory FS and free occupied memory.
118 static void RemoveFile(const wxString
& filename
);