FLTK 1.3.x

Fl_Paged_Device.H

Go to the documentation of this file.
00001 //
00002 // "$Id: Fl_Paged_Device.H 8190 2011-01-05 10:21:45Z 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_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   
00111 private:
00112 #ifdef __APPLE__
00113   struct chain_elt {
00114     Fl_Image *image;
00115     const uchar *data;
00116     struct chain_elt *next;
00117   };
00118   void add_image(Fl_Image *image, const uchar *data); // adds an image to the page image list
00119 #endif
00120   void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
00121 protected:
00123   int x_offset;
00125   int y_offset;
00127   struct chain_elt *image_list_; 
00128 #ifdef __APPLE__
00129 
00130   void delete_image_list(); 
00131 #endif
00132 
00133   Fl_Paged_Device() : Fl_Surface_Device(NULL) {class_name( class_id);};
00135   virtual ~Fl_Paged_Device() {};
00136 public:
00137   static const char *class_id;
00138   virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
00139   virtual int start_page(void);
00140   virtual int printable_rect(int *w, int *h);
00141   virtual void margins(int *left, int *top, int *right, int *bottom);
00142   virtual void origin(int x, int y);
00143   void origin(int *x, int *y);
00144   virtual void scale(float scale_x, float scale_y);
00145   virtual void rotate(float angle);
00146   virtual void translate(int x, int y);
00147   virtual void untranslate(void);
00148   void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
00149   void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
00150   virtual int end_page (void);
00151   virtual void end_job (void);
00152 };
00153 
00154 #endif // Fl_Paged_Device_H
00155 
00156 //
00157 // End of "$Id: Fl_Paged_Device.H 8190 2011-01-05 10:21:45Z manolo $"
00158 //
00159