fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Paged_Device Class Reference

Represents page-structured drawing surfaces. More...

#include <Fl_Paged_Device.H>

Inheritance diagram for Fl_Paged_Device:
Collaboration diagram for Fl_Paged_Device:

List of all members.

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 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 int printable_rect (int *w, int *h)
 Computes the width and height of the printable area of the 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)
 Sets the position in page coordinates of the origin of graphics functions.
void origin (int *x, int *y)
 Computes the page coordinates of the current origin of graphics functions.
virtual void scale (float scale_x, float scale_y)
 Changes the scaling of page coordinates.
virtual void rotate (float angle)
 Rotates the graphics operations relatively to paper.
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.
void print_widget (Fl_Widget *widget, int delta_x=0, int delta_y=0)
 Draws the widget on the printed page.
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 end_page (void)
 To be called at the end of each page.
virtual void end_job (void)
 To be called at the end of a print job.

Static Public Attributes

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

Protected Member Functions

 Fl_Paged_Device ()
 The constructor.
virtual ~Fl_Paged_Device ()
 The destructor.

Protected Attributes

int x_offset
 horizontal offset to the origin of graphics coordinates
int y_offset
 vertical offset to the origin of graphics coordinates
struct chain_elt * image_list_
 chained list of Fl_Image's used in this page

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.

Definition at line 47 of file Fl_Paged_Device.H.


Member Enumeration Documentation

Possible page formats.

All paper formats with pre-defined width and height.

Enumerator:
A0 

A0 format

A1 
A2 
A3 
A4 

A4 format

A5 
A6 
A7 
A8 
A9 
B0 
B1 
B2 
B3 
B4 
B5 
B6 
B7 
B8 
B9 
B10 
C5E 
DLE 
EXECUTIVE 
FOLIO 
LEDGER 
LEGAL 
LETTER 

Letter format

TABLOID 
ENVELOPE 
MEDIA 

Definition at line 54 of file Fl_Paged_Device.H.

Possible page layouts.

Enumerator:
PORTRAIT 

Portrait orientation

LANDSCAPE 

Landscape orientation

REVERSED 

Reversed orientation

ORIENTATION 

orientation

Definition at line 90 of file Fl_Paged_Device.H.


Constructor & Destructor Documentation

Fl_Paged_Device::Fl_Paged_Device ( ) [inline, protected]

The constructor.

Definition at line 133 of file Fl_Paged_Device.H.

References class_id, and Fl_Device::class_name().

virtual Fl_Paged_Device::~Fl_Paged_Device ( ) [inline, protected, virtual]

The destructor.

Definition at line 135 of file Fl_Paged_Device.H.


Member Function Documentation

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.

Definition at line 274 of file Fl_Paged_Device.cxx.

int Fl_Paged_Device::end_page ( void  ) [virtual]

To be called at the end of each page.

Returns:
0 iff OK.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 269 of file Fl_Paged_Device.cxx.

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.

Definition at line 229 of file Fl_Paged_Device.cxx.

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]xHorizontal position in page coordinates of the desired origin of graphics functions.
[in]ySame as above, vertically.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 242 of file Fl_Paged_Device.cxx.

Referenced by print_widget().

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

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

Parameters:
[out]xIf non-null, *x is set to the horizontal page offset of graphics origin.
[out]ySame as above, vertically.

Definition at line 113 of file Fl_Paged_Device.cxx.

References x_offset, and y_offset.

void Fl_Paged_Device::print_widget ( Fl_Widget widget,
int  delta_x = 0,
int  delta_y = 0 
)

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]widgetAny FLTK widget (e.g., standard, custom, window).
[in]delta_xOptional horizontal offset for positioning the widget relatively to the current origin of graphics functions.
[in]delta_ySame as above, vertically.

Definition at line 49 of file Fl_Paged_Device.cxx.

References Fl_Widget::as_gl_window(), Fl_Widget::as_window(), Fl_Widget::damage(), Fl_Widget::draw(), FL_DAMAGE_ALL, fl_pop_clip(), fl_push_clip(), Fl_Widget::h(), height, NULL, origin(), Fl_Plugin_Manager::plugin(), Fl_Device_Plugin::print(), printable_rect(), translate(), untranslate(), Fl_Widget::visible(), Fl_Widget::w(), width, Fl_Widget::x(), and Fl_Widget::y().

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 
)

Prints a rectangular part of an on-screen window.

Parameters:
winThe window from where to capture.
xThe rectangle left
yThe rectangle top
wThe rectangle width
hThe rectangle height
delta_xOptional horizontal offset from current graphics origin where to print the captured rectangle.
delta_yAs above, vertically.

Definition at line 130 of file Fl_Paged_Device.cxx.

References Fl::check(), Fl_Window::current(), Fl_Display_Device::display_device(), Fl::first_window(), fl_draw_image(), fl_gc, fl_read_image(), i, Fl_Window::make_current(), NULL, Fl_Surface_Device::set_current(), Fl_Window::show(), Fl_Surface_Device::surface(), w, and width.

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 iff OK.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 216 of file Fl_Paged_Device.cxx.

Referenced by print_widget().

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 counterclockwise degrees.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 262 of file Fl_Paged_Device.cxx.

void Fl_Paged_Device::scale ( float  scale_x,
float  scale_y 
) [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.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 253 of file Fl_Paged_Device.cxx.

int Fl_Paged_Device::start_job ( int  pagecount,
int *  frompage = NULL,
int *  topage = NULL 
) [virtual]

Starts a print job.

Parameters:
[in]pagecountthe total number of pages of the job
[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
Returns:
0 iff OK

Reimplemented in Fl_PostScript_Printer, and Fl_Printer.

Definition at line 197 of file Fl_Paged_Device.cxx.

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 iff OK

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 206 of file Fl_Paged_Device.cxx.

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, and Fl_Printer.

Definition at line 283 of file Fl_Paged_Device.cxx.

Referenced by print_widget().

void Fl_Paged_Device::untranslate ( void  ) [virtual]

Undoes the effect of a previous translate() call.

Reimplemented in Fl_PostScript_File_Device, and Fl_Printer.

Definition at line 288 of file Fl_Paged_Device.cxx.

Referenced by print_widget().


Member Data Documentation

const char * Fl_Paged_Device::class_id = "Fl_Paged_Device" [static]

A string that identifies each subclass of Fl_Device.

Function class_name() applied to a device of this class returns this string.

Reimplemented from Fl_Surface_Device.

Reimplemented in Fl_PostScript_File_Device, Fl_PostScript_Printer, and Fl_Printer.

Definition at line 135 of file Fl_Paged_Device.H.

Referenced by Fl_Paged_Device().

struct chain_elt* Fl_Paged_Device::image_list_ [protected]

chained list of Fl_Image's used in this page

Definition at line 127 of file Fl_Paged_Device.H.

width, height and name of all elements of the enum Page_Format.

Definition at line 109 of file Fl_Paged_Device.H.

Referenced by Fl_PostScript_Graphics_Driver::page(), and Fl_PostScript_Graphics_Driver::start_postscript().

int Fl_Paged_Device::x_offset [protected]

horizontal offset to the origin of graphics coordinates

Definition at line 123 of file Fl_Paged_Device.H.

Referenced by Fl_PostScript_File_Device::origin(), origin(), Fl_PostScript_File_Device::rotate(), and Fl_PostScript_File_Device::start_page().

int Fl_Paged_Device::y_offset [protected]

vertical offset to the origin of graphics coordinates

Definition at line 125 of file Fl_Paged_Device.H.

Referenced by Fl_PostScript_File_Device::origin(), origin(), Fl_PostScript_File_Device::rotate(), and Fl_PostScript_File_Device::start_page().


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