Documentation
¶
Index ¶
- Variables
- func NewPoint(x, y func() int) func() Point
- func ShrinkAreaTransformer(dx, dy int) func(parent Area) Area
- func WholeArea() func(parent Area) Area
- type Area
- func (a Area) Add(x1, y1, x2, y2 int) Area
- func (a Area) Bottom(y int) func() int
- func (a Area) BottomRight() func() Point
- func (a Area) Copy() Area
- func (a Area) Height() int
- func (a Area) Inside(x, y int) bool
- func (a Area) Left(x int) func() int
- func (a Area) OnBottom() func() int
- func (a Area) OnLeft() func() int
- func (a Area) OnRight() func() int
- func (a Area) OnTop() func() int
- func (a Area) Right(x int) func() int
- func (a Area) Top(y int) func() int
- func (a Area) TopLeft() func() Point
- func (a Area) Valid() bool
- func (a Area) Width() int
- type AreaTransformer
- type ButtonStyle
- type Cards
- func (e *Cards) BringUp(id string)
- func (e *Cards) Children() []Drawable
- func (e *Cards) Disabled()
- func (e *Cards) Draw(c *console.Console)
- func (e *Cards) Enabled()
- func (e *Cards) Insert(id string, c Drawable)
- func (e *Cards) LostFocus()
- func (e *Cards) OnEvent(event tb.Event)
- func (e *Cards) ReceiveFocus()
- func (e *Cards) Remove(id string)
- func (e *Cards) SetHidden()
- func (e *Cards) SetVisible()
- type Color
- type Drawable
- type FrameStyle
- type Point
- type View
- func (e *View) Add(child Drawable)
- func (e *View) Children() []Drawable
- func (e *View) Disabled()
- func (e *View) Draw(_ *console.Console)
- func (e *View) Enabled()
- func (e *View) GetArea() Area
- func (e *View) GetColor() Color
- func (e *View) HasFocus() bool
- func (e *View) InitView(transformer AreaTransformer)
- func (e *View) IsEnabled() bool
- func (e *View) IsVisible() bool
- func (e *View) LostFocus()
- func (e *View) OnEvent(_ tb.Event)
- func (e *View) OnResize()
- func (e *View) ReceiveFocus()
- func (e *View) SetColor(color Color)
- func (e *View) SetHidden()
- func (e *View) SetParent(parent Drawable)
- func (e *View) SetTransformer(transformer AreaTransformer)
- func (e *View) SetVisible()
- type Window
Constants ¶
This section is empty.
Variables ¶
View Source
var BoldFrameStyle = FrameStyle{ Top: []rune{'┏', '┳', '┓'}, Intersect: []rune{'┣', '╋', '┫'}, Bottom: []rune{'┗', '┻', '┛'}, Middle: []rune{'┃', '━'}, }
View Source
var DoubleFrameStyle = FrameStyle{ Top: []rune{'╔', '╦', '╗'}, Intersect: []rune{'╠', '╬', '╣'}, Bottom: []rune{'╚', '╩', '╝'}, Middle: []rune{'║', '═'}, }
View Source
var NormalFrameStyle = FrameStyle{ Top: []rune{'┌', '┬', '┐'}, Intersect: []rune{'├', '┼', '┤'}, Bottom: []rune{'└', '┴', '┘'}, Middle: []rune{'│', '─'}, }
NormalFrameStyle uses https://en.wikipedia.org/wiki/Box-drawing_characters
Functions ¶
func ShrinkAreaTransformer ¶
Types ¶
type Area ¶
func (Area) BottomRight ¶
type AreaTransformer ¶
type ButtonStyle ¶
type ButtonStyle struct {
TextColor *Color
FrameColor *Color
FrameStyle *FrameStyle
TextAttribute tb.Attribute
}
type Cards ¶
type Cards struct {
View
// contains filtered or unexported fields
}
func CreateCards ¶
func CreateCards(area AreaTransformer) *Cards
func (*Cards) ReceiveFocus ¶
func (e *Cards) ReceiveFocus()
func (*Cards) SetVisible ¶
func (e *Cards) SetVisible()
type Drawable ¶
type Drawable interface {
Draw(c *console.Console)
OnEvent(event tb.Event)
OnResize()
GetArea() Area
Add(child Drawable) // do not use these 3 function directly.
SetParent(Drawable)
Children() []Drawable
SetVisible() // show/hide element
SetHidden()
IsVisible() bool
ReceiveFocus() // tell element that it's got focus - keyboard events goes to this element
LostFocus()
HasFocus() bool
Disabled() // tell element that it's disabled and no longer receives events from mause or keyboard
Enabled()
IsEnabled() bool
}
type FrameStyle ¶
type View ¶
type View struct {
// contains filtered or unexported fields
}
func (*View) InitView ¶
func (e *View) InitView(transformer AreaTransformer)
func (*View) ReceiveFocus ¶
func (e *View) ReceiveFocus()
func (*View) SetTransformer ¶
func (e *View) SetTransformer(transformer AreaTransformer)
func (*View) SetVisible ¶
func (e *View) SetVisible()
type Window ¶
func (*Window) DefaultButtonStyle ¶
func (e *Window) DefaultButtonStyle(pressed bool) ButtonStyle
func (*Window) DefaultColor ¶
Click to show internal directories.
Click to hide internal directories.