1999-01-25 13:33:08 -05:00
|
|
|
\section{\class{wxMetafile}}\label{wxmetafile}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
A {\bf wxMetafile} represents the MS Windows metafile object, so metafile
|
1998-05-20 10:25:30 -04:00
|
|
|
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}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/metafile.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\helpref{wxMetafileDC}{wxmetafiledc}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafile::wxMetafile}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\func{}{wxMetafile}{\param{const wxString\& }{filename = ""}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Constructor. If a filename is given, the Windows disk metafile is
|
|
|
|
read in. Check whether this was performed successfully by
|
1999-01-25 13:33:08 -05:00
|
|
|
using the \helpref{wxMetafile::Ok}{wxmetafileok} member.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafile::\destruct{wxMetafile}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\func{}{\destruct{wxMetafile}}{\void}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafile::Ok}\label{wxmetafileok}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{bool}{Ok}{\void}
|
|
|
|
|
|
|
|
Returns TRUE if the metafile is valid.
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafile::Play}\label{wxmetafileplay}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{bool}{Play}{\param{wxDC *}{dc}}
|
|
|
|
|
|
|
|
Plays the metafile into the given device context, returning
|
|
|
|
TRUE if successful.
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafile::SetClipboard}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{bool}{SetClipboard}{\param{int}{ width = 0}, \param{int}{ height = 0}}
|
|
|
|
|
|
|
|
Passes the metafile data to the clipboard. The metafile can no longer be
|
1999-01-25 13:33:08 -05:00
|
|
|
used for anything, but the wxMetafile object must still be destroyed by
|
1998-05-20 10:25:30 -04:00
|
|
|
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}
|
1999-01-25 13:33:08 -05:00
|
|
|
wxMetafileDC dc;
|
1998-05-20 10:25:30 -04:00
|
|
|
if (dc.Ok())
|
|
|
|
{
|
|
|
|
Draw(dc, FALSE);
|
1999-01-25 13:33:08 -05:00
|
|
|
wxMetafile *mf = dc.Close();
|
1998-05-20 10:25:30 -04:00
|
|
|
if (mf)
|
|
|
|
{
|
|
|
|
bool success = mf->SetClipboard((int)(dc.MaxX() + 10), (int)(dc.MaxY() + 10));
|
|
|
|
delete mf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
\end{verbatim}
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\section{\class{wxMetafileDC}}\label{wxmetafiledc}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
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
|
1999-01-25 13:33:08 -05:00
|
|
|
\rtfsp{\bf wxDC}. The \helpref{wxMetafileDC::Close}{wxmetafiledcclose} member must be called after drawing into the
|
1998-05-20 10:25:30 -04:00
|
|
|
device context, to return a metafile. The only purpose for this at
|
1999-01-25 13:33:08 -05:00
|
|
|
present is to allow the metafile to be copied to the clipboard (see \helpref{wxMetafile}{wxmetafile}).
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Adding metafile capability to an application should be easy if you
|
1999-01-25 13:33:08 -05:00
|
|
|
already write to a wxDC; simply pass the wxMetafileDC to your drawing
|
1998-05-20 10:25:30 -04:00
|
|
|
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,
|
1999-01-25 13:33:08 -05:00
|
|
|
call the function \helpref{::wxMakeMetafilePlaceable}{wxmakemetafileplaceable} after
|
1998-05-20 10:25:30 -04:00
|
|
|
closing your disk-based metafile device context.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxDC}{wxdc}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/metafile.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\helpref{wxMetafile}{wxmetafile}, \helpref{wxDC}{wxdc}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafileDC::wxMetafileDC}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\func{}{wxMetafileDC}{\param{const wxString\& }{filename = ""}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Constructor. If no filename is passed, the metafile is created
|
|
|
|
in memory.
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafileDC::\destruct{wxMetafileDC}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\func{}{\destruct{wxMetafileDC}}{\void}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\membersection{wxMetafileDC::Close}\label{wxmetafiledcclose}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-01-25 13:33:08 -05:00
|
|
|
\func{wxMetafile *}{Close}{\void}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
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).
|
|
|
|
|