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