-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainmenu.go
76 lines (63 loc) · 1.62 KB
/
mainmenu.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main
import (
"log/slog"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
func makeMainMenu(a fyne.App, w fyne.Window) *fyne.MainMenu {
// File
file_new := fyne.NewMenuItem("New", func() {
slog.Info("selected menu item File>New")
newFile(a, w)
})
file_new.Icon = theme.FileIcon()
file_open := fyne.NewMenuItem("Open", func() {
slog.Info("selected menu item File>Open")
openFile(a, w)
})
file_open.Icon = theme.FolderOpenIcon()
file_save := fyne.NewMenuItem("Save", func() {
slog.Info("selected menu item File>Save")
saveFile(a, w)
})
file_save.Icon = theme.DocumentSaveIcon()
file_saveAs := fyne.NewMenuItem("Save As", func() {
slog.Info("selected menu item File>Save As")
saveFileAs(a, w)
})
file_saveAs.Icon = theme.DocumentSaveIcon()
file_export_audio := fyne.NewMenuItem("Export Audio", func() {
slog.Info("selected menu item File>Export Audio")
exportAudio(a, w)
})
file_export_audio.Icon = theme.MediaMusicIcon()
file := fyne.NewMenu("File",
file_new,
fyne.NewMenuItemSeparator(),
file_open,
fyne.NewMenuItemSeparator(),
file_save,
file_saveAs,
fyne.NewMenuItemSeparator(),
file_export_audio,
)
// Edit
edit_settings := fyne.NewMenuItem("Settings", func() {
slog.Info("selected menu item Edit>Settings")
showSettings(a)
})
edit_settings.Icon = theme.SettingsIcon()
edit := fyne.NewMenu("Edit",
edit_settings,
)
// Help
help_about := fyne.NewMenuItem("About", func() {
slog.Info("selected menu item Help>About")
showAboutDialog(a, w)
})
help_about.Icon = theme.InfoIcon()
help := fyne.NewMenu("Help",
help_about,
)
return fyne.NewMainMenu(file, edit, help)
}