drop NewViewManager function
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
abb276f6f1
commit
c635fdd0c4
5
main.go
5
main.go
|
@ -38,8 +38,7 @@ func main() {
|
|||
Current: true,
|
||||
SelFgColor: gocui.ColorBlack,
|
||||
SelBgColor: gocui.ColorGreen,
|
||||
// extra field for view state
|
||||
State: peers,
|
||||
State: peers,
|
||||
// corner positions
|
||||
TopLeft: func(mx, my int) (int, int) {
|
||||
return 0, 0
|
||||
|
@ -69,7 +68,7 @@ func main() {
|
|||
|
||||
views := []*ViewController{mainView, infoView}
|
||||
|
||||
vm := NewViewManager(g, views)
|
||||
vm := ViewManager{g: g, views: views}
|
||||
|
||||
g.SetManagerFunc(vm.Layout)
|
||||
|
||||
|
|
16
view.go
16
view.go
|
@ -18,8 +18,8 @@ type ViewController struct {
|
|||
SelBgColor gocui.Attribute
|
||||
SelFgColor gocui.Attribute
|
||||
Keybindings []Binding
|
||||
Manager ViewManager
|
||||
State interface{}
|
||||
// extra field for view state
|
||||
State interface{}
|
||||
}
|
||||
|
||||
type ViewManager struct {
|
||||
|
@ -27,18 +27,6 @@ type ViewManager struct {
|
|||
views []*ViewController
|
||||
}
|
||||
|
||||
func NewViewManager(g *gocui.Gui, views []*ViewController) *ViewManager {
|
||||
vm := ViewManager{
|
||||
g: g,
|
||||
views: views,
|
||||
}
|
||||
// Attach a ViewManager instance to Views
|
||||
for _, v := range vm.views {
|
||||
v.Manager = vm
|
||||
}
|
||||
return &vm
|
||||
}
|
||||
|
||||
func (m *ViewManager) Layout(g *gocui.Gui) error {
|
||||
mx, my := g.Size()
|
||||
|
||||
|
|
Loading…
Reference in New Issue