Skip to content

PaddingSpec

#include <Style.hpp>

Specifies padding on all four sides of a widget’s content area.

Padding is the space between a widget’s border and its content. All values are in cells (characters) — percentage-based padding is not supported since it would require knowing the widget’s final size in advance.

Example Usage:

style.padding = [PaddingSpec::all](/api/core/paddingspec#all)(1); // 1 cell on all sides
style.padding = [PaddingSpec::xy](/api/core/paddingspec#xy)(2, 1); // 2 left/right, 1 top/bottom
style.padding = {.top = 1, .bottom = 1}; // manual per-side
ReturnNameDescription
inttopPadding on the top edge (in cells)
intbottomPadding on the bottom edge (in cells)
intleftPadding on the left edge (in cells)
intrightPadding on the right edge (in cells)

int top = 0

Padding on the top edge (in cells)


int bottom = 0

Padding on the bottom edge (in cells)


int left = 0

Padding on the left edge (in cells)


int right = 0

Padding on the right edge (in cells)

ReturnNameDescription
PaddingSpecall static inlineCreates equal padding on all four sides.
PaddingSpecxy static inlineCreates padding with separate horizontal and vertical values.
PaddingSpecnone static inlineCreates zero padding on all sides.

static inline

static inline PaddingSpec all(int v)

Creates equal padding on all four sides.

  • v The number of cells to pad on each side

static inline

static inline PaddingSpec xy(int x, int y)

Creates padding with separate horizontal and vertical values.

  • x Padding on the left and right edges (in cells)

  • y Padding on the top and bottom edges (in cells)


static inline

static inline PaddingSpec none()

Creates zero padding on all sides.