tui/view.go
Timon Ringwald dfa00f5fe3 more views
2022-04-02 13:01:41 +02:00

34 lines
872 B
Go

package tui
// View defines the behavior of any element displayable on screen.
// To define custom Views, it is recommended to add ViewTmpl
// as the promoted anonymous field for your custom View struct.
// It implements the View interface with useful default behavior
type View interface {
Events
SetStyle(s Style)
Style() Style
Layout() (prefWidth, prefHeight int)
Draw(buf *ViewBuffer)
}
// Group defines the behavior of a View which can hold multiple sub views
type Group interface {
View
Views() []View
}
// Wrapper defines the behavior of a GroupView which can hold exactly one sub view.
// To define custom Wrappers, it is recommended to add WrapperTmpl
// as the promoted anonymous field for your custom Wrapper struct.
// It implements the Wrapper interface with useful default behavior
type Wrapper interface {
Group
SetView(View)
View() View
}