---
name: "Gtk_Box"
section: "3"
platform: "linux"
package: "libgtkmm-dev"
version: "1.0.3-1.1"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/Gtk_Box"
---

# Gtk\_Box(3)

## NAME - Gtk\_Box

{lass Gtk\_Box} is a base class for horizontal or vertical boxes, which layout widgets inserted to them next to each other.

## HEADER REQUIRED

**#include \<gtk--/box.h&gt;\>**

## BASE CLASSES

[Gtk\_Container(3)](/Gtk_Container/3.md)

## DERIVED BY

[Gtk\_ButtonBox(3)](/Gtk_ButtonBox/3.md) [Gtk\_HBox(3)](/Gtk_HBox/3.md) [Gtk\_VBox(3)](/Gtk_VBox/3.md)

## DESCRIPTION

Gtk\_Box is an abstract class and it defers choice of which way the widgets are packed to the screen to the derived classes. Gtk\_Box provides common interface for inserting widgets to a box indepenently of how it is shown in the screen.

The most common use of Gtk\_Box is like this:

 class mywindow : public Gtk\_Window {\
     Gtk\_Label label1,label2;\
     Gtk\_VBox vbox;\
  public:\
     mywindow();\
  };\
  mywindow::mywindow() \
  {\
     add(vbox);\
     vbox.pack\_end(label1, true, true, 0);\
     vbox.pack\_end(label2, true, true, 0);\
  }

## PROPERTIES

- *children*

  Type: GList\*\

- *spacing*

  Type: gint16\

- *homogeneous*

  Type: guint:1\

-

   .IP

## PUBLIC MEMBER INDEX

```
Gtk_Box(GtkBox *castitem);
void  pack_start(const Gtk_Widget &child, bool expand=true, bool fill=true, gint padding=0);
  pack_start inserts a widget to a box.
void  pack_end(const Gtk_Widget &child, bool expand=true, bool fill=true, gint padding=0);
void  pack_start(const Gtk_ObjectHandle &child, bool expand=true, bool fill=true, gint padding=0);
void  pack_end(const Gtk_ObjectHandle &child, bool expand=true, bool fill=true, gint padding=0);
void  set_homogeneous(bool homogeneous);
void  set_spacing(gint spacing);
void  reorder_child(const Gtk_Widget &child, gint pos);
void  query_child_packing(const Gtk_Widget &child, bool *expand, bool *fill, guint *padding, GtkPackType *pack_type) const;
void  set_child_packing(const Gtk_Widget &child, bool expand, bool fill, guint padding, GtkPackType pack_type);
GtkBox*  gtkobj();
const GtkBox*  gtkobj() const;
static bool  isGtkBox(Gtk_Object *checkcast);
```

## PROTECTED MEMBER INDEX

```
friend  CppClassType;
typedef GtkBox  BaseObjectType;
typedef GtkBoxClass  BaseClassType;
virtual void * get_parent_class();
Gtk_Box();
```

## PRIVATE MEMBER INDEX

```
static CppClassType  box_class;
GtkType  get_type();
```

## PUBLIC MEMBER DESCRIPTIONS

- void Gtk\_Box::**pack\_start** (*const Gtk\_Widget &child, bool expand=true, bool fill=true, gint padding=0*);

  pack\_start inserts a widget to a box..\
   The expand argument to **pack\_start**() or **pack\_end**() controls whether the widgets are laid out in the box to fill in all the extra space in the box so the box is expanded to fill the area alloted to it (true). Or the box is shrunk to just fit the widgets (false). Setting expand to false will allow you to do right and left justifying of your widgets. Otherwise, they will all expand to fit in the box, and the same effect could be achieved by using only one of **pack\_start**() or **pack\_end**() functions.

The fill argument to the **pack\_start**()/**pack\_end**() functions control whether the extra space is allocated to the objects themselves (true), or as extra padding in the box around these objects (y*false*). It only has an effect if the expand argument is also true.

What's the difference between spacing (set when the box is created) and padding (set when elements are packed)? Spacing is added between objects, and padding is added on either side of an object.

- void Gtk\_Box::**set\_homogeneous** (*bool homogeneous*);

  allows setting homongeneous afterwards. This is usually given on  Gtk\_VBox::**Gtk\_VBox**() or Gtk\_HBox::**Gtk\_HBox**()\

## PROTECTED MEMBER DESCRIPTIONS

## PRIVATE MEMBER DESCRIPTIONS
