NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / canvas / test / gtk_scene.cc
1 #include <iostream>
2 #include <gtkmm.h>
3 #include "canvas/canvas.h"
4 #include "canvas/rectangle.h"
5 #include "canvas/line.h"
6 #include "canvas/pixbuf.h"
7
8 using namespace std;
9 using namespace ArdourCanvas;
10
11 bool
12 foo (GdkEvent* ev)
13 {
14         cout << "click.\n";
15         return true;
16 }
17
18 int main (int argc, char* argv[])
19 {
20         Gtk::Main kit (argc, argv);
21
22         Gtk::Window window;
23         window.set_title ("Hello world");
24         window.set_size_request (512, 512);
25
26         Gtk::VBox overall_vbox;
27         Gtk::HScrollbar h_scroll;
28         Gtk::VScrollbar v_scroll;
29
30         GtkCanvasViewport viewport (*h_scroll.get_adjustment(), *v_scroll.get_adjustment());
31         GtkCanvas* canvas = viewport.canvas ();
32
33         overall_vbox.pack_start (viewport, true, true);
34         overall_vbox.pack_start (h_scroll, false, false);
35
36         Rectangle a (canvas->root(), Rect (64, 64, 128, 128));
37         a.set_outline_color (0xff0000aa);
38         Rectangle b (canvas->root(), Rect (64, 64, 128, 128));
39         b.set_position (Duple (256, 256));
40         b.set_outline_width (4);
41         b.set_outline_what (0x2 | 0x8);
42         b.set_outline_color (0x0000ffff);
43         b.Event.connect (sigc::ptr_fun (foo));
44
45         Rectangle c (canvas->root(), Rect (2048, 2048, 2096, 2096));
46
47         Rectangle d (canvas->root(), Rect (0, 256, COORD_MAX, 284));
48         d.name = "d";
49
50         Line e (canvas->root());
51         e.set (Duple (256, 0), Duple (256, COORD_MAX));
52         e.name = "e";
53         e.set_outline_color (0xff0000ff);
54
55         Pixbuf pixbuf (canvas->root());
56         pixbuf.set_position (Duple (192, 192));
57         Glib::RefPtr<Gdk::Pixbuf> p = Gdk::Pixbuf::create_from_file ("../../libs/canvas/test/test.png");
58         pixbuf.set (p);
59
60         window.add (overall_vbox);
61         canvas->show ();
62         window.show_all ();
63
64         Gtk::Main::run (window);
65         return 0;
66 }