5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 20:40:33 +08:00

Add Menu.Merge() to combine 2 menus

This commit is contained in:
Lea Anthony 2021-01-15 11:53:55 +11:00
parent b435ec1217
commit 7ac8cc6b8b
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -12,6 +12,14 @@ func (m *Menu) Append(item *MenuItem) {
m.Items = append(m.Items, item) m.Items = append(m.Items, item)
} }
// Merge will append the items in the given menu
// into this menu
func (m *Menu) Merge(menu *Menu) {
for _, item := range menu.Items {
m.Items = append(m.Items, item)
}
}
func (m *Menu) Prepend(item *MenuItem) { func (m *Menu) Prepend(item *MenuItem) {
m.Items = append([]*MenuItem{item}, m.Items...) m.Items = append([]*MenuItem{item}, m.Items...)
} }