Documentation
¶
Index ¶
- type App
- type BatchCmd
- type Command
- type ConsumeEventCmd
- type CopyToClipboardCmd
- type CursorState
- type DebugCmd
- type DrawContext
- type Event
- type EventCapturer
- type EventHandler
- type EventPhase
- type FocusWidgetCmd
- type Init
- type MouseEnter
- type MouseLeave
- type QuitCmd
- type RedrawCmd
- type RefreshCmd
- type RelativePoint
- type SendNotificationCmd
- type SetMouseShapeCmd
- type SetTitleCmd
- type Size
- type SubSurface
- type Surface
- type Widget
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 (*App) Characters ¶
Characters turns a string into a slice of measured graphemes
type BatchCmd ¶
type BatchCmd []Command
BatchCmd is a batch of other commands
func ConsumeAndRedraw ¶
func ConsumeAndRedraw() BatchCmd
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 EventCapturer ¶
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 MouseEnter ¶
type MouseEnter struct{}
type MouseLeave ¶
type MouseLeave struct{}
type RelativePoint ¶
type SendNotificationCmd ¶
SendNotificationCmd sends a system notification
type SetMouseShapeCmd ¶
type SetMouseShapeCmd vaxis.MouseShape
SetMouseShapeCmd sets the mouse shape
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 ¶
Creates a new surface. The resulting surface will have a Buffer with capacity large enough for Size
func (*Surface) FillCharacter ¶
FillCharacter writes ch to all cells in s
type Widget ¶
type Widget interface {
Draw(DrawContext) (Surface, error)
}