GtkBox

Name

GtkBox -- a base class for box containers

Synopsis


#include <gtk/gtk.h>


struct      GtkBox;
struct      GtkBoxChild;
void        gtk_box_pack_start              (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             guint padding);
void        gtk_box_pack_end                (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             guint padding);
void        gtk_box_pack_start_defaults     (GtkBox *box,
                                             GtkWidget *widget);
void        gtk_box_pack_end_defaults       (GtkBox *box,
                                             GtkWidget *widget);
gboolean    gtk_box_get_homogeneous         (GtkBox *box);
void        gtk_box_set_homogeneous         (GtkBox *box,
                                             gboolean homogeneous);
gint        gtk_box_get_spacing             (GtkBox *box);
void        gtk_box_set_spacing             (GtkBox *box,
                                             gint spacing);
void        gtk_box_reorder_child           (GtkBox *box,
                                             GtkWidget *child,
                                             gint position);
void        gtk_box_query_child_packing     (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean *expand,
                                             gboolean *fill,
                                             guint *padding,
                                             GtkPackType *pack_type);
void        gtk_box_set_child_packing       (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             guint padding,
                                             GtkPackType pack_type);


Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkContainer
                     +----GtkBox

Properties


  "spacing"              gint                 : Read / Write
  "homogeneous"          gboolean             : Read / Write

Description

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, GtkHBox and GtkVBox.

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 GtkHBox or GtkVBox, 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 GtkContainer. For a GtkBox, there are two reference positions: the start and the end of the box. For a GtkVBox, the start is defined as the top of the box and the end is defined as the bottom. For a GtkHBox 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 expand, fill, or padding attributes of the child to be added.

Because GtkBox is a GtkContainer, 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 expand, fill, and padding attributes of any GtkBox child. Use gtk_box_query_child_packing() to query these fields.

Details

struct GtkBox

struct GtkBox;

The GtkBox describes an instance of GtkBox and contains the following fields. (These fields should be considered read-only. They should never be set by an application.)


struct GtkBoxChild

struct GtkBoxChild
{
  GtkWidget *widget;
  guint16 padding;
  guint expand : 1;
  guint fill : 1;
  guint pack : 1;
  guint is_secondary : 1;
};

The GtkBoxChild holds a child widget of GtkBox and describes how the child is to be packed into the GtkBox. Use gtk_box_query_child_packing() and gtk_box_set_child_packing() to query and reset the padding, expand, fill, and pack fields.

GtkBoxChild contains the following fields. (These fields should be considered read-only. They should never be directly set by an application.)


gtk_box_pack_start ()

void        gtk_box_pack_start              (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             guint padding);

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.


gtk_box_pack_end ()

void        gtk_box_pack_end                (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             guint padding);

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.


gtk_box_pack_start_defaults ()

void        gtk_box_pack_start_defaults     (GtkBox *box,
                                             GtkWidget *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, expand, fill, and padding in GtkBoxChild, are given their default values, TRUE, TRUE, and 0, respectively.


gtk_box_pack_end_defaults ()

void        gtk_box_pack_end_defaults       (GtkBox *box,
                                             GtkWidget *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, expand, fill, and padding in GtkBoxChild, are given their default values, TRUE, TRUE, and 0, respectively.


gtk_box_get_homogeneous ()

gboolean    gtk_box_get_homogeneous         (GtkBox *box);

Returns whether the box is homogeneous (all children are the same size). See gtk_box_set_homogeneous().


gtk_box_set_homogeneous ()

void        gtk_box_set_homogeneous         (GtkBox *box,
                                             gboolean homogeneous);

Sets the homogeneous field of GtkBox, controlling whether or not all children of box are given equal space in the box.


gtk_box_get_spacing ()

gint        gtk_box_get_spacing             (GtkBox *box);

Gets the value set by gtk_box_set_spacing().


gtk_box_set_spacing ()

void        gtk_box_set_spacing             (GtkBox *box,
                                             gint spacing);

Sets the spacing field of GtkBox, which is the number of pixels to place between children of box.


gtk_box_reorder_child ()

void        gtk_box_reorder_child           (GtkBox *box,
                                             GtkWidget *child,
                                             gint position);

Moves child to a new position in the list of box children. The list is the children field of GtkBox, and contains 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.


gtk_box_query_child_packing ()

void        gtk_box_query_child_packing     (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean *expand,
                                             gboolean *fill,
                                             guint *padding,
                                             GtkPackType *pack_type);

Returns information about how child is packed into box.


gtk_box_set_child_packing ()

void        gtk_box_set_child_packing       (GtkBox *box,
                                             GtkWidget *child,
                                             gboolean expand,
                                             gboolean fill,
                                             guint padding,
                                             GtkPackType pack_type);

Sets the way child is packed into box.

Properties

"spacing" (gint : Read / Write)

the minimum amount of space to put between children. Refers to the spacing field of GtkBox.

"homogeneous" (gboolean : Read / Write)

how to allocate space for children, equally or variably. Refers to the homogeneous field of GtkBox.

See Also

GtkHBox

a derived class that organizes widgets into a row.

GtkVBox

a derived class that organizes widgets into a column.

GtkFrame

a GtkWidget useful for drawing a border around a GtkBox.

GtkTable

a GtkContainer for organizing widgets into a grid, rather than independent rows or columns.

GtkLayout

a GtkContainer for organizing widgets into arbitrary layouts.