9 print STDERR "Brum!\n";
12 Glib::Timeout->add(5000, \&timer);
14 my $cursor = Gtk2::Gdk::Cursor->new('watch');
16 my $window = Gtk2::Window->new ('toplevel');
18 my $b1 = Gtk2::Button->new ('Quit');
19 $b1->signal_connect (clicked => sub { Gtk2->main_quit });
20 my $b2 = Gtk2::Button->new ('Exit');
21 $b2->signal_connect (clicked => sub { Gtk2->main_quit });
22 my $b3 = Gtk2::Button->new ('Apage!');
23 $b3->signal_connect (clicked => sub { Gtk2->main_quit });
24 my $box = Gtk2::HBox->new();
25 $box->pack_start_defaults($b1);
26 $box->pack_start_defaults($b2);
27 $box->pack_start_defaults($b3);
28 $box->set_border_width(5);
30 my $bb = Gtk2::Button->new ('Brum!');
31 $bb->signal_connect (clicked => sub {
32 my $dialog = Gtk2::MessageDialog->new($window, [qw/modal destroy-with-parent/], 'question', 'ok-cancel', "So what?");
33 $dialog->set_default_response("ok");
34 $dialog->signal_connect (response => sub { $_[0]->destroy });
37 #$bb->set_sensitive(0);
39 my $store = Gtk2::ListStore->new('Glib::Uint', 'Glib::String');
40 for (my $i=0; $i<10; $i++) {
41 my $iter = $store->append;
42 $store->set($iter, 0, $i, 1, "Hey ($i)");
45 my $tree = Gtk2::TreeView->new($store);
46 my $rend = Gtk2::CellRendererText->new;
47 my $col = Gtk2::TreeViewColumn->new_with_attributes("Int", $rend, "text", 0);
48 $tree->append_column($col);
49 $col = Gtk2::TreeViewColumn->new_with_attributes("String", $rend, "text", 1);
50 $tree->append_column($col);
51 $tree->set_headers_visible(0);
53 my $lay = Gtk2::ScrolledWindow->new;
54 $lay->set_policy("automatic", "automatic");
56 $lay->set_border_width(5);
58 my $frame = Gtk2::Frame->new("A list");
61 my $sel = $tree->get_selection;
62 $sel->set_mode('single');
63 $sel->signal_connect(changed => sub {
64 my $iter = $_[0]->get_selected;
65 my $val = $store->get($iter, 0);
66 print "Selected $val\n";
69 my $lab = Gtk2::Label->new;
70 $lab->set_markup("<span size='x-large'>Welcome to the Cave</span>");
72 my $bar = Gtk2::Statusbar->new;
73 my $barctx = $bar->get_context_id('xyzzy');
74 $bar->push($barctx, "Ready");
76 my $bbox = Gtk2::VBox->new();
77 $bbox->pack_start($lab, 0, 0, 0);
78 $bbox->pack_start($box, 0, 0, 0);
79 $bbox->pack_start($frame, 1, 1, 0);
80 $bbox->pack_start($bb, 0, 0, 0);
81 $bbox->pack_start($bar, 0, 0, 0);
83 $window->signal_connect ("delete-event" => sub { Gtk2->main_quit });
84 $window->set_title("Brum");
85 $window->set_wmclass("submit", "Submit");
86 $window->set_default_size(320, 400);
90 #$window->window->set_cursor($cursor);
91 #$window->window->set_cursor(undef);