FLTK 1.3.3
Fl_Printer.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Printer.H 10393 2014-10-26 15:23:03Z manolo $"
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)
40 
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
90 
91  ~Fl_System_Printer(void);
92 }; // class Fl_System_Printer
93 
94 #endif
95 
96 #if !(defined(__APPLE__) || defined(WIN32) )
97 
105  friend class Fl_Printer;
106 protected:
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 
149 class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
150 public:
151  static const char *class_id;
152  const char *class_name() {return class_id;};
154  Fl_Printer(void);
155  int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
156  int start_page(void);
157  int printable_rect(int *w, int *h);
158  void margins(int *left, int *top, int *right, int *bottom);
159  void origin(int *x, int *y);
160  void origin(int x, int y);
161  void scale(float scale_x, float scale_y = 0.);
162  void rotate(float angle);
163  void translate(int x, int y);
164  void untranslate(void);
165  int end_page (void);
166  void end_job (void);
167  void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0);
168  void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
169  void set_current(void);
170  Fl_Graphics_Driver* driver(void);
172  ~Fl_Printer(void);
173 
177  static const char *dialog_title;
178  static const char *dialog_printer;
179  static const char *dialog_range;
180  static const char *dialog_copies;
181  static const char *dialog_all;
182  static const char *dialog_pages;
183  static const char *dialog_from;
184  static const char *dialog_to;
185  static const char *dialog_properties;
186  static const char *dialog_copyNo;
187  static const char *dialog_print_button;
188  static const char *dialog_cancel_button;
189  static const char *dialog_print_to_file;
190  static const char *property_title;
191  static const char *property_pagesize;
192  static const char *property_mode;
193  static const char *property_use;
194  static const char *property_save;
195  static const char *property_cancel;
197 private:
198 #if defined(WIN32) || defined(__APPLE__)
199  Fl_System_Printer *printer;
200 #else
201  Fl_PostScript_Printer *printer;
202 #endif
203 };
204 
205 #endif // Fl_Printer_H
206 
207 //
208 // End of "$Id: Fl_Printer.H 10393 2014-10-26 15:23:03Z manolo $"
209 //