00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef Fl_Printer_H
00024 #define Fl_Printer_H
00025
00026 #include <FL/x.H>
00027 #include <FL/Fl_Paged_Device.H>
00028 #include <FL/fl_draw.H>
00029 #include <FL/Fl_Pixmap.H>
00030 #include <FL/Fl_RGB_Image.H>
00031 #include <FL/Fl_Bitmap.H>
00032 #include <stdio.h>
00033 #if !(defined(__APPLE__) || defined(WIN32))
00034 #include <FL/Fl_PostScript.H>
00035 #elif defined(WIN32)
00036 #include <commdlg.h>
00037 #endif
00038
00039 #if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
00040
00047 class Fl_System_Printer : public Fl_Paged_Device {
00048 friend class Fl_Printer;
00049 private:
00051 void *gc;
00052 void set_current(void);
00053 #ifdef __APPLE__
00054 float scale_x;
00055 float scale_y;
00056 float angle;
00057 PMPrintSession printSession;
00058 PMPageFormat pageFormat;
00059 PMPrintSettings printSettings;
00060 #elif defined(WIN32)
00061 int abortPrint;
00062 PRINTDLG pd;
00063 HDC hPr;
00064 int prerr;
00065 int left_margin;
00066 int top_margin;
00067 void absolute_printable_rect(int *x, int *y, int *w, int *h);
00068 #endif
00069 protected:
00071 Fl_System_Printer(void);
00072 public:
00073 static const char *class_id;
00074 const char *class_name() {return class_id;};
00075 int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00076 int start_page (void);
00077 int printable_rect(int *w, int *h);
00078 void margins(int *left, int *top, int *right, int *bottom);
00079 void origin(int *x, int *y);
00080 void origin(int x, int y);
00081 void scale (float scale_x, float scale_y = 0.);
00082 void rotate(float angle);
00083 void translate(int x, int y);
00084 void untranslate(void);
00085 int end_page (void);
00086 void end_job (void);
00087 #ifdef __APPLE__
00088 void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y);
00089 #endif
00090
00091 ~Fl_System_Printer(void);
00092 };
00093
00094 #endif
00095
00096 #if !(defined(__APPLE__) || defined(WIN32) )
00097
00104 class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
00105 friend class Fl_Printer;
00106 protected:
00108 Fl_PostScript_Printer(void) {};
00109 public:
00110 static const char *class_id;
00111 const char *class_name() {return class_id;};
00112 int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
00113 };
00114
00115 #endif
00116
00176 class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
00177 public:
00178 static const char *class_id;
00179 const char *class_name() {return class_id;};
00181 Fl_Printer(void);
00182 int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00183 int start_page(void);
00184 int printable_rect(int *w, int *h);
00185 void margins(int *left, int *top, int *right, int *bottom);
00186 void origin(int *x, int *y);
00187 void origin(int x, int y);
00188 void scale(float scale_x, float scale_y = 0.);
00189 void rotate(float angle);
00190 void translate(int x, int y);
00191 void untranslate(void);
00192 int end_page (void);
00193 void end_job (void);
00194 void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0);
00195 void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
00196 void set_current(void);
00197 Fl_Graphics_Driver* driver(void);
00199 ~Fl_Printer(void);
00200
00204 static const char *dialog_title;
00205 static const char *dialog_printer;
00206 static const char *dialog_range;
00207 static const char *dialog_copies;
00208 static const char *dialog_all;
00209 static const char *dialog_pages;
00210 static const char *dialog_from;
00211 static const char *dialog_to;
00212 static const char *dialog_properties;
00213 static const char *dialog_copyNo;
00214 static const char *dialog_print_button;
00215 static const char *dialog_cancel_button;
00216 static const char *dialog_print_to_file;
00217 static const char *property_title;
00218 static const char *property_pagesize;
00219 static const char *property_mode;
00220 static const char *property_use;
00221 static const char *property_save;
00222 static const char *property_cancel;
00224 private:
00225 #if defined(WIN32) || defined(__APPLE__)
00226 Fl_System_Printer *printer;
00227 #else
00228 Fl_PostScript_Printer *printer;
00229 #endif
00230 };
00231
00232 #endif // Fl_Printer_H
00233
00234
00235
00236