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.CenterBox

Contents

- Exported types
- Methods
  - getBaselinePosition
  - getCenterWidget
  - getEndWidget
  - getShrinkCenterLast
  - getStartWidget
  - new
  - setBaselinePosition
  - setCenterWidget
  - setEndWidget
  - setShrinkCenterLast
  - setStartWidget
- Properties
  - baselinePosition
  - centerWidget
  - endWidget
  - shrinkCenterLast
  - startWidget

Description

Arranges three children in a row, keeping the middle child centered as well as possible.

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

To add children to `GtkCenterBox`, use `centerBoxSetStartWidget`, `centerBoxSetCenterWidget` and `centerBoxSetEndWidget`.

The sizing and positioning of children can be influenced with the align and expand properties of the children.

# GtkCenterBox as GtkBuildable

The `GtkCenterBox` implementation of the `GtkBuildable` interface supports placing children in the 3 positions by specifying “start”, “center” or “end” as the “type” attribute of a `<child>` element.

# CSS nodes

`GtkCenterBox` uses a single CSS node with the name “box”,

The first child of the `GtkCenterBox` will be allocated depending on the text direction, i.e. in left-to-right layouts it will be allocated on the left and in right-to-left layouts on the right.

In vertical orientation, the nodes of the children are arranged from top to bottom.

# Accessibility

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

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

Synopsis

- newtype CenterBox = CenterBox (ManagedPtr CenterBox)
- class (GObject o, IsDescendantOf CenterBox o) => IsCenterBox o
- toCenterBox :: (MonadIO m, IsCenterBox o) => o -> m CenterBox
- centerBoxGetBaselinePosition :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> m BaselinePosition
- centerBoxGetCenterWidget :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> m (Maybe Widget)
- centerBoxGetEndWidget :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> m (Maybe Widget)
- centerBoxGetShrinkCenterLast :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> m Bool
- centerBoxGetStartWidget :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> m (Maybe Widget)
- centerBoxNew :: (HasCallStack, MonadIO m) => m CenterBox
- centerBoxSetBaselinePosition :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> BaselinePosition -> m ()
- centerBoxSetCenterWidget :: (HasCallStack, MonadIO m, IsCenterBox a, IsWidget b) => a -> Maybe b -> m ()
- centerBoxSetEndWidget :: (HasCallStack, MonadIO m, IsCenterBox a, IsWidget b) => a -> Maybe b -> m ()
- centerBoxSetShrinkCenterLast :: (HasCallStack, MonadIO m, IsCenterBox a) => a -> Bool -> m ()
- centerBoxSetStartWidget :: (HasCallStack, MonadIO m, IsCenterBox a, IsWidget b) => a -> Maybe b -> m ()
- constructCenterBoxBaselinePosition :: (IsCenterBox o, MonadIO m) => BaselinePosition -> m (GValueConstruct o)
- getCenterBoxBaselinePosition :: (MonadIO m, IsCenterBox o) => o -> m BaselinePosition
- setCenterBoxBaselinePosition :: (MonadIO m, IsCenterBox o) => o -> BaselinePosition -> m ()
- clearCenterBoxCenterWidget :: (MonadIO m, IsCenterBox o) => o -> m ()
- constructCenterBoxCenterWidget :: (IsCenterBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getCenterBoxCenterWidget :: (MonadIO m, IsCenterBox o) => o -> m (Maybe Widget)
- setCenterBoxCenterWidget :: (MonadIO m, IsCenterBox o, IsWidget a) => o -> a -> m ()
- clearCenterBoxEndWidget :: (MonadIO m, IsCenterBox o) => o -> m ()
- constructCenterBoxEndWidget :: (IsCenterBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getCenterBoxEndWidget :: (MonadIO m, IsCenterBox o) => o -> m (Maybe Widget)
- setCenterBoxEndWidget :: (MonadIO m, IsCenterBox o, IsWidget a) => o -> a -> m ()
- constructCenterBoxShrinkCenterLast :: (IsCenterBox o, MonadIO m) => Bool -> m (GValueConstruct o)
- getCenterBoxShrinkCenterLast :: (MonadIO m, IsCenterBox o) => o -> m Bool
- setCenterBoxShrinkCenterLast :: (MonadIO m, IsCenterBox o) => o -> Bool -> m ()
- clearCenterBoxStartWidget :: (MonadIO m, IsCenterBox o) => o -> m ()
- constructCenterBoxStartWidget :: (IsCenterBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getCenterBoxStartWidget :: (MonadIO m, IsCenterBox o) => o -> m (Maybe Widget)
- setCenterBoxStartWidget :: (MonadIO m, IsCenterBox o, IsWidget a) => o -> a -> m ()

# Exported types

newtype CenterBox Source #

Memory-managed wrapper type.

Constructors

CenterBox (ManagedPtr CenterBox) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf CenterBox o) => IsCenterBox o Source #

Type class for types which can be safely cast to `CenterBox`, for instance with `toCenterBox`.

#### Instances

Instances details

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

toCenterBox :: (MonadIO m, IsCenterBox o) => o -> m CenterBox Source #

Cast to `CenterBox`, 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, 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, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, 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, getBaselinePosition, getBounds, getBuildableId, getCanFocus, getCanTarget, getCenterWidget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getEndWidget, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, 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, getShrinkCenterLast, getSize, getSizeRequest, getStartWidget, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

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

## getBaselinePosition

centerBoxGetBaselinePosition Source #

Arguments

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

Gets the baseline position of the center box.

See `centerBoxSetBaselinePosition`.

## getCenterWidget

centerBoxGetCenterWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a) |
=> a | `self`: a center box
-> m (Maybe Widget) | Returns: the center widget

Gets the center widget.

## getEndWidget

centerBoxGetEndWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a) |
=> a | `self`: a center box
-> m (Maybe Widget) | Returns: the end widget

Gets the end widget.

## getShrinkCenterLast

centerBoxGetShrinkCenterLast Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a) |
=> a | `self`: a center box
-> m Bool | Returns: whether to shrink the center widget after others

Gets whether the center widget shrinks after other children.

Since: 4.12

## getStartWidget

centerBoxGetStartWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a) |
=> a | `self`: a center box
-> m (Maybe Widget) | Returns: the start widget

Gets the start widget.

## new

centerBoxNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m CenterBox | Returns: the new `GtkCenterBox`

Creates a new `GtkCenterBox`.

## setBaselinePosition

centerBoxSetBaselinePosition Source #

Arguments

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

Sets the baseline position of a center 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.

## setCenterWidget

centerBoxSetCenterWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a, IsWidget b) |
=> a | `self`: a center box
-> Maybe b | `child`: the new center widget
-> m () |

Sets the center widget.

To remove the existing center widget, pass `NULL`.

## setEndWidget

centerBoxSetEndWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a, IsWidget b) |
=> a | `self`: a center box
-> Maybe b | `child`: the new end widget
-> m () |

Sets the end widget.

To remove the existing end widget, pass `NULL`.

## setShrinkCenterLast

centerBoxSetShrinkCenterLast Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a) |
=> a | `self`: a cener box
-> Bool | `shrinkCenterLast`: whether to shrink the center widget after others
-> m () |

Sets whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If `shrinkCenterLast` is false, start and end widgets keep natural width and the center widget starts shrinking instead.

Since: 4.12

## setStartWidget

centerBoxSetStartWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsCenterBox a, IsWidget b) |
=> a | `self`: a center box
-> Maybe b | `child`: the new start widget
-> m () |

Sets the start widget.

To remove the existing start widget, pass `NULL`.

# Properties

## baselinePosition

The position of the baseline aligned widget if extra space is available.

constructCenterBoxBaselinePosition :: (IsCenterBox 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`.

getCenterBoxBaselinePosition :: (MonadIO m, IsCenterBox o) => o -> m BaselinePosition Source #

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

    get centerBox #baselinePosition

setCenterBoxBaselinePosition :: (MonadIO m, IsCenterBox o) => o -> BaselinePosition -> m () Source #

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

    set centerBox [ #baselinePosition := value ]

## centerWidget

The widget that is placed at the center position.

Since: 4.10

clearCenterBoxCenterWidget :: (MonadIO m, IsCenterBox o) => o -> m () Source #

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

    clear #centerWidget

constructCenterBoxCenterWidget :: (IsCenterBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

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

getCenterBoxCenterWidget :: (MonadIO m, IsCenterBox o) => o -> m (Maybe Widget) Source #

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

    get centerBox #centerWidget

setCenterBoxCenterWidget :: (MonadIO m, IsCenterBox o, IsWidget a) => o -> a -> m () Source #

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

    set centerBox [ #centerWidget := value ]

## endWidget

The widget that is placed at the end position.

In vertical orientation, the end position is at the bottom. In horizontal orientation, the end position is at the trailing edge with respect to the text direction.

Since: 4.10

clearCenterBoxEndWidget :: (MonadIO m, IsCenterBox o) => o -> m () Source #

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

    clear #endWidget

constructCenterBoxEndWidget :: (IsCenterBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

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

getCenterBoxEndWidget :: (MonadIO m, IsCenterBox o) => o -> m (Maybe Widget) Source #

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

    get centerBox #endWidget

setCenterBoxEndWidget :: (MonadIO m, IsCenterBox o, IsWidget a) => o -> a -> m () Source #

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

    set centerBox [ #endWidget := value ]

## shrinkCenterLast

Whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If false, start and end widgets keep natural width and the center widget starts shrinking instead.

Since: 4.12

constructCenterBoxShrinkCenterLast :: (IsCenterBox o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getCenterBoxShrinkCenterLast :: (MonadIO m, IsCenterBox o) => o -> m Bool Source #

Get the value of the “`shrink-center-last`” property. When overloading is enabled, this is equivalent to

    get centerBox #shrinkCenterLast

setCenterBoxShrinkCenterLast :: (MonadIO m, IsCenterBox o) => o -> Bool -> m () Source #

Set the value of the “`shrink-center-last`” property. When overloading is enabled, this is equivalent to

    set centerBox [ #shrinkCenterLast := value ]

## startWidget

The widget that is placed at the start position.

In vertical orientation, the start position is at the top. In horizontal orientation, the start position is at the leading edge with respect to the text direction.

Since: 4.10

clearCenterBoxStartWidget :: (MonadIO m, IsCenterBox o) => o -> m () Source #

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

    clear #startWidget

constructCenterBoxStartWidget :: (IsCenterBox o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

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

getCenterBoxStartWidget :: (MonadIO m, IsCenterBox o) => o -> m (Maybe Widget) Source #

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

    get centerBox #startWidget

setCenterBoxStartWidget :: (MonadIO m, IsCenterBox o, IsWidget a) => o -> a -> m () Source #

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

    set centerBox [ #startWidget := value ]