FLTK
Fl_Paged_Device.H
Go to the documentation of this file.
1 //
2 // Printing support for the Fast Light Tool Kit (FLTK).
3 //
4 // Copyright 2010-2016 by Bill Spitzak and others.
5 //
6 // This library is free software. Distribution and use rights are outlined in
7 // the file "COPYING" which should have been included with this file. If this
8 // file is missing or damaged, see the license at:
9 //
10 // https://www.fltk.org/COPYING.php
11 //
12 // Please see the following page on how to report bugs and issues:
13 //
14 // https://www.fltk.org/bugs.php
15 //
16 
21 #ifndef Fl_Paged_Device_H
22 #define Fl_Paged_Device_H
23 
24 #include <FL/Fl_Widget_Surface.H>
25 
26 
28 #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
29 
36 class FL_EXPORT Fl_Paged_Device : public Fl_Widget_Surface {
37 protected:
40 public:
46  enum Page_Format {
47  A0 = 0,
48  A1,
49  A2,
50  A3,
51  A4,
52  A5,
53  A6,
54  A7,
55  A8,
56  A9,
57  B0,
58  B1,
59  B2,
60  B3,
61  B4,
62  B5,
63  B6,
64  B7,
65  B8,
66  B9,
67  B10,
68  C5E,
69  DLE,
70  EXECUTIVE,
71  FOLIO,
72  LEDGER,
73  LEGAL,
75  TABLOID,
76  ENVELOPE,
77  MEDIA = 0x1000
78  };
82  enum Page_Layout {
83  PORTRAIT = 0,
84  LANDSCAPE = 0x100,
85  REVERSED = 0x200,
86  ORIENTATION = 0x300
87  };
88 
91  typedef struct {
93  int width;
95  int height;
97  const char *name;
98  } page_format;
101  static const page_format page_formats[NO_PAGE_FORMATS];
103  virtual ~Fl_Paged_Device() {};
104  virtual int begin_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL, char **perr_message = NULL);
107  int start_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL, char **perr_message = NULL) {
108  return begin_job(pagecount, frompage, topage, perr_message);
109  }
110  virtual int begin_page(void);
113  int start_page() {return begin_page();}
114  virtual void margins(int *left, int *top, int *right, int *bottom);
115  virtual void scale(float scale_x, float scale_y = 0.);
116  virtual void rotate(float angle);
118  void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0) {draw(widget, delta_x, delta_y);}
120  void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0) {
121  draw_decorated_window(win, x_offset, y_offset);
122  }
123  virtual int end_page (void);
124  virtual void end_job (void);
125 };
126 
127 #endif // Fl_Paged_Device_H
128 
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:85
Represents page-structured drawing surfaces.
Definition: Fl_Paged_Device.H:36
This widget produces an actual window.
Definition: Fl_Window.H:53
virtual ~Fl_Paged_Device()
The destructor.
Definition: Fl_Paged_Device.H:103
Page_Layout
Possible page layouts.
Definition: Fl_Paged_Device.H:82
Fl_Paged_Device()
The constructor.
Definition: Fl_Paged_Device.H:39
width, height and name of a page format
Definition: Fl_Paged_Device.H:91
virtual 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.
Definition: Fl_Widget_Surface.cxx:198
int height
height in points
Definition: Fl_Paged_Device.H:95
int start_page()
Synonym of begin_page().
Definition: Fl_Paged_Device.H:113
void draw(Fl_Widget *widget, int delta_x=0, int delta_y=0)
Draws the widget on the drawing surface.
Definition: Fl_Widget_Surface.cxx:43
int width
width in points
Definition: Fl_Paged_Device.H:93
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).
Definition: Fl_Paged_Device.H:107
A surface on which any FLTK widget can be drawn.
Definition: Fl_Widget_Surface.H:25
Page_Format
Possible page formats.
Definition: Fl_Paged_Device.H:46
void print_window(Fl_Window *win, int x_offset=0, int y_offset=0)
Synonym of draw_decorated_window(Fl_Window*, int, int)
Definition: Fl_Paged_Device.H:120
#define NO_PAGE_FORMATS
Number of elements in enum Page_Format.
Definition: Fl_Paged_Device.H:28
void print_widget(Fl_Widget *widget, int delta_x=0, int delta_y=0)
Synonym of draw(Fl_Widget*, int, int)
Definition: Fl_Paged_Device.H:118
Letter format.
Definition: Fl_Paged_Device.H:74
A4 format.
Definition: Fl_Paged_Device.H:51
const char * name
format name
Definition: Fl_Paged_Device.H:97