wxPrintout

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.

Derived from

wxObject

Include files

<wx/print.h>

See also

Printing framework overview, wxPrinterDC, wxPrintDialog, wxPrinter, wxPrintPreview



wxPrintout::wxPrintout



wxPrintout(const wxString& title = "Printout")

Constructor. Pass an optional title argument - the current filename would be a good idea. This will appear in the printing list (at least in MSW)



wxPrintout::~wxPrintout



~wxPrintout(void)

Destructor.



wxPrintout::GetDC



wxDC * GetDC(void)

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.



wxPrintout::GetPageInfo



void GetPageInfo(int * minPage, int * maxPage, int * pageFrom, int * pageTo)

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.

If minPage is zero, the page number controls in the print dialog will be disabled.

wxPython での注意点: When this method is implemented in a derived Python class, it should be designed to take no parameters (other than the self reference) and to return a tuple of four integers.

wxPerl での注意点: When this method is overridden in a derived class, it must not take any parameters, and returns a 4-element list.



wxPrintout::GetPageSizeMM



void GetPageSizeMM(int * w, int * h)

Returns the size of the printer page in millimetres.

wxPython での注意点: This method returns the output-only parameters as a tuple.

wxPerl での注意点: In wxPerl this method takes no arguments and returns a 2-element list ( w, h )



wxPrintout::GetPageSizePixels



void GetPageSizePixels(int * w, int * h)

Returns the size of the printer page in pixels. These may not be the same as the values returned from wxDC::GetSize 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.

wxPython での注意点: This method returns the output-only parameters as a tuple.

wxPerl での注意点: In wxPerl this method takes no arguments and returns a 2-element list ( w, h )



wxPrintout::GetPPIPrinter



void GetPPIPrinter(int * w, int * h)

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.

wxPython での注意点: This method returns the output-only parameters as a tuple.

wxPerl での注意点: In wxPerl this method takes no arguments and returns a 2-element list ( w, h )



wxPrintout::GetPPIScreen



void GetPPIScreen(int * w, int * h)

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.



wxPrintout::GetTitle



wxString GetTitle(void)

Returns the title of the printout

wxPython での注意点: This method returns the output-only parameters as a tuple.

wxPerl での注意点: In wxPerl this method takes no arguments and returns a 2-element list ( w, h )



wxPrintout::HasPage



bool HasPage(int pageNum)

Should be overridden 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.



wxPrintout::IsPreview



bool IsPreview(void)

Returns true if the printout is currently being used for previewing.



wxPrintout::OnBeginDocument



bool OnBeginDocument(int startPage, int endPage)

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.

The base wxPrintout::OnBeginDocument must be called (and the return value checked) from within the overridden function, since it calls wxDC::StartDoc.

wxPython での注意点: If this method is overridden in a Python class then the base class version can be called by using the method base_OnBeginDocument(startPage, endPage).



wxPrintout::OnEndDocument



void OnEndDocument(void)

Called by the framework at the end of document printing. OnEndDocument is called once for every copy printed.

The base wxPrintout::OnEndDocument must be called from within the overridden function, since it calls wxDC::EndDoc.



wxPrintout::OnBeginPrinting



void OnBeginPrinting(void)

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).



wxPrintout::OnEndPrinting



void OnEndPrinting(void)

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).



wxPrintout::OnPreparePrinting



void OnPreparePrinting(void)

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.



wxPrintout::OnPrintPage



bool OnPrintPage(int pageNum)

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.

ymasuda 平成17年11月19日