FLTK 1.3.7: Fl_Printer.H Source File

FLTK 1.3.7

Fl_Printer.H
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Printing support for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 2010-2014 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_Printer_H
24 #define Fl_Printer_H
25
26 #include <FL/x.H>
27 #include <FL/Fl_Paged_Device.H>
28 #include <FL/fl_draw.H>
29 #include <FL/Fl_Pixmap.H>
30 #include <FL/Fl_RGB_Image.H>
31 #include <FL/Fl_Bitmap.H>
32 #include <stdio.h>
33 #if !(defined(__APPLE__) || defined(WIN32))
34 #include <FL/Fl_PostScript.H>
35 #elif defined(WIN32)
36 #include <commdlg.h>
37 #endif
38
39 #if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
47 class Fl_System_Printer : public Fl_Paged_Device {
48 friend class Fl_Printer;
49 private:
51 void *gc;
52 void set_current(void);
53 #ifdef __APPLE__
54 float scale_x;
55 float scale_y;
56 float angle; // rotation angle in radians
57 PMPrintSession printSession;
58 PMPageFormat pageFormat;
59 PMPrintSettings printSettings;
60 #elif defined(WIN32)
61 int abortPrint;
62 PRINTDLG pd;
63 HDC hPr;
64 int prerr;
65 int left_margin;
66 int top_margin;
67 void absolute_printable_rect(int *x, int *y, int *w, int *h);
68 #endif
69 protected:
71 Fl_System_Printer(void);
72 public:
73 static const char *class_id;
74 const char *class_name() {return class_id;};
75 int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
76 int start_page (void);
77 int printable_rect(int *w, int *h);
78 void margins(int *left, int *top, int *right, int *bottom);
79 void origin(int *x, int *y);
80 void origin(int x, int y);
81 void scale (float scale_x, float scale_y = 0.);
82 void rotate(float angle);
83 void translate(int x, int y);
84 void untranslate(void);
85 int end_page (void);
86 void end_job (void);
87 #ifdef __APPLE__
88 void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y);
89 #endif
91 ~Fl_System_Printer(void);
92 }; // class Fl_System_Printer
93
94 #endif
95
96 #if !(defined(__APPLE__) || defined(WIN32) )
104 class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
105 friend class Fl_Printer;
106 protected:
108 Fl_PostScript_Printer(void) {};
109 public:
110 static const char *class_id;
111 const char *class_name() {return class_id;};
112 int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
113 };
114
115 #endif
116
176 class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
177 public:
178 static const char *class_id;
179 const char *class_name() {return class_id;};
181 Fl_Printer(void);
182 int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
183 int start_page(void);
184 int printable_rect(int *w, int *h);
185 void margins(int *left, int *top, int *right, int *bottom);
186 void origin(int *x, int *y);
187 void origin(int x, int y);
188 void scale(float scale_x, float scale_y = 0.);
189 void rotate(float angle);
190 void translate(int x, int y);
191 void untranslate(void);
192 int end_page (void);
193 void end_job (void);
194 void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0);
195 void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
196 void set_current(void);
197 Fl_Graphics_Driver* driver(void);
199 ~Fl_Printer(void);
200
204 static const char *dialog_title;
205 static const char *dialog_printer;
206 static const char *dialog_range;
207 static const char *dialog_copies;
208 static const char *dialog_all;
209 static const char *dialog_pages;
210 static const char *dialog_from;
211 static const char *dialog_to;
212 static const char *dialog_properties;
213 static const char *dialog_copyNo;
214 static const char *dialog_print_button;
215 static const char *dialog_cancel_button;
216 static const char *dialog_print_to_file;
217 static const char *property_title;
218 static const char *property_pagesize;
219 static const char *property_mode;
220 static const char *property_use;
221 static const char *property_save;
222 static const char *property_cancel;
224 private:
225 #if defined(WIN32) || defined(__APPLE__)
226 Fl_System_Printer *printer;
227 #else
228 Fl_PostScript_Printer *printer;
229 #endif
230 };
231
232 #endif // Fl_Printer_H
233
234 //
235 // End of "$Id$"
236 //
Fl_Paged_Device.H
declaration of class Fl_Paged_Device.
Fl_PostScript.H
declaration of classes Fl_PostScript_Graphics_Driver, Fl_PostScript_File_Device.
Fl_Graphics_Driver
A virtual class subclassed for each graphics driver FLTK uses.
Definition: Fl_Device.H:110
Fl_Paged_Device
Represents page-structured drawing surfaces.
Definition: Fl_Paged_Device.H:38
Fl_Paged_Device::start_page
virtual int start_page(void)
Starts a new printed page.
Definition: Fl_Paged_Device.cxx:170
Fl_Paged_Device::print_widget
virtual void print_widget(Fl_Widget *widget, int delta_x=0, int delta_y=0)
Draws the widget on the printed page.
Definition: Fl_Paged_Device.cxx:40
Fl_Paged_Device::start_job
virtual int start_job(int pagecount, int *frompage=NULL, int *topage=NULL)
Starts a print job.
Definition: Fl_Paged_Device.cxx:161
Fl_Paged_Device::scale
virtual void scale(float scale_x, float scale_y=0.)
Changes the scaling of page coordinates.
Definition: Fl_Paged_Device.cxx:219
Fl_Paged_Device::print_window_part
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.
Definition: Fl_Paged_Device.cxx:129
Fl_Paged_Device::margins
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.
Definition: Fl_Paged_Device.cxx:193
Fl_Paged_Device::printable_rect
virtual int printable_rect(int *w, int *h)
Computes the width and height of the printable area of the page.
Definition: Fl_Paged_Device.cxx:180
Fl_Paged_Device::end_page
virtual int end_page(void)
To be called at the end of each page.
Definition: Fl_Paged_Device.cxx:235
Fl_Paged_Device::origin
virtual void origin(int x, int y)
Sets the position in page coordinates of the origin of graphics functions.
Definition: Fl_Paged_Device.cxx:206
Fl_Paged_Device::untranslate
virtual void untranslate(void)
Undoes the effect of a previous translate() call.
Definition: Fl_Paged_Device.cxx:254
Fl_Paged_Device::translate
virtual void translate(int x, int y)
Translates the current graphics origin accounting for the current rotation.
Definition: Fl_Paged_Device.cxx:249
Fl_Paged_Device::end_job
virtual void end_job(void)
To be called at the end of a print job.
Definition: Fl_Paged_Device.cxx:240
Fl_Paged_Device::rotate
virtual void rotate(float angle)
Rotates the graphics operations relatively to paper.
Definition: Fl_Paged_Device.cxx:228
Fl_PostScript_File_Device
To send graphical output to a PostScript file.
Definition: Fl_PostScript.H:226
Fl_PostScript_Printer
Print support under Unix/Linux.
Definition: Fl_Printer.H:104
Fl_PostScript_Printer::class_name
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Printer.H:111
Fl_PostScript_Printer::start_job
int start_job(int pages, int *firstpage=NULL, int *lastpage=NULL)
Starts a print job.
Definition: Fl_PostScript.cxx:1558
Fl_PostScript_Printer::Fl_PostScript_Printer
Fl_PostScript_Printer(void)
The constructor.
Definition: Fl_Printer.H:108
Fl_Printer
OS-independent print support.
Definition: Fl_Printer.H:176
Fl_Printer::property_title
static const char * property_title
[this text may be customized at run-time]
Definition: Fl_Printer.H:217
Fl_Printer::dialog_to
static const char * dialog_to
[this text may be customized at run-time]
Definition: Fl_Printer.H:211
Fl_Printer::dialog_copyNo
static const char * dialog_copyNo
[this text may be customized at run-time]
Definition: Fl_Printer.H:213
Fl_Printer::dialog_all
static const char * dialog_all
[this text may be customized at run-time]
Definition: Fl_Printer.H:208
Fl_Printer::dialog_range
static const char * dialog_range
[this text may be customized at run-time]
Definition: Fl_Printer.H:206
Fl_Printer::dialog_print_to_file
static const char * dialog_print_to_file
[this text may be customized at run-time]
Definition: Fl_Printer.H:216
Fl_Printer::dialog_cancel_button
static const char * dialog_cancel_button
[this text may be customized at run-time]
Definition: Fl_Printer.H:215
Fl_Printer::property_mode
static const char * property_mode
[this text may be customized at run-time]
Definition: Fl_Printer.H:219
Fl_Printer::dialog_from
static const char * dialog_from
[this text may be customized at run-time]
Definition: Fl_Printer.H:210
Fl_Printer::dialog_properties
static const char * dialog_properties
[this text may be customized at run-time]
Definition: Fl_Printer.H:212
Fl_Printer::property_save
static const char * property_save
[this text may be customized at run-time]
Definition: Fl_Printer.H:221
Fl_Printer::property_pagesize
static const char * property_pagesize
[this text may be customized at run-time]
Definition: Fl_Printer.H:218
Fl_Printer::class_name
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Printer.H:179
Fl_Printer::dialog_title
static const char * dialog_title
[this text may be customized at run-time]
Definition: Fl_Printer.H:204
Fl_Printer::dialog_pages
static const char * dialog_pages
[this text may be customized at run-time]
Definition: Fl_Printer.H:209
Fl_Printer::dialog_printer
static const char * dialog_printer
[this text may be customized at run-time]
Definition: Fl_Printer.H:205
Fl_Printer::dialog_copies
static const char * dialog_copies
[this text may be customized at run-time]
Definition: Fl_Printer.H:207
Fl_Printer::dialog_print_button
static const char * dialog_print_button
[this text may be customized at run-time]
Definition: Fl_Printer.H:214
Fl_Printer::property_cancel
static const char * property_cancel
[this text may be customized at run-time]
Definition: Fl_Printer.H:222
Fl_Printer::set_current
void set_current(void)
Make this surface the current drawing surface.
Definition: Fl_Printer.cxx:183
Fl_Printer::property_use
static const char * property_use
[this text may be customized at run-time]
Definition: Fl_Printer.H:220
Fl_Surface_Device::set_current
virtual void set_current(void)
Make this surface the current drawing surface.
Definition: Fl_Device.cxx:44
Fl_Surface_Device::driver
Fl_Graphics_Driver * driver()
Returns the graphics driver of this drawing surface.
Definition: Fl_Device.H:571
Fl_System_Printer
Print support under MSWindows and Mac OS.
Definition: Fl_Printer.H:47
Fl_System_Printer::~Fl_System_Printer
~Fl_System_Printer(void)
The destructor.
Fl_System_Printer::rotate
void rotate(float angle)
Rotates the graphics operations relatively to paper.
Fl_System_Printer::start_job
int start_job(int pagecount, int *frompage=NULL, int *topage=NULL)
Starts a print job.
Fl_System_Printer::untranslate
void untranslate(void)
Undoes the effect of a previous translate() call.
Fl_System_Printer::translate
void translate(int x, int y)
Translates the current graphics origin accounting for the current rotation.
Fl_System_Printer::class_name
const char * class_name()
Returns the name of the class of this object.
Definition: Fl_Printer.H:74
Fl_System_Printer::printable_rect
int printable_rect(int *w, int *h)
Computes the width and height of the printable area of the page.
Fl_System_Printer::Fl_System_Printer
Fl_System_Printer(void)
The constructor.
Fl_System_Printer::start_page
int start_page(void)
Starts a new printed page.
Fl_System_Printer::scale
void scale(float scale_x, float scale_y=0.)
Changes the scaling of page coordinates.
Fl_System_Printer::end_job
void end_job(void)
To be called at the end of a print job.
Fl_System_Printer::margins
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.
Fl_System_Printer::end_page
int end_page(void)
To be called at the end of each page.
Fl_System_Printer::origin
void origin(int *x, int *y)
Computes the page coordinates of the current origin of graphics functions.
Fl_System_Printer::origin
void origin(int x, int y)
Sets the position in page coordinates of the origin of graphics functions.
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Fl_Window
This widget produces an actual window.
Definition: Fl_Window.H:57
fl_draw.H
utility header to pull drawing functions together
- Copyright © 1998-2021 by Bill Spitzak and others.