Permalink
Browse files

Now understands mouse button presses!

  • Loading branch information...
colomon committed Dec 3, 2011
1 parent c750a25 commit df3638a31b41c310b81afdfe9a924e64b3073b04
Showing with 12 additions and 1 deletion.
  1. +12 −1 bin/gtk-mandelbrot.pl
View
@@ -238,6 +238,7 @@
constant GdkRgbDither = CLR::("Gdk.RgbDither,$GDK");
constant GdkColor = CLR::("Gdk.Color,$GDK");
constant GtkDrawingArea = CLR::("Gtk.DrawingArea,$GTK");
+constant GtkEventBox = CLR::("Gtk.EventBox,$GTK");
constant SystemByte = CLR::("System.Byte");
constant ByteArray = CLR::("System.Byte[]");
@@ -252,13 +253,23 @@
my $window = Window.new("mandelbrot");
my $windowSizeX = $size; my $windowSizeY = $size;
$window.Resize($windowSizeX, $windowSizeY); # TODO: resize at runtime NYI
+
+my $event-box = GtkEventBox.new;
+$event-box.add_ButtonReleaseEvent(&ButtonEvent);
+
my $drawingarea = GtkDrawingArea.new;
$drawingarea.add_ExposeEvent(&ExposeEvent);
$window.add_DeleteEvent(&DeleteEvent);
-$window.Add($drawingarea);
+$event-box.Add($drawingarea);
+
+$window.Add($event-box);
$window.ShowAll;
Application.Run; # end of main program, it's all over when this returns
+sub ButtonEvent($obj, $args) { #OK not used
+ say "Button";
+}
+
sub DeleteEvent($obj, $args) { #OK not used
Application.Quit;
};

0 comments on commit df3638a

Please sign in to comment.