izapple2/frontend/a2fyne/panelDevices.go
Chris Green e770dbc058 Make device panel scrollable
Previous panel caused main window to resize when device panel was enabled so if the vertical resolution wasn't big enough you'd lose visibility of the toolbar and the text would be noticeably distorted.
2023-10-25 09:27:18 +02:00

34 lines
554 B
Go

package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
)
type panelDevices struct {
s *state
w *fyne.Container
joystick *panelJoystick
}
func newPanelDevices(s *state) *panelDevices {
var pd panelDevices
pd.s = s
pd.w = container.NewMax()
c := container.NewVBox()
pd.joystick = newPanelJoystick()
c.Add(pd.joystick.w)
var cards = s.a.GetCards()
for i, card := range cards {
if card != nil && card.GetName() != "" {
c.Add(newPanelCard(i, card).w)
}
}
pd.w.Add(container.NewVScroll(c))
return &pd
}