mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget,widget/material: make Clickable widgets focusable
This change adds focus and keyboard control to Clickable widgets. They now consider a press of the enter or return key equivalent to a click. To keep the change simple, the focus indication is the same as the hover indication. References: https://todo.sr.ht/~eliasnaur/gio/195 References: https://github.com/tailscale/tailscale/issues/1611 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+7
-2
@@ -23,16 +23,21 @@ func (b *Bool) Changed() bool {
|
||||
return changed
|
||||
}
|
||||
|
||||
// Hovered returns whether pointer is over the element.
|
||||
// Hovered reports whether pointer is over the element.
|
||||
func (b *Bool) Hovered() bool {
|
||||
return b.clk.Hovered()
|
||||
}
|
||||
|
||||
// Pressed returns whether pointer is pressing the element.
|
||||
// Pressed reports whether pointer is pressing the element.
|
||||
func (b *Bool) Pressed() bool {
|
||||
return b.clk.Pressed()
|
||||
}
|
||||
|
||||
// Focused reports whether b has focus.
|
||||
func (b *Bool) Focused() bool {
|
||||
return b.clk.Focused()
|
||||
}
|
||||
|
||||
func (b *Bool) History() []Press {
|
||||
return b.clk.History()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user