// // "$Id$" // // Printing support for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php // // Please report all bugs and problems on the following page: // // http://www.fltk.org/str.php // /** \file Fl_Printer.H \brief declaration of class Fl_Printer. */ #ifndef Fl_Printer_H #define Fl_Printer_H #include /** \brief OS-independent print support. Fl_Printer allows to use all drawing, color, text, image, and clip FLTK functions, and to have them operate on printed page(s). There are two main, non exclusive, ways to use it. In both cases, begin by begin_job(), begin_page(), printable_rect() and origin() calls and finish by end_page() and end_job() calls.

Example of use: print a widget centered in a page \code #include #include int width, height; Fl_Widget *widget = ... // a widget we want printed Fl_Printer *printer = new Fl_Printer(); if (printer->begin_job(1) == 0) { printer->begin_page(); printer->printable_rect(&width, &height); fl_color(FL_BLACK); fl_line_style(FL_SOLID, 2); fl_rect(0, 0, width, height); fl_font(FL_COURIER, 12); time_t now; time(&now); fl_draw(ctime(&now), 0, fl_height()); printer->origin(width/2, height/2); printer->print_widget(widget, -widget->w()/2, -widget->h()/2); printer->end_page(); printer->end_job(); } delete printer; \endcode Platform specifics

*/ class FL_EXPORT Fl_Printer : public Fl_Paged_Device { private: Fl_Paged_Device *printer; /** Each platform implements this function its own way */ static Fl_Paged_Device* newPrinterDriver(void); public: /** The constructor */ Fl_Printer(void); int begin_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL); int begin_page(void); int printable_rect(int *w, int *h); void margins(int *left, int *top, int *right, int *bottom); void origin(int *x, int *y); void origin(int x, int y); void scale(float scale_x, float scale_y = 0.); void rotate(float angle); void translate(int x, int y); void untranslate(void); int end_page (void); void end_job (void); void draw_decorated_window(Fl_Window *win, int x_offset = 0, int y_offset = 0); void set_current(void); virtual bool is_current(); /** \name These attributes are useful for the Linux/Unix platform only. \{ */ static const char *dialog_title; static const char *dialog_printer; static const char *dialog_range; static const char *dialog_copies; static const char *dialog_all; static const char *dialog_pages; static const char *dialog_from; static const char *dialog_to; static const char *dialog_properties; static const char *dialog_copyNo; static const char *dialog_print_button; static const char *dialog_cancel_button; static const char *dialog_print_to_file; static const char *property_title; static const char *property_pagesize; static const char *property_mode; static const char *property_use; static const char *property_save; static const char *property_cancel; /** \} */ /** The destructor */ ~Fl_Printer(void); }; #endif // Fl_Printer_H // // End of "$Id$" //