/usr/share/doc/libgtkada-doc/examples/tutorial/helloworld/hello.adb is in libgtkada-doc 2.24.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | -----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 2000 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-----------------------------------------------------------------------
with Hello_Package; use Hello_Package;
with Gtk.Main;
with Gtk.Widget;
with Gtk.Window; use Gtk.Window;
with Gtk.Button; use Gtk.Button;
procedure Hello is
Window : Gtk_Window;
Button : Gtk_Button;
begin
-- This is called in all GtkAda applications. Arguments are parsed
-- from the command line and are returned to the application.
Gtk.Main.Init;
-- Creates a new window
Gtk.Window.Gtk_New (Window);
-- When the window is given the "delete_event" signal (this is given
-- by the window manager, usually by the "close" option, or on the
-- titlebar), we ask it to call the Delete_Event function.
Return_Handlers.Connect
(Window, "delete_event",
Return_Handlers.To_Marshaller (Delete_Event'Access));
-- Here we connect the "destroy" event to a signal handler.
-- This event occurs when we call Gtk.Widget.Destroy on the window,
-- or if we return False in the "delete_event" callback.
Handlers.Connect
(Window, "destroy", Handlers.To_Marshaller (Destroy'Access));
-- Sets the border width of the window.
Gtk.Window.Set_Border_Width (Window, 10);
-- Creates a new button with the label "Hello World".
Gtk_New (Button, "Hello World");
-- When the button receives the "clicked" signal, it will call the
-- procedure Hello_Callback.
Handlers.Connect
(Button, "clicked", Handlers.To_Marshaller (Hello_Callback'Access));
-- This will cause the window to be destroyed by calling
-- Gtk.Widget.Destroy (Window) when "clicked". Again, the destroy
-- signal could come from here, or the window manager.
Handlers.Object_Connect
(Button,
"clicked",
Handlers.To_Marshaller (Gtk.Widget.Destroy_Cb'Access),
Window);
-- This packs the button into the window (a Gtk_Container).
Gtk.Window.Add (Window, Button);
-- The final step is to display this newly created widget.
Show (Button);
-- and the window
Show (Window);
-- All GtkAda applications must have a Main. Control ends here
-- and waits for an event to occur (like a key press or
-- mouse event).
Gtk.Main.Main;
end Hello;
|