File: fs_mem.tex

package info (click to toggle)
wxwidgets2.8 2.8.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 239,052 kB
  • ctags: 289,550
  • sloc: cpp: 1,838,857; xml: 396,717; python: 282,506; ansic: 126,171; makefile: 51,406; sh: 14,581; asm: 299; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 39; lisp: 38; tcl: 24; haskell: 20; java: 18; cs: 18; erlang: 17; ruby: 16; ada: 9; ml: 9; csh: 9
file content (117 lines) | stat: -rw-r--r-- 3,901 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
%
% automatically generated by HelpGen from
% /home/vasek/fs\_mem.h at 27/Feb/00 19:23:10
%

\section{\class{wxMemoryFSHandler}}\label{wxmemoryfshandler}

This \helpref{wxFileSystem}{wxfilesystem} handler can store arbitrary 
data in memory stream and make them accessible via URL. It is particularly
suitable for storing bitmaps from resources or included XPM files so that
they can be used with wxHTML.

Filenames are prefixed with "memory:", e.g. "memory:myfile.html".

Example:

\begin{verbatim}
#ifndef __WXMSW__
#include "logo.xpm"
#endif

void MyFrame::OnAbout(wxCommandEvent&)
{
    wxBusyCursor bcur;
    wxFileSystem::AddHandler(new wxMemoryFSHandler);
    wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
    wxMemoryFSHandler::AddFile("about.htm", 
                               "<html><body>About: "
                               "<img src=\"memory:logo.pcx\"></body></html>");

    wxDialog dlg(this, -1, wxString(_("About")));
    wxBoxSizer *topsizer;
    wxHtmlWindow *html;
    topsizer = new wxBoxSizer(wxVERTICAL);
    html = new wxHtmlWindow(&dlg, -1, wxDefaultPosition, 
                            wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
    html->SetBorders(0);
    html->LoadPage("memory:about.htm");
    html->SetSize(html->GetInternalRepresentation()->GetWidth(), 
                  html->GetInternalRepresentation()->GetHeight());
    topsizer->Add(html, 1, wxALL, 10);
    topsizer->Add(new wxStaticLine(&dlg, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
    topsizer->Add(new wxButton(&dlg, wxID_OK, "Ok"), 
                  0, wxALL | wxALIGN_RIGHT, 15);
    dlg.SetAutoLayout(true);
    dlg.SetSizer(topsizer);
    topsizer->Fit(&dlg);
    dlg.Centre();
    dlg.ShowModal();
    
    wxMemoryFSHandler::RemoveFile("logo.pcx");
    wxMemoryFSHandler::RemoveFile("about.htm");
}
\end{verbatim}


\wxheading{Derived from}

\helpref{wxFileSystemHandler}{wxfilesystemhandler}

\wxheading{Include files}

<wx/fs\_mem.h>


\latexignore{\rtfignore{\wxheading{Members}}}


\membersection{wxMemoryFSHandler::wxMemoryFSHandler}\label{wxmemoryfshandlerwxmemoryfshandler}

\func{}{wxMemoryFSHandler}{\void}

Constructor.

\membersection{wxMemoryFSHandler::AddFile}\label{wxmemoryfshandleraddfile}

\func{static void}{AddFile}{\param{const wxString\& }{filename}, \param{wxImage\& }{image}, \param{long }{type}}

\func{static void}{AddFile}{\param{const wxString\& }{filename}, \param{const wxBitmap\& }{bitmap}, \param{long }{type}}

Add file to list of files stored in memory. Stored 
data (bitmap, text or raw data)
will be copied into private memory stream and available under 
name "memory:" + \arg{filename}.

The \arg{type} argument is one of {\tt wxBITMAP\_TYPE\_XXX} constants.
Note that you must use a \arg{type} value (aka image format)
that wxWidgets can save (e.g. JPG, PNG, see \helpref{wxImage
documentation}{wximage})!

\wxheading{See also}

\helpref{AddFileWithMimeType}{wxmemoryfshandleraddfilewithmimetype}


\membersection{wxMemoryFSHandler::AddFileWithMimeType}\label{wxmemoryfshandleraddfilewithmimetype}

\func{static void}{AddFileWithMimeType}{\param{const wxString\& }{filename}, \param{const wxString\& }{textdata}, \param{const wxString\& }{mimetype}}

\func{static void}{AddFileWithMimeType}{\param{const wxString\& }{filename}, \param{const void* }{binarydata}, \param{size\_t }{size}, \param{const wxString\& }{mimetype}}

Like \helpref{AddFile}{wxmemoryfshandleraddfile}, but lets you explicitly
specify added file's MIME type. This version should be used whenever you know
the MIME type, because it makes accessing the files faster.

\newsince{2.8.5}

\wxheading{See also}

\helpref{AddFile}{wxmemoryfshandleraddfile}

\membersection{wxMemoryFSHandler::RemoveFile}\label{wxmemoryfshandlerremovefile}

\func{static void}{RemoveFile}{\param{const wxString\& }{filename}}

Remove file from memory FS and free occupied memory.