40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
|
package ui
|
||
|
|
||
|
import "git.bullercodeworks.com/brian/wandle"
|
||
|
|
||
|
/*
|
||
|
ViewPort helps keep track of what's being displayed on the screen
|
||
|
It matches the widdle interface:
|
||
|
git.bullercodeworks.com/brian/widdles/widdle.go
|
||
|
*/
|
||
|
type ViewPort struct {
|
||
|
x, y int
|
||
|
width int
|
||
|
height int
|
||
|
scrollRow int
|
||
|
active bool
|
||
|
|
||
|
firstRow int
|
||
|
buffer []string
|
||
|
}
|
||
|
|
||
|
func (w *ViewPort) Init() wandle.Cmd {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (w *ViewPort) Update(wandle.Msg) wandle.Cmd {
|
||
|
return nil
|
||
|
}
|
||
|
func (w *ViewPort) View(style wandle.Style) {}
|
||
|
func (w *ViewPort) IsActive() bool { return w.active }
|
||
|
func (w *ViewPort) SetActive(b bool) { w.active = b }
|
||
|
func (w *ViewPort) Focusable() bool { return true }
|
||
|
func (w *ViewPort) SetX(x int) { w.x = x }
|
||
|
func (w *ViewPort) SetY(y int) { w.y = y }
|
||
|
func (w *ViewPort) GetX() int { return w.x }
|
||
|
func (w *ViewPort) GetY() int { return w.y }
|
||
|
func (w *ViewPort) GetHeight() int { return w.height }
|
||
|
func (w *ViewPort) GetWidth() int { return w.width }
|
||
|
|
||
|
func (w *ViewPort) SetBuffer(buffer []string) { w.buffer = buffer }
|