mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
gesture,widget: add hovered property
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
@@ -125,6 +125,16 @@ func (c *Click) Add(ops *op.Ops) {
|
|||||||
op.Add(ops)
|
op.Add(ops)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hovered returns whether a pointer is inside the area.
|
||||||
|
func (c *Click) Hovered() bool {
|
||||||
|
return c.entered
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pressed returns whether a pointer is pressing.
|
||||||
|
func (c *Click) Pressed() bool {
|
||||||
|
return c.pressed
|
||||||
|
}
|
||||||
|
|
||||||
// Events returns the next click event, if any.
|
// Events returns the next click event, if any.
|
||||||
func (c *Click) Events(q event.Queue) []ClickEvent {
|
func (c *Click) Events(q event.Queue) []ClickEvent {
|
||||||
var events []ClickEvent
|
var events []ClickEvent
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ func (b *Bool) Changed() bool {
|
|||||||
return changed
|
return changed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hovered returns whether pointer is over the element.
|
||||||
|
func (b *Bool) Hovered() bool {
|
||||||
|
return b.clk.Hovered()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pressed returns whether pointer is pressing the element.
|
||||||
|
func (b *Bool) Pressed() bool {
|
||||||
|
return b.clk.Pressed()
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Bool) History() []Press {
|
func (b *Bool) History() []Press {
|
||||||
return b.clk.History()
|
return b.clk.History()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,16 @@ func (b *Clickable) Clicked() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hovered returns whether pointer is over the element.
|
||||||
|
func (b *Clickable) Hovered() bool {
|
||||||
|
return b.click.Hovered()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pressed returns whether pointer is pressing the element.
|
||||||
|
func (b *Clickable) Pressed() bool {
|
||||||
|
return b.click.Pressed()
|
||||||
|
}
|
||||||
|
|
||||||
// Clicks returns and clear the clicks since the last call to Clicks.
|
// Clicks returns and clear the clicks since the last call to Clicks.
|
||||||
func (b *Clickable) Clicks() []Click {
|
func (b *Clickable) Clicks() []Click {
|
||||||
clicks := b.clicks
|
clicks := b.clicks
|
||||||
|
|||||||
Reference in New Issue
Block a user