with Gtk.Box; use Gtk.Box; with Gtk.Button; use Gtk.Button; with Gtk.Label; use Gtk.Label; with Gtk.Widget; use Gtk.Widget; with Gtk.Main; with Gtk.Window; use Gtk.Window; with Gtk.GEntry; use Gtk.GEntry; --with Gtk.Handlers; use Gtk.Handlers; with Handlery; procedure Main is Win : Gtk_Window; Label : Gtk_Label; VBox : Gtk_Vbox; Button1, Button2, Button3, Btn_Quit : Gtk_Button; HBox1, HBox2 : Gtk_Hbox; Edit1, Edit2, Edit3 : Gtk_GEntry; procedure Quit_Handler (Btn_Quit : access Gtk_Button_Record'Class) is begin Gtk.Main.Main_Quit; end Quit_Handler; procedure App_Quit (Win : access Gtk_Widget_Record'Class) is begin Gtk.Main.Main_Quit; end App_Quit; begin -- Initialize GtkAda. Gtk.Main.Init; -- Create a window with a size of 400x400 Gtk_New (Win); Win.Set_Default_Size (400, 400); -- Win.On_Destroy(App_Quit'Unrestricted_Access); handlery.Handlers.Connect ( Win, "destroy", handlery.Handlers.To_Marshaller (handlery.Destroy'Access)); -- Create a box to organize vertically the contents of the window Gtk_New_Vbox (VBox); Gtk_New_Hbox (HBox1); Gtk_New_Hbox (HBox2); -- Add a label Gtk_New (Label, "Hello world."); VBox.Add(Label); -- Add a button 1 Gtk_New(Button1,"Button1"); HBox1.Add(Button1); -- Add a button 2 Gtk_New(Button2,"Button2"); HBox1.Add(Button2); -- Add a button 3 Gtk_New(Button3); Button3.Set_Label("Button3"); HBox1.Add(Button3); -- Add a Text Edit 1 Gtk_New(Edit1); HBox2.Add(Edit1); -- Add a Text Edit 2 Gtk_New(Edit2); HBox2.Add(Edit2); -- Add a Text Edit 3 Gtk_New(Edit3); HBox2.Add(Edit3); Gtk_New(Btn_Quit, "Quit Application"); -- Btn_Quit.On_Clicked(Quit_Handler'Unrestricted_Access); handlery.Handlers.Connect ( Btn_Quit, "clicked", handlery.Handlers.To_Marshaller (handlery.Destroy'Access)); VBox.Add(HBox1); VBox.Add(HBox2); VBox.Add(Btn_Quit); Win.Add (VBox); -- Show the window Win.Show_All; -- Start the Gtk+ main loop Gtk.Main.Main; end Main;