Often we'd want to work with set of primitives that are boxed (e.g. have *Box)
This for example needed for managing borders state/color in general way in multi-panels layout.
I suggest we define:
// BoxedPrimitive defines a primitive with a Box
// It's implemented by Box and any type that has *Box field
type BoxedPrimitive interface {
Primitive
GetBox() *Box
}
And implement it once as:
// GetBox returns the box itself implementing the BoxedPrimitive interface.
func (b *Box) GetBox() *Box {
return b
}
This allows to have code like:
var panels := []tview.BoxedPrimitive = { tview.NewTextView(), tview.NewList(), tview.NewTable()}
for _, p := range panels {
p.GetBox().SetBorderColor(someColor)
}
Often we'd want to work with set of primitives that are boxed (e.g. have
*Box)This for example needed for managing borders state/color in general way in multi-panels layout.
I suggest we define:
And implement it once as:
This allows to have code like: