Base class for box containers
GtkBox is an abstract widget which encapsulates functionallity for a particular
kind of container, one that organizes a variable number of widgets into a
rectangular area. GtkBox currently has two derived classes, <gtk-hbox>
and <gtk-vbox>
.
The rectangular area of a GtkBox is organized into either a single row or a
single column of child widgets depending upon whether the box is of type
<gtk-hbox>
or <gtk-vbox>
, respectively. Thus, all children of a
GtkBox are allocated one dimension in common, which is the height of a row, or
the width of a column.
GtkBox uses a notion of packing. Packing refers to adding widgets with
reference to a particular position in a <gtk-container>
. For a GtkBox,
there are two reference positions: the start and the end of the
box. For a <gtk-vbox>
, the start is defined as the top of the box and the
end is defined as the bottom. For a <gtk-hbox>
the start is defined as
the left side and the end is defined as the right side.
Use repeated calls to gtk-box-pack-start
to pack widgets into a GtkBox
from start to end. Use gtk-box-pack-end
to add widgets from end to start.
You may intersperse these calls and add widgets from both ends of the same
GtkBox.
Use gtk-box-pack-start-defaults
or gtk-box-pack-end-defaults
to
pack widgets into a GtkBox if you do not need to specify the , , or attributes
of the child to be added.
Because GtkBox is a <gtk-container>
, you may also use
gtk-container-add
to insert widgets into the box, and they will be packed
as if with gtk-box-pack-start-defaults
. Use gtk-container-remove
to remove widgets from the GtkBox.
Use gtk-box-set-homogeneous
to specify whether or not all children of the
GtkBox are forced to get the same amount of space.
Use gtk-box-set-spacing
to determine how much space will be minimally
placed between all children in the GtkBox.
Use gtk-box-reorder-child
to move a GtkBox child to a different place in
the box.
Use gtk-box-set-child-packing
to reset the , , and attributes of any
GtkBox child. Use gtk-box-query-child-packing
to query these fields.
Derives from
<gtk-container>
.This class defines the following slots:
spacing
- The amount of space between children
homogeneous
- Whether the children should all be the same size
<gtk-box>
) (child <gtk-widget>
) (expand bool
) (fill bool
) (padding unsigned-int
)Adds child to box, packed with reference to the start of box. The child is packed after any other child packed with reference to the start of box.
- box
- a
<gtk-box>
.- child
- the
<gtk-widget>
to be added to box.- expand
- ‘
#t
’ if the new child is to be given extra space allocated to box. The extra space will be divided evenly between all children of box that use this option.- fill
- ‘
#t
’ if space given to child by the expand option is actually allocated to child, rather than just padding it. This parameter has no effect if expand is set to ‘#f
’. A child is always allocated the full height of a<gtk-hbox>
and the full width of a<gtk-vbox>
. This option affects the other dimension.- padding
- extra space in pixels to put between this child and its neighbors, over and above the global amount specified by
<gtk-box>
. If child is a widget at one of the reference ends of box, then padding pixels are also put between child and the reference edge of box.
<gtk-box>
) (child <gtk-widget>
) (expand bool
) (fill bool
) (padding unsigned-int
)Adds child to box, packed with reference to the end of box. The child is packed after (away from end of) any other child packed with reference to the end of box.
- box
- a
<gtk-box>
.- child
- the
<gtk-widget>
to be added to box.- expand
- ‘
#t
’ if the new child is to be given extra space allocated to box. The extra space will be divided evenly between all children of box that use this option.- fill
- ‘
#t
’ if space given to child by the expand option is actually allocated to child, rather than just padding it. This parameter has no effect if expand is set to ‘#f
’. A child is always allocated the full height of a<gtk-hbox>
and the full width of a<gtk-vbox>
. This option affects the other dimension.- padding
- extra space in pixels to put between this child and its neighbors, over and above the global amount specified by
<gtk-box>
. If child is a widget at one of the reference ends of box, then padding pixels are also put between child and the reference edge of box.
<gtk-box>
) (widget <gtk-widget>
)Adds widget to box, packed with reference to the start of box. The child is packed after any other child packed with reference to the start of box.
Parameters for how to pack the child widget,
<gtk-box-child>
, are given their default values, ‘#t
’, ‘#t
’, and 0, respectively.
- box
- a
<gtk-box>
.- widget
- the
<gtk-widget>
to be added to box.
<gtk-box>
) (widget <gtk-widget>
)Adds widget to box, packed with reference to the end of box. The child is packed after (away from end of) any other child packed with reference to the end of box.
Parameters for how to pack the child widget,
<gtk-box-child>
, are given their default values, ‘#t
’, ‘#t
’, and 0, respectively.
- box
- a
<gtk-box>
.- widget
- the
<gtk-widget>
to be added to box.
<gtk-box>
) ⇒ (ret bool
)Returns whether the box is homogeneous (all children are the same size). See
gtk-box-set-homogeneous
.
- box
- a
<gtk-box>
- ret
- ‘
#t
’ if the box is homogeneous.
<gtk-box>
) (homogeneous bool
)Sets the whether or not all children of box are given equal space in the box.
- box
- a
<gtk-box>
.- homogeneous
- a boolean value, ‘
#t
’ to create equal allotments, ‘#f
’ for variable allotments.
<gtk-box>
) ⇒ (ret int
)Gets the value set by
gtk-box-set-spacing
.
- box
- a
<gtk-box>
- ret
- spacing between children
<gtk-box>
) (spacing int
)Sets the number of pixels to place between children of box.
- box
- a
<gtk-box>
.- spacing
- the number of pixels to put between children.
<gtk-box>
) (child <gtk-widget>
) (position int
)Moves child to a new position in the list of box children. The list is the both widgets packed
<gtk-pack-start>
as well as widgets packed<gtk-pack-end>
, in the order that these widgets were added to box.A widget's position in the box children list determines where the widget is packed into box. A child widget at some position in the list will be packed just after all other widgets of the same packing type that appear earlier in the list.
- box
- a
<gtk-box>
.- child
- the
<gtk-widget>
to move.- position
- the new position for child in the
<gtk-box>
, starting from 0. If negative, indicates the end of the list.
<gtk-box>
) (child <gtk-widget>
) (expand bool
) (fill bool
) (padding unsigned-int
) (pack_type <gtk-pack-type>
)Sets the way child is packed into box.
- box
- a
<gtk-box>
.- child
- the
<gtk-widget>
of the child to set.- expand
- the new value of the
- fill
- the new value of the
- padding
- the new value of the
- pack-type
- the new value of the