vxfw

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT, Apache-2.0 Imports: 7 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(opts vaxis.Options) (*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) NewImage

func (a *App) NewImage(img image.Image) (vaxis.Image, error)

NewImage creates a new image using the highest quality renderer the terminal is capable of. The returned image can be displayed with the vxfw/image widget.

func (App) PostEvent

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

func (*App) Resume

func (a *App) Resume() error

func (*App) Run

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

Run the application

func (*App) Suspend

func (a *App) Suspend() error

type BatchCmd

type BatchCmd []Command

BatchCmd is a batch of other commands

func ConsumeAndRedraw

func ConsumeAndRedraw() BatchCmd

type Command

type Command interface{}

type ConsumeEventCmd

type ConsumeEventCmd struct{}

ConsumeEventCmd tells the application to stop the event propagation

type CopyToClipboardCmd

type CopyToClipboardCmd string

CopyToClipboard copies the provided string to the host clipboard

type CursorState

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

type DebugCmd

type DebugCmd struct{}

DebugCmd tells the runtime to print the Surface tree each render

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
}

func (DrawContext) WithConstraints

func (ctx DrawContext) WithConstraints(min, max Size) DrawContext

WithConstraints returns a new DrawContext with the supplied min and max size Use DrawContext.WithMin or DrawContext.WithMax to change one constraint

func (DrawContext) WithMax

func (ctx DrawContext) WithMax(max Size) DrawContext

WithMax returns a new DrawContext with the maximum size set to max

func (DrawContext) WithMin

func (ctx DrawContext) WithMin(min Size) DrawContext

WithMin returns a new DrawContext with the minimum size set to min

type Event

type Event interface{}

type EventCapturer

type EventCapturer interface {
	CaptureEvent(vaxis.Event) (Command, error)
}

EventCapturer is a Widget which can capture events before they are delivered to the target widget. To capture an event, the EventCapturer must be an ancestor of the target widget

type EventHandler

type EventHandler interface {
	HandleEvent(vaxis.Event, EventPhase) (Command, error)
}

EventHandler is a Widget which can handle events. It's a separate interface to simplify creating custom [Widget]s that do not require event handling.

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 FocusWidgetCmd

type FocusWidgetCmd Widget

FocusWidgetCmd sets the focus to the widget

type Init

type Init struct{}

Sent as the first event to the root widget

type MouseEnter

type MouseEnter struct{}

type MouseLeave

type MouseLeave struct{}

type QuitCmd

type QuitCmd struct{}

QuitCmd tells the application to exit

type RedrawCmd

type RedrawCmd struct{}

RedrawCmd tells the UI to redraw

type RefreshCmd

type RefreshCmd struct{}

RefreshCmd tells the UI to flush a complete redraw

type RelativePoint

type RelativePoint struct {
	Row int
	Col int
}

type SendNotificationCmd

type SendNotificationCmd struct {
	Title string
	Body  string
}

SendNotificationCmd sends a system notification

type SetMouseShapeCmd

type SetMouseShapeCmd vaxis.MouseShape

SetMouseShapeCmd sets the mouse shape

type SetTitleCmd

type SetTitleCmd string

SetTitleCmd sets the title of the terminal

type Size

type Size struct {
	Width  uint16
	Height uint16
}

func (Size) HasUnboundedHeight

func (s Size) HasUnboundedHeight() bool

func (Size) HasUnboundedWidth

func (s Size) HasUnboundedWidth() 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
	Render   func(vaxis.Window)
}

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)

func (*Surface) Fill

func (s *Surface) Fill(cell vaxis.Cell)

Fill writes cell to all cells in s

func (*Surface) FillCharacter

func (s *Surface) FillCharacter(ch vaxis.Character)

FillCharacter writes ch to all cells in s

func (*Surface) FillStyle

func (s *Surface) FillStyle(style vaxis.Style)

FillStyle sets style on all cells in s

func (*Surface) WriteCell

func (s *Surface) WriteCell(col uint16, row uint16, cell vaxis.Cell)

type Widget

type Widget interface {
	Draw(DrawContext) (Surface, error)
}

Directories

Path Synopsis
Package image provides a vxfw widget for rendering vaxis images.
Package image provides a vxfw widget for rendering vaxis images.

Jump to

Keyboard shortcuts

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