## GtkCenterBox GtkCenterBox — A centering container |

## Functions

GtkWidget * | gtk_center_box_new ()
void | gtk_center_box_set_start_widget ()
void | gtk_center_box_set_center_widget ()
void | gtk_center_box_set_end_widget ()
GtkWidget * | gtk_center_box_get_start_widget ()
GtkWidget * | gtk_center_box_get_center_widget ()
GtkWidget * | gtk_center_box_get_end_widget ()
void | gtk_center_box_set_baseline_position ()
GtkBaselinePosition | gtk_center_box_get_baseline_position ()

## Types and Values

| GtkCenterBox

## Includes

    #include <gtk/gtk.h>

## Description

The GtkCenterBox widget arranges three children in a horizontal or vertical arrangement, keeping the middle child centered as well as possible.

To add children to GtkCenterBox, use `gtk_center_box_set_start_widget()`, `gtk_center_box_set_center_widget()` and `gtk_center_box_set_end_widget()`.

The sizing and positioning of children can be influenced with the align and expand properties of the children.

### GtkCenterBox as GtkBuildable

The GtkCenterBox implementation of the GtkBuildable interface supports placing children in the 3 positions by specifying “start”, “center” or “end” as the “type” attribute of a <child> element.

### CSS nodes

GtkCenterBox uses a single CSS node with the name “box”,

The first child of the GtkCenterBox will be allocated depending on the text direction, i.e. in left-to-right layouts it will be allocated on the left and in right-to-left layouts on the right.

In vertical orientation, the nodes of the children are arranged from top to bottom.

## Functions

### gtk_center_box_new ()

    GtkWidget *
    gtk_center_box_new (void);

Creates a new GtkCenterBox.

#### Returns

the new GtkCenterBox.

### gtk_center_box_set_start_widget ()

    void
    gtk_center_box_set_start_widget (GtkCenterBox *self,
                                     GtkWidget *child);

Sets the start widget. To remove the existing start widget, pass `NULL`.

#### Parameters

self | a GtkCenterBox |
child | the new start widget, or `NULL`. | [nullable]

### gtk_center_box_set_center_widget ()

    void
    gtk_center_box_set_center_widget (GtkCenterBox *self,
                                      GtkWidget *child);

Sets the center widget. To remove the existing center widget, pas `NULL`.

#### Parameters

self | a GtkCenterBox |
child | the new center widget, or `NULL`. | [nullable]

### gtk_center_box_set_end_widget ()

    void
    gtk_center_box_set_end_widget (GtkCenterBox *self,
                                   GtkWidget *child);

Sets the end widget. To remove the existing end widget, pass `NULL`.

#### Parameters

self | a GtkCenterBox |
child | the new end widget, or `NULL`. | [nullable]

### gtk_center_box_get_start_widget ()

    GtkWidget *
    gtk_center_box_get_start_widget (GtkCenterBox *self);

Gets the start widget, or `NULL` if there is none.

#### Parameters

self | a GtkCenterBox |

#### Returns

the start widget.

[transfer none][nullable]

### gtk_center_box_get_center_widget ()

    GtkWidget *
    gtk_center_box_get_center_widget (GtkCenterBox *self);

Gets the center widget, or `NULL` if there is none.

#### Parameters

self | a GtkCenterBox |

#### Returns

the center widget.

[transfer none][nullable]

### gtk_center_box_get_end_widget ()

    GtkWidget *
    gtk_center_box_get_end_widget (GtkCenterBox *self);

Gets the end widget, or `NULL` if there is none.

#### Parameters

self | a GtkCenterBox |

#### Returns

the end widget.

[transfer none][nullable]

### gtk_center_box_set_baseline_position ()

    void
    gtk_center_box_set_baseline_position (GtkCenterBox *self,
                                          GtkBaselinePosition position);

Sets the baseline position of a center 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.

#### Parameters

self | a GtkCenterBox |
position | a GtkBaselinePosition |

### gtk_center_box_get_baseline_position ()

    GtkBaselinePosition
    gtk_center_box_get_baseline_position (GtkCenterBox *self);

Gets the value set by `gtk_center_box_set_baseline_position()`.

#### Parameters

self | a GtkCenterBox |

#### Returns

the baseline position

## Types and Values

### GtkCenterBox

    typedef struct _GtkCenterBox GtkCenterBox;

## See Also

GtkBox