vxfw

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp() (*App, error)

func (*App) Characters

func (a *App) Characters(s string) []vaxis.Character

Characters turns a string into a slice of measured graphemes

func (App) PostEvent

func (a App) PostEvent(ev vaxis.Event)

func (*App) Run

func (a *App) Run(w Widget) error

Run the application

type BatchCmd

type BatchCmd []Command

type Command

type Command interface{}

type CursorState

type CursorState struct {
	Row   uint16
	Col   uint16
	Shape vaxis.CursorStyle
}

type DrawContext

type DrawContext struct {
	// The minimum size the widget must render as
	Min Size
	// The maximum size the widget must render as. A value of math.MaxUint16
	// in either dimension means that dimension has no limit
	Max Size
	// Function to turn a string into a slice of characters. This splits the
	// string into graphemes and measures each grapheme
	Characters func(string) []vaxis.Character
}

type EventPhase

type EventPhase uint8

EventPhase is the phase of the event during the event handling process. Possible values are

CapturePhase
TargetPhase
BubblePhase
const (
	CapturePhase EventPhase = iota
	TargetPhase
	BubblePhase
)

type QuitCmd

type QuitCmd struct{}

type RedrawCmd

type RedrawCmd struct{}

type RelativePoint

type RelativePoint struct {
	Row int
	Col int
}

type Size

type Size struct {
	Width  uint16
	Height uint16
}

func (Size) UnboundedHeight

func (s Size) UnboundedHeight() bool

func (Size) UnboundedWidth

func (s Size) UnboundedWidth() bool

type SubSurface

type SubSurface struct {
	Origin  RelativePoint
	Surface Surface
	ZIndex  int
}

func NewSubSurface

func NewSubSurface(col int, row int, s Surface) SubSurface

type Surface

type Surface struct {
	Size     Size
	Widget   Widget
	Cursor   *CursorState
	Buffer   []vaxis.Cell
	Children []SubSurface
}

func NewSurface

func NewSurface(width uint16, height uint16, w Widget) Surface

Creates a new surface. The resulting surface will have a Buffer with capacity large enough for Size

func (*Surface) AddChild

func (s *Surface) AddChild(col int, row int, child Surface)

type Widget

type Widget interface {
	HandleEvent(vaxis.Event, EventPhase) (Command, error)
	Draw(DrawContext) (Surface, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳