The IlvPrintable Class
IlvPrintable is an abstract class that provides a base for describing objects that can be printed. Its is associated with a printable job that contains the printing parameters for a given job.
A printable can be described by subclassing the following methods:
public virtual IlvRect getBBox(IlvPrintableJob const& job) const = 0; protected virtual IlBoolean internalPrint(IlvPrintableJob const& job) const = 0; A few subclasses of IlvPrintable are available:
// declares a printable using the given region of a container.
// if the rectangle is null then the whole container is printed.
IlvPrintableContainer* printcont = new IlvPrintableContainer(container,
&rect);
IlvPrintableText allows printing of text. An alignment parameter can be specified.
// declares a printable using a simple text.
IlvPrintableText* printtext = new IlvPrintableText
(display->defaultPalette(),
"This is a text",
IlvCenter);
IlvPrintableFormattedText allows printing of text with various predefined attributes. Each Conversion specification is introduced by the character
%. The following attributes are defined:
%p | The index of the page will be printed. |
%P | The total number of pages will be printed. |
%N | The document name will be printed. |
%y | The year will be printed. |
%M | The month will be printed numerically. |
%d | The day of the month will be printed. |
%h | The hour of the day (0-24) will be printed. |
%H | The hour will be printed. |
%m | The minute will be printed. |
%s | The second will be printed. |
%AM | The AM/PM indicator will be printed in upper case. |
%am | The am/pm indicator will be printed in lower case. |
You may still print %p codes by replacing them with %\p.
// declares a printable formated text
IlvPrintableFormattedText* printftext = new
IlvPrintableFormattedText(display->defaultPalette(),
"%N : (Page %p/%P - %d/%M/%y - %h:%m:s)");
// declares a printable graphic
IlvGraphic* ellipse = new IlvFilledEllipse(display,
IlvRect(0, 0, 100, 50));
IlvPrintableGraphic* printgraphic = new IlvPrintableGraphic(ellipse);
// declares a printable frame
IlvPrintableFrame* printframe = new IlvPrintableFrame
(display->defaultPalette());
Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.