mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
Programmatic Click function
Signed-off-by: Paulo Melo <paulo.durrer.melo@gmail.com>
This commit is contained in:
@@ -44,6 +44,14 @@ type Press struct {
|
|||||||
Cancelled bool
|
Cancelled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Click executes a simple programmatic click
|
||||||
|
func (b *Clickable) Click() {
|
||||||
|
b.clicks = append(b.clicks, Click{
|
||||||
|
Modifiers: 0,
|
||||||
|
NumClicks: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Clicked reports whether there are pending clicks as would be
|
// Clicked reports whether there are pending clicks as would be
|
||||||
// reported by Clicks. If so, Clicked removes the earliest click.
|
// reported by Clicks. If so, Clicked removes the earliest click.
|
||||||
func (b *Clickable) Clicked() bool {
|
func (b *Clickable) Clicked() bool {
|
||||||
@@ -82,6 +90,7 @@ func (b *Clickable) History() []Press {
|
|||||||
return b.history
|
return b.history
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Layout and update the button state
|
||||||
func (b *Clickable) Layout(gtx layout.Context) layout.Dimensions {
|
func (b *Clickable) Layout(gtx layout.Context) layout.Dimensions {
|
||||||
b.update(gtx)
|
b.update(gtx)
|
||||||
stack := op.Save(gtx.Ops)
|
stack := op.Save(gtx.Ops)
|
||||||
|
|||||||
Reference in New Issue
Block a user