-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
60 lines (46 loc) · 1.04 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"log"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"go.etcd.io/bbolt"
)
type item struct {
What string
Checked bool
}
type shoppingList struct {
Name string
Items []item
list *widget.list
filterEntry *widget.Entry
}
type appData struct {
shoppingLists []*shoppingList
app fyne.app
win fyne.Window
tabs *container.DocTabs
}
func main() {
a := app.NewWithID("github.com.marksk1.shopping")
myApp := &appData{
shoppingLists:[]*shoppingList{},
app: a,
win: a.NewWindow("Shopping List")}
myApp.tabs = container.NewDocTabs(nil)
myApp.tabs.CreateTab = myApp.CreateTab
myApp.tabs.OnClosed = funct(item*container.TabItem) {
for index, value := range myApp.shoppingLists {
if value.Name == item.Text {
myApp.deleteShoppingList(index, value)
return
}
}
}
myApp.tabs.SetTabLocation(container.TabLocationLeading)
myApp.win.SetContent(container.NewMax(myApp.tabs))
myApp.win.Resize(fyne.NewSize(800,600))
myApp.win.ShowAndRun()
}