---
name: "Gtk2::Container"
section: "3pm"
platform: "linux"
package: "libgtk2-perl-doc"
version: "2:1.24992-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/Gtk2::Container"
---

# Gtk2::Container(3pm)

wrapper for GtkContainer

## NAME

Gtk2::Container - wrapper for GtkContainer

## HIERARCHY

```
  Glib::Object
  +----Glib::InitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::Widget
                 +----Gtk2::Container
```

## INTERFACES

```
  Glib::Object::_Unregistered::AtkImplementorIface
  Gtk2::Buildable
```

## METHODS

### $container-\>add ($widget)

- •

  `$widget` (Gtk2::Widget)

### $container-\>add\_with\_properties ($widget, ...)

- •

  `$widget` (Gtk2::Widget)

- •

  ... (list) list of property name/value pairs

### integer = $container-\>get\_border\_width

### $container-\>set\_border\_width ($border\_width)

- •

  `$border_width` (integer)

### $container-\>check\_resize

### list = $container-\>child\_get ($child, ...)

- •

  `$child` (Gtk2::Widget)

- •

  ... (list) list of property names

Returns a list of properties of the child.

### list = $container-\>child\_get\_property ($child, ...)

- •

  `$child` (Gtk2::Widget)

- •

  ... (list)

Alias for child\_get

### $container-\>child\_set ($child, ...)

- •

  `$child` (Gtk2::Widget)

- •

  ... (list) list of property name/value pairs

Sets a list of properties on the child.

### $container-\>child\_set\_property ($child, ...)

- •

  `$child` (Gtk2::Widget)

- •

  ... (list)

Alias for child\_set

### string = $container-\>child\_type

### list = $container-\>get\_children

Returns a list of Gtk2::Widget's, the children of the container.

### pspec or undef = $object\_or\_class\_name-\>find\_child\_property ($name)

- •

  `$name` (string)

Return a `"Glib::ParamSpec"` for child property `$name` on container `$object_or_class_name`.  If there's no property `$name` then return `"undef"`.  See Glib::Object `"list_properties"` for the fields in a ParamSpec.

### list = $container-\>get\_focus\_chain

Returns a list of Gtk2::Widgets, the focus chain.

### $container-\>set\_focus\_chain (...)

- •

  ... (list) of Gtk2::Widget's, the focus chain

Sets a focus chain, overriding the one computed automatically by GTK+.

In principle each widget in the chain should be a descendant of the container, but this is not enforced by this method, since it's allowed to set the focus chain before you pack the widgets, or have a widget in the chain that isn't always packed. The necessary checks are done when the focus chain is actually traversed.

### widget or undef = $container-\>get\_focus\_child

Since: gtk+ 2.14

### $container-\>set\_focus\_child ($child)

- •

  `$child` (Gtk2::Widget or undef)

### adjustment or undef = $container-\>get\_focus\_hadjustment

### $container-\>set\_focus\_hadjustment ($adjustment)

- •

  `$adjustment` (Gtk2::Adjustment or undef)

### adjustment or undef = $container-\>get\_focus\_vadjustment

### $container-\>set\_focus\_vadjustment ($adjustment)

- •

  `$adjustment` (Gtk2::Adjustment or undef)

### $container-\>forall ($callback, $callback\_data=undef)

- •

  `$callback` (subroutine) Code to invoke on each child widget

- •

  `$callback_data` (scalar)

Invoke *$callback* on each child of *$container*, including "internal" children.  Most applications should not use this function.  Compare with *Gtk2::Container::foreach*.

### $container-\>foreach ($callback, $callback\_data=undef)

- •

  `$callback` (subroutine) Code to invoke on each child widget

- •

  `$callback_data` (scalar)

Invoke *$callback* on each child of *$container*, ignoring "internal" children.

### list = $object\_or\_class\_name-\>list\_child\_properties

Return a list of `"Glib::ParamSpec"` objects which are the child properties available for children of a container `$object_or_class_name`.  See Glib::Object `"list_properties"` for the fields in a ParamSpec.

### $container-\>propagate\_expose ($child, $event)

- •

  `$child` (Gtk2::Widget)

- •

  `$event` (Gtk2::Gdk::Event)

### $container-\>set\_reallocate\_redraws ($needs\_redraws)

- •

  `$needs_redraws` (boolean)

### $container-\>remove ($widget)

- •

  `$widget` (Gtk2::Widget)

### $container-\>resize\_children

### resizemode = $container-\>get\_resize\_mode

### $container-\>set\_resize\_mode ($resize\_mode)

- •

  `$resize_mode` (Gtk2::ResizeMode)

### $container-\>unset\_focus\_chain

## PROPERTIES

- 'border-width' (Glib::UInt : default 0 : readable / writable / private)

  The width of the empty border outside the containers children

- 'child' (Gtk2::Widget : default undef : writable / private)

  Can be used to add a new child to the container

- 'resize-mode' (Gtk2::ResizeMode : default "parent" : readable / writable / private)

  Specify how resize events are handled

## SIGNALS

- **add** (Gtk2::Container, Gtk2::Widget)

  - **check-resize** (Gtk2::Container)

  - **remove** (Gtk2::Container, Gtk2::Widget)

  - **set-focus-child** (Gtk2::Container, Gtk2::Widget)

  ## ENUMS AND FLAGS

### enum Gtk2::ResizeMode

- •

  'parent' / 'GTK\_RESIZE\_PARENT'

- •

  'queue' / 'GTK\_RESIZE\_QUEUE'

- •

  'immediate' / 'GTK\_RESIZE\_IMMEDIATE'

## SEE ALSO

Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget

## COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL.  See Gtk2 for a full notice.
