()
| 21 | func (km *KeyMapButton) WidgetValue() any { return &km.MapName } |
| 22 | |
| 23 | func (km *KeyMapButton) Init() { |
| 24 | km.Button.Init() |
| 25 | km.SetType(ButtonTonal) |
| 26 | km.Updater(func() { |
| 27 | km.SetText(string(km.MapName)) |
| 28 | }) |
| 29 | InitValueButton(km, false, func(d *Body) { |
| 30 | d.SetTitle("Select a key map") |
| 31 | si := 0 |
| 32 | _, curRow, _ := keymap.AvailableMaps.MapByName(km.MapName) |
| 33 | tv := NewTable(d).SetSlice(&keymap.AvailableMaps).SetSelectedIndex(curRow).BindSelect(&si) |
| 34 | tv.OnChange(func(e events.Event) { |
| 35 | name := keymap.AvailableMaps[si] |
| 36 | km.MapName = keymap.MapName(name.Name) |
| 37 | }) |
| 38 | }) |
| 39 | } |
| 40 | |
| 41 | // KeyChordButton represents a [key.Chord] value with a button. |
| 42 | type KeyChordButton struct { |
nothing calls this directly
no test coverage detected