NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / canvas / test / gtk_viewport.cc
1 #include <iostream>
2 #include <gtkmm.h>
3 #include "canvas/canvas.h"
4 #include "canvas/rectangle.h"
5
6 using namespace std;
7 using namespace ArdourCanvas;
8
9 Gtk::Adjustment* hadj;
10 Gtk::Adjustment* vadj;
11
12 void
13 left_clicked ()
14 {
15         hadj->set_value (hadj->get_value() - 64);
16 }
17
18 void
19 right_clicked ()
20 {
21         hadj->set_value (hadj->get_value() + 64);
22 }
23
24 int main (int argc, char* argv[])
25 {
26         Gtk::Main kit (argc, argv);
27
28         Gtk::Window window;
29         window.set_title ("Hello world");
30         GtkCanvas canvas;
31
32         Rectangle a (canvas.root(), Rect (64, 64, 128, 128));
33         a.set_outline_color (0xff0000aa);
34         Rectangle b (canvas.root(), Rect (64, 64, 128, 128));
35         b.set_position (Duple (256, 256));
36         b.set_outline_width (4);
37         b.set_outline_color (0x00ff00ff);
38
39         Gtk::HBox button_box;
40
41         Gtk::Button left ("Left");
42         left.signal_clicked().connect (sigc::ptr_fun (&left_clicked));
43         button_box.pack_start (left);
44
45         Gtk::Button right ("Right");
46         right.signal_clicked().connect (sigc::ptr_fun (&right_clicked));
47         button_box.pack_start (right);
48
49         hadj = new Gtk::Adjustment (0, 0, 1e3);
50         vadj = new Gtk::Adjustment (0, 0, 1e3);
51
52         Gtk::Viewport viewport (*hadj, *vadj);
53         viewport.add (canvas);
54
55         Gtk::VBox overall_box;
56         overall_box.pack_start (viewport);
57         overall_box.pack_start (button_box, false, false);
58
59         window.add (overall_box);
60         canvas.show ();
61         window.show_all ();
62
63         Gtk::Main::run (window);
64         return 0;
65 }