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