FLTK 1.3.0
Fl_Paged_Device.H
Go to the documentation of this file.
00001 //
00002 // "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z 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 //
00027 
00032 #ifndef Fl_Paged_Device_H
00033 #define Fl_Paged_Device_H
00034 
00035 #include <FL/Fl_Device.H>
00036 #include <FL/Fl_Window.H>
00037 
00039 #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
00040 
00047 class FL_EXPORT Fl_Paged_Device : public Fl_Surface_Device {
00048 public:
00054   enum Page_Format {
00055     A0 = 0, 
00056     A1,
00057     A2,
00058     A3,
00059     A4, 
00060     A5,
00061     A6,
00062     A7,
00063     A8,
00064     A9,
00065     B0,
00066     B1,
00067     B2,
00068     B3,
00069     B4,
00070     B5,
00071     B6,
00072     B7,
00073     B8,
00074     B9,
00075     B10,
00076     C5E,
00077     DLE,
00078     EXECUTIVE,
00079     FOLIO,
00080     LEDGER,
00081     LEGAL,
00082     LETTER, 
00083     TABLOID,
00084     ENVELOPE,
00085     MEDIA = 0x1000
00086   };
00090   enum Page_Layout {
00091     PORTRAIT = 0,  
00092     LANDSCAPE = 0x100,   
00093     REVERSED = 0x200,  
00094     ORIENTATION = 0x300 
00095   };
00096 
00099   typedef struct {
00101     int width; 
00103     int height; 
00105     const char *name; 
00106   } page_format;
00109   static const page_format page_formats[NO_PAGE_FORMATS];  
00110 private:
00111   void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
00112 protected:
00114   int x_offset;
00116   int y_offset;
00118   Fl_Paged_Device() : Fl_Surface_Device(NULL) {};
00120   virtual ~Fl_Paged_Device() {};
00121 public:
00122   static const char *class_id;
00123   const char *class_name() {return class_id;};
00124   virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00125   virtual int start_page(void);
00126   virtual int printable_rect(int *w, int *h);
00127   virtual void margins(int *left, int *top, int *right, int *bottom);
00128   virtual void origin(int x, int y);
00129   virtual void origin(int *x, int *y);
00130   virtual void scale(float scale_x, float scale_y = 0.);
00131   virtual void rotate(float angle);
00132   virtual void translate(int x, int y);
00133   virtual void untranslate(void);
00134   virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
00142   void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
00143   virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
00144   virtual int end_page (void);
00145   virtual void end_job (void);
00146 };
00147 
00148 #endif // Fl_Paged_Device_H
00149 
00150 //
00151 // End of "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $"
00152 //
00153