From 998cc6df521a115454727d1ecf6bc7d4fee96f68 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 14 Mar 2010 18:07:24 +0000 Subject: Merge of branch-1.3-Fl_Printer, with the following main changes: (1) adding Fl_Device class (and more) for device abstraction (2) adding Fl_Pinter class (and more) for printing support. Todo: Code cleanup, update dependencies, remove/replace test print window. I'm looking into converting the test window popup in a global shortcut that would pop up the print dialog now... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7263 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/cube.cxx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/cube.cxx') diff --git a/test/cube.cxx b/test/cube.cxx index 4598921a9..b7bf82614 100644 --- a/test/cube.cxx +++ b/test/cube.cxx @@ -157,8 +157,41 @@ void makeform(const char *name) { form->end(); } +// added to demo printing +#include +#include + +void print_cb(Fl_Widget *w, void *data) +{ + Fl_Gl_Printer printer; + Fl_Window *win = Fl::first_window(); + if(!win) return; + if( printer.start_job(1) ) return; + if( printer.start_page() ) return; + printer.scale(0.68,0.68); + printer.print_widget( win ); + printer.print_gl_window( cube, cube->x(), cube->y() ); + printer.print_gl_window( cube2, cube2->x(), cube2->y() ); + printer.end_page(); + printer.end_job(); +} +// end of printing demo + int main(int argc, char **argv) { makeform(argv[0]); + // added to demo printing + form->begin(); + static Fl_Menu_Item items[] = { + { "Menu", 0, 0, 0, FL_SUBMENU }, + { "Print", 0, print_cb, 0, 0 }, + { 0 }, + { 0 } + }; + Fl_Sys_Menu_Bar *menubar_; + menubar_ = new Fl_Sys_Menu_Bar(0, 0, 40, 25); + menubar_->menu(items); + form->end(); + // end of printing demo speed->bounds(4,0); speed->value(cube->speed = cube2->speed = 1.0); size->bounds(4,0.01); -- cgit v1.2.3