FLTK 1.3.0
Fl_Paged_Device.H
Go to the documentation of this file.
00001 //
00002 // "$Id$"
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. 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_Paged_Device_H
00024 #define Fl_Paged_Device_H
00025 
00026 #include <FL/Fl_Device.H>
00027 #include <FL/Fl_Window.H>
00028 
00030 #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
00031 
00038 class FL_EXPORT Fl_Paged_Device : public Fl_Surface_Device {
00039 public:
00045   enum Page_Format {
00046     A0 = 0, 
00047     A1,
00048     A2,
00049     A3,
00050     A4, 
00051     A5,
00052     A6,
00053     A7,
00054     A8,
00055     A9,
00056     B0,
00057     B1,
00058     B2,
00059     B3,
00060     B4,
00061     B5,
00062     B6,
00063     B7,
00064     B8,
00065     B9,
00066     B10,
00067     C5E,
00068     DLE,
00069     EXECUTIVE,
00070     FOLIO,
00071     LEDGER,
00072     LEGAL,
00073     LETTER, 
00074     TABLOID,
00075     ENVELOPE,
00076     MEDIA = 0x1000
00077   };
00081   enum Page_Layout {
00082     PORTRAIT = 0,  
00083     LANDSCAPE = 0x100,   
00084     REVERSED = 0x200,  
00085     ORIENTATION = 0x300 
00086   };
00087 
00090   typedef struct {
00092     int width; 
00094     int height; 
00096     const char *name; 
00097   } page_format;
00100   static const page_format page_formats[NO_PAGE_FORMATS];  
00101 private:
00102   void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
00103 protected:
00105   int x_offset;
00107   int y_offset;
00109   Fl_Paged_Device() : Fl_Surface_Device(NULL), x_offset(0), y_offset(0) {};
00110 #if FLTK_ABI_VERSION >= 10302
00111 public:
00113   virtual ~Fl_Paged_Device() {};
00114 #else
00115 
00116   virtual ~Fl_Paged_Device() {};
00117 public:
00118 #endif // FLTK_ABI_VERSION
00119   static const char *class_id;
00120   const char *class_name() {return class_id;};
00121   virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00122   virtual int start_page(void);
00123   virtual int printable_rect(int *w, int *h);
00124   virtual void margins(int *left, int *top, int *right, int *bottom);
00125   virtual void origin(int x, int y);
00126   virtual void origin(int *x, int *y);
00127   virtual void scale(float scale_x, float scale_y = 0.);
00128   virtual void rotate(float angle);
00129   virtual void translate(int x, int y);
00130   virtual void untranslate(void);
00131   virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
00139   void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
00140   virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
00141   virtual int end_page (void);
00142   virtual void end_job (void);
00143 };
00144 
00145 #endif // Fl_Paged_Device_H
00146 
00147 //
00148 // End of "$Id$"
00149 //
00150