Skip to content

ui::Thickness

Header: winui/core/Geometry.hpp.

A per-edge thickness in DIPs, used for margins, paddings and border widths.

A number is the same value on every edge (.margin = 8). Other thicknesses name their edges, through ui::Edges (.margin = ui::Edges{.left = 32}) or ui::Symmetric (.padding = ui::Symmetric{.horizontal = 16, .vertical = 8}), so the code says which edge gets which value.

Example:

window.set_content(ui::VerticalStack{
    .margin   = ui::Symmetric{.horizontal = 24, .vertical = 12},
    .content  = {ui::Text{.text = "Indented", .margin = ui::Edges{.left = 16}}},
});

left

float left = 0.0f

Left edge, DIPs.

top

float top = 0.0f

Top edge, DIPs.

float right = 0.0f

Right edge, DIPs.

bottom

float bottom = 0.0f

Bottom edge, DIPs.

Thickness

constexpr Thickness() = default

All four edges 0.

Thickness

constexpr Thickness(float uniform)

The same value on all four edges, so a field takes .margin = 8.

Thickness

constexpr Thickness(const Edges& edges)

The edges edges names; the others 0.

Thickness

constexpr Thickness(const Symmetric& edges)

horizontal on the left and right, vertical on the top and bottom.

horizontal

float horizontal() const

left + right: the width this thickness takes out of a rect.

vertical

float vertical() const

top + bottom: the height this thickness takes out of a rect.