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 #ifdef WIN32
00027 #ifndef Fl_Gdi_H
00028 #define Fl_Gdi_H
00029
00030 #include <windows.h>
00031 #include <commdlg.h>
00032
00033 #include <efltk/Fl_Color.h>
00034 #include <efltk/Fl_Font.h>
00035
00036 extern FL_API Fl_Color fl_color_;
00037 extern FL_API float fl_size_;
00038 extern FL_API Fl_Font fl_font_;
00039 extern FL_API HDC fl_gc;
00040
00041
00042
00043
00044
00045
00046
00047 class FL_API Fl_Gdi_Settings{
00048 void init();
00049 bool * pages_;
00050 int copies_;
00051 int max_page_;
00052 int first_page_;
00053 int last_page_;
00054
00055
00056
00057 public:
00058 DEVMODE * mode;
00059 DEVNAMES * names;
00060 void reset();
00061 int first_page(){return first_page_;};
00062 void first_page(int i){first_page_=i;};
00063 int last_page(){return last_page_;};
00064 void last_page(int i){last_page_=i;};
00065 void pages(int first, int last){first_page_=first; last_page_=last;};
00066 int max_page(){return max_page_;};
00067 void max_page(int p){max_page_=p;};
00068 int format();
00069 void format(int f);
00070 int orientation();
00071 void orientation(int o);
00072 void copies(int i){copies_=i;};
00073 int copies(){return copies_;};
00074
00075 Fl_Gdi_Settings():pages_(0),copies_(1),max_page_(0),first_page_(1),last_page_(0),mode(0),names(0){};
00076 ~Fl_Gdi_Settings(){
00077 if(mode) GlobalFree(mode);
00078 if(names) GlobalFree(names);
00079 };
00080 };
00081
00082 class FL_API Fl_Gdi: public Fl_Printer{
00083 HDC gc_;
00084 DEVMODE * mode_;
00085 int delete_mode_;
00086 int ix, iy, ox, oy;
00087 int WOx, VEx, WEx, VOx;
00088 int WOy, VEy, WEy, VOy;
00089
00090
00091
00092 protected:
00093 void set_page(int page);
00094 public:
00095 void delete_mode(int i){delete_mode_=i;};
00096
00097 void draw(Fl_Widget * w);
00098
00099 void draw(const char* s, float x, float y) { Fl_Printer::draw(s, x, y); }
00100 void draw(const Fl_String & s, float x, float y) { Fl_Printer::draw(s, x, y); }
00101 void draw(const char* s, int n, float x, float y) { Fl_Printer::draw(s, n, x, y); }
00102
00103 void page(double pw, double ph, int orientation);
00104 void page(int format, int orientation);
00105 void page();
00106
00107
00109 void push_clip(int x, int y, int w, int h);
00110 int not_clipped(int x, int y, int w, int h);
00111 int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
00112
00113 void margins(double left, double top, double right, double bottom);
00114
00115
00116 void fit(double x, double y, double w, double h, int align);
00117 void fit(double x, double y, double w, double h, double dpi, int align);
00118 void place(double x, double y, double w, double h, double tx, double ty, double tw, double th, int align);
00119 void place(double x, double y, double w, double h, double tx, double ty, double tw, double th, double dpi, int align);
00120
00121
00122
00123
00124
00125
00126
00127 Fl_Gdi(HDC gc, DEVMODE * mode);
00128 ~Fl_Gdi();
00129 };
00130
00131 Fl_Gdi * fl_gdi_printer_chooser(Fl_Gdi_Settings * settings=0);
00132
00133 #endif
00134 #endif