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.
Widget Hierarchy |
---|
Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) \___ Gtk_Container (see section Package Gtk.Container) \___ Gtk_Box (see section Package Gtk.Box) |
Subprograms |
---|
procedure Gtk_New_Vbox (Box : in out Gtk_Box; Homogeneous : in Boolean := False; Spacing : in Gint := 0); | ||
Create a new vertical box. | ||
procedure Gtk_New_Hbox (Box : in out Gtk_Box; Homogeneous : in Boolean := False; Spacing : in Gint := 0); | ||
Create a new horizontal box. | ||
procedure Initialize_Vbox (Box : access Gtk_Box_Record'Class; Homogeneous : in Boolean := False; Spacing : in Gint := 0); | ||
Internal initialization function. | ||
procedure Initialize_Hbox (Box : access Gtk_Box_Record'Class; Homogeneous : in Boolean := False; Spacing : in Gint := 0); | ||
Internal initialization function. | ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Box.
| ||
function Get_Hbox_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_HBox.
| ||
function Get_Vbox_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_VBox.
| ||
procedure Pack_Start (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Expand : in Boolean := True; Fill : in Boolean := True; Padding : in Gint := 0); | ||
Add a new child to the beginning of the box (ie left or top part). If Expand is False, the size allocated for each size will be the one requested by the widget (or the largest child if Homogeneous was set to true when the box was created). Otherwise, the total size of the box is divided between all the children. Note that this does not mean that the children have to occupy all the space given to them... If Fill is True, then the widget will be resized so as to occupy all the space allocated to them. This is only relevant if Expand is True, since otherwise the space allocated is the same one as the child's size.
Padding is the amount of space left around the widget when it is drawn.
| ||
procedure Pack_End (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Expand : in Boolean := True; Fill : in Boolean := True; Padding : in Gint := 0); | ||
Add a new child to the end of the box (ie right or bottom part).
See Pack_Start for an explanation of all the parameters.
| ||
procedure Pack_Start_Defaults (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class); | ||
This is the same as Pack_Start if you use the default parameter values. | ||
procedure Pack_End_Defaults (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class); | ||
This is the same as Pack_End if you use the default parameter values. | ||
procedure Set_Homogeneous (In_Box : access Gtk_Box_Record; Homogeneous : in Boolean); | ||
Modify the homogeneous parameter for the box. | ||
procedure Set_Spacing (In_Box : access Gtk_Box_Record; Spacing : in Gint); | ||
Modify the spacing for the box. | ||
procedure Reorder_Child (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Pos : in Guint); | ||
Move the Child to a new position. | ||
procedure Query_Child_Packing (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Expand : out Boolean; Fill : out Boolean; Padding : out Gint; PackType : out Gtk.Enums.Gtk_Pack_Type); | ||
Get information on how the child was packed in the box. | ||
procedure Set_Child_Packing (In_Box : access Gtk_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Expand : in Boolean; Fill : in Boolean; Padding : in Gint; PackType : in Gtk.Enums.Gtk_Pack_Type); | ||
Modify the packing for a child.
| ||
function Get_Child (Box : access Gtk_Box_Record; Num : in Gint) return Gtk.Widget.Gtk_Widget; | ||
Return the Num-th child of the box, or null if there is no such child.
|