ppforge/internal/ui/newobjectdialog.go

58 lines
1.3 KiB
Go
Raw Normal View History

package ui
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
type NewObjectDialog struct {
representation *fyne.Container
// views
selection *fyne.Container // 4buttons grid
protocolChooser *fyne.Container
packetChooser *fyne.Container
}
var pnod *NewObjectDialog
func CreateNewObjectDialog() *NewObjectDialog {
if pnod == nil {
pnod = &NewObjectDialog{}
pnod.representation = container.NewMax(nil)
// representation
// grid layout 100x100px elements in a center layout, 4 buttons, new Protocol, edit protocol, new Packet, edit Packet
buttons := []widget.Button{}
buttons = append(buttons, *widget.NewButton("New protocol", func() {
}))
buttons = append(buttons, *widget.NewButton("Edit protocol", func() {
}))
buttons = append(buttons, *widget.NewButton("New packet", func() {
}))
buttons = append(buttons, *widget.NewButton("Edit packet", func() {
}))
selectgrid := container.NewGridWithColumns(2, nil)
for _, v := range buttons {
selectgrid.Add(&v)
}
pnod.selection = container.NewMax(selectgrid)
pnod.representation.Add(pnod.selection)
// data
}
return pnod
}
func (nod *NewObjectDialog) Representation() *fyne.Container {
return nod.representation
}
func (nod *NewObjectDialog) Refresh() {
}