vxexp

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

README

vxexp

vxexp is a collection of experimental widgets and utility functions for the dank terminal UI library vaxis/vxfw by rockorager.

NOTE: This is not an official repository. There is no stability guarantee, nor is there a guarantee that any of the widgets in this repository will make it upstream.

vxexp tracks the latest version of vaxis/vxfw, and tries to upstream widgets or other changes where possible. Upstreamed widgets will eventually be removed from vxexp.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClampUint16

func ClampUint16(x, min, max uint16) uint16

func LoosenContext

func LoosenContext(ctx vxfw.DrawContext) vxfw.DrawContext

LoosenContext takes a vxfw.DrawContext and returns a context with no minimum sizes.

func TightenContext

func TightenContext(ctx vxfw.DrawContext, size vxfw.Size) vxfw.DrawContext

TightenContext returns a vxfw.DrawContext whose min and max along each dimension is as close to size as possible while still staying in-bounds. If either dimension of size is 0, it's ignored.

Types

type EventHandlerFunc

type EventHandlerFunc func(vaxis.Event, vxfw.EventPhase) (vxfw.Command, error)

EventHandlerFunc is a convenience function to make stateless widgets. EventHandlerFunc(fn) is a vxfw.EventHandler that calls fn during the event handling phase.

func (EventHandlerFunc) Draw

Draw implements vxfw.Widget

func (EventHandlerFunc) HandleEvent

func (fn EventHandlerFunc) HandleEvent(event vaxis.Event, phase vxfw.EventPhase) (vxfw.Command, error)

type WidgetFunc

type WidgetFunc func(vxfw.DrawContext) (vxfw.Surface, error)

WidgetFunc is convenience adapter to turn an ordinary function into a vxfw.Widget WidgetFunc(fn) is a vxfw.Widget that calls fn during the Draw phase.

func (WidgetFunc) Draw

func (fn WidgetFunc) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error)

Jump to

Keyboard shortcuts

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