gi-gtk4-4.0.12: Gtk 4.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.Box

Contents

- Exported types
- Methods
  - append
  - getBaselineChild
  - getBaselinePosition
  - getHomogeneous
  - getSpacing
  - insertChildAfter
  - new
  - prepend
  - remove
  - reorderChildAfter
  - setBaselineChild
  - setBaselinePosition
  - setHomogeneous
  - setSpacing
- Properties
  - baselineChild
  - baselinePosition
  - homogeneous
  - spacing

Description

Arranges child widgets into a single row or column.

<picture> <source srcset="box-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkBox" src="box.png"> </picture>

Whether it is a row or column depends on the value of its Orientable:orientation property. Within the other dimension, all children are allocated the same size. The Widget:halign and Widget:valign properties can be used on the children to influence their allocation.

Use repeated calls to `boxAppend` to pack widgets into a `GtkBox` from start to end. Use `boxRemove` to remove widgets from the `GtkBox`. `boxInsertChildAfter` can be used to add a child at a particular position.

Use `boxSetHomogeneous` to specify whether or not all children of the `GtkBox` are forced to get the same amount of space.

Use `boxSetSpacing` to determine how much space will be minimally placed between all children in the `GtkBox`. Note that spacing is added *between* the children.

Use `boxReorderChildAfter` to move a child to a different place in the box.

# CSS nodes

`GtkBox` uses a single CSS node with name box.

# Accessibility

Until GTK 4.10, `GtkBox` used the `AccessibleRoleGroup` role.

Starting from GTK 4.12, `GtkBox` uses the `AccessibleRoleGeneric` role.

Synopsis

- newtype Box = Box (ManagedPtr Box)
- class (GObject o, IsDescendantOf Box o) => IsBox o
- toBox :: (MonadIO m, IsBox o) => o -> m Box
- boxAppend :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> m ()
- boxGetBaselineChild :: (HasCallStack, MonadIO m, IsBox a) => a -> m Int32
- boxGetBaselinePosition :: (HasCallStack, MonadIO m, IsBox a) => a -> m BaselinePosition
- boxGetHomogeneous :: (HasCallStack, MonadIO m, IsBox a) => a -> m Bool
- boxGetSpacing :: (HasCallStack, MonadIO m, IsBox a) => a -> m Int32
- boxInsertChildAfter :: (HasCallStack, MonadIO m, IsBox a, IsWidget b, IsWidget c) => a -> b -> Maybe c -> m ()
- boxNew :: (HasCallStack, MonadIO m) => Orientation -> Int32 -> m Box
- boxPrepend :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> m ()
- boxRemove :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> m ()
- boxReorderChildAfter :: (HasCallStack, MonadIO m, IsBox a, IsWidget b, IsWidget c) => a -> b -> Maybe c -> m ()
- boxSetBaselineChild :: (HasCallStack, MonadIO m, IsBox a) => a -> Int32 -> m ()
- boxSetBaselinePosition :: (HasCallStack, MonadIO m, IsBox a) => a -> BaselinePosition -> m ()
- boxSetHomogeneous :: (HasCallStack, MonadIO m, IsBox a) => a -> Bool -> m ()
- boxSetSpacing :: (HasCallStack, MonadIO m, IsBox a) => a -> Int32 -> m ()
- constructBoxBaselineChild :: (IsBox o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getBoxBaselineChild :: (MonadIO m, IsBox o) => o -> m Int32
- setBoxBaselineChild :: (MonadIO m, IsBox o) => o -> Int32 -> m ()
- constructBoxBaselinePosition :: (IsBox o, MonadIO m) => BaselinePosition -> m (GValueConstruct o)
- getBoxBaselinePosition :: (MonadIO m, IsBox o) => o -> m BaselinePosition
- setBoxBaselinePosition :: (MonadIO m, IsBox o) => o -> BaselinePosition -> m ()
- constructBoxHomogeneous :: (IsBox o, MonadIO m) => Bool -> m (GValueConstruct o)
- getBoxHomogeneous :: (MonadIO m, IsBox o) => o -> m Bool
- setBoxHomogeneous :: (MonadIO m, IsBox o) => o -> Bool -> m ()
- constructBoxSpacing :: (IsBox o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getBoxSpacing :: (MonadIO m, IsBox o) => o -> m Int32
- setBoxSpacing :: (MonadIO m, IsBox o) => o -> Int32 -> m ()

# Exported types

newtype Box Source #

Memory-managed wrapper type.

Constructors

Box (ManagedPtr Box) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf Box o) => IsBox o Source #

Type class for types which can be safely cast to `Box`, for instance with `toBox`.

#### Instances

Instances details

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

toBox :: (MonadIO m, IsBox o) => o -> m Box Source #

Cast to `Box`, 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

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, append, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, insertChildAfter, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, prepend, queueAllocate, queueDraw, queueResize, realize, ref, refSink, remove, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, reorderChildAfter, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBaselineChild, getBaselinePosition, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getHomogeneous, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOrientation, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getSpacing, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setBaselineChild, setBaselinePosition, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setHomogeneous, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOrientation, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setSpacing, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

## append

boxAppend Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) |
=> a | `box`: a box
-> b | `child`: the widget to append
-> m () |

Adds a child at the end.

## getBaselineChild

boxGetBaselineChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> m Int32 | Returns: the baseline child

Gets the value set by `boxSetBaselineChild`.

Since: 4.12

## getBaselinePosition

boxGetBaselinePosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> m BaselinePosition | Returns: the baseline position

Gets the value set by `boxSetBaselinePosition`.

## getHomogeneous

boxGetHomogeneous Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> m Bool | Returns: true if the box is homogeneous

Returns whether the box is homogeneous.

In a homogeneous box all children are the same size.

## getSpacing

boxGetSpacing Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> m Int32 | Returns: spacing between children

Gets the value set by `boxSetSpacing`.

## insertChildAfter

boxInsertChildAfter Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a, IsWidget b, IsWidget c) |
=> a | `box`: a box
-> b | `child`: the widget to insert
-> Maybe c | `sibling`: the sibling after which to insert `child`
-> m () |

Inserts a child at a specific position.

The child is added after `sibling` in the list of `box` children.

If `sibling` is `NULL`, the `child` is placed at the beginning.

## new

boxNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Orientation | `orientation`: the box’s orientation
-> Int32 | `spacing`: the number of pixels to place between children
-> m Box | Returns: a new `GtkBox`.

Creates a new box.

## prepend

boxPrepend Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) |
=> a | `box`: a box
-> b | `child`: the widget to prepend
-> m () |

Adds a child at the beginning.

## remove

boxRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) |
=> a | `box`: a box
-> b | `child`: the child to remove
-> m () |

Removes a child widget from the box.

The child must have been added before with `boxAppend`, `boxPrepend`, or `boxInsertChildAfter`.

## reorderChildAfter

boxReorderChildAfter Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a, IsWidget b, IsWidget c) |
=> a | `box`: a box
-> b | `child`: the widget to move, must be a child of `box`
-> Maybe c | `sibling`: the sibling to move `child` after
-> m () |

Moves a child to a different position.

The child is moved to the position after `sibling` in the list of `box` children.

If `sibling` is `NULL`, the child is placed at the beginning.

## setBaselineChild

boxSetBaselineChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> Int32 | `child`: a child position, or -1
-> m () |

Sets the baseline child of a box.

This affects only vertical boxes.

Since: 4.12

## setBaselinePosition

boxSetBaselinePosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> BaselinePosition | `position`: the baseline position
-> m () |

Sets the baseline position of a box.

This affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then `position` is used to allocate the baseline with respect to the extra space available.

## setHomogeneous

boxSetHomogeneous Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> Bool | `homogeneous`: true to create equal allotments, false for variable allotments
-> m () |

Sets whether or not all children are given equal space in the box.

## setSpacing

boxSetSpacing Source #

Arguments

:: (HasCallStack, MonadIO m, IsBox a) |
=> a | `box`: a box
-> Int32 | `spacing`: the number of pixels to put between children
-> m () |

Sets the number of pixels to place between children.

# Properties

## baselineChild

The position of the child that determines the baseline.

This is only relevant if the box is in vertical orientation.

Since: 4.12

constructBoxBaselineChild :: (IsBox o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

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

getBoxBaselineChild :: (MonadIO m, IsBox o) => o -> m Int32 Source #

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

    get box #baselineChild

setBoxBaselineChild :: (MonadIO m, IsBox o) => o -> Int32 -> m () Source #

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

    set box [ #baselineChild := value ]

## baselinePosition

How to position baseline-aligned widgets if extra space is available.

constructBoxBaselinePosition :: (IsBox o, MonadIO m) => BaselinePosition -> m (GValueConstruct o) Source #

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

getBoxBaselinePosition :: (MonadIO m, IsBox o) => o -> m BaselinePosition Source #

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

    get box #baselinePosition

setBoxBaselinePosition :: (MonadIO m, IsBox o) => o -> BaselinePosition -> m () Source #

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

    set box [ #baselinePosition := value ]

## homogeneous

Whether the children should all be the same size.

constructBoxHomogeneous :: (IsBox o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getBoxHomogeneous :: (MonadIO m, IsBox o) => o -> m Bool Source #

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

    get box #homogeneous

setBoxHomogeneous :: (MonadIO m, IsBox o) => o -> Bool -> m () Source #

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

    set box [ #homogeneous := value ]

## spacing

The amount of space between children.

constructBoxSpacing :: (IsBox o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

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

getBoxSpacing :: (MonadIO m, IsBox o) => o -> m Int32 Source #

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

    get box #spacing

setBoxSpacing :: (MonadIO m, IsBox o) => o -> Int32 -> m () Source #

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

    set box [ #spacing := value ]