FLTK 1.3.9: Fl_Paged_Device Class Reference

FLTK 1.3.9

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Fl_Paged_Device Class Reference

Represents page-structured drawing surfaces. More...

`#include <Fl_Paged_Device.H>`

Inheritance diagram for Fl_Paged_Device:

## 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
const char * | class_name ()
| Returns the name of the class of this object.
virtual void | end_job (void)
| To be called at the end of a print job.
virtual int | end_page (void)
| To be called at the end of each page.
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.
virtual void | origin (int *x, int *y)
| Computes the page coordinates of the current origin of graphics functions.
virtual void | origin (int x, int y)
| Sets the position in page coordinates of the origin of graphics functions.
virtual void | print_widget (Fl_Widget *widget, int delta_x=0, int delta_y=0)
| Draws the widget on the printed page.
void | print_window (Fl_Window *win, int x_offset=0, int y_offset=0)
| Prints a window with its title bar and frame if any.
virtual void | print_window_part (Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0)
| Prints a rectangular part of an on-screen window.
virtual int | printable_rect (int *w, int *h)
| Computes the width and height of the printable area of the page.
virtual void | rotate (float angle)
| Rotates the graphics operations relatively to paper.
virtual void | scale (float scale_x, float scale_y=0.)
| Changes the scaling of page coordinates.
virtual int | start_job (int pagecount, int *frompage=NULL, int *topage=NULL)
| Starts a print job.
virtual int | start_page (void)
| Starts a new printed page.
virtual void | translate (int x, int y)
| Translates the current graphics origin accounting for the current rotation.
virtual void | untranslate (void)
| Undoes the effect of a previous translate() call.
virtual | ~Fl_Paged_Device ()
| The destructor.
Public Member Functions inherited from Fl_Surface_Device
const char * | class_name ()
| Returns the name of the class of this object.
Fl_Graphics_Driver * | driver ()
| Returns the graphics driver of this drawing surface.
void | driver (Fl_Graphics_Driver *graphics_driver)
| Sets the graphics driver of this drawing surface.
virtual void | set_current (void)
| Make this surface the current drawing surface.
virtual | ~Fl_Surface_Device ()
| The destructor.
Public Member Functions inherited from Fl_Device
virtual const char * | class_name ()
| Returns the name of the class of this object.
virtual | ~Fl_Device ()
| Virtual destructor.

## Static Public Attributes
static const char * | class_id = "Fl_Paged_Device"
static const page_format | page_formats [NO_PAGE_FORMATS]
| width, height and name of all elements of the enum Page_Format.
Static Public Attributes inherited from Fl_Surface_Device
static const char * | class_id = "Fl_Surface_Device"
Static Public Attributes inherited from Fl_Device
static const char * | class_id = "Fl_Device"
| A string that identifies each subclass of Fl_Device.

## Protected Member Functions
| Fl_Paged_Device ()
| The constructor.
Protected Member Functions inherited from Fl_Surface_Device
| Fl_Surface_Device (Fl_Graphics_Driver *graphics_driver)
| Constructor that sets the graphics driver to use for the created surface.

## Protected Attributes
int | x_offset
| horizontal offset to the origin of graphics coordinates
int | y_offset
| vertical offset to the origin of graphics coordinates

## Friends
class | Fl_Copy_Surface
class | Fl_Image_Surface

## Additional Inherited Members
Static Public Member Functions inherited from Fl_Surface_Device
static Fl_Surface_Device * | surface ()
| The current drawing surface.

## 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

enum Fl_Paged_Device::Page_Format

Possible page formats.

All paper formats with pre-defined width and height.

Enumerator
A0 | A0 format.
A4 | A4 format.
LETTER | Letter format.

## ◆ Page_Layout

enum Fl_Paged_Device::Page_Layout

Possible page layouts.

Enumerator
PORTRAIT | Portrait orientation.
LANDSCAPE | Landscape orientation.
REVERSED | Reversed orientation.
ORIENTATION | orientation

## Member Function Documentation

## ◆ class_name()

const char * Fl_Paged_Device::class_name | ( |  | ) |
| inlinevirtual

Returns the name of the class of this object.

Use of the class_name() function is discouraged because it will be removed from future FLTK versions.

The class of an instance of an Fl_Device subclass can be checked with code such as:

if ( instance->class_name() == Fl_Printer::class_id ) { ... }

Reimplemented from Fl_Surface_Device.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, Fl_PostScript_Printer, 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, Fl_System_Printer, and Fl_Printer.

## ◆ end_page()

int Fl_Paged_Device::end_page | ( | void |  | ) |
| virtual

To be called at the end of each page.

Returns
  0 if OK, non-zero if any error.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, 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] | left | If non-null, *left is set to the left margin size.
  [out] | top | If non-null, *top is set to the top margin size.
  [out] | right | If non-null, *right is set to the right margin size.
  [out] | bottom | If non-null, *bottom is set to the bottom margin size.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, and Fl_Printer.

## ◆ origin() [1/2]

void Fl_Paged_Device::origin | ( | int * | x,
|  | int * | y
| ) |  |
| virtual

Computes the page coordinates of the current origin of graphics functions.

Parameters

  [out] | x | If non-null, *x is set to the horizontal page offset of graphics origin.
  [out] | y | Same as above, vertically.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, and Fl_Printer.

## ◆ origin() [2/2]

void Fl_Paged_Device::origin | ( | int | x,
|  | int | y
| ) |  |
| virtual

Sets the position in page coordinates of the origin of graphics functions.

Arguments should be expressed relatively to the result of a previous printable_rect() call. That is, `printable_rect(&w, &h); origin(w/2, 0);` sets the graphics origin at the top center of the page printable area. Origin() calls are not affected by rotate() calls. Successive origin() calls don't combine their effects.

Parameters

  [in] | x | Horizontal position in page coordinates of the desired origin of graphics functions.
  [in] | y | Same as above, vertically.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, and Fl_Printer.

## ◆ print_widget()

void Fl_Paged_Device::print_widget | ( | Fl_Widget * | widget,
|  | int | delta_x = `0`,
|  | int | delta_y = `0`
| ) |  |
| virtual

Draws the widget on the printed page.

The widget's position on the printed page is determined by the last call to origin() and by the optional delta_x and delta_y arguments. Its dimensions are in points unless there was a previous call to scale().

Parameters

  [in] | widget | Any FLTK widget (e.g., standard, custom, window).
  [in] | delta_x | Optional horizontal offset for positioning the widget relatively to the current origin of graphics functions.
  [in] | delta_y | Same as above, vertically.

Reimplemented in Fl_Printer.

## ◆ print_window()

void Fl_Paged_Device::print_window | ( | Fl_Window * | win,
|  | int | x_offset = `0`,
|  | int | y_offset = `0`
| ) |  |

Prints a window with its title bar and frame if any.

`x_offset` and `y_offset` are optional coordinates of where to position the window top left. Equivalent to print_widget() if `win` is a subwindow or has no border. Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the printed window.

## ◆ print_window_part()

void Fl_Paged_Device::print_window_part | ( | Fl_Window * | win,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | int | delta_x = `0`,
|  | int | delta_y = `0`
| ) |  |
| virtual

Prints a rectangular part of an on-screen window.

Parameters

  win | The window from where to capture.
  x | The rectangle left
  y | The rectangle top
  w | The rectangle width
  h | The rectangle height
  delta_x | Optional horizontal offset from current graphics origin where to print the captured rectangle.
  delta_y | As above, vertically.

Reimplemented in Fl_Printer.

## ◆ printable_rect()

int Fl_Paged_Device::printable_rect | ( | int * | w,
|  | int * | h
| ) |  |
| virtual

Computes the width and height 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 origin(), but are changed by scale() calls. Values account for the user-selected paper type and print orientation.

Returns
  0 if OK, non-zero if any error

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, 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

  angle | Rotation angle in counter-clockwise degrees.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, 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_x | Horizontal dimensions of plot are multiplied by this quantity.
  scale_y | Same 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, Fl_System_Printer, and Fl_Printer.

## ◆ start_job()

int Fl_Paged_Device::start_job | ( | int | pagecount,
|  | int * | frompage = `NULL`,
|  | int * | topage = `NULL`
| ) |  |
| virtual

Starts a print job.

Parameters

  [in] | pagecount | the total number of pages of the job (or 0 if you don't know the number of pages)
  [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 if OK, non-zero if any error

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, Fl_Printer, and Fl_PostScript_Printer.

## ◆ start_page()

int Fl_Paged_Device::start_page | ( | void |  | ) |
| virtual

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 printable page area.

Returns
  0 if OK, non-zero if any error

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, and Fl_Printer.

## ◆ translate()

void Fl_Paged_Device::translate | ( | int | x,
|  | int | y
| ) |  |
| virtual

Translates the current graphics origin accounting for the current rotation.

This function is only useful after a rotate() call. Each translate() call must be matched by an untranslate() call. Successive translate() calls add up their effects.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, and Fl_Printer.

## ◆ untranslate()

void Fl_Paged_Device::untranslate | ( | void |  | ) |
| virtual

Undoes the effect of a previous translate() call.

Reimplemented in Fl_PostScript_File_Device, Fl_System_Printer, and Fl_Printer.

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

- Fl_Paged_Device.H
- Fl_Paged_Device.cxx