styles

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: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BorderDrawers = []BorderDrawer{
		BorderHidden: borderDrawer{
			// contains filtered or unexported fields
		},
	}
)

Functions

func LayoutContentBoxOrigin

func LayoutContentBoxOrigin(s ComputedStyle) geometry.Vec2D

Types

type BorderDrawer

type BorderDrawer interface {
	Left(BordersStyle, draw.Surface)
	Top(BordersStyle, draw.Surface)
	Right(BordersStyle, draw.Surface)
	Bottom(BordersStyle, draw.Surface)
}

type BorderSide

type BorderSide struct {
	Size  int
	Style BorderStyle
	draw.CellStyle
}

Border define style properties of a single border side.

type BorderStyle

type BorderStyle int8

BorderStyle enumerates border styles.

const (
	BorderHidden BorderStyle = iota
)

type BordersStyle

type BordersStyle struct {
	Top    BorderSide
	Bottom BorderSide
	Left   BorderSide
	Right  BorderSide
}

BordersStyle define borders style properties.

type ComputedStyle

type ComputedStyle struct {
	MarginStyle MarginPaddingStyle

	BordersStyle BordersStyle

	PaddingStyle MarginPaddingStyle

	draw.CellStyle

	ExtrasStyle any
}

ComputedStyle contains styling properties used for rendering.

func (ComputedStyle) Compute

func (cs ComputedStyle) Compute() ComputedStyle

Compute implements Style.

type MarginPaddingStyle

type MarginPaddingStyle struct {
	Left, Top, Right, Bottom int
}

MarginPaddingStyle define margin and padding style properties.

type Renderable

type Renderable[R render.Renderable] struct {
	Renderable R
	Styled     Styled
}

func (Renderable[R]) Draw

func (r Renderable[R]) Draw(surface draw.Surface)

Draw implements draw.Drawer.

func (Renderable[R]) IsDirty

func (r Renderable[R]) IsDirty() bool

IsDirty implements render.Renderable.

func (Renderable[R]) Layout

func (r Renderable[R]) Layout(co layout.Constraint) geometry.Size

Layout implements layout.Layout.

func (Renderable[R]) MarkDirty

func (r Renderable[R]) MarkDirty()

MarkDirty implements render.Renderable.

func (Renderable[R]) Style

func (r Renderable[R]) Style() Style

Style implements Styled.

type Style

type Style interface {
	// Compute styling properties and returns it. This enable Style object
	// to compute dynamically their properties and, therefore, support style inheritance,
	// relative units (percentage, viewport), etc.
	Compute() ComputedStyle
}

Style is a generic interface for widget styling.

type Styled

type Styled interface {
	Style() Style
}

Styled define object with styling properties.

Jump to

Keyboard shortcuts

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