monomer-1.1.1.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Monomer.Widgets.Containers.Box

Description

Container for a single item.

Useful in different layout situations, since it provides alignment options. This allows for the inner widget to keep its size while being positioned more explicitly, while the box takes up the complete space assigned by its parent (in particular for containers which do not follow SizeReq restriccions, such as Grid).

Can be used to add padding to an inner widget with a border. This is equivalent to the margin property in CSS.

Also useful to handle click events in complex widget structures (for example, a label with an image at its side).

Synopsis

Configuration

data BoxCfg s e Source #

Configuration options for box:

  • mergeRequired: function called during merge that receives the old and new model, returning True in case the child widget needs to be merged. Since by default merge is required, this function can be used to restrict merging when it would be expensive and it is not necessary. For example, a list of widgets representing search result only needs to be updated when the list of results changes, not while the user inputs new search criteria (which also triggers a model change and, hence, the merge process).
  • ignoreEmptyArea: when the inner widget does not use all the available space, ignoring the unassigned space allows for mouse events to pass through. This is useful in zstack layers.
  • sizeReqUpdater: allows modifying the SizeReq generated by the inner widget.
  • alignLeft: aligns the inner widget to the left.
  • alignCenter: aligns the inner widget to the horizontal center.
  • alignRight: aligns the inner widget to the right.
  • alignTop: aligns the inner widget to the top.
  • alignMiddle: aligns the inner widget to the left.
  • alignBottom: aligns the inner widget to the bottom.
  • onClick: click event.
  • onClickReq: generates a WidgetRequest on click.
  • onClickEmpty: click event on empty area.
  • onClickEmptyReq: generates a WidgetRequest on click in empty area.
  • expandContent: if the inner widget should use all the available space. To be able to use alignment options, this must be False (the default).

Instances

Instances details
Semigroup (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

(<>) :: BoxCfg s e -> BoxCfg s e -> BoxCfg s e #

sconcat :: NonEmpty (BoxCfg s e) -> BoxCfg s e #

stimes :: Integral b => b -> BoxCfg s e -> BoxCfg s e #

Monoid (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

mempty :: BoxCfg s e #

mappend :: BoxCfg s e -> BoxCfg s e -> BoxCfg s e #

mconcat :: [BoxCfg s e] -> BoxCfg s e #

Default (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

def :: BoxCfg s e #

CmbAlignBottom (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbAlignMiddle (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbAlignTop (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbAlignRight (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbAlignCenter (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbAlignLeft (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbSizeReqUpdater (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbIgnoreEmptyArea (BoxCfg s e) Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

WidgetEvent e => CmbOnBtnReleased (BoxCfg s e) e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onBtnReleased :: (Button -> Int -> e) -> BoxCfg s e Source #

WidgetEvent e => CmbOnBtnPressed (BoxCfg s e) e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onBtnPressed :: (Button -> Int -> e) -> BoxCfg s e Source #

WidgetEvent e => CmbOnClickEmpty (BoxCfg s e) e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onClickEmpty :: e -> BoxCfg s e Source #

WidgetEvent e => CmbOnClick (BoxCfg s e) e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onClick :: e -> BoxCfg s e Source #

WidgetEvent e => CmbOnLeave (BoxCfg s e) e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onLeave :: e -> BoxCfg s e Source #

WidgetEvent e => CmbOnEnter (BoxCfg s e) e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onEnter :: e -> BoxCfg s e Source #

CmbMergeRequired (BoxCfg s e) s Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

mergeRequired :: (s -> s -> Bool) -> BoxCfg s e Source #

CmbOnBtnReleasedReq (BoxCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onBtnReleasedReq :: (Button -> Int -> WidgetRequest s e) -> BoxCfg s e Source #

CmbOnBtnPressedReq (BoxCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onBtnPressedReq :: (Button -> Int -> WidgetRequest s e) -> BoxCfg s e Source #

CmbOnClickEmptyReq (BoxCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

CmbOnClickReq (BoxCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onClickReq :: WidgetRequest s e -> BoxCfg s e Source #

CmbOnLeaveReq (BoxCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onLeaveReq :: WidgetRequest s e -> BoxCfg s e Source #

CmbOnEnterReq (BoxCfg s e) s e Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onEnterReq :: WidgetRequest s e -> BoxCfg s e Source #

WidgetEvent e => CmbOnBlur (BoxCfg s e) e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onBlur :: (Path -> e) -> BoxCfg s e Source #

WidgetEvent e => CmbOnFocus (BoxCfg s e) e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onFocus :: (Path -> e) -> BoxCfg s e Source #

CmbOnBlurReq (BoxCfg s e) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onBlurReq :: (Path -> WidgetRequest s e) -> BoxCfg s e Source #

CmbOnFocusReq (BoxCfg s e) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Containers.Box

Methods

onFocusReq :: (Path -> WidgetRequest s e) -> BoxCfg s e Source #

Constructors

box :: (WidgetModel s, WidgetEvent e) => WidgetNode s e -> WidgetNode s e Source #

Creates a box widget with a single node as child.

box_ :: (WidgetModel s, WidgetEvent e) => [BoxCfg s e] -> WidgetNode s e -> WidgetNode s e Source #

Creates a box widget with a single node as child. Accepts config.

expandContent :: BoxCfg s e Source #

Assigns all the available space to its contained child.