gi-gtk-3.0.11: 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.FlowBox

Contents

Description

A GtkFlowBox positions child widgets in sequence according to its orientation.

For instance, with the horizontal orientation, the widgets will be arranged from left to right, starting a new row under the previous row when necessary. Reducing the width in this case will require more rows, so a larger height will be requested.

Likewise, with the vertical orientation, the widgets will be arranged from top to bottom, starting a new column to the right when necessary. Reducing the height will require more columns, so a larger width will be requested.

The children of a GtkFlowBox can be dynamically sorted and filtered.

Although a GtkFlowBox must have only FlowBoxChild children, you can add any kind of widget to it via containerAdd, and a GtkFlowBoxChild widget will automatically be inserted between the box and the widget.

Also see ListBox.

GtkFlowBox was added in GTK+ 3.12.

CSS nodes

plain code

flowbox
├── flowboxchild
│   ╰── <child>
├── flowboxchild
│   ╰── <child>
┊
╰── [rubberband]

GtkFlowBox uses a single CSS node with name flowbox. GtkFlowBoxChild uses a single CSS node with name flowboxchild. For rubberband selection, a subnode with name rubberband is used.

Synopsis

Exported types

Methods

bindModel

flowBoxBindModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a, IsListModel b) 
=> a

box: a FlowBox

-> Maybe b

model: the ListModel to be bound to box

-> FlowBoxCreateWidgetFunc

createWidgetFunc: a function that creates widgets for items

-> m () 

Binds model to box.

If box was already bound to a model, that previous binding is destroyed.

The contents of box are cleared and then filled with widgets that represent items from model. box is updated whenever model changes. If model is Nothing, box is left empty.

It is undefined to add or remove widgets directly (for example, with flowBoxInsert or containerAdd) while box is bound to a model.

Note that using a model is incompatible with the filtering and sorting functionality in GtkFlowBox. When using a model, filtering and sorting should be implemented by the model.

Since: 3.18

getActivateOnSingleClick

flowBoxGetActivateOnSingleClick Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m Bool

Returns: True if children are activated on single click, False otherwise

Returns whether children activate on single clicks.

Since: 3.12

getChildAtIndex

flowBoxGetChildAtIndex Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Int32

idx: the position of the child

-> m (Maybe FlowBoxChild)

Returns: the child widget, which will always be a FlowBoxChild or Nothing in case no child widget with the given index exists.

Gets the nth child in the box.

Since: 3.12

getChildAtPos

flowBoxGetChildAtPos Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Int32

x: the x coordinate of the child

-> Int32

y: the y coordinate of the child

-> m (Maybe FlowBoxChild)

Returns: the child widget, which will always be a FlowBoxChild or Nothing in case no child widget exists for the given x and y coordinates.

Gets the child in the (x, y) position.

Since: 3.22.6

getColumnSpacing

flowBoxGetColumnSpacing Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m Word32

Returns: the horizontal spacing

Gets the horizontal spacing.

Since: 3.12

getHomogeneous

flowBoxGetHomogeneous Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m Bool

Returns: True if the box is homogeneous.

Returns whether the box is homogeneous (all children are the same size). See boxSetHomogeneous.

Since: 3.12

getMaxChildrenPerLine

flowBoxGetMaxChildrenPerLine Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m Word32

Returns: the maximum number of children per line

Gets the maximum number of children per line.

Since: 3.12

getMinChildrenPerLine

flowBoxGetMinChildrenPerLine Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m Word32

Returns: the minimum number of children per line

Gets the minimum number of children per line.

Since: 3.12

getRowSpacing

flowBoxGetRowSpacing Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m Word32

Returns: the vertical spacing

Gets the vertical spacing.

Since: 3.12

getSelectedChildren

flowBoxGetSelectedChildren Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m [FlowBoxChild]

Returns: A List containing the Widget for each selected child. Free with g_list_free() when done.

Creates a list of all selected children.

Since: 3.12

getSelectionMode

flowBoxGetSelectionMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m SelectionMode

Returns: the SelectionMode

Gets the selection mode of box.

Since: 3.12

insert

data FlowBoxInsertMethodInfo Source #

Instances

((~) * signature (b -> Int32 -> m ()), MonadIO m, IsFlowBox a, IsWidget b) => MethodInfo * FlowBoxInsertMethodInfo a signature Source # 

flowBoxInsert Source #

Arguments

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

box: a FlowBox

-> b

widget: the Widget to add

-> Int32

position: the position to insert child in

-> m () 

Inserts the widget into box at position.

If a sort function is set, the widget will actually be inserted at the calculated position and this function has the same effect as containerAdd.

If position is -1, or larger than the total number of children in the box, then the widget will be appended to the end.

Since: 3.12

invalidateFilter

flowBoxInvalidateFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m () 

Updates the filtering for all children.

Call this function when the result of the filter function on the box is changed due ot an external factor. For instance, this would be used if the filter function just looked for a specific search term, and the entry with the string has changed.

Since: 3.12

invalidateSort

flowBoxInvalidateSort Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m () 

Updates the sorting for all children.

Call this when the result of the sort function on box is changed due to an external factor.

Since: 3.12

new

flowBoxNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m FlowBox

Returns: a new FlowBox container

Creates a GtkFlowBox.

Since: 3.12

selectAll

data FlowBoxSelectAllMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsFlowBox a) => MethodInfo * FlowBoxSelectAllMethodInfo a signature Source # 

flowBoxSelectAll Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m () 

Select all children of box, if the selection mode allows it.

Since: 3.12

selectChild

data FlowBoxSelectChildMethodInfo Source #

Instances

((~) * signature (b -> m ()), MonadIO m, IsFlowBox a, IsFlowBoxChild b) => MethodInfo * FlowBoxSelectChildMethodInfo a signature Source # 

flowBoxSelectChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a, IsFlowBoxChild b) 
=> a

box: a FlowBox

-> b

child: a child of box

-> m () 

Selects a single child of box, if the selection mode allows it.

Since: 3.12

selectedForeach

flowBoxSelectedForeach Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> FlowBoxForeachFunc

func: the function to call for each selected child

-> m () 

Calls a function for each selected child.

Note that the selection cannot be modified from within this function.

Since: 3.12

setActivateOnSingleClick

flowBoxSetActivateOnSingleClick Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Bool

single: True to emit child-activated on a single click

-> m () 

If single is True, children will be activated when you click on them, otherwise you need to double-click.

Since: 3.12

setColumnSpacing

flowBoxSetColumnSpacing Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Word32

spacing: the spacing to use

-> m () 

Sets the horizontal space to add between children. See the FlowBox:column-spacing property.

Since: 3.12

setFilterFunc

flowBoxSetFilterFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Maybe FlowBoxFilterFunc

filterFunc: callback that lets you filter which children to show

-> m () 

By setting a filter function on the box one can decide dynamically which of the children to show. For instance, to implement a search function that only shows the children matching the search terms.

The filterFunc will be called for each child after the call, and it will continue to be called each time a child changes (via flowBoxChildChanged) or when flowBoxInvalidateFilter is called.

Note that using a filter function is incompatible with using a model (see flowBoxBindModel).

Since: 3.12

setHadjustment

flowBoxSetHadjustment Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a, IsAdjustment b) 
=> a

box: a FlowBox

-> 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 box. The adjustment is also used for autoscrolling during rubberband selection. See scrolledWindowGetHadjustment for a typical way of obtaining the adjustment, and flowBoxSetVadjustmentfor 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 box.

Since: 3.12

setHomogeneous

flowBoxSetHomogeneous Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Bool

homogeneous: True to create equal allotments, False for variable allotments

-> m () 

Sets the FlowBox:homogeneous property of box, controlling whether or not all children of box are given equal space in the box.

Since: 3.12

setMaxChildrenPerLine

flowBoxSetMaxChildrenPerLine Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Word32

nChildren: the maximum number of children per line

-> m () 

Sets the maximum number of children to request and allocate space for in box’s orientation.

Setting the maximum number of children per line limits the overall natural size request to be no more than nChildren children long in the given orientation.

Since: 3.12

setMinChildrenPerLine

flowBoxSetMinChildrenPerLine Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Word32

nChildren: the minimum number of children per line

-> m () 

Sets the minimum number of children to line up in box’s orientation before flowing.

Since: 3.12

setRowSpacing

flowBoxSetRowSpacing Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Word32

spacing: the spacing to use

-> m () 

Sets the vertical space to add between children. See the FlowBox:row-spacing property.

Since: 3.12

setSelectionMode

flowBoxSetSelectionMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> SelectionMode

mode: the new selection mode

-> m () 

Sets how selection works in box. See SelectionMode for details.

Since: 3.12

setSortFunc

flowBoxSetSortFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> Maybe FlowBoxSortFunc

sortFunc: the sort function

-> m () 

By setting a sort function on the box, one can dynamically reorder the children of the box, based on the contents of the children.

The sortFunc will be called for each child after the call, and will continue to be called each time a child changes (via flowBoxChildChanged) and when flowBoxInvalidateSort is called.

Note that using a sort function is incompatible with using a model (see flowBoxBindModel).

Since: 3.12

setVadjustment

flowBoxSetVadjustment Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a, IsAdjustment b) 
=> a

box: a FlowBox

-> 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 box. The adjustment is also used for autoscrolling during rubberband selection. See scrolledWindowGetVadjustment for a typical way of obtaining the adjustment, and flowBoxSetHadjustmentfor 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 box.

Since: 3.12

unselectAll

data FlowBoxUnselectAllMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsFlowBox a) => MethodInfo * FlowBoxUnselectAllMethodInfo a signature Source # 

flowBoxUnselectAll Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a) 
=> a

box: a FlowBox

-> m () 

Unselect all children of box, if the selection mode allows it.

Since: 3.12

unselectChild

flowBoxUnselectChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsFlowBox a, IsFlowBoxChild b) 
=> a

box: a FlowBox

-> b

child: a child of box

-> m () 

Unselects a single child of box, if the selection mode allows it.

Since: 3.12

Properties

activateOnSingleClick

data FlowBoxActivateOnSingleClickPropertyInfo Source #

Instances

AttrInfo FlowBoxActivateOnSingleClickPropertyInfo Source # 
type AttrOrigin FlowBoxActivateOnSingleClickPropertyInfo Source # 
type AttrLabel FlowBoxActivateOnSingleClickPropertyInfo Source # 
type AttrLabel FlowBoxActivateOnSingleClickPropertyInfo = "activate-on-single-click"
type AttrGetType FlowBoxActivateOnSingleClickPropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxActivateOnSingleClickPropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxActivateOnSingleClickPropertyInfo Source # 
type AttrAllowedOps FlowBoxActivateOnSingleClickPropertyInfo Source # 

columnSpacing

data FlowBoxColumnSpacingPropertyInfo Source #

Instances

AttrInfo FlowBoxColumnSpacingPropertyInfo Source # 
type AttrOrigin FlowBoxColumnSpacingPropertyInfo Source # 
type AttrLabel FlowBoxColumnSpacingPropertyInfo Source # 
type AttrGetType FlowBoxColumnSpacingPropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxColumnSpacingPropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxColumnSpacingPropertyInfo Source # 
type AttrAllowedOps FlowBoxColumnSpacingPropertyInfo Source # 

homogeneous

data FlowBoxHomogeneousPropertyInfo Source #

Instances

AttrInfo FlowBoxHomogeneousPropertyInfo Source # 
type AttrOrigin FlowBoxHomogeneousPropertyInfo Source # 
type AttrLabel FlowBoxHomogeneousPropertyInfo Source # 
type AttrGetType FlowBoxHomogeneousPropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxHomogeneousPropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxHomogeneousPropertyInfo Source # 
type AttrAllowedOps FlowBoxHomogeneousPropertyInfo Source # 

maxChildrenPerLine

data FlowBoxMaxChildrenPerLinePropertyInfo Source #

Instances

AttrInfo FlowBoxMaxChildrenPerLinePropertyInfo Source # 
type AttrOrigin FlowBoxMaxChildrenPerLinePropertyInfo Source # 
type AttrLabel FlowBoxMaxChildrenPerLinePropertyInfo Source # 
type AttrLabel FlowBoxMaxChildrenPerLinePropertyInfo = "max-children-per-line"
type AttrGetType FlowBoxMaxChildrenPerLinePropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxMaxChildrenPerLinePropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxMaxChildrenPerLinePropertyInfo Source # 
type AttrAllowedOps FlowBoxMaxChildrenPerLinePropertyInfo Source # 

minChildrenPerLine

data FlowBoxMinChildrenPerLinePropertyInfo Source #

Instances

AttrInfo FlowBoxMinChildrenPerLinePropertyInfo Source # 
type AttrOrigin FlowBoxMinChildrenPerLinePropertyInfo Source # 
type AttrLabel FlowBoxMinChildrenPerLinePropertyInfo Source # 
type AttrLabel FlowBoxMinChildrenPerLinePropertyInfo = "min-children-per-line"
type AttrGetType FlowBoxMinChildrenPerLinePropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxMinChildrenPerLinePropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxMinChildrenPerLinePropertyInfo Source # 
type AttrAllowedOps FlowBoxMinChildrenPerLinePropertyInfo Source # 

rowSpacing

data FlowBoxRowSpacingPropertyInfo Source #

Instances

AttrInfo FlowBoxRowSpacingPropertyInfo Source # 
type AttrOrigin FlowBoxRowSpacingPropertyInfo Source # 
type AttrLabel FlowBoxRowSpacingPropertyInfo Source # 
type AttrGetType FlowBoxRowSpacingPropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxRowSpacingPropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxRowSpacingPropertyInfo Source # 
type AttrAllowedOps FlowBoxRowSpacingPropertyInfo Source # 

selectionMode

data FlowBoxSelectionModePropertyInfo Source #

Instances

AttrInfo FlowBoxSelectionModePropertyInfo Source # 
type AttrOrigin FlowBoxSelectionModePropertyInfo Source # 
type AttrLabel FlowBoxSelectionModePropertyInfo Source # 
type AttrGetType FlowBoxSelectionModePropertyInfo Source # 
type AttrBaseTypeConstraint FlowBoxSelectionModePropertyInfo Source # 
type AttrSetTypeConstraint FlowBoxSelectionModePropertyInfo Source # 
type AttrAllowedOps FlowBoxSelectionModePropertyInfo Source # 

Signals

activateCursorChild

childActivated

moveCursor

selectAll

selectedChildrenChanged

toggleCursorChild

unselectAll