00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
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);
00119 #endif
00120 void traverse(Fl_Widget *widget);
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) {type_ = device_type;};
00135 virtual ~Fl_Paged_Device() {};
00136 public:
00137 static const char *device_type;
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
00158
00159