]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/metafile.tex
Changed GetForce -> !CanVeto
[wxWidgets.git] / docs / latex / wx / metafile.tex
CommitLineData
e2a6f233 1\section{\class{wxMetafile}}\label{wxmetafile}
a660d684 2
e2a6f233 3A {\bf wxMetafile} represents the MS Windows metafile object, so metafile
a660d684
KB
4operations have no effect in X. In wxWindows, only sufficient functionality
5has been provided for copying a graphic to the clipboard; this may be extended
6in a future version. Presently, the only way of creating a metafile
7is to use a wxMetafileDC.
8
9\wxheading{Derived from}
10
11\helpref{wxObject}{wxobject}
12
13\wxheading{See also}
14
e2a6f233 15\helpref{wxMetafileDC}{wxmetafiledc}
a660d684
KB
16
17\latexignore{\rtfignore{\wxheading{Members}}}
18
e2a6f233 19\membersection{wxMetafile::wxMetafile}
a660d684 20
e2a6f233 21\func{}{wxMetafile}{\param{const wxString\& }{filename = ""}}
a660d684
KB
22
23Constructor. If a filename is given, the Windows disk metafile is
24read in. Check whether this was performed successfully by
e2a6f233 25using the \helpref{wxMetafile::Ok}{wxmetafileok} member.
a660d684 26
e2a6f233 27\membersection{wxMetafile::\destruct{wxMetafile}}
a660d684 28
e2a6f233 29\func{}{\destruct{wxMetafile}}{\void}
a660d684
KB
30
31Destructor.
32
e2a6f233 33\membersection{wxMetafile::Ok}\label{wxmetafileok}
a660d684
KB
34
35\func{bool}{Ok}{\void}
36
37Returns TRUE if the metafile is valid.
38
e2a6f233 39\membersection{wxMetafile::Play}\label{wxmetafileplay}
a660d684
KB
40
41\func{bool}{Play}{\param{wxDC *}{dc}}
42
43Plays the metafile into the given device context, returning
44TRUE if successful.
45
e2a6f233 46\membersection{wxMetafile::SetClipboard}
a660d684
KB
47
48\func{bool}{SetClipboard}{\param{int}{ width = 0}, \param{int}{ height = 0}}
49
50Passes the metafile data to the clipboard. The metafile can no longer be
e2a6f233 51used for anything, but the wxMetafile object must still be destroyed by
a660d684
KB
52the application.
53
54Below is a example of metafle, metafile device context and clipboard use
55from the {\tt hello.cpp} example. Note the way the metafile dimensions
56are passed to the clipboard, making use of the device context's ability
57to keep track of the maximum extent of drawing commands.
58
59\begin{verbatim}
e2a6f233 60 wxMetafileDC dc;
a660d684
KB
61 if (dc.Ok())
62 {
63 Draw(dc, FALSE);
e2a6f233 64 wxMetafile *mf = dc.Close();
a660d684
KB
65 if (mf)
66 {
67 bool success = mf->SetClipboard((int)(dc.MaxX() + 10), (int)(dc.MaxY() + 10));
68 delete mf;
69 }
70 }
71\end{verbatim}
72
e2a6f233 73\section{\class{wxMetafileDC}}\label{wxmetafiledc}
a660d684
KB
74
75This is a type of device context that allows a metafile object to be
76created (Windows only), and has most of the characteristics of a normal
e2a6f233 77\rtfsp{\bf wxDC}. The \helpref{wxMetafileDC::Close}{wxmetafiledcclose} member must be called after drawing into the
a660d684 78device context, to return a metafile. The only purpose for this at
e2a6f233 79present is to allow the metafile to be copied to the clipboard (see \helpref{wxMetafile}{wxmetafile}).
a660d684
KB
80
81Adding metafile capability to an application should be easy if you
e2a6f233 82already write to a wxDC; simply pass the wxMetafileDC to your drawing
a660d684
KB
83function instead. You may wish to conditionally compile this code so it
84is not compiled under X (although no harm will result if you leave it
85in).
86
87Note that a metafile saved to disk is in standard Windows metafile format,
88and cannot be imported into most applications. To make it importable,
e2a6f233 89call the function \helpref{::wxMakeMetafilePlaceable}{wxmakemetafileplaceable} after
a660d684
KB
90closing your disk-based metafile device context.
91
92\wxheading{Derived from}
93
94\helpref{wxDC}{wxdc}\\
95\helpref{wxObject}{wxobject}
96
97\wxheading{See also}
98
e2a6f233 99\helpref{wxMetafile}{wxmetafile}, \helpref{wxDC}{wxdc}
a660d684
KB
100
101\latexignore{\rtfignore{\wxheading{Members}}}
102
e2a6f233 103\membersection{wxMetafileDC::wxMetafileDC}
a660d684 104
e2a6f233 105\func{}{wxMetafileDC}{\param{const wxString\& }{filename = ""}}
a660d684
KB
106
107Constructor. If no filename is passed, the metafile is created
108in memory.
109
e2a6f233 110\membersection{wxMetafileDC::\destruct{wxMetafileDC}}
a660d684 111
e2a6f233 112\func{}{\destruct{wxMetafileDC}}{\void}
a660d684
KB
113
114Destructor.
115
e2a6f233 116\membersection{wxMetafileDC::Close}\label{wxmetafiledcclose}
a660d684 117
e2a6f233 118\func{wxMetafile *}{Close}{\void}
a660d684
KB
119
120This must be called after the device context is finished with. A
121metafile is returned, and ownership of it passes to the calling
122application (so it should be destroyed explicitly).
123