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
|
with Gtk.Main, Gtk.Button;
package body Packbox is
use Gtk.Box, Gtk.Button;
function Delete_Event
(Widget : access Gtk.Widget.Gtk_Widget_Record'Class) return Boolean
is
pragma Unreferenced (Widget);
begin
Gtk.Main.Main_Quit;
return False;
end Delete_Event;
function Make_Box
(Homogeneous : Boolean;
Spacing : Gint;
Expand : Boolean;
Fill : Boolean;
Padding : Guint) return Gtk.Box.Gtk_Hbox
is
Box : Gtk_Box;
Button : Gtk_Button;
begin
-- Create a new hbox with the appropriate homogeneous
-- and spacing settings
Gtk_New_Hbox (Box, Homogeneous, Spacing);
-- Create a series of buttons with the appropriate settings
Gtk_New (Button, "Gtk.Box.Pack");
Pack_Start (Box, Button, Expand, Fill, Padding);
Show (Button);
Gtk_New (Button, "(Box,");
Pack_Start (Box, Button, Expand, Fill, Padding);
Show (Button);
Gtk_New (Button, "Button,");
Pack_Start (Box, Button, Expand, Fill, Padding);
Show (Button);
-- Create a button with the label depending on the value of
-- expand.
Gtk_New (Button, "Expand => " & Boolean'Image (Expand) & ",");
Pack_Start (Box, Button, Expand, Fill, Padding);
Show (Button);
-- This is the same as the button creation for "expand"
-- above.
Gtk_New (Button, "Fill => " & Boolean'Image (Fill) & ",");
Pack_Start (Box, Button, Expand, Fill, Padding);
Show (Button);
Gtk_New (Button, "Padding => " & Guint'Image (Padding) & ");");
Pack_Start (Box, Button, Expand, Fill, Padding);
Show (Button);
return Box;
end Make_Box;
procedure Quit (Widget : access Gtk.Widget.Gtk_Widget_Record'Class) is
pragma Unreferenced (Widget);
begin
Gtk.Main.Main_Quit;
end Quit;
end Packbox;
|