wxWidgets/docs/latex/wx/metafile.tex
Karsten Ballüder a660d684ed I've now added the documentation files.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1998-05-20 14:25:30 +00:00

126 lines
3.8 KiB
TeX

\section{\class{wxMetaFile}}\label{wxmetafile}
A {\bf wxMetaFile} represents the MS Windows metafile object, so metafile
operations have no effect in X. In wxWindows, 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.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxMetaFileDC}{wxmetafiledc}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxMetaFile::wxMetaFile}
\func{}{wxMetaFile}{\param{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 \helpref{wxMetaFile::Ok}{wxmetafileok} member.
\membersection{wxMetaFile::\destruct{wxMetaFile}}
\func{}{\destruct{wxMetaFile}}{\void}
Destructor.
\membersection{wxMetaFile::Ok}\label{wxmetafileok}
\func{bool}{Ok}{\void}
Returns TRUE if the metafile is valid.
\membersection{wxMetaFile::Play}\label{wxmetafileplay}
\func{bool}{Play}{\param{wxDC *}{dc}}
Plays the metafile into the given device context, returning
TRUE if successful.
\membersection{wxMetaFile::SetClipboard}
\func{bool}{SetClipboard}{\param{int}{ width = 0}, \param{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 metafle, metafile device context and clipboard use
from the {\tt 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.
\begin{verbatim}
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;
}
}
\end{verbatim}
\section{\class{wxMetaFileDC}}\label{wxmetafiledc}
This is a type of device context that allows a metafile object to be
created (Windows only), and has most of the characteristics of a normal
\rtfsp{\bf wxDC}. The \helpref{wxMetaFileDC::Close}{wxmetafiledcclose} member must be called after drawing into the
device context, to return a metafile. The only purpose for this at
present is to allow the metafile to be copied to the clipboard (see \helpref{wxMetaFile}{wxmetafile}).
Adding metafile capability to an application should be easy if you
already write to a wxDC; simply pass the wxMetaFileDC to your drawing
function instead. You may wish to conditionally compile this code so it
is not compiled under X (although no harm will result if you leave it
in).
Note that a metafile saved to disk is in standard Windows metafile format,
and cannot be imported into most applications. To make it importable,
call the function \helpref{::wxMakeMetaFilePlaceable}{wxmakemetafileplaceable} after
closing your disk-based metafile device context.
\wxheading{Derived from}
\helpref{wxDC}{wxdc}\\
\helpref{wxObject}{wxobject}
\wxheading{See also}
\helpref{wxMetaFile}{wxmetafile}, \helpref{wxDC}{wxdc}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxMetaFileDC::wxMetaFileDC}
\func{}{wxMetaFileDC}{\param{const wxString\& }{filename = ""}}
Constructor. If no filename is passed, the metafile is created
in memory.
\membersection{wxMetaFileDC::\destruct{wxMetaFileDC}}
\func{}{\destruct{wxMetaFileDC}}{\void}
Destructor.
\membersection{wxMetaFileDC::Close}\label{wxmetafiledcclose}
\func{wxMetaFile *}{Close}{\void}
This must be called after the device context is finished with. A
metafile is returned, and ownership of it passes to the calling
application (so it should be destroyed explicitly).