VCF::PrintSession Class Reference
The PrintSession is the core printing class. More...
#include <vcf/GraphicsKit/PrintSession.h>
Inheritance diagram for VCF::PrintSession:

Public Types | |
| enum | { PageBegunEvent = 102231, PageDoneEvent, PrintingBegunEvent, PrintingFinishedEvent } |
| enum | { UnknownPage = -1 } |
| enum | PrintJob { pjPrintAll = 0, pjPrintSelectedPage, pjPrintRange } |
| enum | PageSize { psA4, psB5, psLetter, psLegal, psExecutive, psA0, psA1, psA2, psA3, psA5, psA6, psA7, psA8, psA9, psB0, psB1, psB10, psB2, psB3, psB4, psB6, psB7, psB8, psB9, psC5E, psComm10E, psDLE, psFolio, psLedger, psTabloid, psCustom } |
| An enumeration of different standard page sizes. More... | |
| enum | PageSizeUnits { psuPixels = 0, psuPoints, psuInches, psuMillimeters, psuTwips } |
| The page units. More... | |
Public Member Functions | |
| PrintSession () | |
| virtual | ~PrintSession () |
| double | getDPI () |
| Returns the dots per inch (DPI) for this session. | |
| String | getTitle () |
| returns the title for the print session. | |
| void | setTitle (const String &title) |
| Set the title for the print session. | |
| void | setDefaultPageSettings () |
| Sets the print sessions settings to default values appropriate for the platform. | |
| Size | getPageSize () |
| returns the page size in pixels, adjusted for the DPI of the printing device. | |
| Size | getPageSizeIn (PageSizeUnits units) |
| Returns the page size in the scale of the units requested. | |
| void | setPageSize (const Size &pageSize) |
| Sets the page size. | |
| void | setPageSizeIn (const Size &pageSize, PageSizeUnits units) |
| Sets the page size using the requested units. | |
| void | setStandardPageSize (const PageSize &pageSize) |
| Sets the page size in one of the standard page size enumerations. | |
| void | setStartPage (const uint32 &startPage) |
| Sets the page number to start printing with. | |
| uint32 | getStartPage () |
| returns the page this session wil use to start printing | |
| void | setEndPage (const uint32 &endPage) |
| Sets the last page to print. | |
| uint32 | getEndPage () |
| Returns the last page to print for this session. | |
| std::vector< uint32 > | getPrintablePages () |
| Returns a vector of printable pages. | |
| void | setPrintablePages (const std::vector< uint32 > &printablePages) |
| Rect | getPageDrawingRect () |
| Returns the page rect in pixel units. | |
| void | setPageDrawingRect (const Rect &drawingRect) |
| Sets the page drawing rect. | |
| PrintInfoHandle | getPrintInfoHandle () |
| returns the print info handle. | |
| void | setPrintInfoHandle (PrintInfoHandle info) |
| void | abort () |
| Aborts the current printing session. | |
| PrintContext * | beginPrintingDocument () |
| Starts printing the document. | |
| void | endPrintingDocument () |
| This ends the printing for the document. | |
| void | beginPage (PrintContext *context) |
| This should be called for each page of the "document" that you want to print. | |
| void | endPage (PrintContext *context) |
| This should be called for each page of the "document" once you are finished with that page. | |
| void | runDefaultPrintLoop () |
| This is a high level function that can attempt to run a print loop through all the pages of the printing document, starting with the first page, and ending with the last page. | |
Public Attributes | |
| VCF::Delegate | PrintDelegate |
| PageBegun | |
| PageDone | |
| PrintingBegun | |
| PrintingFinished | |
Protected Attributes | |
| String | title_ |
| PrintSessionPeer * | peer_ |
| bool | errorDuringPrinting_ |
| int | currentPage_ |
Detailed Description
The PrintSession is the core printing class.You use it to set things up with default attributes, to start printing, to end printing, to start a new page, and to end the page.
- Event Delegates for this class:
Member Enumeration Documentation
|
|
|
|
|
|
|
|
An enumeration of different standard page sizes.
|
|
|
The page units.
|
|
|
|
Constructor & Destructor Documentation
|
|
|
|
|
|
Member Function Documentation
|
|
Aborts the current printing session.
|
|
|
This should be called for each page of the "document" that you want to print.
|
|
|
Starts printing the document. This will return a new instance of a PrintContext for which the caller is responsible for. |
|
|
This should be called for each page of the "document" once you are finished with that page. For example, this will print a single page:
PrintSession session; PrintContext* ctx = session.beginPrintingDocument(); session.beginPage( ctx ); //your code here that draws in the ctx session.endPage( ctx ); session.endPrintingDocument(); |
|
|
This ends the printing for the document.
|
|
|
Returns the dots per inch (DPI) for this session. Note that the DPI value for this maybe quite a bit higher than the value returned by GraphicsToolkit::getDPI(NULL), which returns the screen based DPI, whereas this returns the printing device DPI.
|
|
|
Returns the last page to print for this session.
|
|
|
Returns the page rect in pixel units.
|
|
|
returns the page size in pixels, adjusted for the DPI of the printing device.
|
|
|
Returns the page size in the scale of the units requested.
|
|
|
Returns a vector of printable pages. The default, assuming the start page was set to 1, and the end page to 10, might look like: element page
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
element page
0 2
1 4
2 5
3 9
|
|
|
returns the print info handle. This is an opaque handle to a platform specific struct, and you cannot manipulate it other than to pass it to other printing classes. |
|
|
returns the page this session wil use to start printing
|
|
|
returns the title for the print session. On some platform this may be displayed in the UI for displaying print progress. |
|
|
This is a high level function that can attempt to run a print loop through all the pages of the printing document, starting with the first page, and ending with the last page.
PrintSession session; session.setStartPage( 1 ); session.setEndPage( 10 ); session.runDefaultPrintLoop(); //this will print 10 pages. This will call beginPrintingDocument(), endPrintingDocument(), beginPage(), and endPage(), as appropriate. You can handle the actual drawing by add an event handler to the PageBegun delegate, which will get fired for each page. See the example in vcf/examples/Printing for a more complete example of this. |
|
|
Sets the print sessions settings to default values appropriate for the platform.
|
|
|
Sets the last page to print.
|
|
|
Sets the page drawing rect.
|
|
|
Sets the page size. Assumes the width and height are in pixels. |
|
||||||||||||
|
Sets the page size using the requested units.
|
|
|
|
|
|
|
|
|
Sets the page size in one of the standard page size enumerations.
|
|
|
Sets the page number to start printing with.
|
|
|
Set the title for the print session.
|
Member Data Documentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The documentation for this class was generated from the following file:
- vcf/GraphicsKit/PrintSession.h
