FLTK 1.4.0
Fl_Paged_Device Class Reference

Represents page-structured drawing surfaces. More...

#include <Fl_Paged_Device.H>

Inheritance diagram for Fl_Paged_Device:
Fl_Widget_Surface Fl_Surface_Device Fl_PostScript_File_Device Fl_Printer

Classes

struct  page_format
 width, height and name of a page format More...
 

Public Types

enum  Page_Format {
  A0 = 0 , A1 , A2 , A3 ,
  A4 , A5 , A6 , A7 ,
  A8 , A9 , B0 , B1 ,
  B2 , B3 , B4 , B5 ,
  B6 , B7 , B8 , B9 ,
  B10 , C5E , DLE , EXECUTIVE ,
  FOLIO , LEDGER , LEGAL , LETTER ,
  TABLOID , ENVELOPE , MEDIA = 0x1000
}
 Possible page formats. More...
 
enum  Page_Layout { PORTRAIT = 0 , LANDSCAPE = 0x100 , REVERSED = 0x200 , ORIENTATION = 0x300 }
 Possible page layouts. More...
 

Public Member Functions

virtual int begin_job (int pagecount=0, int *frompage=NULL, int *topage=NULL, char **perr_message=NULL)
 Begins a print job. More...
 
virtual int begin_page (void)
 Begins a new printed page. More...
 
virtual void end_job (void)
 To be called at the end of a print job. More...
 
virtual int end_page (void)
 To be called at the end of each page. More...
 
virtual void margins (int *left, int *top, int *right, int *bottom)
 Computes the dimensions of margins that lie between the printable page area and the full page. More...
 
void print_widget (Fl_Widget *widget, int delta_x=0, int delta_y=0)
 Synonym of draw(Fl_Widget*, int, int)
 
void print_window (Fl_Window *win, int x_offset=0, int y_offset=0)
 Synonym of draw_decorated_window(Fl_Window*, int, int)
 
virtual void rotate (float angle)
 Rotates the graphics operations relatively to paper. More...
 
virtual void scale (float scale_x, float scale_y=0.)
 Changes the scaling of page coordinates. More...
 
int start_job (int pagecount=0, int *frompage=NULL, int *topage=NULL, char **perr_message=NULL)
 Synonym of begin_job(int pagecount, int *frompage, int *topage, char **perr_message). More...
 
int start_page ()
 Synonym of begin_page(). More...
 
virtual ~Fl_Paged_Device ()
 The destructor.
 
- Public Member Functions inherited from Fl_Widget_Surface
void draw (Fl_Widget *widget, int delta_x=0, int delta_y=0)
 Draws the widget on the drawing surface. More...
 
void draw_decorated_window (Fl_Window *win, int x_offset=0, int y_offset=0)
 Draws a window with its title bar and frame if any. More...
 
virtual void origin (int *x, int *y)
 Computes the coordinates of the current origin of graphics functions. More...
 
virtual void origin (int x, int y)
 Sets the position of the origin of graphics in the drawable part of the drawing surface. More...
 
void print_window_part (Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0)
 Draws a rectangular part of an on-screen window. More...
 
virtual int printable_rect (int *w, int *h)
 Computes the width and height of the drawable area of the drawing surface. More...
 
virtual void translate (int x, int y)
 Translates the current graphics origin accounting for the current rotation. More...
 
virtual void untranslate ()
 Undoes the effect of a previous translate() call. More...
 
- Public Member Functions inherited from Fl_Surface_Device
Fl_Graphics_Driver * driver ()
 Returns the graphics driver of this drawing surface.
 
virtual bool is_current ()
 Is this surface the current drawing surface? More...
 
virtual void set_current (void)
 Make this surface the current drawing surface. More...
 
virtual ~Fl_Surface_Device ()
 The destructor.
 

Static Public Attributes

static const page_format page_formats [NO_PAGE_FORMATS]
 width, height and name of all elements of the enum Page_Format.
 

Protected Member Functions

 Fl_Paged_Device ()
 The constructor.
 
- Protected Member Functions inherited from Fl_Widget_Surface
 Fl_Widget_Surface (Fl_Graphics_Driver *d)
 The constructor. More...
 
- Protected Member Functions inherited from Fl_Surface_Device
void driver (Fl_Graphics_Driver *graphics_driver)
 Sets the graphics driver of this drawing surface.
 
virtual void end_current ()
 FLTK calls this each time a surface ceases to be the current drawing surface. More...
 
 Fl_Surface_Device (Fl_Graphics_Driver *graphics_driver)
 Constructor that sets the graphics driver to use for the created surface.
 

Additional Inherited Members

- Static Public Member Functions inherited from Fl_Surface_Device
static Fl_Surface_Devicepop_current ()
 Removes the top element from the current drawing surface stack, and makes the new top element current. More...
 
static void push_current (Fl_Surface_Device *new_current)
 Pushes new_current on top of the stack of current drawing surfaces, and makes it current. More...
 
static Fl_Surface_Devicesurface ()
 The current drawing surface. More...
 
- Protected Attributes inherited from Fl_Widget_Surface
int x_offset
 horizontal offset to the origin of graphics coordinates
 
int y_offset
 vertical offset to the origin of graphics coordinates
 

Detailed Description

Represents page-structured drawing surfaces.

This class has no public constructor: don't instantiate it; use Fl_Printer or Fl_PostScript_File_Device instead.

Member Enumeration Documentation

◆ Page_Format

Possible page formats.

All paper formats with pre-defined width and height. The Fl_Paged_Device::page_formats array gives these widths and heights.

Enumerator
A0 

A0 format.

A1 

A1 format.

A2 

A2 format.

A3 

A3 format.

A4 

A4 format.

A5 

A5 format.

A6 

A6 format.

A7 

A7 format.

A8 

A8 format.

A9 

A9 format.

B0 

B0 format.

B1 

B1 format.

B2 

B2 format.

B3 

B3 format.

B4 

B4 format.

B5 

B5 format.

B6 

B6 format.

B7 

B7 format.

B8 

B8 format.

B9 

B9 format.

B10 

B10 format.

EXECUTIVE 

Executive format.

FOLIO 

Folio format.

LEDGER 

Ledger format.

LEGAL 

Legal format.

LETTER 

Letter format.

TABLOID 

Tabloid format.

◆ Page_Layout

Possible page layouts.

Enumerator
PORTRAIT 

Portrait orientation.

LANDSCAPE 

Landscape orientation.

REVERSED 

Reversed orientation.

ORIENTATION 

orientation

Member Function Documentation

◆ begin_job()

int Fl_Paged_Device::begin_job ( int  pagecount = 0,
int *  frompage = NULL,
int *  topage = NULL,
char **  perr_message = NULL 
)
virtual

Begins a print job.

Parameters
[in]pagecountthe total number of pages of the job (or 0 if you don't know the number of pages)
[out]frompageif non-null, *frompage is set to the first page the user wants printed
[out]topageif non-null, *topage is set to the last page the user wants printed
[out]perr_messageif non-null and if the returned value is ≥ 2, *perr_message is set to a string describing the error. That string can be delete[]'d after use.
Returns
0 if OK, 1 if user cancelled the job, ≥ 2 if any error.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ begin_page()

int Fl_Paged_Device::begin_page ( void  )
virtual

Begins 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 printable page area. This function also makes this surface the current drawing surface with Fl_Surface_Device::push_current().

Note
begin_page() calls Fl_Surface_Device::push_current() and leaves this device as the active surface. If any calls between begin_page() and end_page() open dialog boxes or will otherwise draw into FLTK windows, those calls must be put between a call to Fl_Surface_Device::pop_current() and a call to Fl_Surface_Device::push_current(), or the content of the dialog box will be rendered to the printer instead of the screen.
Returns
0 if OK, non-zero if any error

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ end_job()

void Fl_Paged_Device::end_job ( void  )
virtual

To be called at the end of a print job.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ end_page()

int Fl_Paged_Device::end_page ( void  )
virtual

To be called at the end of each page.

This function also stops this surface from being the current drawing surface with Fl_Surface_Device::pop_current().

Note
end_page() calls Fl_Surface_Device::pop_current(). If any calls between begin_page() and end_page() open dialog boxes or will otherwise draw into FLTK windows, those calls must be put between a call to Fl_Surface_Device::pop_current() and a call to Fl_Surface_Device::push_current().
Returns
0 if OK, non-zero if any error.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ margins()

void Fl_Paged_Device::margins ( int *  left,
int *  top,
int *  right,
int *  bottom 
)
virtual

Computes the dimensions of margins that lie between the printable page area and the full page.

Values are in the same unit as that used by FLTK drawing functions. They are changed by scale() calls.

Parameters
[out]leftIf non-null, *left is set to the left margin size.
[out]topIf non-null, *top is set to the top margin size.
[out]rightIf non-null, *right is set to the right margin size.
[out]bottomIf non-null, *bottom is set to the bottom margin size.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ rotate()

void Fl_Paged_Device::rotate ( float  angle)
virtual

Rotates the graphics operations relatively to paper.

The rotation is centered on the current graphics origin. Successive rotate() calls don't combine their effects.

Parameters
angleRotation angle in counter-clockwise degrees.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ scale()

void Fl_Paged_Device::scale ( float  scale_x,
float  scale_y = 0. 
)
virtual

Changes the scaling of page coordinates.

This function also resets the origin of graphics functions at top left of printable page area. After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area. Successive scale() calls don't combine their effects.

Parameters
scale_xHorizontal dimensions of plot are multiplied by this quantity.
scale_ySame as above, vertically. The value 0. is equivalent to setting scale_y = scale_x. Thus, scale(factor); is equivalent to scale(factor, factor);

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

◆ start_job()

int Fl_Paged_Device::start_job ( int  pagecount = 0,
int *  frompage = NULL,
int *  topage = NULL,
char **  perr_message = NULL 
)
inline

Synonym of begin_job(int pagecount, int *frompage, int *topage, char **perr_message).

For API compatibility with FLTK 1.3.x

◆ start_page()

int Fl_Paged_Device::start_page ( )
inline

Synonym of begin_page().

For API compatibility with FLTK 1.3.x


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