1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
<HTML>
<head><title>wxPrintout</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxprintout"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx179.htm#wxprinterdc"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx181.htm#wxprintpreview"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxPrintout</H2>
<P>
This class encapsulates the functionality of printing out an
application document. A new class must be derived and members
overridden to respond to calls such as OnPrintPage and HasPage.
Instances of this class are passed to wxPrinter::Print or a
wxPrintPreview object to initiate printing or previewing.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/print.h><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx302.htm#printingoverview">Printing framework overview</A>, <A HREF="wx179.htm#wxprinterdc">wxPrinterDC</A>, <A HREF="wx177.htm#wxprintdialog">wxPrintDialog</A>,
<A HREF="wx178.htm#wxprinter">wxPrinter</A>, <A HREF="wx181.htm#wxprintpreview">wxPrintPreview</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic676">wxPrintout::wxPrintout</A><BR>
<A HREF="#topic677">wxPrintout::~wxPrintout</A><BR>
<A HREF="#wxprintoutgetdc">wxPrintout::GetDC</A><BR>
<A HREF="#wxprintoutgetpageinfo">wxPrintout::GetPageInfo</A><BR>
<A HREF="#wxprintoutgetpagesizemm">wxPrintout::GetPageSizeMM</A><BR>
<A HREF="#wxprintoutgetpagesizepixels">wxPrintout::GetPageSizePixels</A><BR>
<A HREF="#wxprintoutgetppiprinter">wxPrintout::GetPPIPrinter</A><BR>
<A HREF="#wxprintoutgetppiscreen">wxPrintout::GetPPIScreen</A><BR>
<A HREF="#wxprintouthaspage">wxPrintout::HasPage</A><BR>
<A HREF="#wxprintoutispreview">wxPrintout::IsPreview</A><BR>
<A HREF="#wxprintoutonbegindocument">wxPrintout::OnBeginDocument</A><BR>
<A HREF="#wxprintoutonenddocument">wxPrintout::OnEndDocument</A><BR>
<A HREF="#wxprintoutonbeginprinting">wxPrintout::OnBeginPrinting</A><BR>
<A HREF="#wxprintoutonendprinting">wxPrintout::OnEndPrinting</A><BR>
<A HREF="#wxprintoutonprepareprinting">wxPrintout::OnPreparePrinting</A><BR>
<A HREF="#wxprintoutonprintpage">wxPrintout::OnPrintPage</A><BR>
<P>
<HR>
<A NAME="topic676"></A>
<H3>wxPrintout::wxPrintout</H3>
<P>
<B></B> <B>wxPrintout</B>(<B>const wxString& </B><I>title = "Printout"</I>)<P>
Constructor. Pass an optional title argument (currently unused).<P>
<HR>
<A NAME="topic677"></A>
<H3>wxPrintout::~wxPrintout</H3>
<P>
<B></B> <B>~wxPrintout</B>()<P>
Destructor.<P>
<HR>
<A NAME="wxprintoutgetdc"></A>
<H3>wxPrintout::GetDC</H3>
<P>
<B>wxDC *</B> <B>GetDC</B>()<P>
Returns the device context associated with the printout (given to the printout at start of
printing or previewing). This will be a wxPrinterDC if printing under Windows,
a wxPostScriptDC if printing on other platforms, and a wxMemoryDC if previewing.<P>
<HR>
<A NAME="wxprintoutgetpageinfo"></A>
<H3>wxPrintout::GetPageInfo</H3>
<P>
<B>void</B> <B>GetPageInfo</B>(<B>int *</B><I>minPage</I>, <B>int *</B><I>maxPage</I>, <B>int *</B><I>pageFrom</I>, <B>int *</B><I>pageTo</I>)<P>
Called by the framework to obtain information from the application about minimum and maximum page values that
the user can select, and the required page range to be printed. By default this
returns 1, 32000 for the page minimum and maximum values, and 1, 1 for the required page range.<P>
If <I>minPage</I> is zero, the page number controls in the print dialog will be disabled.<P>
<HR>
<A NAME="wxprintoutgetpagesizemm"></A>
<H3>wxPrintout::GetPageSizeMM</H3>
<P>
<B>void</B> <B>GetPageSizeMM</B>(<B>int *</B><I>w</I>, <B>int *</B><I>h</I>)<P>
Returns the size of the printer page in millimetres.<P>
<HR>
<A NAME="wxprintoutgetpagesizepixels"></A>
<H3>wxPrintout::GetPageSizePixels</H3>
<P>
<B>void</B> <B>GetPageSizePixels</B>(<B>int *</B><I>w</I>, <B>int *</B><I>h</I>)<P>
Returns the size of the printer page in pixels. These may not be the
same as the values returned from <A HREF="wx65.htm#wxdcgetsize">wxDC::GetSize</A> if
the printout is being used for previewing, since in this case, a
memory device context is used, using a bitmap size reflecting the current
preview zoom. The application must take this discrepancy into account if
previewing is to be supported.<P>
<HR>
<A NAME="wxprintoutgetppiprinter"></A>
<H3>wxPrintout::GetPPIPrinter</H3>
<P>
<B>void</B> <B>GetPPIPrinter</B>(<B>int *</B><I>w</I>, <B>int *</B><I>h</I>)<P>
Returns the number of pixels per logical inch of the printer device context.
Dividing the printer PPI by the screen PPI can give a suitable scaling
factor for drawing text onto the printer. Remember to multiply
this by a scaling factor to take the preview DC size into account.<P>
<HR>
<A NAME="wxprintoutgetppiscreen"></A>
<H3>wxPrintout::GetPPIScreen</H3>
<P>
<B>void</B> <B>GetPPIScreen</B>(<B>int *</B><I>w</I>, <B>int *</B><I>h</I>)<P>
Returns the number of pixels per logical inch of the screen device context.
Dividing the printer PPI by the screen PPI can give a suitable scaling
factor for drawing text onto the printer. Remember to multiply
this by a scaling factor to take the preview DC size into account.<P>
<HR>
<A NAME="wxprintouthaspage"></A>
<H3>wxPrintout::HasPage</H3>
<P>
<B>bool</B> <B>HasPage</B>(<B>int</B><I> pageNum</I>)<P>
Should be overriden to return TRUE if the document has this page, or FALSE
if not. Returning FALSE signifies the end of the document. By default,
HasPage behaves as if the document has only one page.<P>
<HR>
<A NAME="wxprintoutispreview"></A>
<H3>wxPrintout::IsPreview</H3>
<P>
<B>bool</B> <B>IsPreview</B>()<P>
Returns TRUE if the printout is currently being used for previewing.<P>
<HR>
<A NAME="wxprintoutonbegindocument"></A>
<H3>wxPrintout::OnBeginDocument</H3>
<P>
<B>bool</B> <B>OnBeginDocument</B>(<B>int</B><I> startPage</I>, <B>int</B><I> endPage</I>)<P>
Called by the framework at the start of document printing. Return FALSE from
this function cancels the print job. OnBeginDocument is called once for every
copy printed.<P>
The base wxPrintout::OnBeginDocument <I>must</I> be called (and the return value
checked) from within the overriden function, since it calls wxDC::StartDoc.<P>
<HR>
<A NAME="wxprintoutonenddocument"></A>
<H3>wxPrintout::OnEndDocument</H3>
<P>
<B>void</B> <B>OnEndDocument</B>()<P>
Called by the framework at the end of document printing. OnEndDocument
is called once for every copy printed.<P>
The base wxPrintout::OnEndDocument <I>must</I> be called
from within the overriden function, since it calls wxDC::EndDoc.<P>
<HR>
<A NAME="wxprintoutonbeginprinting"></A>
<H3>wxPrintout::OnBeginPrinting</H3>
<P>
<B>void</B> <B>OnBeginPrinting</B>()<P>
Called by the framework at the start of printing. OnBeginPrinting is called once for every
print job (regardless of how many copies are being printed).<P>
<HR>
<A NAME="wxprintoutonendprinting"></A>
<H3>wxPrintout::OnEndPrinting</H3>
<P>
<B>void</B> <B>OnEndPrinting</B>()<P>
Called by the framework at the end of printing. OnEndPrinting
is called once for every print job (regardless of how many copies are being printed).<P>
<HR>
<A NAME="wxprintoutonprepareprinting"></A>
<H3>wxPrintout::OnPreparePrinting</H3>
<P>
<B>void</B> <B>OnPreparePrinting</B>()<P>
Called once by the framework before any other demands are made of the
wxPrintout object. This gives the object an opportunity to calculate the
number of pages in the document, for example.<P>
<HR>
<A NAME="wxprintoutonprintpage"></A>
<H3>wxPrintout::OnPrintPage</H3>
<P>
<B>bool</B> <B>OnPrintPage</B>(<B>int</B><I> pageNum</I>)<P>
Called by the framework when a page should be printed. Returning FALSE cancels
the print job. The application can use wxPrintout::GetDC to obtain a device
context to draw on.<P>
</BODY></HTML>
|