Fl_Native_Printer Class Reference

Provides an OS-independent interface to printing under MSWindows and Mac OS X. More...

#include <Fl_Native_Printer.H>

List of all members.

Public Member Functions

 Fl_Native_Printer (void)
 The constructor.
int startjob (int pagecount, int *frompage=NULL, int *topage=NULL)
 Starts a print job.
int startpage (void)
 Starts a new printed page.
int getprintablerect (int *x, int *y, int *w, int *h)
 Computes the origin and size of the printable area of the page.
void setorigin (int x, int y)
 Sets the position in page coordinates of the origin of graphics functions.
void rescale (float scale_x, float scale_y)
 Changes the scaling of page coordinates.
void printwidget (Fl_Widget *widget)
 Draws the widget on the printed page.
int endpage (void)
 To be called at the end of each page.
void endjob (void)
 To be called at the end of a print job.


Detailed Description

Provides an OS-independent interface to printing under MSWindows and Mac OS X.

This class provides an OS-independent interface to printing under MSWindows and Mac OS X only. It allows to use all FLTK drawing, color, text, and clip functions, and to have them operate on printed page(s). There are two main ways to use it.

In both cases, begin by startjob(), startpage(), getprintablerect() and setorigin() calls and finish by endpage() and endjob() calls.

Member Function Documentation

int Fl_Native_Printer::endpage ( void   ) 

To be called at the end of each page.

Returns:
0 iff OK.

int Fl_Native_Printer::getprintablerect ( int *  x,
int *  y,
int *  w,
int *  h 
)

Computes the origin and size of the printable area of the page.

Values are in the same unit as that used by FLTK drawing functions, are unchanged by calls to setorigin(), but are changed by rescale() calls.

Returns:
0 iff OK.

void Fl_Native_Printer::printwidget ( Fl_Widget *  widget  )  [inline]

Draws the widget on the printed page.

The widget's position on the printed page is determined by a previous call to setorigin(). Its dimensions are in points unless there was a previous call to rescale().

Parameters:
[in] widget any FLTK widget (e.g., standard, custom, window).

void Fl_Native_Printer::rescale ( float  scale_x,
float  scale_y 
)

Changes the scaling of page coordinates.

Use next getprintablerect() to get the new coordinates of the printable page area. Successive rescale() calls don't cumulate their effects.

Parameters:
scale_x Horizontal dimensions of plot are multiplied by this quantity
scale_y Vertical dimensions of plot are multiplied by this quantity

int Fl_Native_Printer::startjob ( int  pagecount,
int *  frompage = NULL,
int *  topage = NULL 
)

Starts a print job.

Parameters:
[in] pagecount the total number of pages of the job
[out] frompage if non-null, *frompage is set to the first page the user wants printed
[out] topage if non-null, *topage is set to the last page the user wants printed
Returns:
0 iff OK

int Fl_Native_Printer::startpage ( void   ) 

Starts a new printed page.

The page coordinates are initially in points, i.e., 1/72 inch, and with origin at the top left of the page or of the printable page area.

Returns:
0 iff OK


The documentation for this class was generated from the following file:

Generated on Sat Feb 6 14:38:26 2010 for FlNativePrinter by  doxygen 1.5.9