ppforge/internal/ui/fieldadd.go

17 lines
434 B
Go

package ui
import (
"fyne.io/fyne/v2/widget"
"gitea.mmo.to/ppForge/ppforge/protocol"
)
// GetAdder returns a fyne button which on click creates a new field in the editor
func GetAdder(pEd *ProtocolEditor) *widget.Button {
fieldAdder := widget.NewButton("Add Field", func() {
f := protocol.NewEmptyField()
index := pEd.Reference.AppendField(*f)
pEd.AddFieldCreator(CreateFieldEditor(pEd, index, f))
})
return fieldAdder
}