package Implements_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Box_Record, Gtk_Box);
package Implements_Orientable is new Glib.Types.Implements (Gtk.Orientable.Gtk_Orientable, Gtk_Box_Record, Gtk_Box);
type Gtk_Box_Record is new Gtk_Container_Record with null record;
type Gtk_Box is access all Gtk_Box_Record'Class;
subtype Gtk_Hbox_Record is Gtk_Box_Record;
subtype Gtk_Hbox is Gtk_Box;
subtype Gtk_Vbox_Record is Gtk_Box_Record;
subtype Gtk_Vbox is Gtk_Box;
Homogeneous_Property : constant Glib.Properties.Property_Boolean;
Spacing_Property : constant Glib.Properties.Property_Int;
function Get_Type return Glib.GType;
procedure Initialize_Hbox
( | Box | : access Gtk_Hbox_Record'Class; |
Homogeneous | : Boolean := False; | |
Spacing | : Gint := 0); |
function Get_Hbox_Type return Glib.GType;
procedure Initialize_Vbox
( | Box | : access Gtk_Vbox_Record'Class; |
Homogeneous | : Boolean := False; | |
Spacing | : Gint := 0); |
function Get_Vbox_Type return Glib.GType;
function Get_Homogeneous
( | Box | : access Gtk_Box_Record) return Boolean; |
procedure Set_Homogeneous
( | Box | : access Gtk_Box_Record; |
Homogeneous | : Boolean); |
function Get_Spacing
( | Box | : access Gtk_Box_Record) return Gint; |
procedure Set_Spacing
( | Box | : access Gtk_Box_Record; |
Spacing | : Gint); |
procedure Pack_End
( | In_Box | : access Gtk_Box_Record; |
Child | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Expand | : Boolean := True; | |
Fill | : Boolean := True; | |
Padding | : Guint := 0); |
procedure Pack_End_Defaults
( | Box | : access Gtk_Box_Record; |
Widget | : access Gtk.Widget.Gtk_Widget_Record'Class); |
procedure Pack_Start
( | In_Box | : access Gtk_Box_Record; |
Child | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Expand | : Boolean := True; | |
Fill | : Boolean := True; | |
Padding | : Guint := 0); |
procedure Pack_Start_Defaults
( | Box | : access Gtk_Box_Record; |
Widget | : access Gtk.Widget.Gtk_Widget_Record'Class); |
procedure Query_Child_Packing
( | Box | : access Gtk_Box_Record; |
Child | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Expand | : out Boolean; | |
Fill | : out Boolean; | |
Padding | : out Guint; | |
Pack_Type | : out Gtk.Enums.Gtk_Pack_Type); |
procedure Set_Child_Packing
( | Box | : access Gtk_Box_Record; |
Child | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Expand | : Boolean; | |
Fill | : Boolean; | |
Padding | : Guint; | |
Pack_Type | : Gtk.Enums.Gtk_Pack_Type); |
procedure Reorder_Child
( | Box | : access Gtk_Box_Record; |
Child | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Position | : Gint); |
function Get_Child
( | Box | : access Gtk_Box_Record; |
Num | : Gint) return Gtk.Widget.Gtk_Widget; |
function Get_Orientation
( | Self | : access Gtk_Box_Record) return Gtk.Enums.Gtk_Orientation; |
procedure Set_Orientation
( | Self | : access Gtk_Box_Record; |
Orientation | : Gtk.Enums.Gtk_Orientation); |
function "+"
( | Widget | : access Gtk_Box_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Box renames Implements_Buildable.To_Object; |
function "+"
( | Widget | : access Gtk_Box_Record'Class) return Gtk.Orientable.Gtk_Orientable renames Implements_Orientable.To_Interface; |
function "-"
( | Interf | : Gtk.Orientable.Gtk_Orientable) return Gtk_Box renames Implements_Orientable.To_Object; |
A box is a container that can have multiple children, organized either horizontally or vertically. Two subtypes are provided, Gtk_Hbox and Gtk_Vbox, to conform to the C API. In Ada, you do not need to distinguish between the two, but note that the Gtk_Box type is conceptually an abstract type: there is no way to create a "Gtk_Box", only ways to create either an horizontal box, or a vertical box.
Children can be added to one of two positions in the box, either at the beginning (ie left or top) or at the end (ie right or bottom). Each of these positions can contain multiple widgets.
Every time a child is added to the start, it is placed to the right (resp. the bottom) of the previous widget added to the start.
Every time a child is added to the end, it is placed to the left (resp. the top) of the previous widget added to the end.
There are a number of parameters to specify the behavior of the box when it is resized, and how the children should be reorganized and/or resized.
See the testgtk example in the GtkAda distribution to see concrete examples on how all the parameters for the boxes work.