FLTK 1.3.2
Fl_Paged_Device.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Paged_Device.H 9706 2012-11-06 20:46:14Z matt $"
3 //
4 // Printing support for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 2010 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
23 #ifndef Fl_Paged_Device_H
24 #define Fl_Paged_Device_H
25 
26 #include <FL/Fl_Device.H>
27 #include <FL/Fl_Window.H>
28 
30 #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
31 
38 class FL_EXPORT Fl_Paged_Device : public Fl_Surface_Device {
39 public:
45  enum Page_Format {
46  A0 = 0,
47  A1,
48  A2,
49  A3,
50  A4,
51  A5,
52  A6,
53  A7,
54  A8,
55  A9,
56  B0,
57  B1,
58  B2,
59  B3,
60  B4,
61  B5,
62  B6,
63  B7,
64  B8,
65  B9,
66  B10,
67  C5E,
68  DLE,
69  EXECUTIVE,
70  FOLIO,
71  LEDGER,
72  LEGAL,
74  TABLOID,
75  ENVELOPE,
76  MEDIA = 0x1000
77  };
81  enum Page_Layout {
82  PORTRAIT = 0,
83  LANDSCAPE = 0x100,
84  REVERSED = 0x200,
85  ORIENTATION = 0x300
86  };
87 
90  typedef struct {
92  int width;
94  int height;
96  const char *name;
97  } page_format;
100  static const page_format page_formats[NO_PAGE_FORMATS];
101 private:
102  void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
103 protected:
105  int x_offset;
107  int y_offset;
109  Fl_Paged_Device() : Fl_Surface_Device(NULL), x_offset(0), y_offset(0) {};
110 #if FLTK_ABI_VERSION >= 10301
111 public:
113  virtual ~Fl_Paged_Device() {};
114 #else
115 
116  virtual ~Fl_Paged_Device() {};
117 public:
118 #endif // FLTK_ABI_VERSION
119  static const char *class_id;
120  const char *class_name() {return class_id;};
121  virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
122  virtual int start_page(void);
123  virtual int printable_rect(int *w, int *h);
124  virtual void margins(int *left, int *top, int *right, int *bottom);
125  virtual void origin(int x, int y);
126  virtual void origin(int *x, int *y);
127  virtual void scale(float scale_x, float scale_y = 0.);
128  virtual void rotate(float angle);
129  virtual void translate(int x, int y);
130  virtual void untranslate(void);
131  virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
139  void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
140  virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
141  virtual int end_page (void);
142  virtual void end_job (void);
143 };
144 
145 #endif // Fl_Paged_Device_H
146 
147 //
148 // End of "$Id: Fl_Paged_Device.H 9706 2012-11-06 20:46:14Z matt $"
149 //
150 
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
Represents page-structured drawing surfaces.
Definition: Fl_Paged_Device.H:38
This widget produces an actual window.
Definition: Fl_Window.H:50
declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin.
A surface that's susceptible to receive graphical output.
Definition: Fl_Device.H:522
virtual ~Fl_Paged_Device()
The destructor.
Definition: Fl_Paged_Device.H:116
Page_Layout
Possible page layouts.
Definition: Fl_Paged_Device.H:81
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Paged_Device.H:120
Fl_Paged_Device()
The constructor.
Definition: Fl_Paged_Device.H:109
width, height and name of a page format
Definition: Fl_Paged_Device.H:90
int height
height in points
Definition: Fl_Paged_Device.H:94
int width
width in points
Definition: Fl_Paged_Device.H:92
int y_offset
vertical offset to the origin of graphics coordinates
Definition: Fl_Paged_Device.H:107
Page_Format
Possible page formats.
Definition: Fl_Paged_Device.H:45
#define NO_PAGE_FORMATS
Number of elements in enum Page_Format.
Definition: Fl_Paged_Device.H:30
int x_offset
horizontal offset to the origin of graphics coordinates
Definition: Fl_Paged_Device.H:105
Letter format.
Definition: Fl_Paged_Device.H:73
A4 format.
Definition: Fl_Paged_Device.H:50
const char * name
format name
Definition: Fl_Paged_Device.H:96