layout

package
v0.0.0-...-b5b2f04 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Layout related types and utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraint

type Constraint struct {
	MinSize, MaxSize geometry.Size
	ParentSize       geometry.Size
	RootSize         geometry.Size
}

Constraint define layout constraint.

func (Constraint) ApplyOnHeight

func (c Constraint) ApplyOnHeight(height int) int

ApplyOnHeight applies the height constraints on the given height and return the constrained height.

func (Constraint) ApplyOnSize

func (c Constraint) ApplyOnSize(size geometry.Size) geometry.Size

ApplyOnSize applies the size constraints on the given size and return the constrained size.

func (Constraint) ApplyOnWidth

func (c Constraint) ApplyOnWidth(width int) int

ApplyOnWidth applies the width constraints on the given width and return the constrained width.

func (Constraint) Equals

func (c Constraint) Equals(other Constraint) bool

Equals returns true if the given Constraint is equal to this Constraint.

type Layout

type Layout interface {
	Layout(Constraint) geometry.Size
}

Layout is a generic interface for object that can produce BoxModel using the given Constraint.

type LayoutFunc

type LayoutFunc func(Constraint) geometry.Size

func (LayoutFunc) Layout

func (lf LayoutFunc) Layout(co Constraint) geometry.Size

Layout implements the Layout interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL