frame

package
v0.0.0-...-56b0d0a Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 14 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

func GetCursorRow

func GetCursorRow() (int, error)

todo: will this be supported on windows?... https://github.com/nsf/termbox-go/blob/master/termbox_windows.go currently assumed VT100 compatible emulator

func GetTerminalSize

func GetTerminalSize() (int, int)

Types

type Config

type Config struct {
	Lines int

	HeaderRows     int
	FooterRows     int
	TrailOnRemove  bool
	PositionPolicy PositionPolicy
	ManualDraw     bool
	Output         *os.File
	// contains filtered or unexported fields
}

func (*Config) Height

func (config *Config) Height() int

func (*Config) VisibleHeight

func (config *Config) VisibleHeight() int

type EventHandler

type EventHandler interface {
	// contains filtered or unexported methods
}

type Frame

type Frame struct {
	Config Config

	HeaderLines []*Line
	BodyLines   []*Line
	FooterLines []*Line
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Frame, error)

func (*Frame) Append

func (frame *Frame) Append() (*Line, error)

func (*Frame) AppendFooter

func (frame *Frame) AppendFooter() (*Line, error)

func (*Frame) AppendHeader

func (frame *Frame) AppendHeader() (*Line, error)

func (*Frame) AppendTrail

func (frame *Frame) AppendTrail(str string)

func (*Frame) Clear

func (frame *Frame) Clear()

func (*Frame) Close

func (frame *Frame) Close() error

func (*Frame) Draw

func (frame *Frame) Draw() (errs []error)

func (*Frame) Height

func (frame *Frame) Height() int

func (*Frame) Insert

func (frame *Frame) Insert(index int) (*Line, error)

func (*Frame) IsClosed

func (frame *Frame) IsClosed() bool

todo: I think this should be decided by the user via a Close() action, not by the indication of closed lines since you can always add another line... you don't know when an empty frame should remain open or not

func (*Frame) IsPastScreenBottom

func (frame *Frame) IsPastScreenBottom() bool

func (*Frame) IsPastScreenTop

func (frame *Frame) IsPastScreenTop() bool

func (*Frame) Move

func (frame *Frame) Move(rows int)

func (*Frame) Prepend

func (frame *Frame) Prepend() (*Line, error)

func (*Frame) PrependFooter

func (frame *Frame) PrependFooter() (*Line, error)

func (*Frame) PrependHeader

func (frame *Frame) PrependHeader() (*Line, error)

func (*Frame) Remove

func (frame *Frame) Remove(line *Line) error

func (*Frame) SetAutoDraw

func (frame *Frame) SetAutoDraw(enabled bool)

func (*Frame) VisibleHeight

func (frame *Frame) VisibleHeight() int

type Line

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

func NewLine

func NewLine(row int, events chan ScreenEvent) *Line

func (*Line) Clear

func (line *Line) Clear() error

func (*Line) ClearAndClose

func (line *Line) ClearAndClose() error

func (*Line) Close

func (line *Line) Close() error

func (*Line) Hide

func (line *Line) Hide() error

func (*Line) Id

func (line *Line) Id() uuid.UUID

func (*Line) IsClosed

func (line *Line) IsClosed() bool

func (*Line) Open

func (line *Line) Open() error

func (*Line) Read

func (line *Line) Read(buff []byte) (int, error)

func (*Line) Remove

func (line *Line) Remove() error

func (*Line) Row

func (line *Line) Row() int

func (*Line) Show

func (line *Line) Show() error

func (Line) String

func (line Line) String() string

func (*Line) Write

func (line *Line) Write(buff []byte) (int, error)

func (*Line) WriteAndClose

func (line *Line) WriteAndClose(buff []byte) (int, error)

func (*Line) WriteString

func (line *Line) WriteString(str string) error

func (*Line) WriteStringAndClose

func (line *Line) WriteStringAndClose(str string) (int, error)

type Policy

type Policy interface {
	// contains filtered or unexported methods
}

type PositionPolicy

type PositionPolicy int
const (
	PolicyOverflow     PositionPolicy = iota // allowed to go anywhere, even off the screen
	PolicyFloatForward                       // similar to free, except once it hits the bottom, it does not go off the screen (it makes more realestate). If the frame is too large for the screen, overflow (including headers) occurs at the top of the screen.
	// PolicyFloatForwardBuffered                       // similar to forward-trail, except once it hits the bottom, it does not go off the screen... instead it will act like a bottom-frame with the header fixed to the top of the screen. (it does NOT make more realestate, but instead buffers the unseen output and flushes it all to the screen at the end.). The header and footer stays on the screen while content is overflowed.
	PolicyFloatTop    // top fixed
	PolicyFloatBottom // bottom fixed
)

func (PositionPolicy) String

func (float PositionPolicy) String() string

type ScreenEvent

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

type TestEventHandler

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

func NewTestEventHandler

func NewTestEventHandler(t *testing.T) *TestEventHandler

Jump to

Keyboard shortcuts

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