Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Fl_Gdi.h

00001 //
00002 // "$Id: Fl_Gdi.h,v 1.4 2003/04/24 21:19:18 laza2000 Exp $"
00003 //
00004 // WIN32 GDI printing device for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright (c) 2002  O'ksi'D
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 to "oksid@bluewin.ch".
00024 //
00025 
00026 #ifdef WIN32
00027 #ifndef Fl_Gdi_H
00028 #define Fl_Gdi_H
00029 //#include "Fl_Printer.H"
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 struct Fl_Ext{
00042         int WOx, VEx, WEx, VOx;
00043         int WOy, VEy, WEy, VOy;
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     // Those need to be refined  -  need to be uncached for offscreen cteation 
00122     // note: masking do not seems to work directly
00123 //    void draw_Pixmap(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
00124 //    void draw_RGB(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
00125 //    void draw_Bitmap(Fl_Bitmap * bmp,int XP, int YP, int WP, int HP, int cx, int cy);
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

Generated on Thu Jul 31 15:33:43 2003 for eFLTK by doxygen1.2.15