package main import ( _ "embed" "fmt" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" ) // Define your custom struct type MyStruct struct { Name string } //go:generate sh -c "printf %s $(git rev-parse --short HEAD) > commit.txt" //go:embed commit.txt var git_rev string // Download method for the struct func (s *MyStruct) Download() { fmt.Printf("Downloading %s...\n", s.Name) } var myList = []MyStruct{ {"AtlasLoot"}, {"Bartender4"}, {"Deadly Boss Mods"}, {"Details! Damage Meter"}, {"WeakAuras"}, {"ElvUI"}, {"BigWigs"}, {"Recount"}, {"GatherMate2"}, {"TomTom"}, {"Questie"}, {"TradeSkillMaster"}, {"HandyNotes"}, {"Bagnon"}, {"Threat Plates"}, {"GTFO"}, {"Plater Nameplates"}, {"Rarity"}, {"Pawn"}, {"Auctioneer"}, {"Shadowed Unit Frames"}, {"SexyMap"}, {"TidyPlates"}, {"MoveAnything"}, {"Postal"}, {"OmniCC"}, {"Leatrix Plus"}, {"SimulationCraft"}, {"VuhDo"}, {"KuiNameplates"}, } func main() { a := app.New() w := a.NewWindow(fmt.Sprintf("RexForge %s", git_rev)) w.Resize(fyne.NewSize(900, 600)) list := widget.NewList( func() int { return len(myList) }, func() fyne.CanvasObject { btn := widget.NewButton("", func() {}) label := widget.NewLabel("") return container.NewBorder(nil, nil, label, btn) }, func(i widget.ListItemID, o fyne.CanvasObject) { o.(*fyne.Container).RemoveAll() btn := widget.NewButtonWithIcon("Download", theme.DownloadIcon(), func() { myList[i].Download() }) btn.Importance = widget.LowImportance label := widget.NewLabel(myList[i].Name) row := container.NewBorder(nil, nil, label, btn) o.(*fyne.Container).Add(row) }) refresh_button := widget.NewButtonWithIcon("Refresh", theme.ViewRefreshIcon(), func() { println("Refresh") }) upall_button := widget.NewButtonWithIcon("Update All", theme.DownloadIcon(), func() { println("Update All") }) about_button := widget.NewButtonWithIcon("About", theme.InfoIcon(), func() { println("About") }) settings_button := widget.NewButtonWithIcon("Settings", theme.SettingsIcon(), func() { println("Settings") }) toprow := container.NewVBox( container.NewHBox( refresh_button, upall_button, layout.NewSpacer(), about_button, settings_button, ), widget.NewSeparator(), ) c := container.New( layout.NewBorderLayout(toprow, nil, nil, nil), toprow, container.NewStack(list), ) w.SetContent(c) w.ShowAndRun() }