-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
mouse.go
40 lines (32 loc) · 1.1 KB
/
mouse.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package desktop
import "fyne.io/fyne"
// MouseButton represents a single button in a desktop MouseEvent
type MouseButton int
const (
// LeftMouseButton is the most common mouse button - on some systems the only one
LeftMouseButton MouseButton = iota + 1
// TODO: Expose this button
// middleMouseButton
// RightMouseButton is the secondary button on most mouse input devices.
RightMouseButton
)
// MouseEvent contains data relating to desktop mouse events
type MouseEvent struct {
fyne.PointEvent
Button MouseButton
Modifier Modifier
}
// Mouseable represents desktop mouse events that can be sent to CanvasObjects
type Mouseable interface {
MouseDown(*MouseEvent)
MouseUp(*MouseEvent)
}
// Hoverable is used when a canvas object wishes to know if a pointer device moves over it.
type Hoverable interface {
// MouseIn is a hook that is called if the mouse pointer enters the element.
MouseIn(*MouseEvent)
// MouseMoved is a hook that is called if the mouse pointer moved over the element.
MouseMoved(*MouseEvent)
// MouseOut is a hook that is called if the mouse pointer leaves the element.
MouseOut()
}