KrPrinter

From EDM2
Jump to: navigation, search

Description

#include "krprint.hpp"

This class is used to output graphics to a printer. Its use is similar to that of IDrawingCanvas.

In addition, KrPrinter provides methods to let the user choose the printer and the settings he wants to use.

Derivation

KrPrinter inherits from IBase.

Constructors

You can construct and destruct objects of this class.

Overload 1

public:
KrPrinter ();

The default constructor does not set any graphics list. Use setList before doing any printing.

The printer which is used when print is called is initially the system default printer, using its default settings.

Public Functions

Constructors

KrPrinter

You can construct and destruct objects of this class.

Overload 1

public:
KrPrinter ();

The default constructor does not set any graphics list. Use setList before doing any printing.

The printer which is used when print is called is initially the system default printer, using its default settings.

Graphic List

setList

Use this function to select an IGList into the KrPrinter object. The contents of the IGList will be printed when print is called.

The function returns the previously used IGList. If no IGList has been selected into the KrPronter object so far, 0 is returned.

public:
IGList* setList (IGList& list);

Printing

print

Use this function to print the contents of the IGList previously selected by setList.

The string title is used as the job title which appears in the queue display of the printer object.

public:
Boolean print (IString title);

Retrieving Information

getArea

This function returns the rectangular area in system coordinates on which drawing on the printer takes place. p1 represents the lower left corner, p2 the upper right corner.

public:
void getArea (IPoint & p1, IPoint & p2);

User Interaction

printDialog

This function pops up a dialog window in which the user can choose any printer which is to be used on subsequent calls to print. The user is also prompted to define his own printer settings for the print job. The printer and its settings are stored for the lifetime of the KrPrinter object. The only way to change them is to call printDialog again.

At the end of his input, the user may either press the OK button or the Cancel button. If he chose the OK button, true is returned.

public:
Boolean printDialog ();