widgets

package
v0.0.0-...-9ae858a Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ARROW = '➤'

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseWidget

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

func (*BaseWidget) AskRedraw

func (b *BaseWidget) AskRedraw()

func (*BaseWidget) AskingRedraw

func (b *BaseWidget) AskingRedraw(f func())

func (*BaseWidget) Clear

func (b *BaseWidget) Clear()

func (*BaseWidget) GetViewPort

func (b *BaseWidget) GetViewPort() *views.ViewPort

func (*BaseWidget) HandleTransitions

func (b *BaseWidget) HandleTransitions(ev *lib.Event) bool

func (*BaseWidget) HideCursor

func (b *BaseWidget) HideCursor()

func (*BaseWidget) IsActiveTerm

func (b *BaseWidget) IsActiveTerm() bool

func (*BaseWidget) Messagef

func (b *BaseWidget) Messagef(msg string, args ...interface{})

func (*BaseWidget) OnMessage

func (b *BaseWidget) OnMessage(f func(msg string, args ...interface{}))

func (*BaseWidget) OnSetViewPort

func (b *BaseWidget) OnSetViewPort(f func(view *views.ViewPort, screen tcell.Screen))

func (*BaseWidget) Print

func (b *BaseWidget) Print(x, y int, style tcell.Style, str string) int

func (*BaseWidget) Resize

func (b *BaseWidget) Resize()

func (*BaseWidget) ScrollDown

func (b *BaseWidget) ScrollDown(rows int)

func (*BaseWidget) ScrollUp

func (b *BaseWidget) ScrollUp(rows int)

func (*BaseWidget) SetContent

func (b *BaseWidget) SetContent(x int, y int, mainc rune, combc []rune, style tcell.Style)

func (*BaseWidget) SetViewPort

func (b *BaseWidget) SetViewPort(view *views.ViewPort, screen tcell.Screen)

func (*BaseWidget) ShowCursor

func (b *BaseWidget) ShowCursor(x int, y int)

func (*BaseWidget) Size

func (b *BaseWidget) Size() (int, int)

type ContentWithStyle

type ContentWithStyle struct {
	Content string
	Style   tcell.Style
}

func NewContent

func NewContent(c string) *ContentWithStyle

func (*ContentWithStyle) Reverse

func (cs *ContentWithStyle) Reverse(should bool) tcell.Style

type IStyled

type IStyled interface {
	StyledContent() []*ContentWithStyle
}

type ITreeLine

type ITreeLine interface {
	IStyled
	Depth() int
}

type ListWidget

type ListWidget struct {
	OnSelect func(IStyled)

	BaseWidget
	// contains filtered or unexported fields
}

func NewList

func NewList() *ListWidget

func (*ListWidget) AddLine

func (l *ListWidget) AddLine(line IStyled)

func (*ListWidget) ClearLines

func (l *ListWidget) ClearLines()

func (*ListWidget) Draw

func (l *ListWidget) Draw()

func (*ListWidget) HandleEvent

func (l *ListWidget) HandleEvent(ks []*lib.KeyStroke) bool

func (*ListWidget) SetSelected

func (l *ListWidget) SetSelected(s int)

type Terminal

type Terminal struct {
	BaseWidget

	OnClose func(err error)
	OnEvent func(event tcell.Event) bool
	OnStart func()
	OnTitle func(title string)
	// contains filtered or unexported fields
}

func NewTerminal

func NewTerminal(cmd *exec.Cmd) *Terminal

func (*Terminal) Close

func (term *Terminal) Close(err error)

func (*Terminal) Destroy

func (term *Terminal) Destroy()

func (*Terminal) Draw

func (term *Terminal) Draw()

func (*Terminal) Event

func (term *Terminal) Event(event tcell.Event) bool

func (*Terminal) Focus

func (term *Terminal) Focus(focus bool)

func (*Terminal) HandleEvent

func (term *Terminal) HandleEvent(ks []*lib.KeyStroke) bool

func (*Terminal) Invalidate

func (term *Terminal) Invalidate()

func (*Terminal) IsActiveTerm

func (term *Terminal) IsActiveTerm() bool

func (*Terminal) MouseEvent

func (term *Terminal) MouseEvent(localX int, localY int, event tcell.Event)

type Text

type Text struct {
	BaseWidget
	// contains filtered or unexported fields
}

func (*Text) Draw

func (t *Text) Draw()

func (*Text) GetContent

func (t *Text) GetContent() string

func (*Text) HandleEvent

func (t *Text) HandleEvent(ks []*lib.KeyStroke) bool

func (*Text) SetContent

func (t *Text) SetContent(content string)

type TreeWidget

type TreeWidget struct {
	OnSelect func(ITreeLine)
	ListWidget
	// contains filtered or unexported fields
}

func NewTree

func NewTree() *TreeWidget

func NewTreeWithInitSelected

func NewTreeWithInitSelected(init int) *TreeWidget

func (*TreeWidget) AddLine

func (t *TreeWidget) AddLine(line ITreeLine)

func (*TreeWidget) ClearLines

func (t *TreeWidget) ClearLines()

func (*TreeWidget) Draw

func (t *TreeWidget) Draw()

func (*TreeWidget) GetSelected

func (t *TreeWidget) GetSelected() ITreeLine

func (*TreeWidget) HandleEvent

func (t *TreeWidget) HandleEvent(ks []*lib.KeyStroke) bool

func (*TreeWidget) SetSelected

func (t *TreeWidget) SetSelected(s int)

type Widget

type Widget interface {
	HandleEvent(ks []*lib.KeyStroke) bool
	Draw()
	SetViewPort(view *views.ViewPort, screen tcell.Screen)
	GetViewPort() *views.ViewPort
	SetContent(x int, y int, mainc rune, combc []rune, style tcell.Style)
	IsActiveTerm() bool
	HandleTransitions(ev *lib.Event) bool

	AskRedraw()
	AskingRedraw(func())
	OnMessage(f func(msg string, args ...interface{}))

	Resize()
	Size() (int, int)
}

Jump to

Keyboard shortcuts

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