last_light/ui/ui.go

33 lines
540 B
Go
Raw Normal View History

2024-04-21 03:48:58 +03:00
package ui
import (
"mvvasilev/last_light/util"
2024-04-24 17:11:33 +03:00
"github.com/gdamore/tcell/v2"
"github.com/gdamore/tcell/v2/views"
2024-04-21 03:48:58 +03:00
"github.com/google/uuid"
)
type UIElement interface {
UniqueId() uuid.UUID
2024-04-24 17:11:33 +03:00
MoveTo(x, y uint16)
2024-04-21 03:48:58 +03:00
Position() util.Position
2024-04-24 17:11:33 +03:00
Size() util.Size
Draw(v views.View)
Input(e *tcell.EventKey)
}
type UIHighlightableElement interface {
IsHighlighted() bool
Highlight()
Unhighlight()
SetHighlighted(highlighted bool)
UIElement
}
type UISelectableElement interface {
Select()
OnSelect(func())
UIHighlightableElement
2024-04-21 03:48:58 +03:00
}