]>
Commit | Line | Data |
---|---|---|
dbddf573 VS |
1 | % |
2 | % automatically generated by HelpGen from | |
3 | % /home/vasek/fs\_mem.h at 27/Feb/00 19:23:10 | |
4 | % | |
5 | ||
6 | \section{\class{wxMemoryFSHandler}}\label{wxmemoryfshandler} | |
7 | ||
8 | This \helpref{wxFileSystem}{wxfilesystem} handler can store arbitrary | |
9 | data in memory stream and make them accessible via URL. It is particularly | |
10 | suitable for storing bitmaps from resources or included XPM files so that | |
11 | they can be used with wxHTML. | |
12 | ||
13 | Filenames are prefixed with "memory:", e.g. "memory:myfile.html". | |
14 | ||
15 | Example: | |
16 | ||
17 | \begin{verbatim} | |
18 | #ifndef __WXMSW__ | |
19 | #include "logo.xpm" | |
20 | #endif | |
21 | ||
22 | void MyFrame::OnAbout(wxCommandEvent&) | |
23 | { | |
24 | wxBusyCursor bcur; | |
2b5f62a0 | 25 | wxFileSystem::AddHandler(new wxMemoryFSHandler); |
dbddf573 VS |
26 | wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX); |
27 | wxMemoryFSHandler::AddFile("about.htm", | |
28 | "<html><body>About: " | |
29 | "<img src=\"memory:logo.pcx\"></body></html>"); | |
30 | ||
31 | wxDialog dlg(this, -1, wxString(_("About"))); | |
32 | wxBoxSizer *topsizer; | |
33 | wxHtmlWindow *html; | |
34 | topsizer = new wxBoxSizer(wxVERTICAL); | |
35 | html = new wxHtmlWindow(&dlg, -1, wxDefaultPosition, | |
36 | wxSize(380, 160), wxHW_SCROLLBAR_NEVER); | |
37 | html->SetBorders(0); | |
38 | html->LoadPage("memory:about.htm"); | |
39 | html->SetSize(html->GetInternalRepresentation()->GetWidth(), | |
40 | html->GetInternalRepresentation()->GetHeight()); | |
41 | topsizer->Add(html, 1, wxALL, 10); | |
42 | topsizer->Add(new wxStaticLine(&dlg, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10); | |
43 | topsizer->Add(new wxButton(&dlg, wxID_OK, "Ok"), | |
44 | 0, wxALL | wxALIGN_RIGHT, 15); | |
45 | dlg.SetAutoLayout(true); | |
46 | dlg.SetSizer(topsizer); | |
47 | topsizer->Fit(&dlg); | |
48 | dlg.Centre(); | |
49 | dlg.ShowModal(); | |
50 | ||
51 | wxMemoryFSHandler::RemoveFile("logo.pcx"); | |
52 | wxMemoryFSHandler::RemoveFile("about.htm"); | |
53 | } | |
54 | \end{verbatim} | |
55 | ||
56 | ||
57 | \wxheading{Derived from} | |
58 | ||
59 | \helpref{wxFileSystemHandler}{wxfilesystemhandler} | |
60 | ||
61 | \wxheading{Include files} | |
62 | ||
e7240349 | 63 | <wx/fs\_mem.h> |
dbddf573 | 64 | |
a7af285d VZ |
65 | \wxheading{Library} |
66 | ||
67 | \helpref{wxBase}{librarieslist} | |
68 | ||
dbddf573 VS |
69 | |
70 | \latexignore{\rtfignore{\wxheading{Members}}} | |
71 | ||
72 | ||
73 | \membersection{wxMemoryFSHandler::wxMemoryFSHandler}\label{wxmemoryfshandlerwxmemoryfshandler} | |
74 | ||
75 | \func{}{wxMemoryFSHandler}{\void} | |
76 | ||
77 | Constructor. | |
78 | ||
79 | \membersection{wxMemoryFSHandler::AddFile}\label{wxmemoryfshandleraddfile} | |
80 | ||
81 | \func{static void}{AddFile}{\param{const wxString\& }{filename}, \param{wxImage\& }{image}, \param{long }{type}} | |
82 | ||
83 | \func{static void}{AddFile}{\param{const wxString\& }{filename}, \param{const wxBitmap\& }{bitmap}, \param{long }{type}} | |
84 | ||
dbddf573 VS |
85 | Add file to list of files stored in memory. Stored |
86 | data (bitmap, text or raw data) | |
87 | will be copied into private memory stream and available under | |
54ab3bb8 | 88 | name "memory:" + \arg{filename}. |
dbddf573 | 89 | |
54ab3bb8 VS |
90 | The \arg{type} argument is one of {\tt wxBITMAP\_TYPE\_XXX} constants. |
91 | Note that you must use a \arg{type} value (aka image format) | |
92 | that wxWidgets can save (e.g. JPG, PNG, see \helpref{wxImage | |
93 | documentation}{wximage})! | |
dbddf573 | 94 | |
35fc0be7 VS |
95 | \wxheading{See also} |
96 | ||
97 | \helpref{AddFileWithMimeType}{wxmemoryfshandleraddfilewithmimetype} | |
98 | ||
99 | ||
100 | \membersection{wxMemoryFSHandler::AddFileWithMimeType}\label{wxmemoryfshandleraddfilewithmimetype} | |
101 | ||
102 | \func{static void}{AddFileWithMimeType}{\param{const wxString\& }{filename}, \param{const wxString\& }{textdata}, \param{const wxString\& }{mimetype}} | |
103 | ||
104 | \func{static void}{AddFileWithMimeType}{\param{const wxString\& }{filename}, \param{const void* }{binarydata}, \param{size\_t }{size}, \param{const wxString\& }{mimetype}} | |
105 | ||
106 | Like \helpref{AddFile}{wxmemoryfshandleraddfile}, but lets you explicitly | |
107 | specify added file's MIME type. This version should be used whenever you know | |
108 | the MIME type, because it makes accessing the files faster. | |
109 | ||
110 | \newsince{2.8.5} | |
111 | ||
112 | \wxheading{See also} | |
113 | ||
114 | \helpref{AddFile}{wxmemoryfshandleraddfile} | |
dbddf573 VS |
115 | |
116 | \membersection{wxMemoryFSHandler::RemoveFile}\label{wxmemoryfshandlerremovefile} | |
117 | ||
118 | \func{static void}{RemoveFile}{\param{const wxString\& }{filename}} | |
119 | ||
120 | Remove file from memory FS and free occupied memory. | |
121 |