// BuildMenu fills the menu with the given actions list. // func (o *Actions) BuildMenu(menu cdtype.Menuer, actionIds []int) { for _, ID := range actionIds { act := o.list[ID] var entry cdtype.MenuWidgeter switch act.Menu { case cdtype.MenuEntry: entry = menu.AddEntry(act.Name, act.Icon, o.Callback(act.ID)) case cdtype.MenuSeparator: menu.AddSeparator() case cdtype.MenuCheckBox: entry = menu.AddCheckEntry(act.Name, *act.Bool, o.Callback(act.ID)) if act.Call == nil { act.Call = func() { *act.Bool = !*act.Bool } } case cdtype.MenuRadioButton: entry = menu.AddRadioEntry(act.Name, *act.Bool, act.Group, o.Callback(act.ID)) // case cdtype.MenuSubMenu: } if entry != nil && act.Tooltip != "" { entry.SetTooltipText(act.Tooltip) } } }