summaryrefslogtreecommitdiff
path: root/test/cube.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
commit998cc6df521a115454727d1ecf6bc7d4fee96f68 (patch)
tree70a1c9afffb294a75bd38484c2e6e4a042ac3426 /test/cube.cxx
parent5bc66fafc348c547870bbf51c9c4a7215ad4ff25 (diff)
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
Diffstat (limited to 'test/cube.cxx')
-rw-r--r--test/cube.cxx33
1 files changed, 33 insertions, 0 deletions
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 <FL/Fl_Sys_Menu_Bar.H>
+#include <FL/Fl_Gl_Printer.H>
+
+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);