gi-gtk-3.0.24: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.Container

Contents

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: > >class="GtkBox" > child > class="GtkEntry" id="entry1"/ > packing > name="pack-type"start/property > /packing > /child > child > class="GtkEntry" id="entry2"/ > /child > focus-chain > name="entry1"/ > name="entry2"/ > /focus-chain >/object

Synopsis

Exported types

newtype Container Source #

Memory-managed wrapper type.

Instances
GObject Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsImplementorIface Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsObject Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsBuildable Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsContainer Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsWidget Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

class GObject o => IsContainer o Source #

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

Instances
(GObject a, (UnknownAncestorError Container a :: Constraint)) => IsContainer a Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsContainer Bin Source # 
Instance details

Defined in GI.Gtk.Objects.Bin

IsContainer Box Source # 
Instance details

Defined in GI.Gtk.Objects.Box

IsContainer Button Source # 
Instance details

Defined in GI.Gtk.Objects.Button

IsContainer ButtonBox Source # 
Instance details

Defined in GI.Gtk.Objects.ButtonBox

IsContainer CheckButton Source # 
Instance details

Defined in GI.Gtk.Objects.CheckButton

IsContainer CheckMenuItem Source # 
Instance details

Defined in GI.Gtk.Objects.CheckMenuItem

IsContainer ComboBox Source # 
Instance details

Defined in GI.Gtk.Objects.ComboBox

IsContainer Container Source # 
Instance details

Defined in GI.Gtk.Objects.Container

IsContainer Dialog Source # 
Instance details

Defined in GI.Gtk.Objects.Dialog

IsContainer FlowBox Source # 
Instance details

Defined in GI.Gtk.Objects.FlowBox

IsContainer FlowBoxChild Source # 
Instance details

Defined in GI.Gtk.Objects.FlowBoxChild

IsContainer Frame Source # 
Instance details

Defined in GI.Gtk.Objects.Frame

IsContainer IconView Source # 
Instance details

Defined in GI.Gtk.Objects.IconView

IsContainer ListBox Source # 
Instance details

Defined in GI.Gtk.Objects.ListBox

IsContainer ListBoxRow Source # 
Instance details

Defined in GI.Gtk.Objects.ListBoxRow

IsContainer Menu Source # 
Instance details

Defined in GI.Gtk.Objects.Menu

IsContainer MenuItem Source # 
Instance details

Defined in GI.Gtk.Objects.MenuItem

IsContainer MenuShell Source # 
Instance details

Defined in GI.Gtk.Objects.MenuShell

IsContainer Paned Source # 
Instance details

Defined in GI.Gtk.Objects.Paned

IsContainer Popover Source # 
Instance details

Defined in GI.Gtk.Objects.Popover

IsContainer RadioButton Source # 
Instance details

Defined in GI.Gtk.Objects.RadioButton

IsContainer ScaleButton Source # 
Instance details

Defined in GI.Gtk.Objects.ScaleButton

IsContainer ScrolledWindow Source # 
Instance details

Defined in GI.Gtk.Objects.ScrolledWindow

IsContainer ShortcutsWindow Source # 
Instance details

Defined in GI.Gtk.Objects.ShortcutsWindow

IsContainer Stack Source # 
Instance details

Defined in GI.Gtk.Objects.Stack

IsContainer ToggleButton Source # 
Instance details

Defined in GI.Gtk.Objects.ToggleButton

IsContainer ToggleToolButton Source # 
Instance details

Defined in GI.Gtk.Objects.ToggleToolButton

IsContainer ToolButton Source # 
Instance details

Defined in GI.Gtk.Objects.ToolButton

IsContainer ToolItem Source # 
Instance details

Defined in GI.Gtk.Objects.ToolItem

IsContainer ToolItemGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ToolItemGroup

IsContainer TreeView Source # 
Instance details

Defined in GI.Gtk.Objects.TreeView

IsContainer VolumeButton Source # 
Instance details

Defined in GI.Gtk.Objects.VolumeButton

IsContainer Viewport Source # 
Instance details

Defined in GI.Gtk.Objects.Viewport

IsContainer VPaned Source # 
Instance details

Defined in GI.Gtk.Objects.VPaned

IsContainer VButtonBox Source # 
Instance details

Defined in GI.Gtk.Objects.VButtonBox

IsContainer VBox Source # 
Instance details

Defined in GI.Gtk.Objects.VBox

IsContainer Toolbar Source # 
Instance details

Defined in GI.Gtk.Objects.Toolbar

IsContainer TearoffMenuItem Source # 
Instance details

Defined in GI.Gtk.Objects.TearoffMenuItem

IsContainer Table Source # 
Instance details

Defined in GI.Gtk.Objects.Table

IsContainer Statusbar Source # 
Instance details

Defined in GI.Gtk.Objects.Statusbar

IsContainer StackSwitcher Source # 
Instance details

Defined in GI.Gtk.Objects.StackSwitcher

IsContainer StackSidebar Source # 
Instance details

Defined in GI.Gtk.Objects.StackSidebar

IsContainer Socket Source # 
Instance details

Defined in GI.Gtk.Objects.Socket

IsContainer ShortcutsShortcut Source # 
Instance details

Defined in GI.Gtk.Objects.ShortcutsShortcut

IsContainer ShortcutsSection Source # 
Instance details

Defined in GI.Gtk.Objects.ShortcutsSection

IsContainer ShortcutsGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ShortcutsGroup

IsContainer ShortcutLabel Source # 
Instance details

Defined in GI.Gtk.Objects.ShortcutLabel

IsContainer SeparatorToolItem Source # 
Instance details

Defined in GI.Gtk.Objects.SeparatorToolItem

IsContainer SeparatorMenuItem Source # 
Instance details

Defined in GI.Gtk.Objects.SeparatorMenuItem

IsContainer SearchBar Source # 
Instance details

Defined in GI.Gtk.Objects.SearchBar

IsContainer Revealer Source # 
Instance details

Defined in GI.Gtk.Objects.Revealer

IsContainer RecentChooserWidget Source # 
Instance details

Defined in GI.Gtk.Objects.RecentChooserWidget

IsContainer RecentChooserMenu Source # 
Instance details

Defined in GI.Gtk.Objects.RecentChooserMenu

IsContainer RadioToolButton Source # 
Instance details

Defined in GI.Gtk.Objects.RadioToolButton

IsContainer RadioMenuItem Source # 
Instance details

Defined in GI.Gtk.Objects.RadioMenuItem

IsContainer PopoverMenu Source # 
Instance details

Defined in GI.Gtk.Objects.PopoverMenu

IsContainer PlacesSidebar Source # 
Instance details

Defined in GI.Gtk.Objects.PlacesSidebar

IsContainer Overlay Source # 
Instance details

Defined in GI.Gtk.Objects.Overlay

IsContainer Notebook Source # 
Instance details

Defined in GI.Gtk.Objects.Notebook

IsContainer ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

IsContainer MenuToolButton Source # 
Instance details

Defined in GI.Gtk.Objects.MenuToolButton

IsContainer MenuButton Source # 
Instance details

Defined in GI.Gtk.Objects.MenuButton

IsContainer MenuBar Source # 
Instance details

Defined in GI.Gtk.Objects.MenuBar

IsContainer LockButton Source # 
Instance details

Defined in GI.Gtk.Objects.LockButton

IsContainer LinkButton Source # 
Instance details

Defined in GI.Gtk.Objects.LinkButton

IsContainer Layout Source # 
Instance details

Defined in GI.Gtk.Objects.Layout

IsContainer InfoBar Source # 
Instance details

Defined in GI.Gtk.Objects.InfoBar

IsContainer ImageMenuItem Source # 
Instance details

Defined in GI.Gtk.Objects.ImageMenuItem

IsContainer HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

IsContainer HandleBox Source # 
Instance details

Defined in GI.Gtk.Objects.HandleBox

IsContainer HPaned Source # 
Instance details

Defined in GI.Gtk.Objects.HPaned

IsContainer HButtonBox Source # 
Instance details

Defined in GI.Gtk.Objects.HButtonBox

IsContainer HBox Source # 
Instance details

Defined in GI.Gtk.Objects.HBox

IsContainer Grid Source # 
Instance details

Defined in GI.Gtk.Objects.Grid

IsContainer FontSelection Source # 
Instance details

Defined in GI.Gtk.Objects.FontSelection

IsContainer FontChooserWidget Source # 
Instance details

Defined in GI.Gtk.Objects.FontChooserWidget

IsContainer FontButton Source # 
Instance details

Defined in GI.Gtk.Objects.FontButton

IsContainer Fixed Source # 
Instance details

Defined in GI.Gtk.Objects.Fixed

IsContainer FileChooserWidget Source # 
Instance details

Defined in GI.Gtk.Objects.FileChooserWidget

IsContainer FileChooserButton Source # 
Instance details

Defined in GI.Gtk.Objects.FileChooserButton

IsContainer Expander Source # 
Instance details

Defined in GI.Gtk.Objects.Expander

IsContainer EventBox Source # 
Instance details

Defined in GI.Gtk.Objects.EventBox

IsContainer ComboBoxText Source # 
Instance details

Defined in GI.Gtk.Objects.ComboBoxText

IsContainer ColorSelection Source # 
Instance details

Defined in GI.Gtk.Objects.ColorSelection

IsContainer ColorChooserWidget Source # 
Instance details

Defined in GI.Gtk.Objects.ColorChooserWidget

IsContainer ColorButton Source # 
Instance details

Defined in GI.Gtk.Objects.ColorButton

IsContainer AspectFrame Source # 
Instance details

Defined in GI.Gtk.Objects.AspectFrame

IsContainer AppChooserWidget Source # 
Instance details

Defined in GI.Gtk.Objects.AppChooserWidget

IsContainer AppChooserButton Source # 
Instance details

Defined in GI.Gtk.Objects.AppChooserButton

IsContainer Alignment Source # 
Instance details

Defined in GI.Gtk.Objects.Alignment

IsContainer ActionBar Source # 
Instance details

Defined in GI.Gtk.Objects.ActionBar

IsContainer Window Source # 
Instance details

Defined in GI.Gtk.Objects.Window

IsContainer RecentChooserDialog Source # 
Instance details

Defined in GI.Gtk.Objects.RecentChooserDialog

IsContainer Plug Source # 
Instance details

Defined in GI.Gtk.Objects.Plug

IsContainer OffscreenWindow Source # 
Instance details

Defined in GI.Gtk.Objects.OffscreenWindow

IsContainer MessageDialog Source # 
Instance details

Defined in GI.Gtk.Objects.MessageDialog

IsContainer FontSelectionDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FontSelectionDialog

IsContainer FontChooserDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FontChooserDialog

IsContainer FileChooserDialog Source # 
Instance details

Defined in GI.Gtk.Objects.FileChooserDialog

IsContainer ColorSelectionDialog Source # 
Instance details

Defined in GI.Gtk.Objects.ColorSelectionDialog

IsContainer ColorChooserDialog Source # 
Instance details

Defined in GI.Gtk.Objects.ColorChooserDialog

IsContainer ApplicationWindow Source # 
Instance details

Defined in GI.Gtk.Objects.ApplicationWindow

IsContainer AppChooserDialog Source # 
Instance details

Defined in GI.Gtk.Objects.AppChooserDialog

IsContainer AboutDialog Source # 
Instance details

Defined in GI.Gtk.Objects.AboutDialog

IsContainer ToolPalette Source # 
Instance details

Defined in GI.Gtk.Objects.ToolPalette

IsContainer TextView Source # 
Instance details

Defined in GI.Gtk.Objects.TextView

IsContainer Assistant Source # 
Instance details

Defined in GI.Gtk.Objects.Assistant

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.

noContainer :: Maybe Container Source #

A convenience alias for Nothing :: Maybe Container.

Methods

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::child-notify 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::child-notify 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.

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.

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 necessary anymore since frame clocks and might introduce obscure bugs if used.

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:margin-top.

setFocusChain

containerSetFocusChain Source #

Arguments

:: (HasCallStack, MonadIO m, IsContainer a, IsWidget b) 
=> a

container: a Container

-> [b]

focusableWidgets: the new focus chain

-> m () 

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 GtkContainer::set_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 necessary anymore since frame clocks and might introduce obscure bugs if used.

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 () 

Removes a focus chain explicitly set with containerSetFocusChain.

Properties

borderWidth

No description available in the introspection data.

constructContainerBorderWidth :: IsContainer o => Word32 -> IO (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, IsWidget a) => a -> IO (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 => ResizeMode -> IO (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 C_ContainerAddCallback = Ptr () -> Ptr Widget -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ContainerAddCallback = Widget -> IO () Source #

No description available in the introspection data.

afterContainerAdd :: (IsContainer a, MonadIO m) => 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

mk_ContainerAddCallback :: C_ContainerAddCallback -> IO (FunPtr C_ContainerAddCallback) Source #

Generate a function pointer callable from C code, from a C_ContainerAddCallback.

onContainerAdd :: (IsContainer a, MonadIO m) => 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 C_ContainerCheckResizeCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ContainerCheckResizeCallback = IO () Source #

No description available in the introspection data.

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

Connect a signal handler for the “check-resize” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after container #checkResize callback

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

Connect a signal handler for the “check-resize” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on container #checkResize callback

remove

type C_ContainerRemoveCallback = Ptr () -> Ptr Widget -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ContainerRemoveCallback = Widget -> IO () Source #

No description available in the introspection data.

afterContainerRemove :: (IsContainer a, MonadIO m) => 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

onContainerRemove :: (IsContainer a, MonadIO m) => 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 C_ContainerSetFocusChildCallback = Ptr () -> Ptr Widget -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ContainerSetFocusChildCallback = Widget -> IO () Source #

No description available in the introspection data.

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

Connect a signal handler for the “set-focus-child” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after container #setFocusChild callback

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

Connect a signal handler for the “set-focus-child” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on container #setFocusChild callback