FLTK 1.3.4
Fl_Paged_Device.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Paged_Device.H 11094 2016-01-31 02:49:56Z AlbrechtS $"
3 //
4 // Printing support for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 2010-2016 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 #ifndef __APPLE__
40  friend class Fl_Copy_Surface;
41  friend class Fl_Image_Surface;
42  void draw_decorated_window(Fl_Window *win, int x_offset, int y_offset, Fl_Surface_Device *toset);
43 #endif
44 public:
50  enum Page_Format {
51  A0 = 0,
52  A1,
53  A2,
54  A3,
55  A4,
56  A5,
57  A6,
58  A7,
59  A8,
60  A9,
61  B0,
62  B1,
63  B2,
64  B3,
65  B4,
66  B5,
67  B6,
68  B7,
69  B8,
70  B9,
71  B10,
72  C5E,
73  DLE,
74  EXECUTIVE,
75  FOLIO,
76  LEDGER,
77  LEGAL,
79  TABLOID,
80  ENVELOPE,
81  MEDIA = 0x1000
82  };
86  enum Page_Layout {
87  PORTRAIT = 0,
88  LANDSCAPE = 0x100,
89  REVERSED = 0x200,
90  ORIENTATION = 0x300
91  };
92 
95  typedef struct {
97  int width;
99  int height;
101  const char *name;
102  } page_format;
105  static const page_format page_formats[NO_PAGE_FORMATS];
106 private:
107  void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
108 protected:
110  int x_offset;
112  int y_offset;
114  Fl_Paged_Device() : Fl_Surface_Device(NULL), x_offset(0), y_offset(0) {};
115 #if FLTK_ABI_VERSION >= 10301
116 public:
118  virtual ~Fl_Paged_Device() {};
119 #else
120 
121  virtual ~Fl_Paged_Device() {};
122 public:
123 #endif // FLTK_ABI_VERSION
124  static const char *class_id;
125  const char *class_name() {return class_id;};
126  virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
127  virtual int start_page(void);
128  virtual int printable_rect(int *w, int *h);
129  virtual void margins(int *left, int *top, int *right, int *bottom);
130  virtual void origin(int x, int y);
131  virtual void origin(int *x, int *y);
132  virtual void scale(float scale_x, float scale_y = 0.);
133  virtual void rotate(float angle);
134  virtual void translate(int x, int y);
135  virtual void untranslate(void);
136  virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
144  void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
145  virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
146  virtual int end_page (void);
147  virtual void end_job (void);
148 };
149 
150 #endif // Fl_Paged_Device_H
151 
152 //
153 // End of "$Id: Fl_Paged_Device.H 11094 2016-01-31 02:49:56Z AlbrechtS $"
154 //
155 
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Represents page-structured drawing surfaces.
Definition: Fl_Paged_Device.H:38
This widget produces an actual window.
Definition: Fl_Window.H:57
declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin.
A drawing surface that's susceptible to receive graphical output.
Definition: Fl_Device.H:556
Supports copying of graphical data to the clipboard.
Definition: Fl_Copy_Surface.H:51
virtual ~Fl_Paged_Device()
The destructor.
Definition: Fl_Paged_Device.H:118
Page_Layout
Possible page layouts.
Definition: Fl_Paged_Device.H:86
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Paged_Device.H:125
Fl_Paged_Device()
The constructor.
Definition: Fl_Paged_Device.H:114
width, height and name of a page format
Definition: Fl_Paged_Device.H:95
Directs all graphics requests to an Fl_Image.
Definition: Fl_Image_Surface.H:47
int height
height in points
Definition: Fl_Paged_Device.H:99
Fl_Window widget .
int width
width in points
Definition: Fl_Paged_Device.H:97
int y_offset
vertical offset to the origin of graphics coordinates
Definition: Fl_Paged_Device.H:112
Page_Format
Possible page formats.
Definition: Fl_Paged_Device.H:50
#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:110
Letter format.
Definition: Fl_Paged_Device.H:78
A4 format.
Definition: Fl_Paged_Device.H:55
const char * name
format name
Definition: Fl_Paged_Device.H:101
void draw_decorated_window(Fl_Window *win, int delta_x=0, int delta_y=0)
Draws a window and its borders and title bar to the image drawing surface.
Definition: Fl_Image_Surface.cxx:233