GtkBox — A container for packing widgets in a single row or column
GtkWidget * | gtk_box_new () |
gboolean | gtk_box_get_homogeneous () |
void | gtk_box_set_homogeneous () |
int | gtk_box_get_spacing () |
void | gtk_box_set_spacing () |
GtkBaselinePosition | gtk_box_get_baseline_position () |
void | gtk_box_set_baseline_position () |
void | gtk_box_append () |
void | gtk_box_prepend () |
void | gtk_box_remove () |
void | gtk_box_insert_child_after () |
void | gtk_box_reorder_child_after () |
GtkBaselinePosition | baseline-position | Read / Write |
gboolean | homogeneous | Read / Write |
int | spacing | Read / Write |
struct | GtkBox |
struct | GtkBoxClass |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkBox ├── GtkShortcutsSection ╰── GtkShortcutsGroup
GtkBox implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkOrientable.
#include <gtk/gtk.h>
The GtkBox widget arranges child widgets into a single row or column, depending upon the value of its “orientation” property. Within the other dimension, all children are allocated the same size. Of course, the “halign” and “valign” properties can be used on the children to influence their allocation.
Use repeated calls to gtk_box_append()
to pack widgets into a GtkBox from start to end. Use gtk_box_remove()
to remove widgets from the GtkBox. gtk_box_insert_child_after()
can be used to add a child at a particular position.
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. Note that spacing is added between the children.
Use gtk_box_reorder_child_after()
to move a child to a different place in the box.
GtkBox uses a single CSS node with name box.
GtkBox uses the GTK_ACCESSIBLE_ROLE_GROUP
role.
GtkWidget * gtk_box_new (GtkOrientation orientation
,int spacing
);
Creates a new GtkBox.
orientation | the box’s orientation. | |
spacing | the number of pixels to place by default between children. |
a new GtkBox.
gboolean
gtk_box_get_homogeneous (GtkBox *box
);
Returns whether the box is homogeneous (all children are the same size). See gtk_box_set_homogeneous()
.
box | a GtkBox |
TRUE
if the box is homogeneous.
void gtk_box_set_homogeneous (GtkBox *box
,gboolean homogeneous
);
Sets the “homogeneous” property of box
, controlling whether or not all children of box
are given equal space in the box.
box | a GtkBox | |
homogeneous | a boolean value, |
int
gtk_box_get_spacing (GtkBox *box
);
Gets the value set by gtk_box_set_spacing()
.
box | a GtkBox |
spacing between children
void gtk_box_set_spacing (GtkBox *box
,int spacing
);
Sets the “spacing” property of box
, which is the number of pixels to place between children of box
.
box | a GtkBox | |
spacing | the number of pixels to put between children |
GtkBaselinePosition
gtk_box_get_baseline_position (GtkBox *box
);
Gets the value set by gtk_box_set_baseline_position()
.
box | a GtkBox |
the baseline position
void gtk_box_set_baseline_position (GtkBox *box
,GtkBaselinePosition position
);
Sets the baseline position of a box. This affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then position
is used to allocate the baseline wrt the extra space available.
box | a GtkBox | |
position |
void gtk_box_append (GtkBox *box
,GtkWidget *child
);
Adds child
as the last child to box
.
void gtk_box_prepend (GtkBox *box
,GtkWidget *child
);
Adds child
as the first child to box
.
void gtk_box_remove (GtkBox *box
,GtkWidget *child
);
Removes a child widget from box
, after it has been added with gtk_box_append()
, gtk_box_prepend()
, or gtk_box_insert_child_after()
.
box | a GtkBox | |
child | the child to remove |
void gtk_box_insert_child_after (GtkBox *box
,GtkWidget *child
,GtkWidget *sibling
);
Inserts child
in the position after sibling
in the list of box
children. If sibling
is NULL
, insert child
at the first position.
struct GtkBox;
struct GtkBoxClass { GtkWidgetClass parent_class; };
“baseline-position”
property“baseline-position” GtkBaselinePosition
The position of the baseline aligned widgets if extra space is available.
Owner: GtkBox
Flags: Read / Write
Default value: GTK_BASELINE_POSITION_CENTER
“homogeneous”
property“homogeneous” gboolean
Whether the children should all be the same size.
Owner: GtkBox
Flags: Read / Write
Default value: FALSE
“spacing”
property“spacing” int
The amount of space between children.
Owner: GtkBox
Flags: Read / Write
Allowed values: >= 0
Default value: 0
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkBox.html