gi-gtk3-3.0.44: Gtk 3.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Container

Contents

- Exported types
- Methods
  - add
  - checkResize
  - childGetProperty
  - childNotify
  - childNotifyByPspec
  - childSetProperty
  - childType
  - forall
  - foreach
  - getBorderWidth
  - getChildren
  - getFocusChain
  - getFocusChild
  - getFocusHadjustment
  - getFocusVadjustment
  - getPathForChild
  - getResizeMode
  - propagateDraw
  - remove
  - resizeChildren
  - setBorderWidth
  - setFocusChain
  - setFocusChild
  - setFocusHadjustment
  - setFocusVadjustment
  - setReallocateRedraws
  - setResizeMode
  - unsetFocusChain
- Properties
  - borderWidth
  - child
  - resizeMode
- Signals
  - add
  - checkResize
  - remove
  - setFocusChild

Description

A GTK+ user interface is constructed by nesting widgets inside widgets. Container widgets are the inner nodes in the resulting tree of widgets: they contain other widgets. So, for example, you might have a `Window` containing a `Frame` containing a `Label`. If you wanted an image instead of a textual label inside the frame, you might replace the `Label` widget with a `Image` widget.

There are two major kinds of container widgets in GTK+. Both are subclasses of the abstract GtkContainer base class.

The first type of container widget has a single child widget and derives from `Bin`. These containers are decorators, which add some kind of functionality to the child. For example, a `Button` makes its child into a clickable button; a `Frame` draws a frame around its child and a `Window` places its child widget inside a top-level window.

The second type of container can have more than one child; its purpose is to manage layout. This means that these containers assign sizes and positions to their children. For example, a `HBox` arranges its children in a horizontal row, and a `Grid` arranges the widgets it contains in a two-dimensional grid.

For implementations of `Container` the virtual method `ContainerClass`.`forall`() is always required, since it's used for drawing and other internal operations on the children. If the `Container` implementation expect to have non internal children it's needed to implement both `ContainerClass`.`add`() and `ContainerClass`.`remove`(). If the GtkContainer implementation has internal children, they should be added with `widgetSetParent` on `init()` and removed with `widgetUnparent` in the `WidgetClass`.`destroy`() implementation. See more about implementing custom widgets at https://wiki.gnome.org/HowDoI/CustomWidgets

# Height for width geometry management

GTK+ uses a height-for-width (and width-for-height) geometry management system. Height-for-width means that a widget can change how much vertical space it needs, depending on the amount of horizontal space that it is given (and similar for width-for-height).

There are some things to keep in mind when implementing container widgets that make use of GTK+’s height for width geometry management system. First, it’s important to note that a container must prioritize one of its dimensions, that is to say that a widget or container can only have a `SizeRequestMode` that is `SizeRequestModeHeightForWidth` or `SizeRequestModeWidthForHeight`. However, every widget and container must be able to respond to the APIs for both dimensions, i.e. even if a widget has a request mode that is height-for-width, it is possible that its parent will request its sizes using the width-for-height APIs.

To ensure that everything works properly, here are some guidelines to follow when implementing height-for-width (or width-for-height) containers.

Each request mode involves 2 virtual methods. Height-for-width apis run through `widgetGetPreferredWidth` and then through `widgetGetPreferredHeightForWidth`. When handling requests in the opposite `SizeRequestMode` it is important that every widget request at least enough space to display all of its content at all times.

When `widgetGetPreferredHeight` is called on a container that is height-for-width, the container must return the height for its minimum width. This is easily achieved by simply calling the reverse apis implemented for itself as follows:

### C code

    static void
    foo_container_get_preferred_height (GtkWidget *widget,
                                        gint *min_height,
                                        gint *nat_height)
    {
       if (i_am_in_height_for_width_mode)
         {
           gint min_width;

           GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget,
                                                               &min_width,
                                                               NULL);
           GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width
                                                              (widget,
                                                               min_width,
                                                               min_height,
                                                               nat_height);
         }
       else
         {
           ... many containers support both request modes, execute the
           real width-for-height request here by returning the
           collective heights of all widgets that are stacked
           vertically (or whatever is appropriate for this container)
           ...
         }
    }

Similarly, when `widgetGetPreferredWidthForHeight` is called for a container or widget that is height-for-width, it then only needs to return the base minimum width like so:

### C code

    static void
    foo_container_get_preferred_width_for_height (GtkWidget *widget,
                                                  gint for_height,
                                                  gint *min_width,
                                                  gint *nat_width)
    {
       if (i_am_in_height_for_width_mode)
         {
           GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget,
                                                               min_width,
                                                               nat_width);
         }
       else
         {
           ... execute the real width-for-height request here based on
           the required width of the children collectively if the
           container were to be allocated the said height ...
         }
    }

Height for width requests are generally implemented in terms of a virtual allocation of widgets in the input orientation. Assuming an height-for-width request mode, a container would implement the `get_preferred_height_for_width()` virtual function by first calling `widgetGetPreferredWidth` for each of its children.

For each potential group of children that are lined up horizontally, the values returned by `widgetGetPreferredWidth` should be collected in an array of `RequestedSize` structures. Any child spacing should be removed from the input `forWidth` and then the collective size should be allocated using the `distributeNaturalAllocation` convenience function.

The container will then move on to request the preferred height for each child by using `widgetGetPreferredHeightForWidth` and using the sizes stored in the `RequestedSize` array.

To allocate a height-for-width container, it’s again important to consider that a container must prioritize one dimension over the other. So if a container is a height-for-width container it must first allocate all widgets horizontally using a `RequestedSize` array and `distributeNaturalAllocation` and then add any extra space (if and where appropriate) for the widget to expand.

After adding all the expand space, the container assumes it was allocated sufficient height to fit all of its content. At this time, the container must use the total horizontal sizes of each widget to request the height-for-width of each of its children and store the requests in a `RequestedSize` array for any widgets that stack vertically (for tabular containers this can be generalized into the heights and widths of rows and columns). The vertical space must then again be distributed using `distributeNaturalAllocation` while this time considering the allocated height of the widget minus any vertical spacing that the container adds. Then vertical expand space should be added where appropriate and available and the container should go on to actually allocating the child widgets.

See [GtkWidget’s geometry management section][geometry-management] to learn more about implementing height-for-width geometry management for widgets.

# Child properties

GtkContainer introduces child properties. These are object properties that are not specific to either the container or the contained widget, but rather to their relation. Typical examples of child properties are the position or pack-type of a widget which is contained in a `Box`.

Use `containerClassInstallChildProperty` to install child properties for a container class and `containerClassFindChildProperty` or `containerClassListChildProperties` to get information about existing child properties.

To set the value of a child property, use `containerChildSetProperty`, `gtk_container_child_set()` or `gtk_container_child_set_valist()`. To obtain the value of a child property, use `containerChildGetProperty`, `gtk_container_child_get()` or `gtk_container_child_get_valist()`. To emit notification about child property changes, use `widgetChildNotify`.

# GtkContainer as GtkBuildable

The GtkContainer implementation of the GtkBuildable interface supports a `<packing>` element for children, which can contain multiple `<property>` elements that specify child properties for the child.

Since 2.16, child properties can also be marked as translatable using the same “translatable”, “comments” and “context” attributes that are used for regular properties.

Since 3.16, containers can have a `<focus-chain>` element containing multiple `<widget>` elements, one for each child that should be added to the focus chain. The ”name” attribute gives the id of the widget.

An example of these properties in UI definitions:

### xml code

    <object class="GtkBox">
      <child>
        <object class="GtkEntry" id="entry1"/>
        <packing>
          <property name="pack-type">start</property>
        </packing>
      </child>
      <child>
        <object class="GtkEntry" id="entry2"/>
      </child>
      <focus-chain>
        <widget name="entry1"/>
        <widget name="entry2"/>
      </focus-chain>
    </object>

Synopsis

- newtype Container = Container (ManagedPtr Container)
- class (GObject o, IsDescendantOf Container o) => IsContainer o
- toContainer :: (MonadIO m, IsContainer o) => o -> m Container
- containerAdd :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> m ()
- containerCheckResize :: (HasCallStack, MonadIO m, IsContainer a) => a -> m ()
- containerChildGetProperty :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> Text -> GValue -> m ()
- containerChildNotify :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> Text -> m ()
- containerChildNotifyByPspec :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> GParamSpec -> m ()
- containerChildSetProperty :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> Text -> GValue -> m ()
- containerChildType :: (HasCallStack, MonadIO m, IsContainer a) => a -> m GType
- containerForall :: (HasCallStack, MonadIO m, IsContainer a) => a -> Callback -> m ()
- containerForeach :: (HasCallStack, MonadIO m, IsContainer a) => a -> Callback -> m ()
- containerGetBorderWidth :: (HasCallStack, MonadIO m, IsContainer a) => a -> m Word32
- containerGetChildren :: (HasCallStack, MonadIO m, IsContainer a) => a -> m [Widget]
- containerGetFocusChain :: (HasCallStack, MonadIO m, IsContainer a) => a -> m (Bool, [Widget])
- containerGetFocusChild :: (HasCallStack, MonadIO m, IsContainer a) => a -> m (Maybe Widget)
- containerGetFocusHadjustment :: (HasCallStack, MonadIO m, IsContainer a) => a -> m (Maybe Adjustment)
- containerGetFocusVadjustment :: (HasCallStack, MonadIO m, IsContainer a) => a -> m (Maybe Adjustment)
- containerGetPathForChild :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> m WidgetPath
- containerGetResizeMode :: (HasCallStack, MonadIO m, IsContainer a) => a -> m ResizeMode
- containerPropagateDraw :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> Context -> m ()
- containerRemove :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> b -> m ()
- containerResizeChildren :: (HasCallStack, MonadIO m, IsContainer a) => a -> m ()
- containerSetBorderWidth :: (HasCallStack, MonadIO m, IsContainer a) => a -> Word32 -> m ()
- containerSetFocusChain :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> [b] -> m ()
- containerSetFocusChild :: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) => a -> Maybe b -> m ()
- containerSetFocusHadjustment :: (HasCallStack, MonadIO m, IsContainer a, IsAdjustment b) => a -> b -> m ()
- containerSetFocusVadjustment :: (HasCallStack, MonadIO m, IsContainer a, IsAdjustment b) => a -> b -> m ()
- containerSetReallocateRedraws :: (HasCallStack, MonadIO m, IsContainer a) => a -> Bool -> m ()
- containerSetResizeMode :: (HasCallStack, MonadIO m, IsContainer a) => a -> ResizeMode -> m ()
- containerUnsetFocusChain :: (HasCallStack, MonadIO m, IsContainer a) => a -> m ()
- constructContainerBorderWidth :: (IsContainer o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getContainerBorderWidth :: (MonadIO m, IsContainer o) => o -> m Word32
- setContainerBorderWidth :: (MonadIO m, IsContainer o) => o -> Word32 -> m ()
- clearContainerChild :: (MonadIO m, IsContainer o) => o -> m ()
- constructContainerChild :: (IsContainer o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- setContainerChild :: (MonadIO m, IsContainer o, IsWidget a) => o -> a -> m ()
- constructContainerResizeMode :: (IsContainer o, MonadIO m) => ResizeMode -> m (GValueConstruct o)
- getContainerResizeMode :: (MonadIO m, IsContainer o) => o -> m ResizeMode
- setContainerResizeMode :: (MonadIO m, IsContainer o) => o -> ResizeMode -> m ()
- type ContainerAddCallback = Widget -> IO ()
- afterContainerAdd :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerAddCallback) -> m SignalHandlerId
- onContainerAdd :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerAddCallback) -> m SignalHandlerId
- type ContainerCheckResizeCallback = IO ()
- afterContainerCheckResize :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerCheckResizeCallback) -> m SignalHandlerId
- onContainerCheckResize :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerCheckResizeCallback) -> m SignalHandlerId
- type ContainerRemoveCallback = Widget -> IO ()
- afterContainerRemove :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerRemoveCallback) -> m SignalHandlerId
- onContainerRemove :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerRemoveCallback) -> m SignalHandlerId
- type ContainerSetFocusChildCallback = Widget -> IO ()
- afterContainerSetFocusChild :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerSetFocusChildCallback) -> m SignalHandlerId
- onContainerSetFocusChild :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerSetFocusChildCallback) -> m SignalHandlerId

# Exported types

newtype Container Source #

Memory-managed wrapper type.

Constructors

Container (ManagedPtr Container) |

#### Instances

Instances details

Eq Container Source # |
Instance details Defined in GI.Gtk.Objects.Container Methods (==) :: Container -> Container -> Bool Source # (/=) :: Container -> Container -> Bool Source #
GObject Container Source # |
Instance details Defined in GI.Gtk.Objects.Container
ManagedPtrNewtype Container Source # |
Instance details Defined in GI.Gtk.Objects.Container Methods toManagedPtr :: Container -> ManagedPtr Container Source #
TypedObject Container Source # |
Instance details Defined in GI.Gtk.Objects.Container Methods glibType :: IO GType Source #
HasParentTypes Container Source # |
Instance details Defined in GI.Gtk.Objects.Container
IsGValue (Maybe Container) Source # | Convert `Container` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Container Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Container -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Container) Source #
type ParentTypes Container Source # |
Instance details Defined in GI.Gtk.Objects.Container type ParentTypes Container = '[Widget, Object, ImplementorIface, Buildable]

class (GObject o, IsDescendantOf Container o) => IsContainer o Source #

Type class for types which can be safely cast to `Container`, for instance with `toContainer`.

#### Instances

Instances details

(GObject o, IsDescendantOf Container o) => IsContainer o Source # |
Instance details Defined in GI.Gtk.Objects.Container

toContainer :: (MonadIO m, IsContainer o) => o -> m Container Source #

Cast to `Container`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.

#### Getters

getAccessible, getActionGroup, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getBorderWidth, getCanDefault, getCanFocus, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEvents, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getInternalChild, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.

#### Setters

setAccelPath, setAllocation, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setResizeMode, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.

## add

containerAdd Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> b | `widget`: a widget to be placed inside `container`
-> m () |

Adds `widget` to `container`. Typically used for simple containers such as `Window`, `Frame`, or `Button`; for more complicated layout containers such as `Box` or `Grid`, this function will pick default packing parameters that may not be correct. So consider functions such as `boxPackStart` and `gridAttach` as an alternative to `containerAdd` in those cases. A widget may be added to only one container at a time; you can’t place the same widget inside two different containers.

Note that some containers, such as `ScrolledWindow` or `ListBox`, may add intermediate children between the added widget and the container.

## checkResize

containerCheckResize :: (HasCallStack, MonadIO m, IsContainer a) => a -> m () Source #

No description available in the introspection data.

## childGetProperty

containerChildGetProperty Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> b | `child`: a widget which is a child of `container`
-> Text | `propertyName`: the name of the property to get
-> GValue | `value`: a location to return the value
-> m () |

Gets the value of a child property for `child` and `container`.

## childNotify

containerChildNotify Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: the `Container`
-> b | `child`: the child widget
-> Text | `childProperty`: the name of a child property installed on the class of `container`
-> m () |

Emits a Widget::childNotify signal for the [child property][child-properties] `childProperty` on the child.

This is an analogue of `objectNotify` for child properties.

Also see `widgetChildNotify`.

Since: 3.2

## childNotifyByPspec

containerChildNotifyByPspec Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: the `Container`
-> b | `child`: the child widget
-> GParamSpec | `pspec`: the `ParamSpec` of a child property instealled on the class of `container`
-> m () |

Emits a Widget::childNotify signal for the [child property][child-properties] specified by `pspec` on the child.

This is an analogue of `objectNotifyByPspec` for child properties.

Since: 3.18

## childSetProperty

containerChildSetProperty Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> b | `child`: a widget which is a child of `container`
-> Text | `propertyName`: the name of the property to set
-> GValue | `value`: the value to set the property to
-> m () |

Sets a child property for `child` and `container`.

## childType

containerChildType Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m GType | Returns: a `GType`.

Returns the type of the children supported by the container.

Note that this may return `G_TYPE_NONE` to indicate that no more children can be added, e.g. for a `Paned` which already has two children.

## forall

containerForall Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> Callback | `callback`: a callback
-> m () |

Invokes `callback` on each direct child of `container`, including children that are considered “internal” (implementation details of the container). “Internal” children generally weren’t added by the user of the container, but were added by the container implementation itself.

Most applications should use `containerForeach`, rather than `containerForall`.

## foreach

containerForeach Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> Callback | `callback`: a callback
-> m () |

Invokes `callback` on each non-internal child of `container`. See `containerForall` for details on what constitutes an “internal” child. For all practical purposes, this function should iterate over precisely those child widgets that were added to the container by the application with explicit `add()` calls.

It is permissible to remove the child from the `callback` handler.

Most applications should use `containerForeach`, rather than `containerForall`.

## getBorderWidth

containerGetBorderWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m Word32 | Returns: the current border width

Retrieves the border width of the container. See `containerSetBorderWidth`.

## getChildren

containerGetChildren Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m [Widget] | Returns: a newly-allocated list of the container’s non-internal children.

Returns the container’s non-internal children. See `containerForall` for details on what constitutes an "internal" child.

## getFocusChain

containerGetFocusChain Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m (Bool, [Widget]) | Returns: `True` if the focus chain of the container has been set explicitly.

Deprecated: (Since version 3.24)For overriding focus behavior, use theGtkWidgetClassfocus signal.

Retrieves the focus chain of the container, if one has been set explicitly. If no focus chain has been explicitly set, GTK+ computes the focus chain based on the positions of the children. In that case, GTK+ stores `Nothing` in `focusableWidgets` and returns `False`.

## getFocusChild

containerGetFocusChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m (Maybe Widget) | Returns: The child widget which will receive the focus inside `container` when the `container` is focused, or `Nothing` if none is set.

Returns the current focus child widget inside `container`. This is not the currently focused widget. That can be obtained by calling `windowGetFocus`.

Since: 2.14

## getFocusHadjustment

containerGetFocusHadjustment Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m (Maybe Adjustment) | Returns: the horizontal focus adjustment, or `Nothing` if none has been set.

Retrieves the horizontal focus adjustment for the container. See gtk_container_set_focus_hadjustment ().

## getFocusVadjustment

containerGetFocusVadjustment Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m (Maybe Adjustment) | Returns: the vertical focus adjustment, or `Nothing` if none has been set.

Retrieves the vertical focus adjustment for the container. See `containerSetFocusVadjustment`.

## getPathForChild

containerGetPathForChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> b | `child`: a child of `container`
-> m WidgetPath | Returns: A newly created `WidgetPath`

Returns a newly created widget path representing all the widget hierarchy from the toplevel down to and including `child`.

## getResizeMode

containerGetResizeMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m ResizeMode | Returns: the current resize mode

Deprecated: (Since version 3.12)Resize modes are deprecated. They aren’t necessaryanymore since frame clocks and might introduce obscure bugs ifused.

Returns the resize mode for the container. See gtk_container_set_resize_mode ().

## propagateDraw

containerPropagateDraw Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> b | `child`: a child of `container`
-> Context | `cr`: Cairo context as passed to the container. If you want to use `cr` in container’s draw function, consider using `cairo_save()` and `cairo_restore()` before calling this function.
-> m () |

When a container receives a call to the draw function, it must send synthetic Widget::draw calls to all children that don’t have their own `GdkWindows`. This function provides a convenient way of doing this. A container, when it receives a call to its Widget::draw function, calls `containerPropagateDraw` once for each child, passing in the `cr` the container received.

`containerPropagateDraw` takes care of translating the origin of `cr`, and deciding whether the draw needs to be sent to the child. It is a convenient and optimized way of getting the same effect as calling `widgetDraw` on the child directly.

In most cases, a container can simply either inherit the Widget::draw implementation from `Container`, or do some drawing and then chain to the draw implementation from `Container`.

## remove

containerRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> b | `widget`: a current child of `container`
-> m () |

Removes `widget` from `container`. `widget` must be inside `container`. Note that `container` will own a reference to `widget`, and that this may be the last reference held; so removing a widget from its container can destroy that widget. If you want to use `widget` again, you need to add a reference to it before removing it from a container, using `objectRef`. If you don’t want to use `widget` again it’s usually more efficient to simply destroy it directly using `widgetDestroy` since this will remove it from the container and help break any circular reference count cycles.

## resizeChildren

containerResizeChildren Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m () |

Deprecated: (Since version 3.10)

No description available in the introspection data.

## setBorderWidth

containerSetBorderWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> Word32 | `borderWidth`: amount of blank space to leave outside the container. Valid values are in the range 0-65535 pixels.
-> m () |

Sets the border width of the container.

The border width of a container is the amount of space to leave around the outside of the container. The only exception to this is `Window`; because toplevel windows can’t leave space outside, they leave the space inside. The border is added on all sides of the container. To add space to only one side, use a specific Widget:margin property on the child widget, for example Widget:marginTop.

## setFocusChain

containerSetFocusChain Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> [b] | `focusableWidgets`: the new focus chain
-> m () |

Deprecated: (Since version 3.24)For overriding focus behavior, use theGtkWidgetClassfocus signal.

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.

## setFocusChild

containerSetFocusChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) |
=> a | `container`: a `Container`
-> Maybe b | `child`: a `Widget`, or `Nothing`
-> m () |

Sets, or unsets if `child` is `Nothing`, the focused child of `container`.

This function emits the GtkContainerset_focus_child signal of `container`. Implementations of `Container` can override the default behaviour by overriding the class closure of this signal.

This is function is mostly meant to be used by widgets. Applications can use `widgetGrabFocus` to manually set the focus to a specific widget.

## setFocusHadjustment

containerSetFocusHadjustment Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsAdjustment b) |
=> a | `container`: a `Container`
-> b | `adjustment`: an adjustment which should be adjusted when the focus is moved among the descendents of `container`
-> m () |

Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the horizontal alignment. See `scrolledWindowGetHadjustment` for a typical way of obtaining the adjustment and `containerSetFocusVadjustment` for setting the vertical adjustment.

The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container.

## setFocusVadjustment

containerSetFocusVadjustment Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsAdjustment b) |
=> a | `container`: a `Container`
-> b | `adjustment`: an adjustment which should be adjusted when the focus is moved among the descendents of `container`
-> m () |

Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the vertical alignment. See `scrolledWindowGetVadjustment` for a typical way of obtaining the adjustment and `containerSetFocusHadjustment` for setting the horizontal adjustment.

The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the container.

## setReallocateRedraws

containerSetReallocateRedraws Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> Bool | `needsRedraws`: the new value for the container’s `reallocateRedraws` flag
-> m () |

Deprecated: (Since version 3.14)Call `widgetQueueDraw` in your size_allocate handler.

Sets the `reallocateRedraws` flag of the container to the given value.

Containers requesting reallocation redraws get automatically redrawn if any of their children changed allocation.

## setResizeMode

containerSetResizeMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> ResizeMode | `resizeMode`: the new resize mode
-> m () |

Deprecated: (Since version 3.12)Resize modes are deprecated. They aren’t necessaryanymore since frame clocks and might introduce obscure bugs ifused.

Sets the resize mode for the container.

The resize mode of a container determines whether a resize request will be passed to the container’s parent, queued for later execution or executed immediately.

## unsetFocusChain

containerUnsetFocusChain Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a) |
=> a | `container`: a `Container`
-> m () |

Deprecated: (Since version 3.24)For overriding focus behavior, use theGtkWidgetClassfocus signal.

Removes a focus chain explicitly set with `containerSetFocusChain`.

# Properties

## borderWidth

No description available in the introspection data.

constructContainerBorderWidth :: (IsContainer o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`border-width`” property. This is rarely needed directly, but it is used by `new`.

getContainerBorderWidth :: (MonadIO m, IsContainer o) => o -> m Word32 Source #

Get the value of the “`border-width`” property. When overloading is enabled, this is equivalent to

    get container #borderWidth

setContainerBorderWidth :: (MonadIO m, IsContainer o) => o -> Word32 -> m () Source #

Set the value of the “`border-width`” property. When overloading is enabled, this is equivalent to

    set container [ #borderWidth := value ]

## child

No description available in the introspection data.

clearContainerChild :: (MonadIO m, IsContainer o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructContainerChild :: (IsContainer o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

setContainerChild :: (MonadIO m, IsContainer o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set container [ #child := value ]

## resizeMode

No description available in the introspection data.

constructContainerResizeMode :: (IsContainer o, MonadIO m) => ResizeMode -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`resize-mode`” property. This is rarely needed directly, but it is used by `new`.

getContainerResizeMode :: (MonadIO m, IsContainer o) => o -> m ResizeMode Source #

Get the value of the “`resize-mode`” property. When overloading is enabled, this is equivalent to

    get container #resizeMode

setContainerResizeMode :: (MonadIO m, IsContainer o) => o -> ResizeMode -> m () Source #

Set the value of the “`resize-mode`” property. When overloading is enabled, this is equivalent to

    set container [ #resizeMode := value ]

# Signals

## add

type ContainerAddCallback = Widget -> IO () Source #

No description available in the introspection data.

afterContainerAdd :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerAddCallback) -> m SignalHandlerId Source #

Connect a signal handler for the add signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after container #add callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onContainerAdd :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerAddCallback) -> m SignalHandlerId Source #

Connect a signal handler for the add signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on container #add callback

## checkResize

type ContainerCheckResizeCallback = IO () Source #

No description available in the introspection data.

afterContainerCheckResize :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerCheckResizeCallback) -> m SignalHandlerId Source #

Connect a signal handler for the checkResize signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after container #checkResize callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onContainerCheckResize :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerCheckResizeCallback) -> m SignalHandlerId Source #

Connect a signal handler for the checkResize signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on container #checkResize callback

## remove

type ContainerRemoveCallback = Widget -> IO () Source #

No description available in the introspection data.

afterContainerRemove :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerRemoveCallback) -> m SignalHandlerId Source #

Connect a signal handler for the remove signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after container #remove callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onContainerRemove :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerRemoveCallback) -> m SignalHandlerId Source #

Connect a signal handler for the remove signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on container #remove callback

## setFocusChild

type ContainerSetFocusChildCallback = Widget -> IO () Source #

No description available in the introspection data.

afterContainerSetFocusChild :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerSetFocusChildCallback) -> m SignalHandlerId Source #

Connect a signal handler for the setFocusChild signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after container #setFocusChild callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onContainerSetFocusChild :: (IsContainer a, MonadIO m) => a -> ((?self :: a) => ContainerSetFocusChildCallback) -> m SignalHandlerId Source #

Connect a signal handler for the setFocusChild signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on container #setFocusChild callback