Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The GtkBox widget organizes child widgets into a rectangular area.
The rectangular area of a GtkBox is organized into either a single row or a single column of child widgets depending upon the orientation. Thus, all children of a GtkBox are allocated one dimension in common, which is the height of a row, or the width of a column.
GtkBox uses a notion of packing. Packing refers
to adding widgets with reference to a particular position in a
Container
. For a GtkBox, there are two reference positions: the
start and the end of the box.
For a vertical Box
, the start is defined as the top of the box and
the end is defined as the bottom. For a horizontal Box
the start
is defined as the left side and the end is defined as the right side.
Use repeated calls to boxPackStart
to pack widgets into a
GtkBox from start to end. Use boxPackEnd
to add widgets from
end to start. You may intersperse these calls and add widgets from
both ends of the same GtkBox.
Because GtkBox is a Container
, you may also use containerAdd
to insert widgets into the box, and they will be packed with the default
values for expand and fill child properties. Use containerRemove
to remove widgets from the GtkBox.
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, while
padding added by boxPackStart
or boxPackEnd
is added
on either side of the widget it belongs to.
Use boxReorderChild
to move a GtkBox child to a different
place in the box.
Use boxSetChildPacking
to reset the expand,
fill and padding child properties.
Use boxQueryChildPacking
to query these fields.
Note that a single-row or single-column Grid
provides exactly
the same functionality as Box
.
CSS nodes
GtkBox uses a single CSS node with name box.
In horizontal orientation, the nodes of the children are always arranged from left to right. So :first-child will always select the leftmost child, regardless of text direction.
Synopsis
- newtype Box = Box (ManagedPtr Box)
- class GObject o => IsBox o
- toBox :: (MonadIO m, IsBox o) => o -> m Box
- noBox :: Maybe Box
- boxGetBaselinePosition :: (HasCallStack, MonadIO m, IsBox a) => a -> m BaselinePosition
- boxGetCenterWidget :: (HasCallStack, MonadIO m, IsBox a) => a -> m (Maybe Widget)
- boxGetHomogeneous :: (HasCallStack, MonadIO m, IsBox a) => a -> m Bool
- boxGetSpacing :: (HasCallStack, MonadIO m, IsBox a) => a -> m Int32
- boxNew :: (HasCallStack, MonadIO m) => Orientation -> Int32 -> m Box
- boxPackEnd :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> Bool -> Bool -> Word32 -> m ()
- boxPackStart :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> Bool -> Bool -> Word32 -> m ()
- boxQueryChildPacking :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> m (Bool, Bool, Word32, PackType)
- boxReorderChild :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> Int32 -> m ()
- boxSetBaselinePosition :: (HasCallStack, MonadIO m, IsBox a) => a -> BaselinePosition -> m ()
- boxSetCenterWidget :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> Maybe b -> m ()
- boxSetChildPacking :: (HasCallStack, MonadIO m, IsBox a, IsWidget b) => a -> b -> Bool -> Bool -> Word32 -> PackType -> m ()
- boxSetHomogeneous :: (HasCallStack, MonadIO m, IsBox a) => a -> Bool -> m ()
- boxSetSpacing :: (HasCallStack, MonadIO m, IsBox a) => a -> Int32 -> m ()
- constructBoxBaselinePosition :: IsBox o => BaselinePosition -> IO (GValueConstruct o)
- getBoxBaselinePosition :: (MonadIO m, IsBox o) => o -> m BaselinePosition
- setBoxBaselinePosition :: (MonadIO m, IsBox o) => o -> BaselinePosition -> m ()
- constructBoxHomogeneous :: IsBox o => Bool -> IO (GValueConstruct o)
- getBoxHomogeneous :: (MonadIO m, IsBox o) => o -> m Bool
- setBoxHomogeneous :: (MonadIO m, IsBox o) => o -> Bool -> m ()
- constructBoxSpacing :: IsBox o => Int32 -> IO (GValueConstruct o)
- getBoxSpacing :: (MonadIO m, IsBox o) => o -> m Int32
- setBoxSpacing :: (MonadIO m, IsBox o) => o -> Int32 -> m ()
Exported types
Memory-managed wrapper type.
Box (ManagedPtr Box) |
Instances
GObject Box Source # | |
Defined in GI.Gtk.Objects.Box gobjectType :: Box -> IO GType # | |
IsImplementorIface Box Source # | |
Defined in GI.Gtk.Objects.Box | |
IsObject Box Source # | |
Defined in GI.Gtk.Objects.Box | |
IsBuildable Box Source # | |
Defined in GI.Gtk.Objects.Box | |
IsOrientable Box Source # | |
Defined in GI.Gtk.Objects.Box | |
IsBox Box Source # | |
Defined in GI.Gtk.Objects.Box | |
IsContainer Box Source # | |
Defined in GI.Gtk.Objects.Box | |
IsWidget Box Source # | |
Defined in GI.Gtk.Objects.Box |
class GObject o => IsBox o Source #
Instances
Methods
getBaselinePosition
boxGetBaselinePosition Source #
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> m BaselinePosition | Returns: the baseline position |
Gets the value set by boxSetBaselinePosition
.
Since: 3.10
getCenterWidget
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the center widget
or |
Retrieves the center widget of the box.
Since: 3.12
getHomogeneous
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the box is homogeneous (all children are the
same size). See boxSetHomogeneous
.
getSpacing
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> m Int32 | Returns: spacing between children |
Gets the value set by boxSetSpacing
.
new
:: (HasCallStack, MonadIO m) | |
=> Orientation |
|
-> Int32 |
|
-> m Box | Returns: a new |
Creates a new Box
.
Since: 3.0
packEnd
:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> Bool |
|
-> Word32 |
|
-> m () |
Adds child
to box
, packed with reference to the end of box
.
The child
is packed after (away from end of) any other child
packed with reference to the end of box
.
packStart
:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> Bool |
|
-> Word32 |
|
-> m () |
Adds child
to box
, packed with reference to the start of box
.
The child
is packed after any other child packed with reference
to the start of box
.
queryChildPacking
:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) | |
=> a |
|
-> b |
|
-> m (Bool, Bool, Word32, PackType) |
Obtains information about how child
is packed into box
.
reorderChild
:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) | |
=> a |
|
-> b |
|
-> Int32 |
|
-> m () |
Moves child
to a new position
in the list of box
children.
The list contains widgets packed GTK_PACK_START
as well as widgets packed GTK_PACK_END
, in the order that these
widgets were added to box
.
A widget’s position in the box
children list determines where
the widget is packed into box
. A child widget at some position
in the list will be packed just after all other widgets of the
same packing type that appear earlier in the list.
setBaselinePosition
boxSetBaselinePosition Source #
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> BaselinePosition |
|
-> 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 wrt the
extra space available.
Since: 3.10
setCenterWidget
:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets a center widget; that is a child widget that will be centered with respect to the full width of the box, even if the children at either side take up different amounts of space.
Since: 3.12
setChildPacking
:: (HasCallStack, MonadIO m, IsBox a, IsWidget b) | |
=> a |
|
-> b |
|
-> Bool |
|
-> Bool |
|
-> Word32 |
|
-> PackType |
|
-> m () |
Sets the way child
is packed into box
.
setHomogeneous
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets the Box
:homogeneous
property of box
, controlling
whether or not all children of box
are given equal space
in the box.
setSpacing
:: (HasCallStack, MonadIO m, IsBox a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the Box
:spacing
property of box
, which is the
number of pixels to place between children of box
.
Properties
baselinePosition
No description available in the introspection data.
constructBoxBaselinePosition :: IsBox o => BaselinePosition -> IO (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
No description available in the introspection data.
constructBoxHomogeneous :: IsBox o => Bool -> IO (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
No description available in the introspection data.
constructBoxSpacing :: IsBox o => Int32 -> IO (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 ]