2 \section{\class{wxMetaFile
}}\label{wxmetafile
}
4 A
{\bf wxMetaFile
} represents the MS Windows metafile object, so metafile
5 operations have no effect in X. In wxWindows, only sufficient functionality
6 has been provided for copying a graphic to the clipboard; this may be extended
7 in a future version. Presently, the only way of creating a metafile
8 is to use a wxMetafileDC.
10 \wxheading{Derived from
}
12 \helpref{wxObject
}{wxobject
}
16 \helpref{wxMetaFileDC
}{wxmetafiledc
}
18 \latexignore{\rtfignore{\wxheading{Members
}}}
20 \membersection{wxMetaFile::wxMetaFile
}
22 \func{}{wxMetaFile
}{\param{const wxString\&
}{filename = ""
}}
24 Constructor. If a filename is given, the Windows disk metafile is
25 read in. Check whether this was performed successfully by
26 using the
\helpref{wxMetaFile::Ok
}{wxmetafileok
} member.
28 \membersection{wxMetaFile::
\destruct{wxMetaFile
}}
30 \func{}{\destruct{wxMetaFile
}}{\void}
34 \membersection{wxMetaFile::Ok
}\label{wxmetafileok
}
36 \func{bool
}{Ok
}{\void}
38 Returns TRUE if the metafile is valid.
40 \membersection{wxMetaFile::Play
}\label{wxmetafileplay
}
42 \func{bool
}{Play
}{\param{wxDC *
}{dc
}}
44 Plays the metafile into the given device context, returning
47 \membersection{wxMetaFile::SetClipboard
}
49 \func{bool
}{SetClipboard
}{\param{int
}{ width =
0},
\param{int
}{ height =
0}}
51 Passes the metafile data to the clipboard. The metafile can no longer be
52 used for anything, but the wxMetaFile object must still be destroyed by
55 Below is a example of metafle, metafile device context and clipboard use
56 from the
{\tt hello.cpp
} example. Note the way the metafile dimensions
57 are passed to the clipboard, making use of the device context's ability
58 to keep track of the maximum extent of drawing commands.
65 wxMetaFile *mf = dc.Close();
68 bool success = mf->SetClipboard((int)(dc.MaxX() +
10), (int)(dc.MaxY() +
10));
74 \section{\class{wxMetaFileDC
}}\label{wxmetafiledc
}
76 This is a type of device context that allows a metafile object to be
77 created (Windows only), and has most of the characteristics of a normal
78 \rtfsp{\bf wxDC
}. The
\helpref{wxMetaFileDC::Close
}{wxmetafiledcclose
} member must be called after drawing into the
79 device context, to return a metafile. The only purpose for this at
80 present is to allow the metafile to be copied to the clipboard (see
\helpref{wxMetaFile
}{wxmetafile
}).
82 Adding metafile capability to an application should be easy if you
83 already write to a wxDC; simply pass the wxMetaFileDC to your drawing
84 function instead. You may wish to conditionally compile this code so it
85 is not compiled under X (although no harm will result if you leave it
88 Note that a metafile saved to disk is in standard Windows metafile format,
89 and cannot be imported into most applications. To make it importable,
90 call the function
\helpref{::wxMakeMetaFilePlaceable
}{wxmakemetafileplaceable
} after
91 closing your disk-based metafile device context.
93 \wxheading{Derived from
}
95 \helpref{wxDC
}{wxdc
}\\
96 \helpref{wxObject
}{wxobject
}
100 \helpref{wxMetaFile
}{wxmetafile
},
\helpref{wxDC
}{wxdc
}
102 \latexignore{\rtfignore{\wxheading{Members
}}}
104 \membersection{wxMetaFileDC::wxMetaFileDC
}
106 \func{}{wxMetaFileDC
}{\param{const wxString\&
}{filename = ""
}}
108 Constructor. If no filename is passed, the metafile is created
111 \membersection{wxMetaFileDC::
\destruct{wxMetaFileDC
}}
113 \func{}{\destruct{wxMetaFileDC
}}{\void}
117 \membersection{wxMetaFileDC::Close
}\label{wxmetafiledcclose
}
119 \func{wxMetaFile *
}{Close
}{\void}
121 This must be called after the device context is finished with. A
122 metafile is returned, and ownership of it passes to the calling
123 application (so it should be destroyed explicitly).