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