()
| 47 | func (kc *KeyChordButton) WidgetValue() any { return &kc.Chord } |
| 48 | |
| 49 | func (kc *KeyChordButton) Init() { |
| 50 | kc.Button.Init() |
| 51 | kc.SetType(ButtonTonal) |
| 52 | kc.OnKeyChord(func(e events.Event) { |
| 53 | if !kc.StateIs(states.Focused) { |
| 54 | return |
| 55 | } |
| 56 | kc.Chord = e.KeyChord() |
| 57 | e.SetHandled() |
| 58 | kc.UpdateChange() |
| 59 | }) |
| 60 | kc.Updater(func() { |
| 61 | kc.SetText(kc.Chord.Label()) |
| 62 | }) |
| 63 | kc.AddContextMenu(func(m *Scene) { |
| 64 | NewButton(m).SetText("Clear").SetIcon(icons.ClearAll).OnClick(func(e events.Event) { |
| 65 | kc.Chord = "" |
| 66 | kc.UpdateChange() |
| 67 | }) |
| 68 | }) |
| 69 | } |
nothing calls this directly
no test coverage detected