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

Fl_Printer.h

00001 /*
00002  * $Id: Fl_Printer.h,v 1.4 2003/04/24 21:19:19 laza2000 Exp $
00003  *
00004  * Extended Fast Light Toolkit (EFLTK)
00005  * Copyright (C) 2002-2003 by EDE-Team
00006  * WWW: http://www.sourceforge.net/projects/ede
00007  *
00008  * Fast Light Toolkit (FLTK)
00009  * Copyright (C) 1998-2003 by Bill Spitzak and others.
00010  * WWW: http://www.fltk.org
00011  *
00012  * This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00013  * version 2. See COPYING for details.
00014  *
00015  * Author : Mikko Lahteenmaki
00016  * Email  : mikko@fltk.net
00017  *
00018  * Please report all bugs and problems to "efltk-bugs@fltk.net"
00019  *
00020  */
00021 
00022 #ifndef _FL_PRINTER_H_
00023 #define _FL_PRINTER_H_
00024 
00025 #include "fl_draw.h"
00026 #include "Enumerations.h"
00027 
00028 const double FL_POINT = 1;
00029 const double FL_INCH = 72;
00030 const double FL_MM = 2.835;
00031 const double FL_CM = 28.35;
00032 const double FL_PICA = 12;
00033 
00034 const int NO_PAGE_FORMATS=30;
00035 
00037 class FL_API Fl_Printer : public Fl_Device {
00038 public:
00039     enum PAGE_FORMAT{
00040         USER, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9,
00041         B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10,
00042         C5E, DLE, EXECUTIVE, FOLIO, LEDGER, LEGAL,
00043         LETTER, TABLOID, ENVELOPE, NON_DEFINED = -1
00044     };
00045     enum PAGE_LAYOUT { PORTRAIT=0, LANDSCAPE=1 };
00046 
00047     static const int page_formats[NO_PAGE_FORMATS+1][2];
00048     virtual void page(double pw, double ph, int orientation) = 0;
00049     virtual void page(int format, int orientation) = 0;
00050     double page_width() const { return pw_; }
00051     double page_height() const { return ph_; }
00052     virtual void page() = 0;
00053     virtual void margins(double left, double top, double right, double bottom) = 0;
00054 
00055     virtual void fit(double x, double y, double w, double h, int align) = 0;
00056     virtual void fit(double x, double y, double w, double h, double dpi, int align) = 0;
00057     void fit(Fl_Widget * w, int align);
00058     void fit(Fl_Widget * w, double dpi, int align);
00059 
00060     virtual void place(double x, double y, double w, double h, double tx, double ty, double tw, double th, int align) = 0;
00061     virtual void place(double x, double y, double w, double h, double tx, double ty, double tw, double th, double dpi, int align) = 0;
00062     void place(Fl_Widget * w, double tx, double ty, double tw, double th, int align) { place(w->x(),w->y(),w->w(),w->h(), tx, ty, tw, th, align); }
00063     void place(Fl_Widget * w, double tx, double ty, double tw, double th, double dpi, int align) { place(w->x(),w->y(),w->w(),w->h(), tx, ty, tw, th, dpi, align); }
00064 
00065     Fl_Printer() : lm_(72),tm_(72),rm_(72),bm_(72),orientation_(0) { }
00066     virtual ~Fl_Printer() { }
00067 
00068     virtual void draw(Fl_Widget * w) = 0;
00069 
00070     virtual void draw(const char* s, float x, float y) { Fl_Device::draw(s, x, y); }
00071     virtual void draw(const Fl_String & s, float x, float y) { Fl_Device::draw(s, x, y); }
00072     virtual void draw(const char* s, int n, float x, float y) { Fl_Device::draw(s, n, x, y); }
00073 
00074 protected:
00075 
00076     int nPages;
00077     double lm_,tm_,rm_,bm_;
00078     double pw_, ph_;
00079     int orientation_;
00080 };
00081 
00082 #ifdef _WIN32
00083 
00084 #include "Fl_Gdi.h"
00085 #ifndef FL_PRINTER
00086 #define FL_GDI_PRINTER
00087 #define FL_PRINTER FL_GDI_PRINTER
00088 typedef Fl_Gdi_Settings Fl_Printer_Settings;
00089 inline Fl_Printer * fl_printer_chooser(Fl_Printer_Settings * s=0) {
00090     return fl_gdi_printer_chooser(s);
00091 }
00092 #endif
00093 
00094 #endif //_WIN32
00095 
00096 #endif // _FL_DEVICE_H_

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