FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Printer.H
Go to the documentation of this file.

    00001 //
    00002 // "$Id: Fl_Printer.H 9035 2011-09-14 15:17:32Z manolo $"
    00003 //
    00004 // Printing support for the Fast Light Tool Kit (FLTK).
    00005 //
    00006 // Copyright 2010-2011 by Bill Spitzak and others.
    00007 //
    00008 // This library is free software. Distribution and use rights are outlined in
    00009 // the file "COPYING" which should have been included with this file.  If this
    00010 // file is missing or damaged, see the license at:
    00011 //
    00012 //     http://www.fltk.org/COPYING.php
    00013 //
    00014 // Please report all bugs and problems on the following page:
    00015 //
    00016 //     http://www.fltk.org/str.php
    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; // rotation angle in radians
    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);
    00088   ~Fl_System_Printer(void);
    00089 }; // class Fl_System_Printer
    00090
    00091 #endif
    00092
    00093 #if !(defined(__APPLE__) || defined(WIN32) )
    00094
    00101 class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
    00102   friend class Fl_Printer;
    00103 protected:
    00105   Fl_PostScript_Printer(void) {};
    00106 public:
    00107   static const char *class_id;
    00108   const char *class_name() {return class_id;};
    00109   int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
    00110 };
    00111
    00112 #endif
    00113
    00146 class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
    00147 public:
    00148   static const char *class_id;
    00149   const char *class_name() {return class_id;};
    00151   Fl_Printer(void);
    00152   int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
    00153   int start_page(void);
    00154   int printable_rect(int *w, int *h);
    00155   void margins(int *left, int *top, int *right, int *bottom);
    00156   void origin(int *x, int *y);
    00157   void origin(int x, int y);
    00158   void scale(float scale_x, float scale_y = 0.);
    00159   void rotate(float angle);
    00160   void translate(int x, int y);
    00161   void untranslate(void);
    00162   int end_page (void);
    00163   void end_job (void);
    00164   void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0);
    00165   void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
    00166   void set_current(void);
    00167   Fl_Graphics_Driver* driver(void);
    00169   ~Fl_Printer(void);
    00170
    00174   static const char *dialog_title;
    00175   static const char *dialog_printer;
    00176   static const char *dialog_range;
    00177   static const char *dialog_copies;
    00178   static const char *dialog_all;
    00179   static const char *dialog_pages;
    00180   static const char *dialog_from;
    00181   static const char *dialog_to;
    00182   static const char *dialog_properties;
    00183   static const char *dialog_copyNo;
    00184   static const char *dialog_print_button;
    00185   static const char *dialog_cancel_button;
    00186   static const char *dialog_print_to_file;
    00187   static const char *property_title;
    00188   static const char *property_pagesize;
    00189   static const char *property_mode;
    00190   static const char *property_use;
    00191   static const char *property_save;
    00192   static const char *property_cancel;
    00194 private:
    00195 #if defined(WIN32) || defined(__APPLE__)
    00196   Fl_System_Printer *printer;
    00197 #else
    00198   Fl_PostScript_Printer *printer;
    00199 #endif
    00200 };
    00201
    00202 #endif // Fl_Printer_H
    00203
    00204 //
    00205 // End of "$Id: Fl_Printer.H 9035 2011-09-14 15:17:32Z manolo $"
    00206 //