brick-2.1.1: A declarative terminal user interface library

Safe Haskell | Safe-Inferred
Language | Haskell2010

Brick.Widgets.Center

Contents

- Centering horizontally
- Centering vertically
- Centering both horizontally and vertically
- Centering about an arbitrary origin

Description

This module provides combinators for centering other widgets.

Synopsis

- hCenter :: Widget n -> Widget n
- hCenterWith :: Maybe Char -> Widget n -> Widget n
- hCenterLayer :: Widget n -> Widget n
- vCenter :: Widget n -> Widget n
- vCenterWith :: Maybe Char -> Widget n -> Widget n
- vCenterLayer :: Widget n -> Widget n
- center :: Widget n -> Widget n
- centerWith :: Maybe Char -> Widget n -> Widget n
- centerLayer :: Widget n -> Widget n
- centerAbout :: Location -> Widget n -> Widget n

# Centering horizontally

hCenter :: Widget n -> Widget n Source #

Center the specified widget horizontally. Consumes all available horizontal space.

hCenterWith :: Maybe Char -> Widget n -> Widget n Source #

Center the specified widget horizontally. Consumes all available horizontal space. Uses the specified character to fill in the space to either side of the centered widget (defaults to space).

hCenterLayer :: Widget n -> Widget n Source #

Center the specified widget horizontally using a Vty image translation. Consumes all available horizontal space. Unlike hCenter, this does not fill the surrounding space so it is suitable for use as a layer. Layers underneath this widget will be visible in regions surrounding the centered widget.

# Centering vertically

vCenter :: Widget n -> Widget n Source #

Center a widget vertically. Consumes all vertical space.

vCenterWith :: Maybe Char -> Widget n -> Widget n Source #

Center a widget vertically. Consumes all vertical space. Uses the specified character to fill in the space above and below the centered widget (defaults to space).

vCenterLayer :: Widget n -> Widget n Source #

Center the specified widget vertically using a Vty image translation. Consumes all available vertical space. Unlike vCenter, this does not fill the surrounding space so it is suitable for use as a layer. Layers underneath this widget will be visible in regions surrounding the centered widget.

# Centering both horizontally and vertically

center :: Widget n -> Widget n Source #

Center a widget both vertically and horizontally. Consumes all available vertical and horizontal space.

centerWith :: Maybe Char -> Widget n -> Widget n Source #

Center a widget both vertically and horizontally. Consumes all available vertical and horizontal space. Uses the specified character to fill in the space around the centered widget (defaults to space).

centerLayer :: Widget n -> Widget n Source #

Center a widget both vertically and horizontally using a Vty image translation. Consumes all available vertical and horizontal space. Unlike center, this does not fill in the surrounding space with a character so it is usable as a layer. Any widget underneath this one will be visible in the region surrounding the centered widget.

# Centering about an arbitrary origin

centerAbout :: Location -> Widget n -> Widget n Source #

Center the widget horizontally and vertically about the specified origin.