AddOption creates and adds a new menu item to this menu with the specified text and returns the pointer to the created menu item.
(text string)
| 162 | // AddOption creates and adds a new menu item to this menu with the |
| 163 | // specified text and returns the pointer to the created menu item. |
| 164 | func (m *Menu) AddOption(text string) *MenuItem { |
| 165 | |
| 166 | mi := newMenuItem(text, m.styles.Item) |
| 167 | m.Panel.Add(mi) |
| 168 | m.items = append(m.items, mi) |
| 169 | mi.menu = m |
| 170 | m.recalc() |
| 171 | return mi |
| 172 | } |
| 173 | |
| 174 | // AddSeparator creates and adds a new separator to the menu |
| 175 | func (m *Menu) AddSeparator() *MenuItem { |
no test coverage detected