1999-01-25 18:33:08 +00:00
|
|
|
\section{\class{wxMetafile}}\label{wxmetafile}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
A {\bf wxMetafile} represents the MS Windows metafile object, so metafile
|
2004-05-04 08:27:20 +00:00
|
|
|
operations have no effect in X. In wxWidgets, only sufficient functionality
|
1998-05-20 14:25:30 +00:00
|
|
|
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 20:41:29 +00:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/metafile.h>
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\helpref{wxMetafileDC}{wxmetafiledc}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-28 11:54:59 +00:00
|
|
|
\membersection{wxMetafile::wxMetafile}\label{wxmetafilector}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\func{}{wxMetafile}{\param{const wxString\& }{filename = ""}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Constructor. If a filename is given, the Windows disk metafile is
|
|
|
|
read in. Check whether this was performed successfully by
|
2006-10-08 21:56:55 +00:00
|
|
|
using the \helpref{wxMetafile:IsOk}{wxmetafileisok} member.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
2004-09-28 11:54:59 +00:00
|
|
|
\membersection{wxMetafile::\destruct{wxMetafile}}\label{wxmetafiledtor}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\func{}{\destruct{wxMetafile}}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Destructor.
|
2006-10-30 19:26:48 +00:00
|
|
|
See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
2006-10-08 21:56:55 +00:00
|
|
|
\membersection{wxMetafile::IsOk}\label{wxmetafileisok}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\func{bool}{Ok}{\void}
|
|
|
|
|
2003-01-18 00:16:34 +00:00
|
|
|
Returns true if the metafile is valid.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\membersection{wxMetafile::Play}\label{wxmetafileplay}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\func{bool}{Play}{\param{wxDC *}{dc}}
|
|
|
|
|
|
|
|
Plays the metafile into the given device context, returning
|
2003-01-18 00:16:34 +00:00
|
|
|
true if successful.
|
1998-05-20 14:25:30 +00:00
|
|
|
|
2004-09-28 11:54:59 +00:00
|
|
|
\membersection{wxMetafile::SetClipboard}\label{wxmetafilesetclipboard}
|
1998-05-20 14:25:30 +00: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 18:33:08 +00:00
|
|
|
used for anything, but the wxMetafile object must still be destroyed by
|
1998-05-20 14:25:30 +00:00
|
|
|
the application.
|
|
|
|
|
2002-06-07 20:15:28 +00:00
|
|
|
Below is a example of metafile, metafile device context and clipboard use
|
1998-05-20 14:25:30 +00:00
|
|
|
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 18:33:08 +00:00
|
|
|
wxMetafileDC dc;
|
1998-05-20 14:25:30 +00:00
|
|
|
if (dc.Ok())
|
|
|
|
{
|
2003-01-18 00:16:34 +00:00
|
|
|
Draw(dc, false);
|
1999-01-25 18:33:08 +00:00
|
|
|
wxMetafile *mf = dc.Close();
|
1998-05-20 14:25:30 +00:00
|
|
|
if (mf)
|
|
|
|
{
|
|
|
|
bool success = mf->SetClipboard((int)(dc.MaxX() + 10), (int)(dc.MaxY() + 10));
|
|
|
|
delete mf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
\end{verbatim}
|
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\section{\class{wxMetafileDC}}\label{wxmetafiledc}
|
1998-05-20 14:25:30 +00: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 18:33:08 +00:00
|
|
|
\rtfsp{\bf wxDC}. The \helpref{wxMetafileDC::Close}{wxmetafiledcclose} member must be called after drawing into the
|
1998-05-20 14:25:30 +00:00
|
|
|
device context, to return a metafile. The only purpose for this at
|
1999-01-25 18:33:08 +00:00
|
|
|
present is to allow the metafile to be copied to the clipboard (see \helpref{wxMetafile}{wxmetafile}).
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Adding metafile capability to an application should be easy if you
|
1999-01-25 18:33:08 +00:00
|
|
|
already write to a wxDC; simply pass the wxMetafileDC to your drawing
|
1998-05-20 14:25:30 +00: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 18:33:08 +00:00
|
|
|
call the function \helpref{::wxMakeMetafilePlaceable}{wxmakemetafileplaceable} after
|
1998-05-20 14:25:30 +00:00
|
|
|
closing your disk-based metafile device context.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxDC}{wxdc}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 20:41:29 +00:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/metafile.h>
|
|
|
|
|
1998-05-20 14:25:30 +00:00
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\helpref{wxMetafile}{wxmetafile}, \helpref{wxDC}{wxdc}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-28 11:54:59 +00:00
|
|
|
\membersection{wxMetafileDC::wxMetafileDC}\label{wxmetafiledcctor}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\func{}{wxMetafileDC}{\param{const wxString\& }{filename = ""}}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Constructor. If no filename is passed, the metafile is created
|
|
|
|
in memory.
|
|
|
|
|
2004-09-28 11:54:59 +00:00
|
|
|
\membersection{wxMetafileDC::\destruct{wxMetafileDC}}\label{wxmetafiledcdtor}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\func{}{\destruct{wxMetafileDC}}{\void}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\membersection{wxMetafileDC::Close}\label{wxmetafiledcclose}
|
1998-05-20 14:25:30 +00:00
|
|
|
|
1999-01-25 18:33:08 +00:00
|
|
|
\func{wxMetafile *}{Close}{\void}
|
1998-05-20 14:25:30 +00: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).
|
|
|
|
|