Module: ui.layout.box

Source: ./ui/layout/box.reef


Overview

ui/layout/box.reef - Simple box/stack layout Part of reef-stdlib UI module

This module provides a simple box layout that arranges children sequentially in either horizontal or vertical direction. It's simpler than flexbox but covers most basic layout needs.


Types

Direction (enum)

Variants:

  • Horizontal
  • Vertical

Alignment (enum)

Variants:

  • Start
  • Center
  • End
  • Stretch

BoxLayout

Fields:

Name Type
direction Direction
spacing float
padding_top float
padding_right float
padding_bottom float
padding_left float
alignment Alignment

ChildSize

Fields:

Name Type
width float
height float

Functions

fn direction_horizontal(): Direction

fn direction_vertical(): Direction

fn is_horizontal(d: Direction): bool

fn is_vertical(d: Direction): bool

fn align_start(): Alignment

fn align_center(): Alignment

fn align_end(): Alignment

fn align_stretch(): Alignment

fn is_align_start(a: Alignment): bool

fn is_align_center(a: Alignment): bool

fn is_align_end(a: Alignment): bool

fn is_align_stretch(a: Alignment): bool

fn hbox(spacing: float): BoxLayout

fn vbox(spacing: float): BoxLayout

fn box_layout(direction: Direction, spacing: float): BoxLayout

fn box_layout_full(direction: Direction, spacing: float, padding_top: float, padding_right: float, padding_bottom: float, padding_left: float, alignment: Alignment): BoxLayout

fn box_direction(b: BoxLayout): Direction

fn box_spacing(b: BoxLayout): float

fn box_padding_top(b: BoxLayout): float

fn box_padding_right(b: BoxLayout): float

fn box_padding_bottom(b: BoxLayout): float

fn box_padding_left(b: BoxLayout): float

fn box_alignment(b: BoxLayout): Alignment

fn box_with_spacing(b: BoxLayout, spacing: float): BoxLayout

fn box_with_padding(b: BoxLayout, all: float): BoxLayout

fn box_with_padding_symmetric(b: BoxLayout, vertical: float, horizontal: float): BoxLayout

fn box_with_alignment(b: BoxLayout, alignment: Alignment): BoxLayout

fn child_size(width: float, height: float): ChildSize

fn child_size_width(c: ChildSize): float

fn child_size_height(c: ChildSize): float

fn box_layout_children(b: BoxLayout, constraints: layout.Constraints, child_sizes: [ChildSize], child_count: int): layout.LayoutResult

fn calculate_total_size(b: BoxLayout, child_sizes: [ChildSize], child_count: int): core.Size

fn box_preferred_size(b: BoxLayout, child_sizes: [ChildSize], child_count: int): core.Size


Procedures

proc layout_horizontal(b: BoxLayout, available_width: float, available_height: float, child_sizes: [ChildSize], child_count: int, children: [layout.ChildLayout])

proc layout_vertical(b: BoxLayout, available_width: float, available_height: float, child_sizes: [ChildSize], child_count: int, children: [layout.ChildLayout])


Generated by reefc doc