FLTK 1.3.x

Fl_Printer.H

Go to the documentation of this file.
00001 //
00002 // "$Id: Fl_Printer.H 8197 2011-01-06 08:46:54Z manolo $"
00003 //
00004 // Printing support for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 2010 by Bill Spitzak and others.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00031 #ifndef Fl_Printer_H
00032 #define Fl_Printer_H
00033 
00034 #include <FL/x.H>
00035 #include <FL/Fl_Paged_Device.H>
00036 #include <FL/fl_draw.H>
00037 #include <FL/Fl_Pixmap.H>
00038 #include <FL/Fl_RGB_Image.H>
00039 #include <FL/Fl_Bitmap.H>
00040 #include <stdio.h>
00041 #if !(defined(__APPLE__) || defined(WIN32))
00042 #include <FL/Fl_PostScript.H>
00043 #elif defined(WIN32)
00044 #include <commdlg.h>
00045 #endif
00046 
00047 #if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
00048 
00055 class Fl_System_Printer : public Fl_Paged_Device {
00056   friend class Fl_Printer;
00057 private:
00059   void *gc; 
00060   void set_current(void);
00061 #ifdef __APPLE__
00062   float scale_x;
00063   float scale_y;
00064   float angle; // rotation angle in radians
00065   Fl_PMPrintSession  printSession;
00066   Fl_PMPageFormat    pageFormat;
00067   Fl_PMPrintSettings printSettings;
00068 #elif defined(WIN32)
00069   int   abortPrint;
00070   PRINTDLG      pd;
00071   HDC           hPr;
00072   int           prerr;
00073   int left_margin;
00074   int top_margin;
00075   void absolute_printable_rect(int *x, int *y, int *w, int *h);
00076 #endif
00077 protected:
00079   Fl_System_Printer(void);
00080 public:
00081   static const char *class_id;
00082   int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00083   int start_page (void);
00084   int printable_rect(int *w, int *h);
00085   void margins(int *left, int *top, int *right, int *bottom);
00086   void origin(int x, int y);
00087   void scale (float scale_x, float scale_y);
00088   void rotate(float angle);
00089   void translate(int x, int y);
00090   void untranslate(void);
00091   int end_page (void);
00092   void end_job (void);
00094   ~Fl_System_Printer(void);
00095 }; // class Fl_System_Printer
00096 
00097 #endif
00098   
00099 #if !(defined(__APPLE__) || defined(WIN32) )
00100 
00107 class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
00108   friend class Fl_Printer;
00109 protected:
00111   Fl_PostScript_Printer(void) {class_name(class_id);};
00112 public:
00113   static const char *class_id;
00114   int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
00115 };
00116 
00117 #endif
00118 
00151 class Fl_Printer : public Fl_Paged_Device {
00152 public:
00153   static const char *class_id;
00155   Fl_Printer(void);
00156   int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00157   int start_page(void);
00158   int printable_rect(int *w, int *h);
00159   void margins(int *left, int *top, int *right, int *bottom);
00160   void origin(int x, int y);
00161   void scale(float scale_x, float scale_y);
00162   void rotate(float angle);
00163   void translate(int x, int y);
00164   void untranslate(void);
00165   int end_page (void);
00166   void end_job (void);
00168   ~Fl_Printer(void);
00169  
00173   static const char *dialog_title; 
00174   static const char *dialog_printer; 
00175   static const char *dialog_range; 
00176   static const char *dialog_copies; 
00177   static const char *dialog_all; 
00178   static const char *dialog_pages;
00179   static const char *dialog_from;
00180   static const char *dialog_to;
00181   static const char *dialog_properties;
00182   static const char *dialog_copyNo;
00183   static const char *dialog_print_button;
00184   static const char *dialog_cancel_button;
00185   static const char *dialog_print_to_file;
00186   static const char *property_title;
00187   static const char *property_pagesize;
00188   static const char *property_mode;
00189   static const char *property_use;
00190   static const char *property_save;
00191   static const char *property_cancel;
00193 private:
00194 #if defined(WIN32) || defined(__APPLE__)
00195   Fl_System_Printer *printer;
00196 #else
00197   Fl_PostScript_Printer *printer;
00198 #endif
00199 };
00200 
00201 #endif // Fl_Printer_H
00202 
00203 //
00204 // End of "$Id: Fl_Printer.H 8197 2011-01-06 08:46:54Z manolo $"
00205 //