|
Version: 3.0.5
|
#include </home/Hamish/wxwidgets/wxWidgets3.0-3.0.5.1-1.src/wxWidgets3.0-3.0.5.1-1.i686/src/wxWidgets-3.0.5.1/interface/wx/fs_mem.h>
This wxFileSystem handler can store arbitrary data in memory stream and make them accessible via an URL.
It is particularly suitable for storing bitmaps from resources or included XPM files so that they can be used with wxHTML or wxWebView.
Filenames are prefixed with "memory:"
, e.g. "memory:myfile.html"
.
Example:
#ifndef __WXMSW__
#include "logo.xpm"
#endif
{
"<html><body>About: "
"<img src=\"memory:logo.png\"></body></html>");
#ifdef USE_WEBVIEW
browser->
LoadURL(
"memory:about.htm");
#else // Use wxHtml
#endif
dlg.SetAutoLayout(true);
dlg.Centre();
dlg.ShowModal();
}
<>< =''>:</>&;&;< =''>\ </></>
- See also
- wxMemoryFSHandler::AddFileWithMimeType
|
| wxMemoryFSHandler () |
| Constructor. More...
|
|
Public Member Functions inherited from wxFileSystemHandler |
| wxFileSystemHandler () |
| Constructor. More...
|
|
virtual bool | CanOpen (const wxString &location)=0 |
| Returns true if the handler is able to open this file. More...
|
|
virtual wxString | FindFirst (const wxString &wildcard, int flags=0) |
| Works like wxFindFirstFile(). More...
|
|
virtual wxString | FindNext () |
| Returns next filename that matches parameters passed to wxFileSystem::FindFirst. More...
|
|
virtual wxFSFile * | OpenFile (wxFileSystem &fs, const wxString &location)=0 |
| Opens the file and returns wxFSFile pointer or NULL if failed. More...
|
|
| wxObject () |
| Default ctor; initializes to NULL the internal reference data. More...
|
|
| wxObject (const wxObject &other) |
| Copy ctor. More...
|
|
virtual | ~wxObject () |
| Destructor. More...
|
|
virtual wxClassInfo * | GetClassInfo () const |
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
|
|
wxObjectRefData * | GetRefData () const |
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
|
|
bool | IsKindOf (const wxClassInfo *info) const |
| Determines whether this class is a subclass of (or the same class as) the given class. More...
|
|
bool | IsSameAs (const wxObject &obj) const |
| Returns true if this object has the same data pointer as obj. More...
|
|
void | Ref (const wxObject &clone) |
| Makes this object refer to the data in clone. More...
|
|
void | SetRefData (wxObjectRefData *data) |
| Sets the wxObject::m_refData pointer. More...
|
|
void | UnRef () |
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
|
|
void | UnShare () |
| This is the same of AllocExclusive() but this method is public. More...
|
|
void | operator delete (void *buf) |
| The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
|
|
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
| The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
|
|
|
static void | AddFile (const wxString &filename, wxImage &image, wxBitmapType type) |
| Adds a file to the list of the files stored in memory. More...
|
|
static void | AddFile (const wxString &filename, const wxBitmap &bitmap, wxBitmapType type) |
|
static void | AddFile (const wxString &filename, const wxString &textdata) |
|
static void | AddFile (const wxString &filename, const void *binarydata, size_t size) |
|
static void | AddFileWithMimeType (const wxString &filename, const wxString &textdata, const wxString &mimetype) |
| Like AddFile(), but lets you explicitly specify added file's MIME type. More...
|
|
static void | AddFileWithMimeType (const wxString &filename, const void *binarydata, size_t size, const wxString &mimetype) |
|
static void | RemoveFile (const wxString &filename) |
| Removes a file from memory FS and frees the occupied memory. More...
|
|
Static Public Member Functions inherited from wxFileSystemHandler |
static wxString | GetMimeTypeFromExt (const wxString &location) |
| Returns the MIME type based on extension of location. More...
|
|
◆ wxMemoryFSHandler()
wxMemoryFSHandler::wxMemoryFSHandler |
( |
| ) |
|
◆ AddFile() [1/4]
static void wxMemoryFSHandler::AddFile |
( |
const wxString & |
filename, |
|
|
const void * |
binarydata, |
|
|
size_t |
size |
|
) |
| |
|
static |
◆ AddFile() [2/4]
◆ AddFile() [3/4]
static void wxMemoryFSHandler::AddFile |
( |
const wxString & |
filename, |
|
|
const wxString & |
textdata |
|
) |
| |
|
static |
◆ AddFile() [4/4]
Adds a file to the list of the files stored in memory.
Stored data (bitmap, text or raw data) will be copied into private memory stream and available under name "memory:"
+ filename.
- Note
- you must use a type value (aka image format) that wxWidgets can save (e.g. JPG, PNG, see wxImage documentation)!
- See also
- AddFileWithMimeType()
◆ AddFileWithMimeType() [1/2]
static void wxMemoryFSHandler::AddFileWithMimeType |
( |
const wxString & |
filename, |
|
|
const void * |
binarydata, |
|
|
size_t |
size, |
|
|
const wxString & |
mimetype |
|
) |
| |
|
static |
◆ AddFileWithMimeType() [2/2]
static void wxMemoryFSHandler::AddFileWithMimeType |
( |
const wxString & |
filename, |
|
|
const wxString & |
textdata, |
|
|
const wxString & |
mimetype |
|
) |
| |
|
static |
Like AddFile(), 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.
- Since
- 2.8.5
- See also
- AddFile()
◆ RemoveFile()
static void wxMemoryFSHandler::RemoveFile |
( |
const wxString & |
filename | ) |
|
|
static |
Removes a file from memory FS and frees the occupied memory.
void SetBorders(int b)
This function sets the space between border of window and HTML contents.
@ wxID_OK
Standard button and menu IDs.
Definition: defs.h:658
static void AddHandler(wxFileSystemHandler *handler)
This static function adds new handler into the list of handlers (see wxFileSystemHandler) which provi...
virtual void LoadURL(const wxString &url)=0
Load a web page from a URL.
wxHtmlContainerCell * GetInternalRepresentation() const
Returns pointer to the top-level container.
@ wxID_ANY
Any id: means that we don't care about the id, whether when installing an event handler or when creat...
Definition: defs.h:596
@ wxALIGN_RIGHT
Definition: defs.h:83
const wxPoint wxDefaultPosition
Global instance of a wxPoint initialized with values (-1,-1).
Definition: gdicmn.h:714
const wxString & _(const wxString &string)
Macro to be used around all literal strings that should be translated.
This control may be used to render web (HTML / CSS / javascript) documents.
Definition: webview.h:305
void SetSizer(wxSizer *sizer)
Set the sizer tracked by this item.
wxSize Fit(wxWindow *window)
Tell the sizer to resize the window so that its client area matches the sizer's minimal size (Compute...
virtual bool LoadPage(const wxString &location)
Unlike SetPage() this function first loads the HTML page from location and then displays it.
int GetWidth() const
Returns width of the cell (m_Width member).
virtual void RegisterHandler(wxSharedPtr< wxWebViewHandler > handler)=0
Registers a custom scheme handler.
A static line is just a line which may be used in a dialog to separate the groups of controls.
Definition: statline.h:32
@ wxEXPAND
Definition: defs.h:115
@ wxRIGHT
Definition: defs.h:45
#define wxBITMAP(bitmapName)
This macro loads a bitmap from either application resources (on the platforms for which they exist,...
Definition: gdicmn.h:1049
@ wxVERTICAL
Definition: defs.h:28
This wxFileSystem handler can store arbitrary data in memory stream and make them accessible via an U...
Definition: fs_mem.h:72
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
Appends a child to the sizer.
static void AddFile(const wxString &filename, wxImage &image, wxBitmapType type)
Adds a file to the list of the files stored in memory.
static void RemoveFile(const wxString &filename)
Removes a file from memory FS and frees the occupied memory.
static wxWebView * New(const wxString &backend=wxWebViewBackendDefault)
Factory function to create a new wxWebView with two-step creation, wxWebView::Create should be called...
int GetHeight() const
Returns height of the cell (m_Height member).
A wxSize is a useful data structure for graphics operations.
Definition: gdicmn.h:872
The basic idea behind a box sizer is that windows will most often be laid out in rather simple basic ...
Definition: sizer.h:1863
String class for passing textual data to or receiving it from wxWidgets.
Definition: string.h:314
A wxWebView file system handler to support standard wxFileSystem protocols of the form example:page....
Definition: webviewfshandler.h:24
wxHtmlWindow is probably the only class you will directly use unless you want to do something special...
Definition: htmlwin.h:158
A dialog box is a window with a title bar and sometimes a system menu, which can be moved around the ...
Definition: dialog.h:155
@ wxALL
Definition: defs.h:57
This event class contains information about command events, which originate from a variety of simple ...
Definition: event.h:2013
@ wxLEFT
Definition: defs.h:44
#define wxHW_SCROLLBAR_NEVER
Definition: htmlwin.h:9
@ wxBITMAP_TYPE_PNG
Definition: gdicmn.h:32