wxmetafilea wxmetafile represents the ms windows metafile object, so metafile operations have no effect in x. in wxwidgets, only sufficient functionality has been provided for copying a graphic to the clipboard; this may be extended in a future version. presently, the only way of creating a metafile is to use a wxmetafiledc. derived from include files <wx/metafile.h> see also members
wxmetafile::wxmetafile
wxmetafile::wxmetafilewxmetafile(const wxstring& filename = "") constructor. if a filename is given, the windows disk metafile is read in. check whether this was performed successfully by using the wxmetafile:isok member.
wxmetafile::~wxmetafile~wxmetafile() destructor. see reference-counted object destruction for more info.
wxmetafile::isokbool ok() returns true if the metafile is valid.
wxmetafile::playbool play(wxdc *dc) plays the metafile into the given device context, returning true if successful.
wxmetafile::setclipboardbool setclipboard(int width = 0, int height = 0) passes the metafile data to the clipboard. the metafile can no longer be used for anything, but the wxmetafile object must still be destroyed by the application. below is a example of metafile, metafile device context and clipboard use from the hello.cpp example. note the way the metafile dimensions are passed to the clipboard, making use of the device context's ability to keep track of the maximum extent of drawing commands.
wxmetafiledc dc; if (dc.ok()) { draw(dc, false); wxmetafile *mf = dc.close(); if (mf) { bool success = mf->setclipboard((int)(dc.maxx() + 10), (int)(dc.maxy() + 10)); delete mf; } } |