1 \section{\class{wxMetafile
}}\label{wxmetafile
}
3 A
{\bf wxMetafile
} represents the MS Windows metafile object, so metafile
4 operations have no effect in X. In wxWindows, only sufficient functionality
5 has been provided for copying a graphic to the clipboard; this may be extended
6 in a future version. Presently, the only way of creating a metafile
7 is to use a wxMetafileDC.
9 \wxheading{Derived from
}
11 \helpref{wxObject
}{wxobject
}
13 \wxheading{Include files
}
19 \helpref{wxMetafileDC
}{wxmetafiledc
}
21 \latexignore{\rtfignore{\wxheading{Members
}}}
23 \membersection{wxMetafile::wxMetafile
}
25 \func{}{wxMetafile
}{\param{const wxString\&
}{filename = ""
}}
27 Constructor. If a filename is given, the Windows disk metafile is
28 read in. Check whether this was performed successfully by
29 using the
\helpref{wxMetafile::Ok
}{wxmetafileok
} member.
31 \membersection{wxMetafile::
\destruct{wxMetafile
}}
33 \func{}{\destruct{wxMetafile
}}{\void}
37 \membersection{wxMetafile::Ok
}\label{wxmetafileok
}
39 \func{bool
}{Ok
}{\void}
41 Returns TRUE if the metafile is valid.
43 \membersection{wxMetafile::Play
}\label{wxmetafileplay
}
45 \func{bool
}{Play
}{\param{wxDC *
}{dc
}}
47 Plays the metafile into the given device context, returning
50 \membersection{wxMetafile::SetClipboard
}
52 \func{bool
}{SetClipboard
}{\param{int
}{ width =
0},
\param{int
}{ height =
0}}
54 Passes the metafile data to the clipboard. The metafile can no longer be
55 used for anything, but the wxMetafile object must still be destroyed by
58 Below is a example of metafle, metafile device context and clipboard use
59 from the
{\tt hello.cpp
} example. Note the way the metafile dimensions
60 are passed to the clipboard, making use of the device context's ability
61 to keep track of the maximum extent of drawing commands.
68 wxMetafile *mf = dc.Close();
71 bool success = mf->SetClipboard((int)(dc.MaxX() +
10), (int)(dc.MaxY() +
10));
77 \section{\class{wxMetafileDC
}}\label{wxmetafiledc
}
79 This is a type of device context that allows a metafile object to be
80 created (Windows only), and has most of the characteristics of a normal
81 \rtfsp{\bf wxDC
}. The
\helpref{wxMetafileDC::Close
}{wxmetafiledcclose
} member must be called after drawing into the
82 device context, to return a metafile. The only purpose for this at
83 present is to allow the metafile to be copied to the clipboard (see
\helpref{wxMetafile
}{wxmetafile
}).
85 Adding metafile capability to an application should be easy if you
86 already write to a wxDC; simply pass the wxMetafileDC to your drawing
87 function instead. You may wish to conditionally compile this code so it
88 is not compiled under X (although no harm will result if you leave it
91 Note that a metafile saved to disk is in standard Windows metafile format,
92 and cannot be imported into most applications. To make it importable,
93 call the function
\helpref{::wxMakeMetafilePlaceable
}{wxmakemetafileplaceable
} after
94 closing your disk-based metafile device context.
96 \wxheading{Derived from
}
98 \helpref{wxDC
}{wxdc
}\\
99 \helpref{wxObject
}{wxobject
}
101 \wxheading{Include files
}
107 \helpref{wxMetafile
}{wxmetafile
},
\helpref{wxDC
}{wxdc
}
109 \latexignore{\rtfignore{\wxheading{Members
}}}
111 \membersection{wxMetafileDC::wxMetafileDC
}
113 \func{}{wxMetafileDC
}{\param{const wxString\&
}{filename = ""
}}
115 Constructor. If no filename is passed, the metafile is created
118 \membersection{wxMetafileDC::
\destruct{wxMetafileDC
}}
120 \func{}{\destruct{wxMetafileDC
}}{\void}
124 \membersection{wxMetafileDC::Close
}\label{wxmetafiledcclose
}
126 \func{wxMetafile *
}{Close
}{\void}
128 This must be called after the device context is finished with. A
129 metafile is returned, and ownership of it passes to the calling
130 application (so it should be destroyed explicitly).